@atlaskit/smart-card 25.6.0 → 25.6.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/ssr.js +9 -6
- package/dist/cjs/state/hooks/useSmartLink.js +6 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ssr.js +11 -6
- package/dist/es2019/state/hooks/useSmartLink.js +6 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ssr.js +9 -6
- package/dist/esm/state/hooks/useSmartLink.js +6 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/state/hooks/useSmartLink.d.ts +6 -1
- package/dist/types/view/CardWithUrl/types.d.ts +5 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/ssr.js
CHANGED
|
@@ -11,8 +11,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var _reactErrorBoundary = require("react-error-boundary");
|
|
14
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
14
15
|
var _component = require("./view/CardWithUrl/component");
|
|
15
16
|
var _LazyFallback = require("./view/CardWithUrl/component-lazy/LazyFallback");
|
|
17
|
+
var _analytics = require("./utils/analytics/analytics");
|
|
16
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -22,19 +24,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
22
24
|
// only contains whats necessary to render the card on SSR mode
|
|
23
25
|
var CardSSR = function CardSSR(props) {
|
|
24
26
|
var _useState = (0, _react.useState)(function () {
|
|
25
|
-
|
|
27
|
+
var _props$id;
|
|
28
|
+
return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : (0, _uuid.default)();
|
|
26
29
|
}),
|
|
27
30
|
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
28
31
|
id = _useState2[0];
|
|
29
|
-
var dispatchAnalytics = function dispatchAnalytics() {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
|
|
30
32
|
var cardProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
31
|
-
id: id
|
|
32
|
-
dispatchAnalytics: dispatchAnalytics
|
|
33
|
+
id: id
|
|
33
34
|
});
|
|
34
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
|
|
36
|
+
data: _analytics.context
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
35
38
|
FallbackComponent: function FallbackComponent() {
|
|
36
39
|
return /*#__PURE__*/_react.default.createElement(_LazyFallback.LoadingCardLink, cardProps);
|
|
37
40
|
}
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, cardProps));
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_component.CardWithUrlContent, cardProps)));
|
|
39
42
|
};
|
|
40
43
|
exports.CardSSR = CardSSR;
|
|
@@ -13,7 +13,12 @@ var _config = require("../config");
|
|
|
13
13
|
var _analytics = require("../analytics");
|
|
14
14
|
var _renderers = require("../renderers");
|
|
15
15
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
16
|
-
function useSmartLink(id, url,
|
|
16
|
+
function useSmartLink(id, url,
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
19
|
+
* Avoid prop drilling analytics handlers. Continue passing a handler for now if there's already one in place.
|
|
20
|
+
*/
|
|
21
|
+
dispatchAnalytics) {
|
|
17
22
|
var state = (0, _store.useSmartCardState)(url);
|
|
18
23
|
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
19
24
|
store = _useSmartLinkContext.store;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/ssr.js
CHANGED
|
@@ -2,20 +2,25 @@ import React from 'react';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
5
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
5
6
|
import { CardWithUrlContent } from './view/CardWithUrl/component';
|
|
6
7
|
import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
8
|
+
import { context } from './utils/analytics/analytics';
|
|
7
9
|
// SSR friendly version of smart-card
|
|
8
10
|
// simplifies the logic around rendering and loading placeholders and
|
|
9
11
|
// only contains whats necessary to render the card on SSR mode
|
|
10
12
|
export const CardSSR = props => {
|
|
11
|
-
const [id] = useState(() =>
|
|
12
|
-
|
|
13
|
+
const [id] = useState(() => {
|
|
14
|
+
var _props$id;
|
|
15
|
+
return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : uuid();
|
|
16
|
+
});
|
|
13
17
|
const cardProps = {
|
|
14
18
|
...props,
|
|
15
|
-
id
|
|
16
|
-
dispatchAnalytics
|
|
19
|
+
id
|
|
17
20
|
};
|
|
18
|
-
return /*#__PURE__*/React.createElement(
|
|
21
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
22
|
+
data: context
|
|
23
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
19
24
|
FallbackComponent: () => /*#__PURE__*/React.createElement(LoadingCardLink, cardProps)
|
|
20
|
-
}, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps));
|
|
25
|
+
}, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps)));
|
|
21
26
|
};
|
|
@@ -5,7 +5,12 @@ import { useSmartLinkConfig } from '../config';
|
|
|
5
5
|
import { useSmartLinkAnalytics } from '../analytics';
|
|
6
6
|
import { useSmartLinkRenderers } from '../renderers';
|
|
7
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
8
|
-
export function useSmartLink(id, url,
|
|
8
|
+
export function useSmartLink(id, url,
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
11
|
+
* Avoid prop drilling analytics handlers. Continue passing a handler for now if there's already one in place.
|
|
12
|
+
*/
|
|
13
|
+
dispatchAnalytics) {
|
|
9
14
|
const state = useSmartLinkState(url);
|
|
10
15
|
const {
|
|
11
16
|
store
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/ssr.js
CHANGED
|
@@ -6,25 +6,28 @@ import React from 'react';
|
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import uuid from 'uuid';
|
|
8
8
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
9
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
9
10
|
import { CardWithUrlContent } from './view/CardWithUrl/component';
|
|
10
11
|
import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
12
|
+
import { context } from './utils/analytics/analytics';
|
|
11
13
|
// SSR friendly version of smart-card
|
|
12
14
|
// simplifies the logic around rendering and loading placeholders and
|
|
13
15
|
// only contains whats necessary to render the card on SSR mode
|
|
14
16
|
export var CardSSR = function CardSSR(props) {
|
|
15
17
|
var _useState = useState(function () {
|
|
16
|
-
|
|
18
|
+
var _props$id;
|
|
19
|
+
return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : uuid();
|
|
17
20
|
}),
|
|
18
21
|
_useState2 = _slicedToArray(_useState, 1),
|
|
19
22
|
id = _useState2[0];
|
|
20
|
-
var dispatchAnalytics = function dispatchAnalytics() {}; // we can't dispatch events on SSR, after hydration the we will provide the real callback
|
|
21
23
|
var cardProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
22
|
-
id: id
|
|
23
|
-
dispatchAnalytics: dispatchAnalytics
|
|
24
|
+
id: id
|
|
24
25
|
});
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
26
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
27
|
+
data: context
|
|
28
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
26
29
|
FallbackComponent: function FallbackComponent() {
|
|
27
30
|
return /*#__PURE__*/React.createElement(LoadingCardLink, cardProps);
|
|
28
31
|
}
|
|
29
|
-
}, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps));
|
|
32
|
+
}, /*#__PURE__*/React.createElement(CardWithUrlContent, cardProps)));
|
|
30
33
|
};
|
|
@@ -6,7 +6,12 @@ import { useSmartLinkConfig } from '../config';
|
|
|
6
6
|
import { useSmartLinkAnalytics } from '../analytics';
|
|
7
7
|
import { useSmartLinkRenderers } from '../renderers';
|
|
8
8
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
9
|
-
export function useSmartLink(id, url,
|
|
9
|
+
export function useSmartLink(id, url,
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
12
|
+
* Avoid prop drilling analytics handlers. Continue passing a handler for now if there's already one in place.
|
|
13
|
+
*/
|
|
14
|
+
dispatchAnalytics) {
|
|
10
15
|
var state = useSmartLinkState(url);
|
|
11
16
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
12
17
|
store = _useSmartLinkContext.store;
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { AnalyticsHandler } from '../../utils/types';
|
|
2
|
-
export declare function useSmartLink(id: string, url: string,
|
|
2
|
+
export declare function useSmartLink(id: string, url: string,
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
5
|
+
* Avoid prop drilling analytics handlers. Continue passing a handler for now if there's already one in place.
|
|
6
|
+
*/
|
|
7
|
+
dispatchAnalytics?: AnalyticsHandler): {
|
|
3
8
|
state: import("@atlaskit/linking-common").CardState;
|
|
4
9
|
actions: {
|
|
5
10
|
register: () => Promise<void>;
|
|
@@ -15,7 +15,11 @@ export declare type CardWithUrlContentProps = {
|
|
|
15
15
|
isFrameVisible?: boolean;
|
|
16
16
|
frameStyle?: FrameStyle;
|
|
17
17
|
container?: HTMLElement;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
20
|
+
* Avoid prop drilling analytics handlers
|
|
21
|
+
*/
|
|
22
|
+
dispatchAnalytics?: AnalyticsHandler;
|
|
19
23
|
testId?: string;
|
|
20
24
|
onResolve?: OnResolveCallback;
|
|
21
25
|
onError?: OnErrorCallback;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "25.6.
|
|
3
|
+
"version": "25.6.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/code": "^14.5.0",
|
|
72
72
|
"@atlaskit/css-reset": "^6.4.0",
|
|
73
73
|
"@atlaskit/docs": "*",
|
|
74
|
-
"@atlaskit/field-base": "^15.0
|
|
74
|
+
"@atlaskit/field-base": "^15.1.0",
|
|
75
75
|
"@atlaskit/form": "^8.9.0",
|
|
76
76
|
"@atlaskit/inline-message": "^11.4.0",
|
|
77
77
|
"@atlaskit/link-test-helpers": "^2.2.0",
|