@atlaskit/smart-card 25.3.3 → 25.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 +12 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +5 -0
- package/dist/cjs/utils/analytics/click.js +9 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -0
- package/dist/es2019/utils/analytics/click.js +9 -7
- package/dist/es2019/version.json +1 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +5 -0
- package/dist/esm/utils/analytics/click.js +9 -7
- package/dist/esm/version.json +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +5 -0
- package/dist/types/utils/analytics/click.d.ts +1 -0
- package/dist/types/utils/analytics/types.d.ts +7 -1
- package/dist/types/view/Card/types.d.ts +5 -0
- package/package.json +1 -1
- package/report.api.md +2 -2
- package/tmp/api-report-tmp.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 25.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ae2cba07a9a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ae2cba07a9a) - Removes prevented as a clickOutcome analytics attribute value and adds defaultPrevented as a replacement attribute.
|
|
8
|
+
|
|
9
|
+
## 25.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`65b0490a5dc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/65b0490a5dc) - Deprecates the export of useSmartLinkAnalytics hook and analyticsEvents prop.
|
|
14
|
+
|
|
3
15
|
## 25.3.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -33,6 +33,11 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
|
|
|
33
33
|
/**
|
|
34
34
|
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
35
35
|
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
38
|
+
* This hook's external use is deprecated and may no longer be exported from this package in future releases.
|
|
39
|
+
* Please avoid using it in conjunction with the `analyticsEvents` prop.
|
|
40
|
+
*
|
|
36
41
|
* @param url URL of the link
|
|
37
42
|
* @param dispatchAnalytics dispatchAnalytics function
|
|
38
43
|
* @param id fallback id of the events sent if no id is available
|
|
@@ -26,9 +26,7 @@ function getLinkClickOutcome(e, clickType) {
|
|
|
26
26
|
var _browser = (0, _userAgent.browser)(),
|
|
27
27
|
mac = _browser.mac,
|
|
28
28
|
safari = _browser.safari;
|
|
29
|
-
|
|
30
|
-
return 'prevented';
|
|
31
|
-
}
|
|
29
|
+
|
|
32
30
|
/**
|
|
33
31
|
* If the link/parent is content editable then left click won't have typical effect
|
|
34
32
|
*/
|
|
@@ -76,12 +74,13 @@ function getLinkClickOutcome(e, clickType) {
|
|
|
76
74
|
return 'contextMenu';
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
|
-
return '
|
|
77
|
+
return 'unknown';
|
|
80
78
|
}
|
|
81
79
|
var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
82
80
|
var clickType = _ref.clickType,
|
|
83
81
|
clickOutcome = _ref.clickOutcome,
|
|
84
|
-
keysHeld = _ref.keysHeld
|
|
82
|
+
keysHeld = _ref.keysHeld,
|
|
83
|
+
defaultPrevented = _ref.defaultPrevented;
|
|
85
84
|
return {
|
|
86
85
|
action: 'clicked',
|
|
87
86
|
actionSubject: 'link',
|
|
@@ -89,7 +88,8 @@ var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
|
89
88
|
attributes: {
|
|
90
89
|
clickType: clickType,
|
|
91
90
|
clickOutcome: clickOutcome,
|
|
92
|
-
keysHeld: keysHeld
|
|
91
|
+
keysHeld: keysHeld,
|
|
92
|
+
defaultPrevented: defaultPrevented
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
};
|
|
@@ -100,10 +100,12 @@ var createLinkClickedPayload = function createLinkClickedPayload(event) {
|
|
|
100
100
|
}
|
|
101
101
|
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
102
102
|
var keysHeld = getKeys(event);
|
|
103
|
+
var defaultPrevented = event.defaultPrevented;
|
|
103
104
|
return linkClickedEvent({
|
|
104
105
|
clickType: clickType,
|
|
105
106
|
clickOutcome: clickOutcome,
|
|
106
|
-
keysHeld: keysHeld
|
|
107
|
+
keysHeld: keysHeld,
|
|
108
|
+
defaultPrevented: defaultPrevented
|
|
107
109
|
});
|
|
108
110
|
};
|
|
109
111
|
exports.createLinkClickedPayload = createLinkClickedPayload;
|
package/dist/cjs/version.json
CHANGED
|
@@ -19,6 +19,11 @@ const applyCommonAttributes = (event, commonAttributes) => {
|
|
|
19
19
|
/**
|
|
20
20
|
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
21
21
|
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
24
|
+
* This hook's external use is deprecated and may no longer be exported from this package in future releases.
|
|
25
|
+
* Please avoid using it in conjunction with the `analyticsEvents` prop.
|
|
26
|
+
*
|
|
22
27
|
* @param url URL of the link
|
|
23
28
|
* @param dispatchAnalytics dispatchAnalytics function
|
|
24
29
|
* @param id fallback id of the events sent if no id is available
|
|
@@ -12,9 +12,7 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
12
12
|
mac,
|
|
13
13
|
safari
|
|
14
14
|
} = browser();
|
|
15
|
-
|
|
16
|
-
return 'prevented';
|
|
17
|
-
}
|
|
15
|
+
|
|
18
16
|
/**
|
|
19
17
|
* If the link/parent is content editable then left click won't have typical effect
|
|
20
18
|
*/
|
|
@@ -62,12 +60,13 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
62
60
|
return 'contextMenu';
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
|
-
return '
|
|
63
|
+
return 'unknown';
|
|
66
64
|
}
|
|
67
65
|
const linkClickedEvent = ({
|
|
68
66
|
clickType,
|
|
69
67
|
clickOutcome,
|
|
70
|
-
keysHeld
|
|
68
|
+
keysHeld,
|
|
69
|
+
defaultPrevented
|
|
71
70
|
}) => ({
|
|
72
71
|
action: 'clicked',
|
|
73
72
|
actionSubject: 'link',
|
|
@@ -75,7 +74,8 @@ const linkClickedEvent = ({
|
|
|
75
74
|
attributes: {
|
|
76
75
|
clickType,
|
|
77
76
|
clickOutcome,
|
|
78
|
-
keysHeld
|
|
77
|
+
keysHeld,
|
|
78
|
+
defaultPrevented
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
export const createLinkClickedPayload = event => {
|
|
@@ -85,10 +85,12 @@ export const createLinkClickedPayload = event => {
|
|
|
85
85
|
}
|
|
86
86
|
const clickOutcome = getLinkClickOutcome(event, clickType);
|
|
87
87
|
const keysHeld = getKeys(event);
|
|
88
|
+
const defaultPrevented = event.defaultPrevented;
|
|
88
89
|
return linkClickedEvent({
|
|
89
90
|
clickType,
|
|
90
91
|
clickOutcome,
|
|
91
|
-
keysHeld
|
|
92
|
+
keysHeld,
|
|
93
|
+
defaultPrevented
|
|
92
94
|
});
|
|
93
95
|
};
|
|
94
96
|
export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides = {}) => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -26,6 +26,11 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
|
|
|
26
26
|
/**
|
|
27
27
|
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
28
28
|
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
31
|
+
* This hook's external use is deprecated and may no longer be exported from this package in future releases.
|
|
32
|
+
* Please avoid using it in conjunction with the `analyticsEvents` prop.
|
|
33
|
+
*
|
|
29
34
|
* @param url URL of the link
|
|
30
35
|
* @param dispatchAnalytics dispatchAnalytics function
|
|
31
36
|
* @param id fallback id of the events sent if no id is available
|
|
@@ -16,9 +16,7 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
16
16
|
var _browser = browser(),
|
|
17
17
|
mac = _browser.mac,
|
|
18
18
|
safari = _browser.safari;
|
|
19
|
-
|
|
20
|
-
return 'prevented';
|
|
21
|
-
}
|
|
19
|
+
|
|
22
20
|
/**
|
|
23
21
|
* If the link/parent is content editable then left click won't have typical effect
|
|
24
22
|
*/
|
|
@@ -66,12 +64,13 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
66
64
|
return 'contextMenu';
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
|
-
return '
|
|
67
|
+
return 'unknown';
|
|
70
68
|
}
|
|
71
69
|
var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
72
70
|
var clickType = _ref.clickType,
|
|
73
71
|
clickOutcome = _ref.clickOutcome,
|
|
74
|
-
keysHeld = _ref.keysHeld
|
|
72
|
+
keysHeld = _ref.keysHeld,
|
|
73
|
+
defaultPrevented = _ref.defaultPrevented;
|
|
75
74
|
return {
|
|
76
75
|
action: 'clicked',
|
|
77
76
|
actionSubject: 'link',
|
|
@@ -79,7 +78,8 @@ var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
|
79
78
|
attributes: {
|
|
80
79
|
clickType: clickType,
|
|
81
80
|
clickOutcome: clickOutcome,
|
|
82
|
-
keysHeld: keysHeld
|
|
81
|
+
keysHeld: keysHeld,
|
|
82
|
+
defaultPrevented: defaultPrevented
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
};
|
|
@@ -90,10 +90,12 @@ export var createLinkClickedPayload = function createLinkClickedPayload(event) {
|
|
|
90
90
|
}
|
|
91
91
|
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
92
92
|
var keysHeld = getKeys(event);
|
|
93
|
+
var defaultPrevented = event.defaultPrevented;
|
|
93
94
|
return linkClickedEvent({
|
|
94
95
|
clickType: clickType,
|
|
95
96
|
clickOutcome: clickOutcome,
|
|
96
|
-
keysHeld: keysHeld
|
|
97
|
+
keysHeld: keysHeld,
|
|
98
|
+
defaultPrevented: defaultPrevented
|
|
97
99
|
});
|
|
98
100
|
};
|
|
99
101
|
export var fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
|
package/dist/esm/version.json
CHANGED
|
@@ -3,6 +3,11 @@ import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps,
|
|
|
3
3
|
/**
|
|
4
4
|
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
5
5
|
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
8
|
+
* This hook's external use is deprecated and may no longer be exported from this package in future releases.
|
|
9
|
+
* Please avoid using it in conjunction with the `analyticsEvents` prop.
|
|
10
|
+
*
|
|
6
11
|
* @param url URL of the link
|
|
7
12
|
* @param dispatchAnalytics dispatchAnalytics function
|
|
8
13
|
* @param id fallback id of the events sent if no id is available
|
|
@@ -16,6 +16,7 @@ export declare const fireLinkClickedEvent: (createAnalyticsEvent: (payload: Anal
|
|
|
16
16
|
clickType?: ClickType | undefined;
|
|
17
17
|
clickOutcome?: ClickOutcome | undefined;
|
|
18
18
|
keysHeld?: ("meta" | "alt" | "shift" | "ctrl" | undefined)[] | undefined;
|
|
19
|
+
defaultPrevented?: boolean | undefined;
|
|
19
20
|
} | undefined;
|
|
20
21
|
} | undefined) => void;
|
|
21
22
|
export {};
|
|
@@ -106,7 +106,7 @@ export declare type InstrumentEventProps = CommonEventProps & {
|
|
|
106
106
|
id: string;
|
|
107
107
|
};
|
|
108
108
|
export declare type ClickType = 'left' | 'middle' | 'right' | 'none';
|
|
109
|
-
export declare type ClickOutcome = 'prevented' | 'clickThrough' | 'clickThroughNewTabOrWindow' | 'contextMenu' | 'alt' | 'contentEditable' | '
|
|
109
|
+
export declare type ClickOutcome = 'prevented' | 'clickThrough' | 'clickThroughNewTabOrWindow' | 'contextMenu' | 'alt' | 'contentEditable' | 'unknown';
|
|
110
110
|
export declare type UiLinkClickedEventProps = {
|
|
111
111
|
/**
|
|
112
112
|
* Whether the click occurred with the left, middle or right mouse button
|
|
@@ -114,10 +114,16 @@ export declare type UiLinkClickedEventProps = {
|
|
|
114
114
|
clickType: ClickType;
|
|
115
115
|
/**
|
|
116
116
|
* The user outcome for clicking the link as far as can be reasonably be determined
|
|
117
|
+
* This ignores any programmatic cancellation of the outcome (ie e.preventDefault()) and
|
|
118
|
+
* thus this represents the user intent, not necessarily the actual outcome
|
|
117
119
|
*/
|
|
118
120
|
clickOutcome: ClickOutcome;
|
|
119
121
|
/**
|
|
120
122
|
* The keys held by the user at the time of clicking the link (which influence `clickOutcome`)
|
|
121
123
|
*/
|
|
122
124
|
keysHeld: ('alt' | 'ctrl' | 'meta' | 'shift')[];
|
|
125
|
+
/**
|
|
126
|
+
* Whether the browser's default behaviour was prevented programmatically
|
|
127
|
+
*/
|
|
128
|
+
defaultPrevented: boolean;
|
|
123
129
|
};
|
|
@@ -55,6 +55,11 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
55
55
|
children?: React.ReactNode;
|
|
56
56
|
showHoverPreview?: boolean;
|
|
57
57
|
showAuthTooltip?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
60
|
+
* The use of `useSmartLinkAnalytics` external use in conjunction with `analyticsEvents` prop is deprecated and may be removed in future releases.
|
|
61
|
+
* Please avoid using this prop.
|
|
62
|
+
*/
|
|
58
63
|
analyticsEvents?: AnalyticsFacade;
|
|
59
64
|
placeholder?: string;
|
|
60
65
|
}
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -283,7 +283,7 @@ export { CardPlatform };
|
|
|
283
283
|
|
|
284
284
|
// @public (undocumented)
|
|
285
285
|
export interface CardProps extends WithAnalyticsEventsProps {
|
|
286
|
-
// (undocumented)
|
|
286
|
+
// @deprecated (undocumented)
|
|
287
287
|
analyticsEvents?: AnalyticsFacade;
|
|
288
288
|
// (undocumented)
|
|
289
289
|
appearance: CardAppearance;
|
|
@@ -952,7 +952,7 @@ type UiRenderSuccessEventProps = CommonEventProps & {
|
|
|
952
952
|
status: CardType;
|
|
953
953
|
};
|
|
954
954
|
|
|
955
|
-
// @public
|
|
955
|
+
// @public @deprecated
|
|
956
956
|
export const useSmartLinkAnalytics: (
|
|
957
957
|
url: string,
|
|
958
958
|
dispatchAnalytics: AnalyticsHandler,
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ export { CardPlatform }
|
|
|
193
193
|
|
|
194
194
|
// @public (undocumented)
|
|
195
195
|
export interface CardProps extends WithAnalyticsEventsProps {
|
|
196
|
-
// (undocumented)
|
|
196
|
+
// @deprecated (undocumented)
|
|
197
197
|
analyticsEvents?: AnalyticsFacade;
|
|
198
198
|
// (undocumented)
|
|
199
199
|
appearance: CardAppearance;
|
|
@@ -815,7 +815,7 @@ type UiRenderSuccessEventProps = CommonEventProps & {
|
|
|
815
815
|
status: CardType;
|
|
816
816
|
};
|
|
817
817
|
|
|
818
|
-
// @public
|
|
818
|
+
// @public @deprecated
|
|
819
819
|
export const useSmartLinkAnalytics: (url: string, dispatchAnalytics: AnalyticsHandler, id?: string | undefined, defaultLocation?: string | undefined) => {
|
|
820
820
|
ui: {
|
|
821
821
|
authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiAuthEventProps) => void;
|