@atlaskit/smart-card 29.0.0 → 29.0.2
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/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/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +61 -42
- 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/index.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/types.d.ts +61 -42
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 29.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#147818](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147818)
|
|
8
|
+
[`56e97352c27dc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/56e97352c27dc) -
|
|
9
|
+
Send smart-link-rendered UFO event only half of the time
|
|
10
|
+
|
|
11
|
+
## 29.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#146547](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146547)
|
|
16
|
+
[`b0acda68f75b2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b0acda68f75b2) -
|
|
17
|
+
Update CardProps type for documentation
|
|
18
|
+
|
|
3
19
|
## 29.0.0
|
|
4
20
|
|
|
5
21
|
### Major 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.2"
|
|
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.2",
|
|
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.2"
|
|
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.2",
|
|
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.2"
|
|
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.2",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldSample: (threshold?: number) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type CardAppearance, type CardPlatform, type CardProps } from './types';
|
|
3
3
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "
|
|
4
|
+
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "inlinePreloaderStyle" | "isHovered" | "removeTextHighlightingFromTitle" | "resolvingPlaceholder" | "truncateInline" | "useLegacyBlockCard" | "importer" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "frameStyle" | "platform" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -30,28 +30,25 @@ export type CardActionOptions = {
|
|
|
30
30
|
hide: false;
|
|
31
31
|
exclude?: Array<CardAction>;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
interface ActionProps {
|
|
34
|
+
actionOptions?: CardActionOptions;
|
|
35
|
+
}
|
|
36
|
+
interface HoverPreviewProps extends ActionProps {
|
|
37
|
+
showHoverPreview?: boolean;
|
|
38
|
+
hoverPreviewOptions?: HoverPreviewOptions;
|
|
39
|
+
showAuthTooltip?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface BaseCardProps {
|
|
34
42
|
appearance: CardAppearance;
|
|
35
|
-
id?: string;
|
|
36
|
-
platform?: CardPlatform;
|
|
37
|
-
isSelected?: boolean;
|
|
38
|
-
/** A flag that determines whether a card is in a hover state in edit mode. Currently used for inline links only */
|
|
39
|
-
isHovered?: boolean;
|
|
40
|
-
/** A prop that determines the style of a frame: whether to show it, hide it or only show it when a user hovers over embed */
|
|
41
|
-
frameStyle?: FrameStyle;
|
|
42
|
-
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
43
|
-
importer?: (target: any) => void;
|
|
44
43
|
container?: HTMLElement;
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* https://product-fabric.atlassian.net/browse/EDM-6813
|
|
45
|
+
* A component that will be rendered when smart card fails to render
|
|
46
|
+
* because of uncaught errors
|
|
49
47
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onResolve?: OnResolveCallback;
|
|
48
|
+
fallbackComponent?: React.ComponentType;
|
|
49
|
+
id?: string;
|
|
50
|
+
isSelected?: boolean;
|
|
51
|
+
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
55
52
|
/**
|
|
56
53
|
* A callback function currently invoked in two cases
|
|
57
54
|
* 1. When the {@link CardState.status} is one of {@link ErrorCardType}. "err" property in argument will be undefined in this case
|
|
@@ -63,31 +60,15 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
63
60
|
* If fallbackComponent is not provided, smart card will render null
|
|
64
61
|
*/
|
|
65
62
|
onError?: OnErrorCallback;
|
|
66
|
-
|
|
67
|
-
* A component that will be rendered when smart card fails to render
|
|
68
|
-
* because of uncaught errors
|
|
69
|
-
*/
|
|
70
|
-
fallbackComponent?: React.ComponentType;
|
|
71
|
-
/** This props determines if dimensions of an embed card are to be inherited from the parent.
|
|
72
|
-
* The parent container needs to override a style '.loader-wrapper' and set the desirable height there. (for instance, 'height: 100%')
|
|
73
|
-
*/
|
|
74
|
-
inheritDimensions?: boolean;
|
|
75
|
-
embedIframeRef?: React.Ref<HTMLIFrameElement>;
|
|
76
|
-
embedIframeUrlType?: EmbedIframeUrlType;
|
|
77
|
-
inlinePreloaderStyle?: InlinePreloaderStyle;
|
|
78
|
-
ui?: FlexibleUiOptions;
|
|
79
|
-
children?: React.ReactNode;
|
|
80
|
-
showHoverPreview?: boolean;
|
|
81
|
-
hoverPreviewOptions?: HoverPreviewOptions;
|
|
82
|
-
showAuthTooltip?: boolean;
|
|
63
|
+
onResolve?: OnResolveCallback;
|
|
83
64
|
placeholder?: string;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
testId?: string;
|
|
66
|
+
url?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface InlineProps extends HoverPreviewProps {
|
|
69
|
+
inlinePreloaderStyle?: InlinePreloaderStyle;
|
|
70
|
+
/** A flag that determines whether a card is in a hover state in edit mode. Currently used for inline links only */
|
|
71
|
+
isHovered?: boolean;
|
|
91
72
|
/**
|
|
92
73
|
* When set to true, the text fragment will be removed from the title.
|
|
93
74
|
* This will have no impact on the url and text highlighting will still persist in the url,
|
|
@@ -102,3 +83,41 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
102
83
|
/** When set to true, inline cards will be truncated to one line. */
|
|
103
84
|
truncateInline?: boolean;
|
|
104
85
|
}
|
|
86
|
+
export interface BlockProps extends ActionProps {
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15021 Internal documentation for deprecation (no external access)}
|
|
89
|
+
* When enabled the legacy block card is always used, even if the enableFlexibleBlockCard flag is set to true.
|
|
90
|
+
* Usage is strongly discouraged. This should only be used if there is a specific reason you're
|
|
91
|
+
* unable to use the new flexible block cards.
|
|
92
|
+
*/
|
|
93
|
+
useLegacyBlockCard?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface EmbedProps {
|
|
96
|
+
embedIframeRef?: React.Ref<HTMLIFrameElement>;
|
|
97
|
+
embedIframeUrlType?: EmbedIframeUrlType;
|
|
98
|
+
/** A prop that determines the style of a frame: whether to show it, hide it or only show it when a user hovers over embed */
|
|
99
|
+
frameStyle?: FrameStyle;
|
|
100
|
+
/** This props determines if dimensions of an embed card are to be inherited from the parent.
|
|
101
|
+
* The parent container needs to override a style '.loader-wrapper' and set the desirable height there. (for instance, 'height: 100%')
|
|
102
|
+
*/
|
|
103
|
+
inheritDimensions?: boolean;
|
|
104
|
+
platform?: CardPlatform;
|
|
105
|
+
}
|
|
106
|
+
export interface FlexibleProps extends ActionProps, HoverPreviewProps {
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
ui?: FlexibleUiOptions;
|
|
109
|
+
}
|
|
110
|
+
export interface CardProps extends BaseCardProps, InlineProps, BlockProps, EmbedProps, FlexibleProps, WithAnalyticsEventsProps {
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-3226 Internal documentation for deprecation (no external access)}
|
|
113
|
+
* Likely here for legacy reason where editor would store data in ADF instead of resolving it everytime
|
|
114
|
+
* https://product-fabric.atlassian.net/browse/EDM-10930
|
|
115
|
+
*/
|
|
116
|
+
data?: any;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-3226 Internal documentation for deprecation (no external access)}
|
|
119
|
+
* Likely here for legacy reason where editor would store data in ADF instead of resolving it everytime
|
|
120
|
+
* https://product-fabric.atlassian.net/browse/EDM-10930
|
|
121
|
+
*/
|
|
122
|
+
importer?: (target: any) => void;
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldSample: (threshold?: number) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type CardAppearance, type CardPlatform, type CardProps } from './types';
|
|
3
3
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "
|
|
4
|
+
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "inlinePreloaderStyle" | "isHovered" | "removeTextHighlightingFromTitle" | "resolvingPlaceholder" | "truncateInline" | "useLegacyBlockCard" | "importer" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "frameStyle" | "platform" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -30,28 +30,25 @@ export type CardActionOptions = {
|
|
|
30
30
|
hide: false;
|
|
31
31
|
exclude?: Array<CardAction>;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
interface ActionProps {
|
|
34
|
+
actionOptions?: CardActionOptions;
|
|
35
|
+
}
|
|
36
|
+
interface HoverPreviewProps extends ActionProps {
|
|
37
|
+
showHoverPreview?: boolean;
|
|
38
|
+
hoverPreviewOptions?: HoverPreviewOptions;
|
|
39
|
+
showAuthTooltip?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface BaseCardProps {
|
|
34
42
|
appearance: CardAppearance;
|
|
35
|
-
id?: string;
|
|
36
|
-
platform?: CardPlatform;
|
|
37
|
-
isSelected?: boolean;
|
|
38
|
-
/** A flag that determines whether a card is in a hover state in edit mode. Currently used for inline links only */
|
|
39
|
-
isHovered?: boolean;
|
|
40
|
-
/** A prop that determines the style of a frame: whether to show it, hide it or only show it when a user hovers over embed */
|
|
41
|
-
frameStyle?: FrameStyle;
|
|
42
|
-
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
43
|
-
importer?: (target: any) => void;
|
|
44
43
|
container?: HTMLElement;
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* https://product-fabric.atlassian.net/browse/EDM-6813
|
|
45
|
+
* A component that will be rendered when smart card fails to render
|
|
46
|
+
* because of uncaught errors
|
|
49
47
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onResolve?: OnResolveCallback;
|
|
48
|
+
fallbackComponent?: React.ComponentType;
|
|
49
|
+
id?: string;
|
|
50
|
+
isSelected?: boolean;
|
|
51
|
+
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
55
52
|
/**
|
|
56
53
|
* A callback function currently invoked in two cases
|
|
57
54
|
* 1. When the {@link CardState.status} is one of {@link ErrorCardType}. "err" property in argument will be undefined in this case
|
|
@@ -63,31 +60,15 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
63
60
|
* If fallbackComponent is not provided, smart card will render null
|
|
64
61
|
*/
|
|
65
62
|
onError?: OnErrorCallback;
|
|
66
|
-
|
|
67
|
-
* A component that will be rendered when smart card fails to render
|
|
68
|
-
* because of uncaught errors
|
|
69
|
-
*/
|
|
70
|
-
fallbackComponent?: React.ComponentType;
|
|
71
|
-
/** This props determines if dimensions of an embed card are to be inherited from the parent.
|
|
72
|
-
* The parent container needs to override a style '.loader-wrapper' and set the desirable height there. (for instance, 'height: 100%')
|
|
73
|
-
*/
|
|
74
|
-
inheritDimensions?: boolean;
|
|
75
|
-
embedIframeRef?: React.Ref<HTMLIFrameElement>;
|
|
76
|
-
embedIframeUrlType?: EmbedIframeUrlType;
|
|
77
|
-
inlinePreloaderStyle?: InlinePreloaderStyle;
|
|
78
|
-
ui?: FlexibleUiOptions;
|
|
79
|
-
children?: React.ReactNode;
|
|
80
|
-
showHoverPreview?: boolean;
|
|
81
|
-
hoverPreviewOptions?: HoverPreviewOptions;
|
|
82
|
-
showAuthTooltip?: boolean;
|
|
63
|
+
onResolve?: OnResolveCallback;
|
|
83
64
|
placeholder?: string;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
testId?: string;
|
|
66
|
+
url?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface InlineProps extends HoverPreviewProps {
|
|
69
|
+
inlinePreloaderStyle?: InlinePreloaderStyle;
|
|
70
|
+
/** A flag that determines whether a card is in a hover state in edit mode. Currently used for inline links only */
|
|
71
|
+
isHovered?: boolean;
|
|
91
72
|
/**
|
|
92
73
|
* When set to true, the text fragment will be removed from the title.
|
|
93
74
|
* This will have no impact on the url and text highlighting will still persist in the url,
|
|
@@ -102,3 +83,41 @@ export interface CardProps extends WithAnalyticsEventsProps {
|
|
|
102
83
|
/** When set to true, inline cards will be truncated to one line. */
|
|
103
84
|
truncateInline?: boolean;
|
|
104
85
|
}
|
|
86
|
+
export interface BlockProps extends ActionProps {
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-15021 Internal documentation for deprecation (no external access)}
|
|
89
|
+
* When enabled the legacy block card is always used, even if the enableFlexibleBlockCard flag is set to true.
|
|
90
|
+
* Usage is strongly discouraged. This should only be used if there is a specific reason you're
|
|
91
|
+
* unable to use the new flexible block cards.
|
|
92
|
+
*/
|
|
93
|
+
useLegacyBlockCard?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface EmbedProps {
|
|
96
|
+
embedIframeRef?: React.Ref<HTMLIFrameElement>;
|
|
97
|
+
embedIframeUrlType?: EmbedIframeUrlType;
|
|
98
|
+
/** A prop that determines the style of a frame: whether to show it, hide it or only show it when a user hovers over embed */
|
|
99
|
+
frameStyle?: FrameStyle;
|
|
100
|
+
/** This props determines if dimensions of an embed card are to be inherited from the parent.
|
|
101
|
+
* The parent container needs to override a style '.loader-wrapper' and set the desirable height there. (for instance, 'height: 100%')
|
|
102
|
+
*/
|
|
103
|
+
inheritDimensions?: boolean;
|
|
104
|
+
platform?: CardPlatform;
|
|
105
|
+
}
|
|
106
|
+
export interface FlexibleProps extends ActionProps, HoverPreviewProps {
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
ui?: FlexibleUiOptions;
|
|
109
|
+
}
|
|
110
|
+
export interface CardProps extends BaseCardProps, InlineProps, BlockProps, EmbedProps, FlexibleProps, WithAnalyticsEventsProps {
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-3226 Internal documentation for deprecation (no external access)}
|
|
113
|
+
* Likely here for legacy reason where editor would store data in ADF instead of resolving it everytime
|
|
114
|
+
* https://product-fabric.atlassian.net/browse/EDM-10930
|
|
115
|
+
*/
|
|
116
|
+
data?: any;
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-3226 Internal documentation for deprecation (no external access)}
|
|
119
|
+
* Likely here for legacy reason where editor would store data in ADF instead of resolving it everytime
|
|
120
|
+
* https://product-fabric.atlassian.net/browse/EDM-10930
|
|
121
|
+
*/
|
|
122
|
+
importer?: (target: any) => void;
|
|
123
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "29.0.
|
|
3
|
+
"version": "29.0.2",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/form": "^10.5.0",
|
|
37
37
|
"@atlaskit/frontend-utilities": "^2.7.0",
|
|
38
38
|
"@atlaskit/heading": "^2.4.0",
|
|
39
|
-
"@atlaskit/icon": "^22.
|
|
39
|
+
"@atlaskit/icon": "^22.20.0",
|
|
40
40
|
"@atlaskit/icon-file-type": "^6.5.0",
|
|
41
41
|
"@atlaskit/icon-object": "^6.5.0",
|
|
42
42
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/modal-dialog": "^12.17.0",
|
|
52
52
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
53
53
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
54
|
-
"@atlaskit/popup": "^1.
|
|
54
|
+
"@atlaskit/popup": "^1.28.0",
|
|
55
55
|
"@atlaskit/primitives": "^12.2.0",
|
|
56
56
|
"@atlaskit/section-message": "^6.6.0",
|
|
57
57
|
"@atlaskit/select": "^17.19.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
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",
|
|
@@ -150,7 +150,10 @@
|
|
|
150
150
|
".": "./src/index.ts"
|
|
151
151
|
},
|
|
152
152
|
"platform-feature-flags": {
|
|
153
|
-
"platform
|
|
153
|
+
"platform-smart-card-view-related-urls-action": {
|
|
154
|
+
"type": "boolean"
|
|
155
|
+
},
|
|
156
|
+
"send-smart-link-rendered-ufo-event-half-time": {
|
|
154
157
|
"type": "boolean"
|
|
155
158
|
}
|
|
156
159
|
}
|