@atlaskit/smart-card 16.0.0 → 16.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/cjs/client/utils/environments.js +1 -1
- package/dist/cjs/extractors/block/index.js +4 -4
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +4 -3
- package/dist/cjs/providers/editor/transformer.js +1 -1
- package/dist/cjs/state/actions/index.js +13 -6
- package/dist/cjs/state/analytics/index.js +32 -84
- package/dist/cjs/state/analytics/ufoExperiences.js +60 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +106 -0
- package/dist/cjs/state/hooks/useSmartLink.js +6 -6
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/index.js +3 -2
- package/dist/cjs/view/CardWithUrl/component-lazy/index.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +10 -4
- package/dist/cjs/view/CardWithUrl/loader.js +106 -134
- package/dist/es2019/client/utils/environments.js +1 -1
- package/dist/es2019/extractors/block/index.js +4 -4
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +4 -4
- package/dist/es2019/providers/editor/transformer.js +1 -1
- package/dist/es2019/state/actions/index.js +9 -4
- package/dist/es2019/state/analytics/index.js +2 -40
- package/dist/es2019/state/analytics/ufoExperiences.js +40 -0
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +62 -0
- package/dist/es2019/state/hooks/useSmartLink.js +4 -5
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/index.js +3 -2
- package/dist/es2019/view/CardWithUrl/component-lazy/index.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +10 -4
- package/dist/es2019/view/CardWithUrl/loader.js +83 -92
- package/dist/esm/client/utils/environments.js +1 -1
- package/dist/esm/extractors/block/index.js +4 -4
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +4 -3
- package/dist/esm/providers/editor/transformer.js +1 -1
- package/dist/esm/state/actions/index.js +12 -6
- package/dist/esm/state/analytics/index.js +2 -80
- package/dist/esm/state/analytics/ufoExperiences.js +40 -0
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +94 -0
- package/dist/esm/state/hooks/useSmartLink.js +6 -6
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/index.js +3 -2
- package/dist/esm/view/CardWithUrl/component-lazy/index.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +10 -4
- package/dist/esm/view/CardWithUrl/loader.js +101 -130
- package/dist/types/extractors/block/index.d.ts +2 -2
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +61 -0
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/state/analytics/index.d.ts +3 -32
- package/dist/types/state/analytics/ufoExperiences.d.ts +7 -0
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +30 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +4 -5
- package/dist/types/view/BlockCard/types.d.ts +2 -1
- package/dist/types/view/CardWithUrl/component-lazy/index.d.ts +1 -1
- package/dist/types/view/CardWithUrl/loader.d.ts +1 -15
- package/package.json +13 -11
|
@@ -1,141 +1,112 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
|
|
13
|
-
import React from 'react';
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { lazy, useEffect, useState, Suspense, useCallback } from 'react';
|
|
14
3
|
import uuid from 'uuid';
|
|
15
4
|
import { CardLinkView } from '@atlaskit/media-ui';
|
|
16
5
|
import { uiRenderFailedEvent, fireSmartLinkEvent } from '../../utils/analytics';
|
|
17
6
|
import { clearMarks, clearMeasures } from '../../utils/performance';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
_this.state = {
|
|
47
|
-
id: uuid()
|
|
48
|
-
};
|
|
49
|
-
return _this;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
_createClass(CardWithURLRenderer, [{
|
|
53
|
-
key: "componentDidMount",
|
|
54
|
-
value: function componentDidMount() {
|
|
55
|
-
if (CardWithURLRenderer.CardContent === null) {
|
|
56
|
-
(this.props.importer || CardWithURLRenderer.moduleImporter)(this);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
key: "componentWillUnmount",
|
|
61
|
-
value: function componentWillUnmount() {
|
|
62
|
-
var id = this.state.id;
|
|
7
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
8
|
+
import { failUfoExperience, startUfoExperience } from '../../state/analytics/ufoExperiences';
|
|
9
|
+
var LazyCardWithUrlContent = /*#__PURE__*/lazy(function () {
|
|
10
|
+
return import(
|
|
11
|
+
/* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */
|
|
12
|
+
'./component-lazy/index');
|
|
13
|
+
});
|
|
14
|
+
export function CardWithURLRenderer(props) {
|
|
15
|
+
var _useState = useState(function () {
|
|
16
|
+
return uuid();
|
|
17
|
+
}),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
19
|
+
id = _useState2[0]; // Equivalent to ComponentWillMount
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
useState(function () {
|
|
23
|
+
// We want to start timing of render event only once and right at the start
|
|
24
|
+
startUfoExperience('smart-link-rendered', id);
|
|
25
|
+
});
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
// ComponentWillUnmount
|
|
28
|
+
return function () {
|
|
63
29
|
clearMarks(id);
|
|
64
30
|
clearMeasures(id);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
appearance = _this$props2.appearance,
|
|
89
|
-
isSelected = _this$props2.isSelected,
|
|
90
|
-
isFrameVisible = _this$props2.isFrameVisible,
|
|
91
|
-
onClick = _this$props2.onClick,
|
|
92
|
-
container = _this$props2.container,
|
|
93
|
-
onResolve = _this$props2.onResolve,
|
|
94
|
-
testId = _this$props2.testId,
|
|
95
|
-
showActions = _this$props2.showActions,
|
|
96
|
-
inheritDimensions = _this$props2.inheritDimensions,
|
|
97
|
-
platform = _this$props2.platform,
|
|
98
|
-
embedIframeRef = _this$props2.embedIframeRef,
|
|
99
|
-
inlinePreloaderStyle = _this$props2.inlinePreloaderStyle;
|
|
100
|
-
|
|
101
|
-
if (!url) {
|
|
102
|
-
throw new Error('@atlaskit/smart-card: url property is missing.');
|
|
31
|
+
};
|
|
32
|
+
}, [id]);
|
|
33
|
+
var url = props.url,
|
|
34
|
+
appearance = props.appearance,
|
|
35
|
+
isSelected = props.isSelected,
|
|
36
|
+
isFrameVisible = props.isFrameVisible,
|
|
37
|
+
onClick = props.onClick,
|
|
38
|
+
container = props.container,
|
|
39
|
+
onResolve = props.onResolve,
|
|
40
|
+
testId = props.testId,
|
|
41
|
+
showActions = props.showActions,
|
|
42
|
+
inheritDimensions = props.inheritDimensions,
|
|
43
|
+
platform = props.platform,
|
|
44
|
+
embedIframeRef = props.embedIframeRef,
|
|
45
|
+
inlinePreloaderStyle = props.inlinePreloaderStyle,
|
|
46
|
+
createAnalyticsEvent = props.createAnalyticsEvent; // Wrapper around analytics.
|
|
47
|
+
|
|
48
|
+
var dispatchAnalytics = useCallback(function (analyticsPayload) {
|
|
49
|
+
if (analyticsPayload && analyticsPayload.attributes) {
|
|
50
|
+
// Update if we haven't already set the display - possible
|
|
51
|
+
// in the case of `preview` which is rendered differently.
|
|
52
|
+
if (!analyticsPayload.attributes.display) {
|
|
53
|
+
analyticsPayload.attributes.display = appearance;
|
|
103
54
|
}
|
|
104
|
-
|
|
105
|
-
return CardWithURLRenderer.CardContent !== null ? /*#__PURE__*/React.createElement(CardWithURLRenderer.CardContent, {
|
|
106
|
-
id: this.state.id,
|
|
107
|
-
url: url,
|
|
108
|
-
appearance: appearance,
|
|
109
|
-
onClick: onClick,
|
|
110
|
-
isSelected: isSelected,
|
|
111
|
-
isFrameVisible: isFrameVisible,
|
|
112
|
-
dispatchAnalytics: this.dispatchAnalytics,
|
|
113
|
-
container: container,
|
|
114
|
-
onResolve: onResolve,
|
|
115
|
-
testId: testId,
|
|
116
|
-
showActions: showActions,
|
|
117
|
-
inheritDimensions: inheritDimensions,
|
|
118
|
-
platform: platform,
|
|
119
|
-
embedIframeRef: embedIframeRef,
|
|
120
|
-
inlinePreloaderStyle: inlinePreloaderStyle
|
|
121
|
-
}) : /*#__PURE__*/React.createElement(CardLinkView, {
|
|
122
|
-
key: 'chunk-placeholder',
|
|
123
|
-
link: url
|
|
124
|
-
});
|
|
125
55
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
56
|
+
|
|
57
|
+
fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
|
|
58
|
+
}, [appearance, createAnalyticsEvent]);
|
|
59
|
+
var logError = useCallback(function (error, info) {
|
|
60
|
+
var componentStack = info.componentStack; // NB: APIErrors are thrown in response to Object Resolver Service.
|
|
61
|
+
// In these cases, control is handed back to the Editor. We do not
|
|
62
|
+
// fire an event for these, as they do not cover failed UI render events.
|
|
63
|
+
|
|
64
|
+
if (error.name === 'APIError') {
|
|
65
|
+
throw error;
|
|
66
|
+
} // NB: the rest of the errors caught here are unexpected, and correlate
|
|
67
|
+
// to the reliability of the smart-card front-end components. We instrument
|
|
68
|
+
// these in order to measure our front-end reliability.
|
|
69
|
+
else {
|
|
70
|
+
var errorInfo = {
|
|
71
|
+
componentStack: componentStack
|
|
72
|
+
};
|
|
73
|
+
failUfoExperience('smart-link-rendered', id);
|
|
74
|
+
failUfoExperience('smart-link-authenticated', id);
|
|
75
|
+
dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
|
|
135
76
|
}
|
|
136
|
-
}]);
|
|
77
|
+
}, [appearance, dispatchAnalytics, id]);
|
|
137
78
|
|
|
138
|
-
|
|
139
|
-
|
|
79
|
+
if (!url) {
|
|
80
|
+
throw new Error('@atlaskit/smart-card: url property is missing.');
|
|
81
|
+
}
|
|
140
82
|
|
|
141
|
-
|
|
83
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
84
|
+
FallbackComponent: ErrorFallback,
|
|
85
|
+
onError: logError
|
|
86
|
+
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
87
|
+
fallback: /*#__PURE__*/React.createElement(CardLinkView, {
|
|
88
|
+
key: 'chunk-placeholder',
|
|
89
|
+
link: url
|
|
90
|
+
})
|
|
91
|
+
}, /*#__PURE__*/React.createElement(LazyCardWithUrlContent, {
|
|
92
|
+
id: id,
|
|
93
|
+
url: url,
|
|
94
|
+
appearance: appearance,
|
|
95
|
+
onClick: onClick,
|
|
96
|
+
isSelected: isSelected,
|
|
97
|
+
isFrameVisible: isFrameVisible,
|
|
98
|
+
dispatchAnalytics: dispatchAnalytics,
|
|
99
|
+
container: container,
|
|
100
|
+
onResolve: onResolve,
|
|
101
|
+
testId: testId,
|
|
102
|
+
showActions: showActions,
|
|
103
|
+
inheritDimensions: inheritDimensions,
|
|
104
|
+
platform: platform,
|
|
105
|
+
embedIframeRef: embedIframeRef,
|
|
106
|
+
inlinePreloaderStyle: inlinePreloaderStyle
|
|
107
|
+
})));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var ErrorFallback = function ErrorFallback() {
|
|
111
|
+
return /*#__PURE__*/React.createElement("span", null);
|
|
112
|
+
};
|
|
@@ -3,6 +3,6 @@ import { BlockCardResolvedViewProps, ActionProps } from '@atlaskit/media-ui';
|
|
|
3
3
|
import { LinkPerson } from '../common/person/types';
|
|
4
4
|
import { ExtractBlockOpts } from './types';
|
|
5
5
|
import { CardProviderRenderers } from '../../state/context/types';
|
|
6
|
-
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined) => ActionProps[];
|
|
6
|
+
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined, platform?: "web" | "mobile" | undefined) => ActionProps[];
|
|
7
7
|
export declare const extractBlockUsers: (jsonLd: JsonLd.Data.BaseData) => LinkPerson[] | undefined;
|
|
8
|
-
export declare const extractBlockProps: (jsonLd: JsonLd.Data.BaseData, meta?: JsonLd.Meta.BaseMeta | undefined, opts?: ExtractBlockOpts | undefined, renderers?: CardProviderRenderers | undefined) => BlockCardResolvedViewProps;
|
|
8
|
+
export declare const extractBlockProps: (jsonLd: JsonLd.Data.BaseData, meta?: JsonLd.Meta.BaseMeta | undefined, opts?: ExtractBlockOpts | undefined, renderers?: CardProviderRenderers | undefined, platform?: "web" | "mobile" | undefined) => BlockCardResolvedViewProps;
|
|
@@ -85,3 +85,64 @@ export declare const TEST_DOCUMENT_WITH_ACTIONS: {
|
|
|
85
85
|
summaryMap?: Record<string, string> | undefined;
|
|
86
86
|
updated?: string | undefined;
|
|
87
87
|
};
|
|
88
|
+
export declare const PREVIEW: JsonLd.Data.BaseData['preview'];
|
|
89
|
+
export declare const TEST_DOCUMENT_WITH_PREVIEW: {
|
|
90
|
+
preview: JsonLd.Primitives.LinkModel & JsonLd.Primitives.PreviewExtension;
|
|
91
|
+
'@type': "Collection" | "Document" | "schema:BlogPosting" | "schema:TextDigitalDocument" | "schema:DigitalDocument" | "schema:PresentationDigitalDocument" | "schema:SpreadsheetDigitalDocument" | "atlassian:UndefinedLink" | ("Object" | "Document")[] | ("Object" | "Collection" | "Document" | "schema:BlogPosting" | "schema:TextDigitalDocument" | "schema:DigitalDocument" | "schema:PresentationDigitalDocument" | "schema:SpreadsheetDigitalDocument" | "atlassian:UndefinedLink")[] | ("Document" | "schema:DigitalDocument")[];
|
|
92
|
+
'schema:fileFormat'?: string | undefined;
|
|
93
|
+
'atlassian:fileSize'?: number | undefined;
|
|
94
|
+
'schema:dateCreated'?: string | undefined;
|
|
95
|
+
'atlassian:updatedBy'?: string | JsonLd.Primitives.LinkModel | JsonLd.Primitives.Person<any> | undefined;
|
|
96
|
+
'schema:commentCount'?: number | undefined;
|
|
97
|
+
'atlassian:isDeleted'?: boolean | undefined;
|
|
98
|
+
'schema:potentialAction'?: import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").CommentAction | import("schema-dts").ShareAction | JsonLd.Data.DocumentAction[] | undefined;
|
|
99
|
+
'atlassian:state'?: string | undefined;
|
|
100
|
+
'@context': JsonLd.Primitives.Context;
|
|
101
|
+
'atlassian:downloadUrl'?: string | undefined;
|
|
102
|
+
'atlassian:visitUrl'?: string | undefined;
|
|
103
|
+
'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
|
|
104
|
+
'@id'?: string | undefined;
|
|
105
|
+
attachment?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
106
|
+
attributedTo?: (string & {
|
|
107
|
+
actor?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
108
|
+
}) | (JsonLd.Primitives.Object<any> & {
|
|
109
|
+
actor?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
110
|
+
}) | (JsonLd.Primitives.LinkModel & {
|
|
111
|
+
actor?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
112
|
+
}) | ((string & {
|
|
113
|
+
actor?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
114
|
+
}) | (JsonLd.Primitives.Object<any> & {
|
|
115
|
+
actor?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
116
|
+
}) | (JsonLd.Primitives.LinkModel & {
|
|
117
|
+
actor?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
118
|
+
}))[] | undefined;
|
|
119
|
+
audience?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
120
|
+
bcc?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
121
|
+
bto?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
122
|
+
cc?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
123
|
+
context?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | undefined;
|
|
124
|
+
generator?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | undefined;
|
|
125
|
+
icon?: string | JsonLd.Primitives.LinkModel | JsonLd.Primitives.Image | undefined;
|
|
126
|
+
image?: string | JsonLd.Primitives.LinkModel | JsonLd.Primitives.Image | undefined;
|
|
127
|
+
inReplyTo?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
128
|
+
location?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
129
|
+
oneOf?: (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
130
|
+
anyOf?: (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
131
|
+
closed?: string | boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | undefined;
|
|
132
|
+
replies?: JsonLd.Primitives.Collection<any> | undefined;
|
|
133
|
+
tag?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
134
|
+
to?: string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel | (string | JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel)[] | undefined;
|
|
135
|
+
url?: string | JsonLd.Primitives.LinkModel | JsonLd.Primitives.Link[] | undefined;
|
|
136
|
+
content?: string | undefined;
|
|
137
|
+
contentMap?: Record<string, string> | undefined;
|
|
138
|
+
name?: string | undefined;
|
|
139
|
+
nameMap?: Record<string, string> | undefined;
|
|
140
|
+
duration?: string | undefined;
|
|
141
|
+
mediaType?: string | undefined;
|
|
142
|
+
endTime?: string | undefined;
|
|
143
|
+
published?: string | undefined;
|
|
144
|
+
startTime?: string | undefined;
|
|
145
|
+
summary?: string | undefined;
|
|
146
|
+
summaryMap?: Record<string, string> | undefined;
|
|
147
|
+
updated?: string | undefined;
|
|
148
|
+
};
|
|
@@ -2,4 +2,4 @@ import { BlockCardResolvedViewProps } from '@atlaskit/media-ui';
|
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
3
|
import { InvokeHandler } from '../../../model/invoke-handler';
|
|
4
4
|
import { AnalyticsHandler } from '../../../utils/types';
|
|
5
|
-
export declare const extractPreviewAction: (definitionId: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined) => import("@atlaskit/media-ui").ActionProps | undefined;
|
|
5
|
+
export declare const extractPreviewAction: (definitionId: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: "web" | "mobile" | undefined) => import("@atlaskit/media-ui").ActionProps | undefined;
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { CardType } from '../store/types';
|
|
5
|
-
import { APIError } from '../../client/errors';
|
|
6
|
-
export declare const useSmartLinkAnalytics: (dispatchAnalytics: AnalyticsHandler) => {
|
|
7
|
-
ui: {
|
|
8
|
-
authEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
9
|
-
authAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
10
|
-
cardClickedEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
11
|
-
actionClickedEvent: (providerKey: string, actionType: string, display?: "inline" | "block" | "embed" | "preview" | undefined) => void;
|
|
12
|
-
closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
13
|
-
renderSuccessEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
14
|
-
renderFailedEvent: (display: CardInnerAppearance, error: Error, errorInfo: ErrorInfo) => void;
|
|
15
|
-
};
|
|
16
|
-
operational: {
|
|
17
|
-
resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
|
|
18
|
-
unresolvedEvent: (id: string, status: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
|
|
19
|
-
invokeSucceededEvent: (id: string, providerKey: string, actionType: string, display: CardInnerAppearance) => void;
|
|
20
|
-
invokeFailedEvent: (id: string, providerKey: string, actionType: string, display: CardInnerAppearance, reason: string) => void;
|
|
21
|
-
connectSucceededEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
22
|
-
connectFailedEvent: (definitionId?: string | undefined, extensionKey?: string | undefined, reason?: string | undefined) => void;
|
|
23
|
-
instrument: (id: string, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => void;
|
|
24
|
-
};
|
|
25
|
-
track: {
|
|
26
|
-
appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
27
|
-
};
|
|
28
|
-
screen: {
|
|
29
|
-
authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export declare type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
|
|
1
|
+
export { startUfoExperience, succeedUfoExperience, failUfoExperience, addMetadataToExperience, } from './ufoExperiences';
|
|
2
|
+
export { useSmartLinkAnalytics } from './useSmartLinkAnalytics';
|
|
3
|
+
export type { AnalyticsFacade } from './useSmartLinkAnalytics';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomData } from '@atlaskit/ufo';
|
|
2
|
+
declare type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated';
|
|
3
|
+
export declare const startUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
|
|
4
|
+
export declare const succeedUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
|
|
5
|
+
export declare const failUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
|
|
6
|
+
export declare const addMetadataToExperience: (experienceName: UfoExperienceName, id: string, properties: CustomData) => void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AnalyticsHandler } from '../../utils/types';
|
|
2
|
+
import { CardInnerAppearance } from '../../view/Card/types';
|
|
3
|
+
import { CardType } from '../store/types';
|
|
4
|
+
import { APIError } from '../../client/errors';
|
|
5
|
+
export declare const useSmartLinkAnalytics: (dispatchAnalytics: AnalyticsHandler) => {
|
|
6
|
+
ui: {
|
|
7
|
+
authEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
8
|
+
authAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
9
|
+
cardClickedEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
10
|
+
actionClickedEvent: (providerKey: string, actionType: string, display?: "inline" | "block" | "embed" | "preview" | undefined) => void;
|
|
11
|
+
closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
12
|
+
renderSuccessEvent: (display: CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
13
|
+
};
|
|
14
|
+
operational: {
|
|
15
|
+
resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
|
|
16
|
+
unresolvedEvent: (id: string, status: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
|
|
17
|
+
invokeSucceededEvent: (id: string, providerKey: string, actionType: string, display: CardInnerAppearance) => void;
|
|
18
|
+
invokeFailedEvent: (id: string, providerKey: string, actionType: string, display: CardInnerAppearance, reason: string) => void;
|
|
19
|
+
connectSucceededEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
20
|
+
connectFailedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, status?: string | undefined) => void;
|
|
21
|
+
instrument: (id: string, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => void;
|
|
22
|
+
};
|
|
23
|
+
track: {
|
|
24
|
+
appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
25
|
+
};
|
|
26
|
+
screen: {
|
|
27
|
+
authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AnalyticsHandler } from '../../utils/types';
|
|
3
2
|
export declare function useSmartLink(id: string, url: string, dispatchAnalytics: AnalyticsHandler): {
|
|
4
3
|
state: import("../types").CardState;
|
|
@@ -16,16 +15,15 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
16
15
|
cardClickedEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
17
16
|
actionClickedEvent: (providerKey: string, actionType: string, display?: "inline" | "block" | "embed" | "preview" | undefined) => void;
|
|
18
17
|
closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
19
|
-
renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
20
|
-
renderFailedEvent: (display: import("../../view/Card/types").CardInnerAppearance, error: Error, errorInfo: import("react").ErrorInfo) => void;
|
|
18
|
+
renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
21
19
|
};
|
|
22
20
|
operational: {
|
|
23
21
|
resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
|
|
24
22
|
unresolvedEvent: (id: string, status: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => void;
|
|
25
23
|
invokeSucceededEvent: (id: string, providerKey: string, actionType: string, display: import("../../view/Card/types").CardInnerAppearance) => void;
|
|
26
24
|
invokeFailedEvent: (id: string, providerKey: string, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, reason: string) => void;
|
|
27
|
-
connectSucceededEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
28
|
-
connectFailedEvent: (definitionId?: string | undefined, extensionKey?: string | undefined,
|
|
25
|
+
connectSucceededEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
26
|
+
connectFailedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, status?: string | undefined) => void;
|
|
29
27
|
instrument: (id: string, status: import("../store").CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: import("../..").APIError | undefined) => void;
|
|
30
28
|
};
|
|
31
29
|
track: {
|
|
@@ -36,4 +34,5 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
36
34
|
};
|
|
37
35
|
};
|
|
38
36
|
renderers: import("../context/types").CardProviderRenderers | undefined;
|
|
37
|
+
error: null;
|
|
39
38
|
};
|
|
@@ -3,7 +3,7 @@ import { CardState } from '../../state/types';
|
|
|
3
3
|
import { InvokeHandler } from '../../model/invoke-handler';
|
|
4
4
|
import { CardAuthFlowOpts, CardProviderRenderers } from '../../state/context/types';
|
|
5
5
|
import { AnalyticsHandler } from '../../utils/types';
|
|
6
|
-
import { OnResolveCallback } from '../Card/types';
|
|
6
|
+
import { OnResolveCallback, CardPlatform } from '../Card/types';
|
|
7
7
|
export declare type BlockCardProps = {
|
|
8
8
|
url: string;
|
|
9
9
|
cardState: CardState;
|
|
@@ -18,4 +18,5 @@ export declare type BlockCardProps = {
|
|
|
18
18
|
testId?: string;
|
|
19
19
|
showActions?: boolean;
|
|
20
20
|
renderers?: CardProviderRenderers;
|
|
21
|
+
platform?: CardPlatform;
|
|
21
22
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CardWithUrlContentProps } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export default function LazyCardWithUrlContent(props: CardWithUrlContentProps): JSX.Element;
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
import React, { ErrorInfo } from 'react';
|
|
2
1
|
import { CardProps } from '../Card/types';
|
|
3
|
-
|
|
4
|
-
import { AnalyticsPayload } from '../../utils/types';
|
|
5
|
-
export declare class CardWithURLRenderer extends React.PureComponent<CardProps, {
|
|
6
|
-
id: string;
|
|
7
|
-
}> {
|
|
8
|
-
constructor(props: CardProps);
|
|
9
|
-
static CardContent: typeof CardWithUrlContentType | null;
|
|
10
|
-
static moduleImporter(target: CardWithURLRenderer): void;
|
|
11
|
-
componentDidMount(): void;
|
|
12
|
-
componentWillUnmount(): void;
|
|
13
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
14
|
-
dispatchAnalytics: (analyticsPayload: AnalyticsPayload) => void;
|
|
15
|
-
render(): JSX.Element;
|
|
16
|
-
}
|
|
2
|
+
export declare function CardWithURLRenderer(props: CardProps): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.2.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
".": "./src/index.ts"
|
|
22
22
|
},
|
|
23
23
|
"atlassian": {
|
|
24
|
-
"team": "
|
|
24
|
+
"team": "Linking Platform",
|
|
25
25
|
"releaseModel": "scheduled",
|
|
26
26
|
"website": {
|
|
27
27
|
"name": "Smart Card"
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/analytics-gas-types": "^5.0.0",
|
|
32
32
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
33
|
-
"@atlaskit/
|
|
34
|
-
"@atlaskit/icon": "^21.7.0",
|
|
33
|
+
"@atlaskit/icon": "^21.9.0",
|
|
35
34
|
"@atlaskit/icon-file-type": "^6.3.0",
|
|
36
35
|
"@atlaskit/icon-object": "^6.2.0",
|
|
37
36
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
38
37
|
"@atlaskit/logo": "^13.5.0",
|
|
39
|
-
"@atlaskit/media-ui": "^
|
|
38
|
+
"@atlaskit/media-ui": "^17.1.0",
|
|
40
39
|
"@atlaskit/outbound-auth-flow-client": "^3.1.0",
|
|
41
|
-
"@atlaskit/theme": "^
|
|
40
|
+
"@atlaskit/theme": "^12.0.0",
|
|
41
|
+
"@atlaskit/ufo": "^0.0.6",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
|
-
"@testing-library/react-hooks": "^1.0.4",
|
|
44
43
|
"async-retry": "^1.2.3",
|
|
45
44
|
"dataloader": "^2.0.0",
|
|
46
45
|
"json-ld-types": "2.3.0",
|
|
47
46
|
"p-throttle": "^4.1.1",
|
|
47
|
+
"react-error-boundary": "^3.1.3",
|
|
48
48
|
"react-lazily-render": "^1.2.0",
|
|
49
49
|
"react-loadable": "^5.1.0",
|
|
50
50
|
"redux": "^3.7.2",
|
|
@@ -57,23 +57,24 @@
|
|
|
57
57
|
"styled-components": "^3.2.6"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@atlaskit/avatar": "^20.
|
|
60
|
+
"@atlaskit/avatar": "^20.5.0",
|
|
61
61
|
"@atlaskit/button": "^16.1.0",
|
|
62
62
|
"@atlaskit/checkbox": "^12.3.0",
|
|
63
63
|
"@atlaskit/docs": "*",
|
|
64
|
-
"@atlaskit/form": "^8.
|
|
64
|
+
"@atlaskit/form": "^8.4.0",
|
|
65
65
|
"@atlaskit/inline-message": "^11.1.0",
|
|
66
66
|
"@atlaskit/lozenge": "^11.1.0",
|
|
67
|
-
"@atlaskit/media-test-helpers": "^28.
|
|
67
|
+
"@atlaskit/media-test-helpers": "^28.8.0",
|
|
68
68
|
"@atlaskit/page": "^12.0.0",
|
|
69
69
|
"@atlaskit/radio": "^5.3.0",
|
|
70
|
-
"@atlaskit/select": "^15.
|
|
70
|
+
"@atlaskit/select": "^15.2.0",
|
|
71
71
|
"@atlaskit/spinner": "^15.1.0",
|
|
72
72
|
"@atlaskit/table-tree": "^9.0.0",
|
|
73
73
|
"@atlaskit/textarea": "^4.2.0",
|
|
74
74
|
"@atlaskit/textfield": "^5.1.0",
|
|
75
75
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
76
76
|
"@testing-library/react": "^8.0.1",
|
|
77
|
+
"@testing-library/react-hooks": "^1.0.4",
|
|
77
78
|
"@types/async-retry": "^1.4.1",
|
|
78
79
|
"@types/enzyme": "^3.1.15",
|
|
79
80
|
"@types/lodash": "^4.14.157",
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
"abortcontroller-polyfill": "^1.1.9",
|
|
85
86
|
"brace": "^0.11.1",
|
|
86
87
|
"enzyme": "^3.10.0",
|
|
88
|
+
"jest-extended": "^0.11.2",
|
|
87
89
|
"lorem-ipsum": "^1.0.6",
|
|
88
90
|
"mockdate": "^3.0.2",
|
|
89
91
|
"react": "^16.8.0",
|