@atlaskit/smart-card 30.4.0 → 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 +8 -0
- 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/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/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 +2 -5
|
@@ -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.4.
|
|
10
|
+
packageVersion: "30.4.1",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -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;
|
|
@@ -5,8 +5,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
7
|
import { getUrl } from '@atlaskit/linking-common';
|
|
8
|
-
import { chunkloadFailedEvent as _chunkloadFailedEvent, connectFailedEvent as _connectFailedEvent, connectSucceededEvent as _connectSucceededEvent, context, instrumentEvent, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, screenAuthPopupEvent,
|
|
9
|
-
import {
|
|
8
|
+
import { chunkloadFailedEvent as _chunkloadFailedEvent, connectFailedEvent as _connectFailedEvent, connectSucceededEvent as _connectSucceededEvent, context, instrumentEvent, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, screenAuthPopupEvent, uiActionClickedEvent, uiAuthAlternateAccountEvent, uiAuthEvent, uiCardClickedEvent, uiClosedAuthEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiHoverCardViewedEvent, uiLearnMoreLinkClickedEvent, uiRenderFailedEvent, uiRenderSuccessEvent, uiSmartLinkStatusListItemButtonClicked, uiSmartLinkStatusLozengeButtonClicked, uiSmartLinkStatusOpenPreviewButtonClicked } from '../../utils/analytics';
|
|
9
|
+
import { uiServerActionClicked } from '../../utils/analytics/analytics';
|
|
10
10
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
11
11
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
12
12
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
@@ -633,97 +633,23 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
633
633
|
};
|
|
634
634
|
}, [defaultId, commonAttributes, dispatchAnalytics]);
|
|
635
635
|
|
|
636
|
-
/** Contains all
|
|
637
|
-
var
|
|
636
|
+
/** Contains all screen analytics events */
|
|
637
|
+
var screen = useMemo(function () {
|
|
638
638
|
return {
|
|
639
639
|
/**
|
|
640
|
-
* This fires an event which represents
|
|
640
|
+
* This fires an event which represents the connect account page being opened.
|
|
641
641
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
642
642
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
643
643
|
* @returns
|
|
644
|
-
* @deprecated
|
|
644
|
+
* @deprecated remove when platform_smart-card-migrate-screen-analytics is cleaned up
|
|
645
645
|
*/
|
|
646
|
-
|
|
646
|
+
authPopupEvent: function authPopupEvent(_ref17) {
|
|
647
647
|
var extensionKey = _ref17.extensionKey,
|
|
648
648
|
definitionId = _ref17.definitionId,
|
|
649
649
|
resourceType = _ref17.resourceType,
|
|
650
650
|
destinationProduct = _ref17.destinationProduct,
|
|
651
651
|
destinationSubproduct = _ref17.destinationSubproduct,
|
|
652
652
|
location = _ref17.location;
|
|
653
|
-
return dispatchAnalytics(applyCommonAttributes(trackAppAccountConnected(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
654
|
-
extensionKey: extensionKey,
|
|
655
|
-
definitionId: definitionId,
|
|
656
|
-
resourceType: resourceType,
|
|
657
|
-
destinationProduct: destinationProduct,
|
|
658
|
-
destinationSubproduct: destinationSubproduct,
|
|
659
|
-
location: location
|
|
660
|
-
})), commonAttributes));
|
|
661
|
-
},
|
|
662
|
-
/**
|
|
663
|
-
* This fires an event which represents a user starting the Smart Link connect account process.
|
|
664
|
-
* @param location a location where the Smart Link auth action was initiated.
|
|
665
|
-
* @param extensionKey The extensionKey of the Smart Link resolver invoked.
|
|
666
|
-
* @returns
|
|
667
|
-
* @deprecated
|
|
668
|
-
*/
|
|
669
|
-
appAccountAuthStarted: function appAccountAuthStarted(_ref18) {
|
|
670
|
-
var extensionKey = _ref18.extensionKey,
|
|
671
|
-
location = _ref18.location;
|
|
672
|
-
return dispatchAnalytics(applyCommonAttributes(trackAppAccountAuthStarted(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
673
|
-
extensionKey: extensionKey,
|
|
674
|
-
location: location
|
|
675
|
-
})), commonAttributes));
|
|
676
|
-
},
|
|
677
|
-
/**
|
|
678
|
-
* This fires a tracking event before an action invoke api call is made
|
|
679
|
-
* @deprecated
|
|
680
|
-
*/
|
|
681
|
-
smartLinkQuickActionStarted: function smartLinkQuickActionStarted(props) {
|
|
682
|
-
return dispatchAnalytics(applyCommonAttributes(trackSmartLinkQuickActionStarted(_objectSpread(_objectSpread({}, commonAttributes), props)), commonAttributes));
|
|
683
|
-
},
|
|
684
|
-
/**
|
|
685
|
-
* This fires a tracking event after an action invoke api call is successful
|
|
686
|
-
* @deprecated
|
|
687
|
-
*/
|
|
688
|
-
smartLinkQuickActionSuccess: function smartLinkQuickActionSuccess(props) {
|
|
689
|
-
return dispatchAnalytics(applyCommonAttributes(trackSmartLinkQuickActionSuccess(_objectSpread(_objectSpread({}, commonAttributes), props)), commonAttributes));
|
|
690
|
-
},
|
|
691
|
-
/**
|
|
692
|
-
* This fires a tracking event after an action invoke api call has failed
|
|
693
|
-
* @deprecated
|
|
694
|
-
*/
|
|
695
|
-
smartLinkQuickActionFailed: function smartLinkQuickActionFailed(props) {
|
|
696
|
-
return dispatchAnalytics(applyCommonAttributes(trackSmartLinkQuickActionFailed(_objectSpread(_objectSpread({}, commonAttributes), props)), commonAttributes));
|
|
697
|
-
},
|
|
698
|
-
/**
|
|
699
|
-
* Fires a track event when we call loadMetadata() to get information for a hover card
|
|
700
|
-
* @deprecated
|
|
701
|
-
*/
|
|
702
|
-
hoverCardResolutionStarted: function hoverCardResolutionStarted() {
|
|
703
|
-
return dispatchAnalytics(applyCommonAttributes(trackHoverCardResolutionStarted(_objectSpread({
|
|
704
|
-
display: 'hoverCardPreview'
|
|
705
|
-
}, commonAttributes)), commonAttributes));
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
}, [commonAttributes, dispatchAnalytics]);
|
|
709
|
-
|
|
710
|
-
/** Contains all screen analytics events */
|
|
711
|
-
var screen = useMemo(function () {
|
|
712
|
-
return {
|
|
713
|
-
/**
|
|
714
|
-
* This fires an event which represents the connect account page being opened.
|
|
715
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
716
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
717
|
-
* @returns
|
|
718
|
-
* @deprecated remove when platform_smart-card-migrate-screen-analytics is cleaned up
|
|
719
|
-
*/
|
|
720
|
-
authPopupEvent: function authPopupEvent(_ref19) {
|
|
721
|
-
var extensionKey = _ref19.extensionKey,
|
|
722
|
-
definitionId = _ref19.definitionId,
|
|
723
|
-
resourceType = _ref19.resourceType,
|
|
724
|
-
destinationProduct = _ref19.destinationProduct,
|
|
725
|
-
destinationSubproduct = _ref19.destinationSubproduct,
|
|
726
|
-
location = _ref19.location;
|
|
727
653
|
return dispatchAnalytics(applyCommonAttributes(screenAuthPopupEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
|
|
728
654
|
extensionKey: extensionKey,
|
|
729
655
|
definitionId: definitionId,
|
|
@@ -752,8 +678,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
752
678
|
return {
|
|
753
679
|
ui: ui,
|
|
754
680
|
operational: operational,
|
|
755
|
-
track: track,
|
|
756
681
|
screen: screen
|
|
757
682
|
};
|
|
758
|
-
}, [ui, operational,
|
|
683
|
+
}, [ui, operational, screen]);
|
|
759
684
|
};
|