@atlaskit/smart-card 29.0.1 → 29.0.3
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 +14 -0
- package/dist/cjs/extractors/flexible/actions/index.js +1 -1
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/shouldSample.js +10 -0
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +13 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/index.js +2 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/shouldSample.js +1 -0
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +11 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/index.js +2 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/shouldSample.js +4 -0
- package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +13 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/utils/__mocks__/shouldSample.d.ts +2 -0
- package/dist/types/utils/shouldSample.d.ts +1 -0
- package/dist/types/view/Card/types.d.ts +63 -7
- package/dist/types-ts4.5/utils/__mocks__/shouldSample.d.ts +2 -0
- package/dist/types-ts4.5/utils/shouldSample.d.ts +1 -0
- package/dist/types-ts4.5/view/Card/types.d.ts +63 -7
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 29.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 29.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#147818](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147818)
|
|
14
|
+
[`56e97352c27dc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/56e97352c27dc) -
|
|
15
|
+
Send smart-link-rendered UFO event only half of the time
|
|
16
|
+
|
|
3
17
|
## 29.0.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -20,7 +20,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
20
20
|
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
21
21
|
var _objectSpread2;
|
|
22
22
|
var data = response.data;
|
|
23
|
-
var action = _objectSpread((_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), (0, _defineProperty2.default)(_objectSpread2, _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _objectSpread2), (0, _platformFeatureFlags.
|
|
23
|
+
var action = _objectSpread((_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), (0, _defineProperty2.default)(_objectSpread2, _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _objectSpread2), (0, _platformFeatureFlags.fg)('platform-smart-card-view-related-urls-action') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)) : {});
|
|
24
24
|
return Object.values(action).some(function (value) {
|
|
25
25
|
return Boolean(value);
|
|
26
26
|
}) ? action : undefined;
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "29.0.
|
|
25
|
+
packageVersion: "29.0.3"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shouldSample = void 0;
|
|
7
|
+
var shouldSample = exports.shouldSample = function shouldSample() {
|
|
8
|
+
var threshold = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5;
|
|
9
|
+
return Math.random() > threshold;
|
|
10
|
+
};
|
|
@@ -12,6 +12,8 @@ var _state = require("../../../state");
|
|
|
12
12
|
var _component = require("../component");
|
|
13
13
|
var _LoadingCardLink = require("./LoadingCardLink");
|
|
14
14
|
var _ufoExperiences = require("../../../state/analytics/ufoExperiences");
|
|
15
|
+
var _shouldSample = require("../../../utils/shouldSample");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
19
|
// This property enables the intersection observer to be run once the
|
|
@@ -25,6 +27,9 @@ function LazyIntersectionObserverCard(props) {
|
|
|
25
27
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
26
28
|
isIntersecting = _useState2[0],
|
|
27
29
|
setIsIntersecting = _useState2[1];
|
|
30
|
+
var _useState3 = (0, _react.useState)((0, _shouldSample.shouldSample)()),
|
|
31
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 1),
|
|
32
|
+
shouldSendRenderedUFOEvent = _useState4[0];
|
|
28
33
|
var appearance = props.appearance,
|
|
29
34
|
url = props.url,
|
|
30
35
|
id = props.id;
|
|
@@ -36,13 +41,19 @@ function LazyIntersectionObserverCard(props) {
|
|
|
36
41
|
return entry.isIntersecting;
|
|
37
42
|
});
|
|
38
43
|
if (isVisible) {
|
|
39
|
-
(0,
|
|
44
|
+
if ((0, _platformFeatureFlags.fg)('send-smart-link-rendered-ufo-event-half-time')) {
|
|
45
|
+
if (shouldSendRenderedUFOEvent) {
|
|
46
|
+
(0, _ufoExperiences.startUfoExperience)('smart-link-rendered', id);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
(0, _ufoExperiences.startUfoExperience)('smart-link-rendered', id);
|
|
50
|
+
}
|
|
40
51
|
setIsIntersecting(true);
|
|
41
52
|
observer.disconnect();
|
|
42
53
|
} else {
|
|
43
54
|
prefetch();
|
|
44
55
|
}
|
|
45
|
-
}, [prefetch,
|
|
56
|
+
}, [id, prefetch, shouldSendRenderedUFOEvent]);
|
|
46
57
|
(0, _react.useEffect)(function () {
|
|
47
58
|
if (!ref.current) {
|
|
48
59
|
return;
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "29.0.
|
|
20
|
+
packageVersion: "29.0.3",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { ActionName, InternalActionName } from '../../../constants';
|
|
3
3
|
import { extractDownloadAction } from './extract-download-action';
|
|
4
4
|
import { extractPreviewAction } from './extract-preview-action';
|
|
@@ -16,7 +16,7 @@ const extractActions = (response, url, actionOptions, id, aiSummaryConfig) => {
|
|
|
16
16
|
[ActionName.PreviewAction]: extractPreviewAction(response, actionOptions),
|
|
17
17
|
[ActionName.AutomationAction]: extractAutomationAction(response),
|
|
18
18
|
[InternalActionName.AISummaryAction]: extractAISummaryAction(response, url, actionOptions, aiSummaryConfig),
|
|
19
|
-
...(
|
|
19
|
+
...(fg('platform-smart-card-view-related-urls-action') ? {
|
|
20
20
|
[InternalActionName.ViewRelatedLinksAction]: extractViewRelatedLinksAction(response)
|
|
21
21
|
} : {})
|
|
22
22
|
};
|
|
@@ -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: "29.0.
|
|
7
|
+
packageVersion: "29.0.3"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const shouldSample = (threshold = 0.5) => Math.random() > threshold;
|
|
@@ -3,6 +3,8 @@ import { usePrefetch } from '../../../state';
|
|
|
3
3
|
import { CardWithUrlContent } from '../component';
|
|
4
4
|
import { LoadingCardLink } from './LoadingCardLink';
|
|
5
5
|
import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
|
|
6
|
+
import { shouldSample } from '../../../utils/shouldSample';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
|
|
7
9
|
// This property enables the intersection observer to be run once the
|
|
8
10
|
// HTML element being observed is within `X` px of the target container it is
|
|
@@ -12,6 +14,7 @@ const ROOT_MARGIN_VERTICAL = '360px';
|
|
|
12
14
|
export function LazyIntersectionObserverCard(props) {
|
|
13
15
|
const ref = useRef(null);
|
|
14
16
|
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
17
|
+
const [shouldSendRenderedUFOEvent] = useState(shouldSample());
|
|
15
18
|
const {
|
|
16
19
|
appearance,
|
|
17
20
|
url,
|
|
@@ -23,13 +26,19 @@ export function LazyIntersectionObserverCard(props) {
|
|
|
23
26
|
const onIntersection = useCallback((entries, observer) => {
|
|
24
27
|
const isVisible = entries.some(entry => entry.isIntersecting);
|
|
25
28
|
if (isVisible) {
|
|
26
|
-
|
|
29
|
+
if (fg('send-smart-link-rendered-ufo-event-half-time')) {
|
|
30
|
+
if (shouldSendRenderedUFOEvent) {
|
|
31
|
+
startUfoExperience('smart-link-rendered', id);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
startUfoExperience('smart-link-rendered', id);
|
|
35
|
+
}
|
|
27
36
|
setIsIntersecting(true);
|
|
28
37
|
observer.disconnect();
|
|
29
38
|
} else {
|
|
30
39
|
prefetch();
|
|
31
40
|
}
|
|
32
|
-
}, [prefetch,
|
|
41
|
+
}, [id, prefetch, shouldSendRenderedUFOEvent]);
|
|
33
42
|
useEffect(() => {
|
|
34
43
|
if (!ref.current) {
|
|
35
44
|
return;
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "29.0.
|
|
10
|
+
packageVersion: "29.0.3",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { ActionName, InternalActionName } from '../../../constants';
|
|
6
6
|
import { extractDownloadAction } from './extract-download-action';
|
|
7
7
|
import { extractPreviewAction } from './extract-preview-action';
|
|
@@ -13,7 +13,7 @@ import { extractViewRelatedLinksAction } from './extract-view-related-links-acti
|
|
|
13
13
|
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
14
14
|
var _objectSpread2;
|
|
15
15
|
var data = response.data;
|
|
16
|
-
var action = _objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, ActionName.CopyLinkAction, extractCopyLinkAction(data, actionOptions)), _defineProperty(_objectSpread2, ActionName.DownloadAction, extractDownloadAction(data, actionOptions)), _defineProperty(_objectSpread2, ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), _defineProperty(_objectSpread2, ActionName.PreviewAction, extractPreviewAction(response, actionOptions)), _defineProperty(_objectSpread2, ActionName.AutomationAction, extractAutomationAction(response)), _defineProperty(_objectSpread2, InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), _objectSpread2),
|
|
16
|
+
var action = _objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, ActionName.CopyLinkAction, extractCopyLinkAction(data, actionOptions)), _defineProperty(_objectSpread2, ActionName.DownloadAction, extractDownloadAction(data, actionOptions)), _defineProperty(_objectSpread2, ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), _defineProperty(_objectSpread2, ActionName.PreviewAction, extractPreviewAction(response, actionOptions)), _defineProperty(_objectSpread2, ActionName.AutomationAction, extractAutomationAction(response)), _defineProperty(_objectSpread2, InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), _objectSpread2), fg('platform-smart-card-view-related-urls-action') ? _defineProperty({}, InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response)) : {});
|
|
17
17
|
return Object.values(action).some(function (value) {
|
|
18
18
|
return Boolean(value);
|
|
19
19
|
}) ? action : undefined;
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "29.0.
|
|
18
|
+
packageVersion: "29.0.3"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,6 +4,8 @@ import { usePrefetch } from '../../../state';
|
|
|
4
4
|
import { CardWithUrlContent } from '../component';
|
|
5
5
|
import { LoadingCardLink } from './LoadingCardLink';
|
|
6
6
|
import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
|
|
7
|
+
import { shouldSample } from '../../../utils/shouldSample';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
|
|
8
10
|
// This property enables the intersection observer to be run once the
|
|
9
11
|
// HTML element being observed is within `X` px of the target container it is
|
|
@@ -16,6 +18,9 @@ export function LazyIntersectionObserverCard(props) {
|
|
|
16
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
19
|
isIntersecting = _useState2[0],
|
|
18
20
|
setIsIntersecting = _useState2[1];
|
|
21
|
+
var _useState3 = useState(shouldSample()),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
23
|
+
shouldSendRenderedUFOEvent = _useState4[0];
|
|
19
24
|
var appearance = props.appearance,
|
|
20
25
|
url = props.url,
|
|
21
26
|
id = props.id;
|
|
@@ -27,13 +32,19 @@ export function LazyIntersectionObserverCard(props) {
|
|
|
27
32
|
return entry.isIntersecting;
|
|
28
33
|
});
|
|
29
34
|
if (isVisible) {
|
|
30
|
-
|
|
35
|
+
if (fg('send-smart-link-rendered-ufo-event-half-time')) {
|
|
36
|
+
if (shouldSendRenderedUFOEvent) {
|
|
37
|
+
startUfoExperience('smart-link-rendered', id);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
startUfoExperience('smart-link-rendered', id);
|
|
41
|
+
}
|
|
31
42
|
setIsIntersecting(true);
|
|
32
43
|
observer.disconnect();
|
|
33
44
|
} else {
|
|
34
45
|
prefetch();
|
|
35
46
|
}
|
|
36
|
-
}, [prefetch,
|
|
47
|
+
}, [id, prefetch, shouldSendRenderedUFOEvent]);
|
|
37
48
|
useEffect(function () {
|
|
38
49
|
if (!ref.current) {
|
|
39
50
|
return;
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "29.0.
|
|
13
|
+
packageVersion: "29.0.3",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldSample: (threshold?: number) => boolean;
|
|
@@ -31,6 +31,12 @@ export type CardActionOptions = {
|
|
|
31
31
|
exclude?: Array<CardAction>;
|
|
32
32
|
};
|
|
33
33
|
interface ActionProps {
|
|
34
|
+
/**
|
|
35
|
+
* Configure visibility of actions available.
|
|
36
|
+
* By default, smart links show all actions available on the views.
|
|
37
|
+
* Set `hide` to true to disable all actions.
|
|
38
|
+
* Set `hide` to false and set `exclude` to enable only specific actions.
|
|
39
|
+
*/
|
|
34
40
|
actionOptions?: CardActionOptions;
|
|
35
41
|
}
|
|
36
42
|
interface HoverPreviewProps extends ActionProps {
|
|
@@ -39,18 +45,34 @@ interface HoverPreviewProps extends ActionProps {
|
|
|
39
45
|
showAuthTooltip?: boolean;
|
|
40
46
|
}
|
|
41
47
|
export interface BaseCardProps {
|
|
48
|
+
/**
|
|
49
|
+
* Define smart card default appearance.
|
|
50
|
+
*/
|
|
42
51
|
appearance: CardAppearance;
|
|
52
|
+
/**
|
|
53
|
+
* The container which `react-lazily-render` listens to for scroll events.
|
|
54
|
+
* This property can be used in a scenario where you want to specify your own scroll container
|
|
55
|
+
* while the Card component is (lazy)loading.
|
|
56
|
+
*/
|
|
43
57
|
container?: HTMLElement;
|
|
44
58
|
/**
|
|
45
|
-
* A component
|
|
46
|
-
* because of uncaught errors
|
|
59
|
+
* A React component responsible for returning a fallback UI when smart link fails to render because of uncaught errors.
|
|
47
60
|
*/
|
|
48
61
|
fallbackComponent?: React.ComponentType;
|
|
62
|
+
/**
|
|
63
|
+
* Unique id for smart link used in analytics.
|
|
64
|
+
*/
|
|
49
65
|
id?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Show selected state of smart link.
|
|
68
|
+
*/
|
|
50
69
|
isSelected?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* A callback function after a link is clicked.
|
|
72
|
+
*/
|
|
51
73
|
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
52
74
|
/**
|
|
53
|
-
* A callback function currently invoked in two cases
|
|
75
|
+
* A callback function currently invoked in two cases:
|
|
54
76
|
* 1. When the {@link CardState.status} is one of {@link ErrorCardType}. "err" property in argument will be undefined in this case
|
|
55
77
|
* This does not mean that smart card failed to render.
|
|
56
78
|
* 2. When there is any unhandled error inside smart card while rendering, resulting in failure to render smart card succesfully.
|
|
@@ -60,9 +82,23 @@ export interface BaseCardProps {
|
|
|
60
82
|
* If fallbackComponent is not provided, smart card will render null
|
|
61
83
|
*/
|
|
62
84
|
onError?: OnErrorCallback;
|
|
85
|
+
/**
|
|
86
|
+
* A callback function after the url is resolved into smart card.
|
|
87
|
+
*/
|
|
63
88
|
onResolve?: OnResolveCallback;
|
|
89
|
+
/**
|
|
90
|
+
* String to be displayed while the Card component is (lazy)loading.
|
|
91
|
+
*/
|
|
64
92
|
placeholder?: string;
|
|
93
|
+
/**
|
|
94
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
95
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
96
|
+
* serving as a hook for automated tests.
|
|
97
|
+
*/
|
|
65
98
|
testId?: string;
|
|
99
|
+
/**
|
|
100
|
+
* The url link of the resource to be resolved and shown as Smart Link.
|
|
101
|
+
*/
|
|
66
102
|
url?: string;
|
|
67
103
|
}
|
|
68
104
|
export interface InlineProps extends HoverPreviewProps {
|
|
@@ -85,22 +121,42 @@ export interface InlineProps extends HoverPreviewProps {
|
|
|
85
121
|
}
|
|
86
122
|
export interface BlockProps extends ActionProps {
|
|
87
123
|
/**
|
|
88
|
-
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15021 Internal documentation for deprecation (no external access)}
|
|
89
124
|
* When enabled the legacy block card is always used, even if the enableFlexibleBlockCard flag is set to true.
|
|
90
125
|
* Usage is strongly discouraged. This should only be used if there is a specific reason you're
|
|
91
126
|
* unable to use the new flexible block cards.
|
|
127
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15021 Internal documentation for deprecation (no external access)}
|
|
92
128
|
*/
|
|
93
129
|
useLegacyBlockCard?: boolean;
|
|
94
130
|
}
|
|
95
131
|
export interface EmbedProps {
|
|
132
|
+
/**
|
|
133
|
+
* React referenced value on embed iframe.
|
|
134
|
+
*/
|
|
96
135
|
embedIframeRef?: React.Ref<HTMLIFrameElement>;
|
|
136
|
+
/**
|
|
137
|
+
* Type of URL used with embed iframe. By default, the embed use `data.preview.href` from link response.
|
|
138
|
+
* `interactiveHref` is suitable for displaying iframe content that contains "more editable" version of
|
|
139
|
+
* the link, e.g. includes toolbar.
|
|
140
|
+
* It is only available on supported link response with `data.preview.interactiveHref`.
|
|
141
|
+
*/
|
|
97
142
|
embedIframeUrlType?: EmbedIframeUrlType;
|
|
98
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* A prop that determines the style of a frame:
|
|
145
|
+
* whether to show it, hide it or only show it when a user hovers over embed.
|
|
146
|
+
*/
|
|
99
147
|
frameStyle?: FrameStyle;
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
148
|
+
/**
|
|
149
|
+
* Determines whether width and height of an embed card are to be inherited from the parent.
|
|
150
|
+
* If `true`, embed iframe will remove restrictions on iframe aspect ratio, height and width.
|
|
151
|
+
* The parent container needs to override a style `.loader-wrapper` and set the desirable height there.
|
|
152
|
+
* (For instance, 'height: 100%')
|
|
102
153
|
*/
|
|
103
154
|
inheritDimensions?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Informs Smart Link of the device it is rendered in. Available values are `web` and `mobile`.
|
|
157
|
+
* It is used together with link response `data.preview['atlassian:supportedPlatforms']`.
|
|
158
|
+
* To make embed content available on all supported urls, use `web`.
|
|
159
|
+
*/
|
|
104
160
|
platform?: CardPlatform;
|
|
105
161
|
}
|
|
106
162
|
export interface FlexibleProps extends ActionProps, HoverPreviewProps {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldSample: (threshold?: number) => boolean;
|
|
@@ -31,6 +31,12 @@ export type CardActionOptions = {
|
|
|
31
31
|
exclude?: Array<CardAction>;
|
|
32
32
|
};
|
|
33
33
|
interface ActionProps {
|
|
34
|
+
/**
|
|
35
|
+
* Configure visibility of actions available.
|
|
36
|
+
* By default, smart links show all actions available on the views.
|
|
37
|
+
* Set `hide` to true to disable all actions.
|
|
38
|
+
* Set `hide` to false and set `exclude` to enable only specific actions.
|
|
39
|
+
*/
|
|
34
40
|
actionOptions?: CardActionOptions;
|
|
35
41
|
}
|
|
36
42
|
interface HoverPreviewProps extends ActionProps {
|
|
@@ -39,18 +45,34 @@ interface HoverPreviewProps extends ActionProps {
|
|
|
39
45
|
showAuthTooltip?: boolean;
|
|
40
46
|
}
|
|
41
47
|
export interface BaseCardProps {
|
|
48
|
+
/**
|
|
49
|
+
* Define smart card default appearance.
|
|
50
|
+
*/
|
|
42
51
|
appearance: CardAppearance;
|
|
52
|
+
/**
|
|
53
|
+
* The container which `react-lazily-render` listens to for scroll events.
|
|
54
|
+
* This property can be used in a scenario where you want to specify your own scroll container
|
|
55
|
+
* while the Card component is (lazy)loading.
|
|
56
|
+
*/
|
|
43
57
|
container?: HTMLElement;
|
|
44
58
|
/**
|
|
45
|
-
* A component
|
|
46
|
-
* because of uncaught errors
|
|
59
|
+
* A React component responsible for returning a fallback UI when smart link fails to render because of uncaught errors.
|
|
47
60
|
*/
|
|
48
61
|
fallbackComponent?: React.ComponentType;
|
|
62
|
+
/**
|
|
63
|
+
* Unique id for smart link used in analytics.
|
|
64
|
+
*/
|
|
49
65
|
id?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Show selected state of smart link.
|
|
68
|
+
*/
|
|
50
69
|
isSelected?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* A callback function after a link is clicked.
|
|
72
|
+
*/
|
|
51
73
|
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
52
74
|
/**
|
|
53
|
-
* A callback function currently invoked in two cases
|
|
75
|
+
* A callback function currently invoked in two cases:
|
|
54
76
|
* 1. When the {@link CardState.status} is one of {@link ErrorCardType}. "err" property in argument will be undefined in this case
|
|
55
77
|
* This does not mean that smart card failed to render.
|
|
56
78
|
* 2. When there is any unhandled error inside smart card while rendering, resulting in failure to render smart card succesfully.
|
|
@@ -60,9 +82,23 @@ export interface BaseCardProps {
|
|
|
60
82
|
* If fallbackComponent is not provided, smart card will render null
|
|
61
83
|
*/
|
|
62
84
|
onError?: OnErrorCallback;
|
|
85
|
+
/**
|
|
86
|
+
* A callback function after the url is resolved into smart card.
|
|
87
|
+
*/
|
|
63
88
|
onResolve?: OnResolveCallback;
|
|
89
|
+
/**
|
|
90
|
+
* String to be displayed while the Card component is (lazy)loading.
|
|
91
|
+
*/
|
|
64
92
|
placeholder?: string;
|
|
93
|
+
/**
|
|
94
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
95
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
96
|
+
* serving as a hook for automated tests.
|
|
97
|
+
*/
|
|
65
98
|
testId?: string;
|
|
99
|
+
/**
|
|
100
|
+
* The url link of the resource to be resolved and shown as Smart Link.
|
|
101
|
+
*/
|
|
66
102
|
url?: string;
|
|
67
103
|
}
|
|
68
104
|
export interface InlineProps extends HoverPreviewProps {
|
|
@@ -85,22 +121,42 @@ export interface InlineProps extends HoverPreviewProps {
|
|
|
85
121
|
}
|
|
86
122
|
export interface BlockProps extends ActionProps {
|
|
87
123
|
/**
|
|
88
|
-
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15021 Internal documentation for deprecation (no external access)}
|
|
89
124
|
* When enabled the legacy block card is always used, even if the enableFlexibleBlockCard flag is set to true.
|
|
90
125
|
* Usage is strongly discouraged. This should only be used if there is a specific reason you're
|
|
91
126
|
* unable to use the new flexible block cards.
|
|
127
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15021 Internal documentation for deprecation (no external access)}
|
|
92
128
|
*/
|
|
93
129
|
useLegacyBlockCard?: boolean;
|
|
94
130
|
}
|
|
95
131
|
export interface EmbedProps {
|
|
132
|
+
/**
|
|
133
|
+
* React referenced value on embed iframe.
|
|
134
|
+
*/
|
|
96
135
|
embedIframeRef?: React.Ref<HTMLIFrameElement>;
|
|
136
|
+
/**
|
|
137
|
+
* Type of URL used with embed iframe. By default, the embed use `data.preview.href` from link response.
|
|
138
|
+
* `interactiveHref` is suitable for displaying iframe content that contains "more editable" version of
|
|
139
|
+
* the link, e.g. includes toolbar.
|
|
140
|
+
* It is only available on supported link response with `data.preview.interactiveHref`.
|
|
141
|
+
*/
|
|
97
142
|
embedIframeUrlType?: EmbedIframeUrlType;
|
|
98
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* A prop that determines the style of a frame:
|
|
145
|
+
* whether to show it, hide it or only show it when a user hovers over embed.
|
|
146
|
+
*/
|
|
99
147
|
frameStyle?: FrameStyle;
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
148
|
+
/**
|
|
149
|
+
* Determines whether width and height of an embed card are to be inherited from the parent.
|
|
150
|
+
* If `true`, embed iframe will remove restrictions on iframe aspect ratio, height and width.
|
|
151
|
+
* The parent container needs to override a style `.loader-wrapper` and set the desirable height there.
|
|
152
|
+
* (For instance, 'height: 100%')
|
|
102
153
|
*/
|
|
103
154
|
inheritDimensions?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Informs Smart Link of the device it is rendered in. Available values are `web` and `mobile`.
|
|
157
|
+
* It is used together with link response `data.preview['atlassian:supportedPlatforms']`.
|
|
158
|
+
* To make embed content available on all supported urls, use `web`.
|
|
159
|
+
*/
|
|
104
160
|
platform?: CardPlatform;
|
|
105
161
|
}
|
|
106
162
|
export interface FlexibleProps extends ActionProps, HoverPreviewProps {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "29.0.
|
|
3
|
+
"version": "29.0.3",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"@atlaskit/popup": "^1.28.0",
|
|
55
55
|
"@atlaskit/primitives": "^12.2.0",
|
|
56
56
|
"@atlaskit/section-message": "^6.6.0",
|
|
57
|
-
"@atlaskit/select": "^
|
|
57
|
+
"@atlaskit/select": "^18.0.0",
|
|
58
58
|
"@atlaskit/spinner": "^16.3.0",
|
|
59
59
|
"@atlaskit/textarea": "^5.6.0",
|
|
60
60
|
"@atlaskit/textfield": "^6.5.0",
|
|
61
61
|
"@atlaskit/theme": "^13.0.0",
|
|
62
62
|
"@atlaskit/tokens": "^2.0.0",
|
|
63
|
-
"@atlaskit/tooltip": "^18.
|
|
63
|
+
"@atlaskit/tooltip": "^18.8.0",
|
|
64
64
|
"@atlaskit/ufo": "^0.3.0",
|
|
65
65
|
"@babel/runtime": "^7.0.0",
|
|
66
66
|
"@emotion/react": "^11.7.1",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"@af/visual-regression": "*",
|
|
90
90
|
"@atlaskit/analytics-listeners": "^8.11.0",
|
|
91
91
|
"@atlaskit/css-reset": "^6.11.0",
|
|
92
|
+
"@atlaskit/link": "^1.2.1",
|
|
92
93
|
"@atlaskit/link-test-helpers": "^7.5.0",
|
|
93
94
|
"@atlaskit/media-test-helpers": "^34.4.0",
|
|
94
95
|
"@atlaskit/ssr": "*",
|
|
@@ -150,7 +151,10 @@
|
|
|
150
151
|
".": "./src/index.ts"
|
|
151
152
|
},
|
|
152
153
|
"platform-feature-flags": {
|
|
153
|
-
"platform
|
|
154
|
+
"platform-smart-card-view-related-urls-action": {
|
|
155
|
+
"type": "boolean"
|
|
156
|
+
},
|
|
157
|
+
"send-smart-link-rendered-ufo-event-half-time": {
|
|
154
158
|
"type": "boolean"
|
|
155
159
|
}
|
|
156
160
|
}
|