@atlaskit/smart-card 16.2.0 → 16.2.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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/loader.js +27 -32
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/loader.js +30 -37
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/loader.js +28 -33
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 16.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d7f743bbbdd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7f743bbbdd) - useCallback for dispatchAnalytics to prevent multiple events firing on hover
|
|
8
|
+
|
|
3
9
|
## 16.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -54,8 +54,33 @@ function CardWithURLRenderer(props) {
|
|
|
54
54
|
(0, _performance.clearMeasures)(id);
|
|
55
55
|
};
|
|
56
56
|
}, [id]);
|
|
57
|
+
var url = props.url,
|
|
58
|
+
appearance = props.appearance,
|
|
59
|
+
isSelected = props.isSelected,
|
|
60
|
+
isFrameVisible = props.isFrameVisible,
|
|
61
|
+
onClick = props.onClick,
|
|
62
|
+
container = props.container,
|
|
63
|
+
onResolve = props.onResolve,
|
|
64
|
+
testId = props.testId,
|
|
65
|
+
showActions = props.showActions,
|
|
66
|
+
inheritDimensions = props.inheritDimensions,
|
|
67
|
+
platform = props.platform,
|
|
68
|
+
embedIframeRef = props.embedIframeRef,
|
|
69
|
+
inlinePreloaderStyle = props.inlinePreloaderStyle,
|
|
70
|
+
createAnalyticsEvent = props.createAnalyticsEvent; // Wrapper around analytics.
|
|
57
71
|
|
|
58
|
-
var
|
|
72
|
+
var dispatchAnalytics = (0, _react.useCallback)(function (analyticsPayload) {
|
|
73
|
+
if (analyticsPayload && analyticsPayload.attributes) {
|
|
74
|
+
// Update if we haven't already set the display - possible
|
|
75
|
+
// in the case of `preview` which is rendered differently.
|
|
76
|
+
if (!analyticsPayload.attributes.display) {
|
|
77
|
+
analyticsPayload.attributes.display = appearance;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
(0, _analytics.fireSmartLinkEvent)(analyticsPayload, createAnalyticsEvent);
|
|
82
|
+
}, [appearance, createAnalyticsEvent]);
|
|
83
|
+
var logError = (0, _react.useCallback)(function (error, info) {
|
|
59
84
|
var componentStack = info.componentStack; // NB: APIErrors are thrown in response to Object Resolver Service.
|
|
60
85
|
// In these cases, control is handed back to the Editor. We do not
|
|
61
86
|
// fire an event for these, as they do not cover failed UI render events.
|
|
@@ -73,37 +98,7 @@ function CardWithURLRenderer(props) {
|
|
|
73
98
|
(0, _ufoExperiences.failUfoExperience)('smart-link-authenticated', id);
|
|
74
99
|
dispatchAnalytics((0, _analytics.uiRenderFailedEvent)(appearance, error, errorInfo));
|
|
75
100
|
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var dispatchAnalytics = function dispatchAnalytics(analyticsPayload) {
|
|
80
|
-
var appearance = props.appearance,
|
|
81
|
-
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
82
|
-
|
|
83
|
-
if (analyticsPayload && analyticsPayload.attributes) {
|
|
84
|
-
// Update if we haven't already set the display - possible
|
|
85
|
-
// in the case of `preview` which is rendered differently.
|
|
86
|
-
if (!analyticsPayload.attributes.display) {
|
|
87
|
-
analyticsPayload.attributes.display = appearance;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
(0, _analytics.fireSmartLinkEvent)(analyticsPayload, createAnalyticsEvent);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
var url = props.url,
|
|
95
|
-
appearance = props.appearance,
|
|
96
|
-
isSelected = props.isSelected,
|
|
97
|
-
isFrameVisible = props.isFrameVisible,
|
|
98
|
-
onClick = props.onClick,
|
|
99
|
-
container = props.container,
|
|
100
|
-
onResolve = props.onResolve,
|
|
101
|
-
testId = props.testId,
|
|
102
|
-
showActions = props.showActions,
|
|
103
|
-
inheritDimensions = props.inheritDimensions,
|
|
104
|
-
platform = props.platform,
|
|
105
|
-
embedIframeRef = props.embedIframeRef,
|
|
106
|
-
inlinePreloaderStyle = props.inlinePreloaderStyle;
|
|
101
|
+
}, [appearance, dispatchAnalytics, id]);
|
|
107
102
|
|
|
108
103
|
if (!url) {
|
|
109
104
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { lazy, useEffect, useState, Suspense } from 'react';
|
|
1
|
+
import React, { lazy, useEffect, useState, Suspense, useCallback } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { CardLinkView } from '@atlaskit/media-ui';
|
|
4
4
|
import { uiRenderFailedEvent, fireSmartLinkEvent } from '../../utils/analytics';
|
|
@@ -22,8 +22,35 @@ export function CardWithURLRenderer(props) {
|
|
|
22
22
|
clearMeasures(id);
|
|
23
23
|
};
|
|
24
24
|
}, [id]);
|
|
25
|
+
const {
|
|
26
|
+
url,
|
|
27
|
+
appearance,
|
|
28
|
+
isSelected,
|
|
29
|
+
isFrameVisible,
|
|
30
|
+
onClick,
|
|
31
|
+
container,
|
|
32
|
+
onResolve,
|
|
33
|
+
testId,
|
|
34
|
+
showActions,
|
|
35
|
+
inheritDimensions,
|
|
36
|
+
platform,
|
|
37
|
+
embedIframeRef,
|
|
38
|
+
inlinePreloaderStyle,
|
|
39
|
+
createAnalyticsEvent
|
|
40
|
+
} = props; // Wrapper around analytics.
|
|
25
41
|
|
|
26
|
-
const
|
|
42
|
+
const dispatchAnalytics = useCallback(analyticsPayload => {
|
|
43
|
+
if (analyticsPayload && analyticsPayload.attributes) {
|
|
44
|
+
// Update if we haven't already set the display - possible
|
|
45
|
+
// in the case of `preview` which is rendered differently.
|
|
46
|
+
if (!analyticsPayload.attributes.display) {
|
|
47
|
+
analyticsPayload.attributes.display = appearance;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
52
|
+
}, [appearance, createAnalyticsEvent]);
|
|
53
|
+
const logError = useCallback((error, info) => {
|
|
27
54
|
const {
|
|
28
55
|
componentStack
|
|
29
56
|
} = info; // NB: APIErrors are thrown in response to Object Resolver Service.
|
|
@@ -43,41 +70,7 @@ export function CardWithURLRenderer(props) {
|
|
|
43
70
|
failUfoExperience('smart-link-authenticated', id);
|
|
44
71
|
dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
|
|
45
72
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const dispatchAnalytics = analyticsPayload => {
|
|
50
|
-
const {
|
|
51
|
-
appearance,
|
|
52
|
-
createAnalyticsEvent
|
|
53
|
-
} = props;
|
|
54
|
-
|
|
55
|
-
if (analyticsPayload && analyticsPayload.attributes) {
|
|
56
|
-
// Update if we haven't already set the display - possible
|
|
57
|
-
// in the case of `preview` which is rendered differently.
|
|
58
|
-
if (!analyticsPayload.attributes.display) {
|
|
59
|
-
analyticsPayload.attributes.display = appearance;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const {
|
|
67
|
-
url,
|
|
68
|
-
appearance,
|
|
69
|
-
isSelected,
|
|
70
|
-
isFrameVisible,
|
|
71
|
-
onClick,
|
|
72
|
-
container,
|
|
73
|
-
onResolve,
|
|
74
|
-
testId,
|
|
75
|
-
showActions,
|
|
76
|
-
inheritDimensions,
|
|
77
|
-
platform,
|
|
78
|
-
embedIframeRef,
|
|
79
|
-
inlinePreloaderStyle
|
|
80
|
-
} = props;
|
|
73
|
+
}, [appearance, dispatchAnalytics, id]);
|
|
81
74
|
|
|
82
75
|
if (!url) {
|
|
83
76
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { lazy, useEffect, useState, Suspense } from 'react';
|
|
2
|
+
import React, { lazy, useEffect, useState, Suspense, useCallback } from 'react';
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import { CardLinkView } from '@atlaskit/media-ui';
|
|
5
5
|
import { uiRenderFailedEvent, fireSmartLinkEvent } from '../../utils/analytics';
|
|
@@ -30,8 +30,33 @@ export function CardWithURLRenderer(props) {
|
|
|
30
30
|
clearMeasures(id);
|
|
31
31
|
};
|
|
32
32
|
}, [id]);
|
|
33
|
+
var url = props.url,
|
|
34
|
+
appearance = props.appearance,
|
|
35
|
+
isSelected = props.isSelected,
|
|
36
|
+
isFrameVisible = props.isFrameVisible,
|
|
37
|
+
onClick = props.onClick,
|
|
38
|
+
container = props.container,
|
|
39
|
+
onResolve = props.onResolve,
|
|
40
|
+
testId = props.testId,
|
|
41
|
+
showActions = props.showActions,
|
|
42
|
+
inheritDimensions = props.inheritDimensions,
|
|
43
|
+
platform = props.platform,
|
|
44
|
+
embedIframeRef = props.embedIframeRef,
|
|
45
|
+
inlinePreloaderStyle = props.inlinePreloaderStyle,
|
|
46
|
+
createAnalyticsEvent = props.createAnalyticsEvent; // Wrapper around analytics.
|
|
33
47
|
|
|
34
|
-
var
|
|
48
|
+
var dispatchAnalytics = useCallback(function (analyticsPayload) {
|
|
49
|
+
if (analyticsPayload && analyticsPayload.attributes) {
|
|
50
|
+
// Update if we haven't already set the display - possible
|
|
51
|
+
// in the case of `preview` which is rendered differently.
|
|
52
|
+
if (!analyticsPayload.attributes.display) {
|
|
53
|
+
analyticsPayload.attributes.display = appearance;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
58
|
+
}, [appearance, createAnalyticsEvent]);
|
|
59
|
+
var logError = useCallback(function (error, info) {
|
|
35
60
|
var componentStack = info.componentStack; // NB: APIErrors are thrown in response to Object Resolver Service.
|
|
36
61
|
// In these cases, control is handed back to the Editor. We do not
|
|
37
62
|
// fire an event for these, as they do not cover failed UI render events.
|
|
@@ -49,37 +74,7 @@ export function CardWithURLRenderer(props) {
|
|
|
49
74
|
failUfoExperience('smart-link-authenticated', id);
|
|
50
75
|
dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
|
|
51
76
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var dispatchAnalytics = function dispatchAnalytics(analyticsPayload) {
|
|
56
|
-
var appearance = props.appearance,
|
|
57
|
-
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
58
|
-
|
|
59
|
-
if (analyticsPayload && analyticsPayload.attributes) {
|
|
60
|
-
// Update if we haven't already set the display - possible
|
|
61
|
-
// in the case of `preview` which is rendered differently.
|
|
62
|
-
if (!analyticsPayload.attributes.display) {
|
|
63
|
-
analyticsPayload.attributes.display = appearance;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
var url = props.url,
|
|
71
|
-
appearance = props.appearance,
|
|
72
|
-
isSelected = props.isSelected,
|
|
73
|
-
isFrameVisible = props.isFrameVisible,
|
|
74
|
-
onClick = props.onClick,
|
|
75
|
-
container = props.container,
|
|
76
|
-
onResolve = props.onResolve,
|
|
77
|
-
testId = props.testId,
|
|
78
|
-
showActions = props.showActions,
|
|
79
|
-
inheritDimensions = props.inheritDimensions,
|
|
80
|
-
platform = props.platform,
|
|
81
|
-
embedIframeRef = props.embedIframeRef,
|
|
82
|
-
inlinePreloaderStyle = props.inlinePreloaderStyle;
|
|
77
|
+
}, [appearance, dispatchAnalytics, id]);
|
|
83
78
|
|
|
84
79
|
if (!url) {
|
|
85
80
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|