@atlaskit/smart-card 18.0.10 → 18.0.13
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 +35 -0
- package/dist/cjs/extractors/common/preview/extractImage.js +3 -3
- package/dist/cjs/extractors/common/preview/index.js +3 -3
- package/dist/cjs/extractors/common/primitives/extractLink.js +2 -2
- package/dist/cjs/extractors/common/utils.js +4 -16
- package/dist/cjs/extractors/embed/index.js +3 -3
- package/dist/cjs/hooks.js +9 -1
- package/dist/cjs/state/hooks-external/useSmartLinkReload.js +32 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/extractors/common/preview/extractImage.js +1 -1
- package/dist/es2019/extractors/common/preview/index.js +2 -2
- package/dist/es2019/extractors/common/primitives/extractLink.js +1 -1
- package/dist/es2019/extractors/common/utils.js +1 -11
- package/dist/es2019/extractors/embed/index.js +1 -1
- package/dist/es2019/hooks.js +2 -1
- package/dist/es2019/state/hooks-external/useSmartLinkReload.js +19 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/extractors/common/preview/extractImage.js +1 -1
- package/dist/esm/extractors/common/preview/index.js +2 -2
- package/dist/esm/extractors/common/primitives/extractLink.js +1 -1
- package/dist/esm/extractors/common/utils.js +1 -11
- package/dist/esm/extractors/embed/index.js +1 -1
- package/dist/esm/hooks.js +2 -1
- package/dist/esm/state/hooks-external/useSmartLinkReload.js +20 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/extractors/common/preview/index.d.ts +2 -2
- package/dist/types/extractors/common/utils.d.ts +0 -1
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/providers/editor/index.d.ts +4 -2
- package/dist/types/providers/editor/transformer.d.ts +1 -1
- package/dist/types/providers/editor/types.d.ts +0 -20
- package/dist/types/state/context/types.d.ts +1 -1
- package/dist/types/state/hooks-external/useSmartLinkReload.d.ts +19 -0
- package/package.json +8 -7
- package/dist/cjs/extractors/common/preview/extractPlatformIsSupported.js +0 -30
- package/dist/cjs/extractors/common/preview/extractPreview.js +0 -42
- package/dist/es2019/extractors/common/preview/extractPlatformIsSupported.js +0 -21
- package/dist/es2019/extractors/common/preview/extractPreview.js +0 -31
- package/dist/esm/extractors/common/preview/extractPlatformIsSupported.js +0 -21
- package/dist/esm/extractors/common/preview/extractPreview.js +0 -31
- package/dist/types/extractors/common/preview/extractPlatformIsSupported.d.ts +0 -2
- package/dist/types/extractors/common/preview/extractPreview.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 18.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 18.0.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`b90896c18cd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b90896c18cd) - move helpers and types to @atlaskit/linking-common and import them
|
|
14
|
+
|
|
15
|
+
## 18.0.11
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`ec98e2d8ebc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ec98e2d8ebc) - feat: Expose `useSmartLinkReload` hook.
|
|
20
|
+
|
|
21
|
+
### Example Usage
|
|
22
|
+
|
|
23
|
+
As a consumer if you want to be able to reload the data backing a Smart Link, you may do:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
export const MyComponent = () => {
|
|
27
|
+
const reloader = useSmartLinkReload(url, analytics);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<MyInterfaceItem>
|
|
31
|
+
<Card />
|
|
32
|
+
<Button text="Retry" onClick={reloader} />
|
|
33
|
+
</MyInterfaceItem>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
3
38
|
## 18.0.10
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.extractImage = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
9
9
|
|
|
10
10
|
var extractImage = function extractImage(jsonLd) {
|
|
11
11
|
var image = jsonLd.image;
|
|
@@ -14,10 +14,10 @@ var extractImage = function extractImage(jsonLd) {
|
|
|
14
14
|
if (typeof image === 'string') {
|
|
15
15
|
return image;
|
|
16
16
|
} else if (image['@type'] === 'Link') {
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, _linkingCommon.extractUrlFromLinkJsonLd)(image);
|
|
18
18
|
} else if (image['@type'] === 'Image') {
|
|
19
19
|
if (image.url) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, _linkingCommon.extractUrlFromLinkJsonLd)(image.url);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -12,10 +12,10 @@ Object.defineProperty(exports, "extractImage", {
|
|
|
12
12
|
Object.defineProperty(exports, "extractPreview", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _linkingCommon.extractPreview;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _extractImage = require("./extractImage");
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.extractLink = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
9
9
|
|
|
10
10
|
var extractLink = function extractLink(jsonLd) {
|
|
11
11
|
var url = jsonLd.url;
|
|
@@ -14,7 +14,7 @@ var extractLink = function extractLink(jsonLd) {
|
|
|
14
14
|
if (typeof url === 'string') {
|
|
15
15
|
return url;
|
|
16
16
|
} else {
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, _linkingCommon.extractUrlFromLinkJsonLd)(url);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
};
|
|
@@ -3,30 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.extractUrlFromIconJsonLd = exports.extractPersonFromJsonLd = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
if (typeof link === 'string') {
|
|
10
|
-
return link;
|
|
11
|
-
} else if (Array.isArray(link)) {
|
|
12
|
-
if (link.length > 0) {
|
|
13
|
-
return extractUrlFromLinkJsonLd(link[0]);
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
return link.href;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.extractUrlFromLinkJsonLd = extractUrlFromLinkJsonLd;
|
|
8
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
21
9
|
|
|
22
10
|
var extractUrlFromIconJsonLd = function extractUrlFromIconJsonLd(icon) {
|
|
23
11
|
if (typeof icon === 'string') {
|
|
24
12
|
return icon;
|
|
25
13
|
} else if (icon['@type'] === 'Link') {
|
|
26
|
-
return extractUrlFromLinkJsonLd(icon);
|
|
14
|
+
return (0, _linkingCommon.extractUrlFromLinkJsonLd)(icon);
|
|
27
15
|
} else {
|
|
28
16
|
if (icon.url) {
|
|
29
|
-
return extractUrlFromLinkJsonLd(icon.url);
|
|
17
|
+
return (0, _linkingCommon.extractUrlFromLinkJsonLd)(icon.url);
|
|
30
18
|
}
|
|
31
19
|
}
|
|
32
20
|
};
|
|
@@ -9,12 +9,12 @@ exports.extractEmbedProps = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
+
var _linkingCommon = require("@atlaskit/linking-common");
|
|
13
|
+
|
|
12
14
|
var _primitives = require("../common/primitives");
|
|
13
15
|
|
|
14
16
|
var _context = require("../common/context");
|
|
15
17
|
|
|
16
|
-
var _extractPreview = require("../common/preview/extractPreview");
|
|
17
|
-
|
|
18
18
|
var _extractIsTrusted = require("../common/meta/extractIsTrusted");
|
|
19
19
|
|
|
20
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,7 +22,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
23
|
|
|
24
24
|
var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform) {
|
|
25
|
-
var preview = (0,
|
|
25
|
+
var preview = (0, _linkingCommon.extractPreview)(jsonLd, platform);
|
|
26
26
|
|
|
27
27
|
if (preview && preview.src) {
|
|
28
28
|
return _objectSpread(_objectSpread({}, preview), {}, {
|
package/dist/cjs/hooks.js
CHANGED
|
@@ -9,5 +9,13 @@ Object.defineProperty(exports, "useSmartLinkActions", {
|
|
|
9
9
|
return _useSmartLinkActions.useSmartLinkActions;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "useSmartLinkReload", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _useSmartLinkReload.useSmartLinkReload;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _useSmartLinkActions = require("./state/hooks-external/useSmartLinkActions");
|
|
12
20
|
|
|
13
|
-
var
|
|
21
|
+
var _useSmartLinkReload = require("./state/hooks-external/useSmartLinkReload");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useSmartLinkReload = useSmartLinkReload;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
|
+
|
|
14
|
+
var _actions = require("../actions");
|
|
15
|
+
|
|
16
|
+
var _analytics = require("../analytics");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Exposes a programmatic way to reload the data being used to render a Smart Link.
|
|
20
|
+
* @param
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
function useSmartLinkReload(_ref) {
|
|
24
|
+
var url = _ref.url,
|
|
25
|
+
analyticsHandler = _ref.analyticsHandler;
|
|
26
|
+
var id = (0, _react.useMemo)(function () {
|
|
27
|
+
return (0, _uuid.default)();
|
|
28
|
+
}, []);
|
|
29
|
+
var linkAnalytics = (0, _analytics.useSmartLinkAnalytics)(analyticsHandler);
|
|
30
|
+
var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics);
|
|
31
|
+
return linkActions.reload;
|
|
32
|
+
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { extractPreview } from '@atlaskit/linking-common';
|
|
2
|
+
export { extractImage } from './extractImage';
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (typeof link === 'string') {
|
|
3
|
-
return link;
|
|
4
|
-
} else if (Array.isArray(link)) {
|
|
5
|
-
if (link.length > 0) {
|
|
6
|
-
return extractUrlFromLinkJsonLd(link[0]);
|
|
7
|
-
}
|
|
8
|
-
} else {
|
|
9
|
-
return link.href;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
1
|
+
import { extractUrlFromLinkJsonLd } from '@atlaskit/linking-common';
|
|
12
2
|
export const extractUrlFromIconJsonLd = icon => {
|
|
13
3
|
if (typeof icon === 'string') {
|
|
14
4
|
return icon;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { extractPreview } from '@atlaskit/linking-common';
|
|
1
2
|
import { extractLink, extractTitle } from '../common/primitives';
|
|
2
3
|
import { extractProvider } from '../common/context';
|
|
3
|
-
import { extractPreview } from '../common/preview/extractPreview';
|
|
4
4
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
5
5
|
|
|
6
6
|
const extractEmbedPreview = (jsonLd, platform) => {
|
package/dist/es2019/hooks.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { useSmartLinkActions } from './state/hooks-external/useSmartLinkActions';
|
|
1
|
+
export { useSmartLinkActions } from './state/hooks-external/useSmartLinkActions';
|
|
2
|
+
export { useSmartLinkReload } from './state/hooks-external/useSmartLinkReload';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import uuid from 'uuid';
|
|
3
|
+
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
4
|
+
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Exposes a programmatic way to reload the data being used to render a Smart Link.
|
|
8
|
+
* @param
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export function useSmartLinkReload({
|
|
12
|
+
url,
|
|
13
|
+
analyticsHandler
|
|
14
|
+
}) {
|
|
15
|
+
const id = useMemo(() => uuid(), []);
|
|
16
|
+
const linkAnalytics = useLinkAnalytics(analyticsHandler);
|
|
17
|
+
const linkActions = useLinkActions(id, url, linkAnalytics);
|
|
18
|
+
return linkActions.reload;
|
|
19
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { extractPreview } from '@atlaskit/linking-common';
|
|
2
|
+
export { extractImage } from './extractImage';
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (typeof link === 'string') {
|
|
3
|
-
return link;
|
|
4
|
-
} else if (Array.isArray(link)) {
|
|
5
|
-
if (link.length > 0) {
|
|
6
|
-
return extractUrlFromLinkJsonLd(link[0]);
|
|
7
|
-
}
|
|
8
|
-
} else {
|
|
9
|
-
return link.href;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
1
|
+
import { extractUrlFromLinkJsonLd } from '@atlaskit/linking-common';
|
|
12
2
|
export var extractUrlFromIconJsonLd = function extractUrlFromIconJsonLd(icon) {
|
|
13
3
|
if (typeof icon === 'string') {
|
|
14
4
|
return icon;
|
|
@@ -4,9 +4,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
|
+
import { extractPreview } from '@atlaskit/linking-common';
|
|
7
8
|
import { extractLink, extractTitle } from '../common/primitives';
|
|
8
9
|
import { extractProvider } from '../common/context';
|
|
9
|
-
import { extractPreview } from '../common/preview/extractPreview';
|
|
10
10
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
11
11
|
|
|
12
12
|
var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform) {
|
package/dist/esm/hooks.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { useSmartLinkActions } from './state/hooks-external/useSmartLinkActions';
|
|
1
|
+
export { useSmartLinkActions } from './state/hooks-external/useSmartLinkActions';
|
|
2
|
+
export { useSmartLinkReload } from './state/hooks-external/useSmartLinkReload';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import uuid from 'uuid';
|
|
3
|
+
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
4
|
+
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Exposes a programmatic way to reload the data being used to render a Smart Link.
|
|
8
|
+
* @param
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export function useSmartLinkReload(_ref) {
|
|
12
|
+
var url = _ref.url,
|
|
13
|
+
analyticsHandler = _ref.analyticsHandler;
|
|
14
|
+
var id = useMemo(function () {
|
|
15
|
+
return uuid();
|
|
16
|
+
}, []);
|
|
17
|
+
var linkAnalytics = useLinkAnalytics(analyticsHandler);
|
|
18
|
+
var linkActions = useLinkActions(id, url, linkAnalytics);
|
|
19
|
+
return linkActions.reload;
|
|
20
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
export { extractPreview } from '@atlaskit/linking-common';
|
|
2
|
+
export type { LinkPreview } from '@atlaskit/linking-common';
|
|
1
3
|
export { extractImage } from './extractImage';
|
|
2
|
-
export { extractPreview } from './extractPreview';
|
|
3
|
-
export type { LinkPreview } from './extractPreview';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
2
|
import { LinkPerson } from './person/types';
|
|
3
|
-
export declare const extractUrlFromLinkJsonLd: (link: JsonLd.Primitives.Link | JsonLd.Primitives.Link[]) => string | undefined;
|
|
4
3
|
export declare const extractUrlFromIconJsonLd: (icon: JsonLd.Primitives.Link | JsonLd.Primitives.Image) => string | undefined;
|
|
5
4
|
export declare const extractPersonFromJsonLd: (person: JsonLd.Primitives.Object | JsonLd.Primitives.Link) => LinkPerson | undefined;
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'setimmediate';
|
|
2
|
-
import {
|
|
2
|
+
import { CardAdf } from '@atlaskit/linking-common';
|
|
3
|
+
import { CardProvider } from './types';
|
|
3
4
|
import { CardAppearance } from '../../view/Card';
|
|
4
5
|
import { EnvironmentsKeys } from '../../client/types';
|
|
5
6
|
export declare class EditorCardProvider implements CardProvider {
|
|
@@ -17,4 +18,5 @@ export declare class EditorCardProvider implements CardProvider {
|
|
|
17
18
|
resolve(url: string, appearance: CardAppearance): Promise<CardAdf>;
|
|
18
19
|
}
|
|
19
20
|
export declare const editorCardProvider: EditorCardProvider;
|
|
20
|
-
export type { CardProvider, ORSCheckResponse
|
|
21
|
+
export type { CardProvider, ORSCheckResponse } from './types';
|
|
22
|
+
export type { CardAdf, InlineCardAdf, BlockCardAdf, EmbedCardAdf, } from '@atlaskit/linking-common';
|
|
@@ -16,24 +16,4 @@ declare type Provider = {
|
|
|
16
16
|
export declare type ORSProvidersResponse = {
|
|
17
17
|
providers: Provider[];
|
|
18
18
|
};
|
|
19
|
-
export interface InlineCardAdf {
|
|
20
|
-
type: 'inlineCard';
|
|
21
|
-
attrs: {
|
|
22
|
-
url: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export interface BlockCardAdf {
|
|
26
|
-
type: 'blockCard';
|
|
27
|
-
attrs: {
|
|
28
|
-
url: string;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export interface EmbedCardAdf {
|
|
32
|
-
type: 'embedCard';
|
|
33
|
-
attrs: {
|
|
34
|
-
url: string;
|
|
35
|
-
layout: 'wide';
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export declare type CardAdf = InlineCardAdf | BlockCardAdf | EmbedCardAdf;
|
|
39
19
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Store } from 'redux';
|
|
3
|
+
import { LinkPreview } from '@atlaskit/linking-common';
|
|
3
4
|
import { CardStore, CardConnections } from '../store/types';
|
|
4
5
|
import { CardPlatform, CardAppearance } from '../../view/Card';
|
|
5
6
|
import CardClient from '../../client';
|
|
6
|
-
import { LinkPreview } from '../../extractors/common/preview/extractPreview';
|
|
7
7
|
export interface CardAuthFlowOpts {
|
|
8
8
|
authFlow?: 'oauth2' | 'disabled';
|
|
9
9
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnalyticsHandler } from '../../utils/types';
|
|
2
|
+
export interface UseSmartLinkReloadOpts {
|
|
3
|
+
/**
|
|
4
|
+
* Smart Link URL for which the reload will be invoked.
|
|
5
|
+
* @example https://start.atlassian.com
|
|
6
|
+
*/
|
|
7
|
+
url: string;
|
|
8
|
+
/**
|
|
9
|
+
* Callback for sending analytics events.
|
|
10
|
+
* @description Accepts an analytics payload and fires it to a system.
|
|
11
|
+
*/
|
|
12
|
+
analyticsHandler: AnalyticsHandler;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Exposes a programmatic way to reload the data being used to render a Smart Link.
|
|
16
|
+
* @param
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSmartLinkReload({ url, analyticsHandler, }: UseSmartLinkReloadOpts): () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.13",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,16 +33,17 @@
|
|
|
33
33
|
"@atlaskit/icon-object": "^6.2.0",
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
|
+
"@atlaskit/linking-common": "^1.0.0",
|
|
36
37
|
"@atlaskit/logo": "^13.5.0",
|
|
37
38
|
"@atlaskit/lozenge": "^11.1.0",
|
|
38
|
-
"@atlaskit/media-common": "^2.
|
|
39
|
-
"@atlaskit/media-ui": "^21.
|
|
39
|
+
"@atlaskit/media-common": "^2.12.0",
|
|
40
|
+
"@atlaskit/media-ui": "^21.1.0",
|
|
40
41
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
41
42
|
"@atlaskit/outbound-auth-flow-client": "^3.3.0",
|
|
42
43
|
"@atlaskit/popup": "^1.3.0",
|
|
43
44
|
"@atlaskit/spinner": "^15.1.0",
|
|
44
45
|
"@atlaskit/theme": "^12.1.0",
|
|
45
|
-
"@atlaskit/tokens": "^0.
|
|
46
|
+
"@atlaskit/tokens": "^0.9.0",
|
|
46
47
|
"@atlaskit/tooltip": "^17.5.2",
|
|
47
48
|
"@atlaskit/ufo": "^0.1.0",
|
|
48
49
|
"@babel/runtime": "^7.0.0",
|
|
@@ -76,8 +77,8 @@
|
|
|
76
77
|
"@atlaskit/form": "^8.5.0",
|
|
77
78
|
"@atlaskit/inline-message": "^11.2.0",
|
|
78
79
|
"@atlaskit/lozenge": "^11.1.0",
|
|
79
|
-
"@atlaskit/media-integration-test-helpers": "^2.
|
|
80
|
-
"@atlaskit/media-test-helpers": "^29.
|
|
80
|
+
"@atlaskit/media-integration-test-helpers": "^2.6.0",
|
|
81
|
+
"@atlaskit/media-test-helpers": "^29.4.0",
|
|
81
82
|
"@atlaskit/page": "^12.1.0",
|
|
82
83
|
"@atlaskit/radio": "^5.3.0",
|
|
83
84
|
"@atlaskit/range": "^6.0.0",
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
114
115
|
"react-test-renderer": "^16.8.0",
|
|
115
116
|
"ts-jest": "24.3.0",
|
|
116
|
-
"typescript": "3.9.
|
|
117
|
+
"typescript": "3.9.10",
|
|
117
118
|
"xhr-mock": "^2.4.0"
|
|
118
119
|
},
|
|
119
120
|
"af:exports": {
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractPlatformIsSupported = void 0;
|
|
7
|
-
|
|
8
|
-
var extractPlatformIsSupported = function extractPlatformIsSupported(preview, platform) {
|
|
9
|
-
if (preview) {
|
|
10
|
-
// By default, we support previews everywhere.
|
|
11
|
-
if (typeof preview === 'string') {
|
|
12
|
-
return true;
|
|
13
|
-
} else {
|
|
14
|
-
var supportedPlatforms = preview['atlassian:supportedPlatforms'];
|
|
15
|
-
|
|
16
|
-
if (supportedPlatforms) {
|
|
17
|
-
var isWeb = platform === 'web';
|
|
18
|
-
return isWeb && supportedPlatforms.includes('web') || !isWeb && supportedPlatforms.includes('mobile');
|
|
19
|
-
} // No supported platforms - assume they are all supported.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
} // No preview, don't try and render it on any platforms.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return false;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.extractPlatformIsSupported = extractPlatformIsSupported;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractPreview = void 0;
|
|
7
|
-
|
|
8
|
-
var _utils = require("../utils");
|
|
9
|
-
|
|
10
|
-
var _extractPlatformIsSupported = require("./extractPlatformIsSupported");
|
|
11
|
-
|
|
12
|
-
var extractPreview = function extractPreview(jsonLd, platform) {
|
|
13
|
-
var preview = jsonLd.preview;
|
|
14
|
-
var isSupported = (0, _extractPlatformIsSupported.extractPlatformIsSupported)(preview, platform);
|
|
15
|
-
|
|
16
|
-
if (preview && isSupported) {
|
|
17
|
-
if (typeof preview === 'string') {
|
|
18
|
-
return {
|
|
19
|
-
src: preview
|
|
20
|
-
};
|
|
21
|
-
} else if (preview['@type'] === 'Link') {
|
|
22
|
-
return {
|
|
23
|
-
src: (0, _utils.extractUrlFromLinkJsonLd)(preview),
|
|
24
|
-
aspectRatio: preview['atlassian:aspectRatio']
|
|
25
|
-
};
|
|
26
|
-
} else {
|
|
27
|
-
// TODO, EDM-565: Remove this once the typings for Dropbox and Jira have been patched up.
|
|
28
|
-
if (preview.url || preview.href) {
|
|
29
|
-
return {
|
|
30
|
-
src: (0, _utils.extractUrlFromLinkJsonLd)(preview.url || preview.href),
|
|
31
|
-
aspectRatio: preview['atlassian:aspectRatio']
|
|
32
|
-
};
|
|
33
|
-
} else if (preview.content) {
|
|
34
|
-
return {
|
|
35
|
-
content: preview.content
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
exports.extractPreview = extractPreview;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const extractPlatformIsSupported = (preview, platform) => {
|
|
2
|
-
if (preview) {
|
|
3
|
-
// By default, we support previews everywhere.
|
|
4
|
-
if (typeof preview === 'string') {
|
|
5
|
-
return true;
|
|
6
|
-
} else {
|
|
7
|
-
const supportedPlatforms = preview['atlassian:supportedPlatforms'];
|
|
8
|
-
|
|
9
|
-
if (supportedPlatforms) {
|
|
10
|
-
const isWeb = platform === 'web';
|
|
11
|
-
return isWeb && supportedPlatforms.includes('web') || !isWeb && supportedPlatforms.includes('mobile');
|
|
12
|
-
} // No supported platforms - assume they are all supported.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
} // No preview, don't try and render it on any platforms.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { extractUrlFromLinkJsonLd } from '../utils';
|
|
2
|
-
import { extractPlatformIsSupported } from './extractPlatformIsSupported';
|
|
3
|
-
export const extractPreview = (jsonLd, platform) => {
|
|
4
|
-
const preview = jsonLd.preview;
|
|
5
|
-
const isSupported = extractPlatformIsSupported(preview, platform);
|
|
6
|
-
|
|
7
|
-
if (preview && isSupported) {
|
|
8
|
-
if (typeof preview === 'string') {
|
|
9
|
-
return {
|
|
10
|
-
src: preview
|
|
11
|
-
};
|
|
12
|
-
} else if (preview['@type'] === 'Link') {
|
|
13
|
-
return {
|
|
14
|
-
src: extractUrlFromLinkJsonLd(preview),
|
|
15
|
-
aspectRatio: preview['atlassian:aspectRatio']
|
|
16
|
-
};
|
|
17
|
-
} else {
|
|
18
|
-
// TODO, EDM-565: Remove this once the typings for Dropbox and Jira have been patched up.
|
|
19
|
-
if (preview.url || preview.href) {
|
|
20
|
-
return {
|
|
21
|
-
src: extractUrlFromLinkJsonLd(preview.url || preview.href),
|
|
22
|
-
aspectRatio: preview['atlassian:aspectRatio']
|
|
23
|
-
};
|
|
24
|
-
} else if (preview.content) {
|
|
25
|
-
return {
|
|
26
|
-
content: preview.content
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export var extractPlatformIsSupported = function extractPlatformIsSupported(preview, platform) {
|
|
2
|
-
if (preview) {
|
|
3
|
-
// By default, we support previews everywhere.
|
|
4
|
-
if (typeof preview === 'string') {
|
|
5
|
-
return true;
|
|
6
|
-
} else {
|
|
7
|
-
var supportedPlatforms = preview['atlassian:supportedPlatforms'];
|
|
8
|
-
|
|
9
|
-
if (supportedPlatforms) {
|
|
10
|
-
var isWeb = platform === 'web';
|
|
11
|
-
return isWeb && supportedPlatforms.includes('web') || !isWeb && supportedPlatforms.includes('mobile');
|
|
12
|
-
} // No supported platforms - assume they are all supported.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
} // No preview, don't try and render it on any platforms.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { extractUrlFromLinkJsonLd } from '../utils';
|
|
2
|
-
import { extractPlatformIsSupported } from './extractPlatformIsSupported';
|
|
3
|
-
export var extractPreview = function extractPreview(jsonLd, platform) {
|
|
4
|
-
var preview = jsonLd.preview;
|
|
5
|
-
var isSupported = extractPlatformIsSupported(preview, platform);
|
|
6
|
-
|
|
7
|
-
if (preview && isSupported) {
|
|
8
|
-
if (typeof preview === 'string') {
|
|
9
|
-
return {
|
|
10
|
-
src: preview
|
|
11
|
-
};
|
|
12
|
-
} else if (preview['@type'] === 'Link') {
|
|
13
|
-
return {
|
|
14
|
-
src: extractUrlFromLinkJsonLd(preview),
|
|
15
|
-
aspectRatio: preview['atlassian:aspectRatio']
|
|
16
|
-
};
|
|
17
|
-
} else {
|
|
18
|
-
// TODO, EDM-565: Remove this once the typings for Dropbox and Jira have been patched up.
|
|
19
|
-
if (preview.url || preview.href) {
|
|
20
|
-
return {
|
|
21
|
-
src: extractUrlFromLinkJsonLd(preview.url || preview.href),
|
|
22
|
-
aspectRatio: preview['atlassian:aspectRatio']
|
|
23
|
-
};
|
|
24
|
-
} else if (preview.content) {
|
|
25
|
-
return {
|
|
26
|
-
content: preview.content
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { JsonLd } from 'json-ld-types';
|
|
2
|
-
export interface LinkPreview {
|
|
3
|
-
src?: string;
|
|
4
|
-
content?: string;
|
|
5
|
-
aspectRatio?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const extractPreview: (jsonLd: JsonLd.Data.BaseData, platform?: "web" | "mobile" | undefined) => LinkPreview | undefined;
|