@atlaskit/smart-card 18.0.20 → 19.0.0
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 +49 -0
- package/dist/cjs/client/index.js +6 -379
- package/dist/cjs/extractors/embed/index.js +2 -2
- package/dist/cjs/extractors/hover/extractMetadata.js +31 -0
- package/dist/cjs/index.js +7 -13
- package/dist/cjs/state/actions/constants.js +1 -13
- package/dist/cjs/state/actions/index.js +20 -22
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +2 -2
- package/dist/cjs/state/config/index.js +2 -2
- package/dist/cjs/state/helpers.js +1 -9
- package/dist/cjs/state/hooks/usePrefetch.js +2 -2
- package/dist/cjs/state/index.js +4 -4
- package/dist/cjs/state/renderers/index.js +2 -2
- package/dist/cjs/state/store/index.js +5 -5
- package/dist/cjs/utils/flexible.js +1 -1
- package/dist/cjs/utils/mocks.js +2 -2
- package/dist/cjs/utils/test-utils.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/HoverCard/index.js +11 -2
- package/dist/cjs/view/HoverCard/utils.js +36 -0
- package/dist/es2019/client/index.js +1 -214
- package/dist/es2019/extractors/embed/index.js +1 -1
- package/dist/es2019/extractors/hover/extractMetadata.js +18 -0
- package/dist/es2019/index.js +4 -4
- package/dist/es2019/state/actions/constants.js +0 -6
- package/dist/es2019/state/actions/index.js +4 -4
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +1 -1
- package/dist/es2019/state/config/index.js +1 -1
- package/dist/es2019/state/helpers.js +0 -5
- package/dist/es2019/state/hooks/usePrefetch.js +1 -1
- package/dist/es2019/state/index.js +1 -1
- package/dist/es2019/state/renderers/index.js +1 -1
- package/dist/es2019/state/store/index.js +2 -2
- package/dist/es2019/utils/flexible.js +1 -1
- package/dist/es2019/utils/mocks.js +1 -1
- package/dist/es2019/utils/test-utils.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/HoverCard/index.js +27 -18
- package/dist/es2019/view/HoverCard/utils.js +27 -0
- package/dist/esm/client/index.js +1 -360
- package/dist/esm/extractors/embed/index.js +1 -1
- package/dist/esm/extractors/hover/extractMetadata.js +22 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/state/actions/constants.js +0 -6
- package/dist/esm/state/actions/index.js +4 -4
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +1 -1
- package/dist/esm/state/config/index.js +1 -1
- package/dist/esm/state/helpers.js +0 -5
- package/dist/esm/state/hooks/usePrefetch.js +1 -1
- package/dist/esm/state/index.js +1 -1
- package/dist/esm/state/renderers/index.js +1 -1
- package/dist/esm/state/store/index.js +2 -2
- package/dist/esm/utils/flexible.js +1 -1
- package/dist/esm/utils/mocks.js +1 -1
- package/dist/esm/utils/test-utils.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/HoverCard/index.js +10 -3
- package/dist/esm/view/HoverCard/utils.js +27 -0
- package/dist/types/__tests_external__/page-objects/BaseCard.d.ts +1 -2
- package/dist/types/client/index.d.ts +1 -18
- package/dist/types/extractors/block/index.d.ts +1 -1
- package/dist/types/extractors/common/title-prefix/extractTitlePrefix.d.ts +1 -1
- package/dist/types/extractors/flexible/icon/extract-icon-renderer.d.ts +1 -1
- package/dist/types/extractors/flexible/icon/index.d.ts +1 -1
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/extractors/hover/extractMetadata.d.ts +3 -0
- package/dist/types/extractors/inline/index.d.ts +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/model/invoke-opts.d.ts +1 -14
- package/dist/types/state/actions/constants.d.ts +0 -6
- package/dist/types/state/actions/types.d.ts +2 -13
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +1 -2
- package/dist/types/state/config/index.d.ts +1 -1
- package/dist/types/state/helpers.d.ts +1 -3
- package/dist/types/state/hooks/useSmartLink.d.ts +6 -6
- package/dist/types/state/index.d.ts +3 -3
- package/dist/types/state/reducers/types.d.ts +1 -1
- package/dist/types/state/renderers/index.d.ts +1 -1
- package/dist/types/state/store/index.d.ts +2 -2
- package/dist/types/state/types.d.ts +1 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/utils/analytics/analytics.d.ts +1 -1
- package/dist/types/utils/analytics/index.d.ts +1 -2
- package/dist/types/utils/performance.d.ts +1 -1
- package/dist/types/view/BlockCard/types.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +2 -3
- package/dist/types/view/FlexibleCard/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/utils.d.ts +1 -1
- package/dist/types/view/HoverCard/types.d.ts +5 -0
- package/dist/types/view/HoverCard/utils.d.ts +2 -0
- package/dist/types/view/InlineCard/types.d.ts +1 -1
- package/package.json +3 -9
- package/dist/cjs/client/api.js +0 -119
- package/dist/cjs/client/errors.js +0 -55
- package/dist/cjs/client/types/index.js +0 -5
- package/dist/cjs/client/types/requests.js +0 -5
- package/dist/cjs/client/types/responses.js +0 -31
- package/dist/cjs/client/utils/environments.js +0 -47
- package/dist/cjs/providers/editor/index.js +0 -283
- package/dist/cjs/providers/editor/transformer.js +0 -90
- package/dist/cjs/providers/editor/types.js +0 -5
- package/dist/cjs/state/actions/helpers.js +0 -18
- package/dist/cjs/state/context/index.js +0 -34
- package/dist/cjs/state/context/provider.js +0 -74
- package/dist/cjs/state/context/types.js +0 -5
- package/dist/cjs/state/reducers/index.js +0 -89
- package/dist/cjs/state/store/types.js +0 -5
- package/dist/es2019/client/api.js +0 -38
- package/dist/es2019/client/errors.js +0 -19
- package/dist/es2019/client/types/index.js +0 -1
- package/dist/es2019/client/types/requests.js +0 -1
- package/dist/es2019/client/types/responses.js +0 -19
- package/dist/es2019/client/utils/environments.js +0 -33
- package/dist/es2019/providers/editor/index.js +0 -82
- package/dist/es2019/providers/editor/transformer.js +0 -57
- package/dist/es2019/providers/editor/types.js +0 -1
- package/dist/es2019/state/actions/helpers.js +0 -8
- package/dist/es2019/state/context/index.js +0 -14
- package/dist/es2019/state/context/provider.js +0 -51
- package/dist/es2019/state/context/types.js +0 -1
- package/dist/es2019/state/reducers/index.js +0 -74
- package/dist/es2019/state/store/types.js +0 -1
- package/dist/esm/client/api.js +0 -98
- package/dist/esm/client/errors.js +0 -40
- package/dist/esm/client/types/index.js +0 -1
- package/dist/esm/client/types/requests.js +0 -1
- package/dist/esm/client/types/responses.js +0 -19
- package/dist/esm/client/utils/environments.js +0 -33
- package/dist/esm/providers/editor/index.js +0 -257
- package/dist/esm/providers/editor/transformer.js +0 -79
- package/dist/esm/providers/editor/types.js +0 -1
- package/dist/esm/state/actions/helpers.js +0 -9
- package/dist/esm/state/context/index.js +0 -14
- package/dist/esm/state/context/provider.js +0 -50
- package/dist/esm/state/context/types.js +0 -1
- package/dist/esm/state/reducers/index.js +0 -69
- package/dist/esm/state/store/types.js +0 -1
- package/dist/types/client/api.d.ts +0 -5
- package/dist/types/client/errors.d.ts +0 -9
- package/dist/types/client/types/index.d.ts +0 -13
- package/dist/types/client/types/requests.d.ts +0 -9
- package/dist/types/client/types/responses.d.ts +0 -19
- package/dist/types/client/utils/environments.d.ts +0 -12
- package/dist/types/providers/editor/index.d.ts +0 -22
- package/dist/types/providers/editor/transformer.d.ts +0 -8
- package/dist/types/providers/editor/types.d.ts +0 -19
- package/dist/types/state/actions/helpers.d.ts +0 -2
- package/dist/types/state/context/index.d.ts +0 -8
- package/dist/types/state/context/provider.d.ts +0 -5
- package/dist/types/state/context/types.d.ts +0 -39
- package/dist/types/state/reducers/index.d.ts +0 -4
- package/dist/types/state/store/types.d.ts +0 -18
|
@@ -2,12 +2,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import { useMemo, useCallback } from 'react';
|
|
4
4
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
5
|
-
import {
|
|
5
|
+
import { APIError } from '@atlaskit/linking-common';
|
|
6
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
+
import { ACTION_PENDING, ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, cardAction } from '@atlaskit/linking-common';
|
|
6
8
|
import { getDefinitionId, getByDefinitionId, getServices, getStatus, getExtensionKey } from '../helpers';
|
|
7
|
-
import {
|
|
8
|
-
import { useSmartLinkContext } from '../context';
|
|
9
|
+
import { ERROR_MESSAGE_OAUTH, ERROR_MESSAGE_FATAL } from './constants';
|
|
9
10
|
import * as measure from '../../utils/performance';
|
|
10
|
-
import { APIError } from '../../client/errors';
|
|
11
11
|
import { getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
12
12
|
import { addMetadataToExperience } from '../analytics';
|
|
13
13
|
export var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, resolvedEvent as _resolvedEvent, unresolvedEvent as _unresolvedEvent, invokeSucceededEvent as _invokeSucceededEvent, invokeFailedEvent as _invokeFailedEvent, connectSucceededEvent as _connectSucceededEvent, connectFailedEvent as _connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
2
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, resolvedEvent as _resolvedEvent, unresolvedEvent as _unresolvedEvent, invokeSucceededEvent as _invokeSucceededEvent, invokeFailedEvent as _invokeFailedEvent, connectSucceededEvent as _connectSucceededEvent, connectFailedEvent as _connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
3
3
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
4
4
|
export var useSmartLinkAnalytics = function useSmartLinkAnalytics(dispatchAnalytics) {
|
|
5
5
|
var ui = useMemo(function () {
|
|
@@ -6,11 +6,6 @@ export var getByDefinitionId = function getByDefinitionId(definitionId, store) {
|
|
|
6
6
|
return details && details.meta.definitionId === definitionId;
|
|
7
7
|
});
|
|
8
8
|
};
|
|
9
|
-
export var getUrl = function getUrl(store, url) {
|
|
10
|
-
return store.getState()[url] || {
|
|
11
|
-
status: 'pending'
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
9
|
export var getClickUrl = function getClickUrl(url, jsonLd) {
|
|
15
10
|
if (jsonLd && jsonLd.data) {
|
|
16
11
|
var visitUrl = extractVisitUrl(jsonLd.data);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import { useSmartLinkContext } from '
|
|
4
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
5
5
|
export function usePrefetch(url) {
|
|
6
6
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
7
7
|
store = _useSmartLinkContext.store,
|
package/dist/esm/state/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SmartCardContext, SmartCardProvider, useSmartLinkContext } from '
|
|
1
|
+
export { SmartCardContext, SmartCardProvider, useSmartLinkContext } from '@atlaskit/link-provider';
|
|
2
2
|
export { useSmartLink, usePrefetch } from './hooks';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useSmartLinkContext } from '
|
|
2
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
3
3
|
export var useSmartLinkRenderers = function useSmartLinkRenderers() {
|
|
4
4
|
var context = useSmartLinkContext();
|
|
5
5
|
var renderers = context === null || context === void 0 ? void 0 : context.renderers;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { useSmartLinkContext } from '
|
|
4
|
-
import { getUrl } from '
|
|
3
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
|
+
import { getUrl } from '@atlaskit/linking-common';
|
|
5
5
|
export function useSmartCardState(url) {
|
|
6
6
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
7
7
|
store = _useSmartLinkContext.store; // Initially, card state should be pending and 'empty'.
|
|
@@ -4,7 +4,7 @@ import { TitleBlock } from '../view/FlexibleCard/components/blocks';
|
|
|
4
4
|
import * as Elements from '../view/FlexibleCard/components/elements';
|
|
5
5
|
export var isFlexibleUiCard = function isFlexibleUiCard(children) {
|
|
6
6
|
if (children && React.Children.toArray(children).some(function (child) {
|
|
7
|
-
return
|
|
7
|
+
return isFlexibleUiTitleBlock(child);
|
|
8
8
|
})) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -10,7 +10,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
-
import CardClient from '
|
|
13
|
+
import { CardClient } from '@atlaskit/link-provider';
|
|
14
14
|
export var mockContext = {
|
|
15
15
|
'@vocab': 'https://www.w3.org/ns/activitystreams#',
|
|
16
16
|
atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
|
package/dist/esm/version.json
CHANGED
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
import React, { useCallback, useRef, useMemo } from 'react';
|
|
7
|
-
import { TitleBlock, SnippetBlock, FooterBlock } from '../FlexibleCard/components/blocks';
|
|
7
|
+
import { TitleBlock, SnippetBlock, FooterBlock, MetadataBlock } from '../FlexibleCard/components/blocks';
|
|
8
8
|
import { Card } from '../Card';
|
|
9
9
|
import Popup from '@atlaskit/popup';
|
|
10
10
|
import { SmartLinkSize, ActionName } from '../../constants';
|
|
@@ -16,6 +16,8 @@ import { fireSmartLinkEvent } from '../../utils/analytics';
|
|
|
16
16
|
import { useSmartCardState as useLinkState } from '../../state/store';
|
|
17
17
|
import { useSmartLinkAnalytics } from '../../state/analytics';
|
|
18
18
|
import { getExtensionKey, getDefinitionId } from '../../state/helpers';
|
|
19
|
+
import { extractMetadata } from '../../extractors/hover/extractMetadata';
|
|
20
|
+
import { getSimulatedMetadata } from './utils';
|
|
19
21
|
export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
20
22
|
var children = _ref.children,
|
|
21
23
|
url = _ref.url,
|
|
@@ -104,7 +106,9 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
104
106
|
};
|
|
105
107
|
}, [url, definitionId, extensionKey, analytics]);
|
|
106
108
|
|
|
107
|
-
var
|
|
109
|
+
var CardComponent = function CardComponent() {
|
|
110
|
+
//TODO: EDM-3224 deleted simulated and use real JsonLd
|
|
111
|
+
var metadataElements = extractMetadata(getSimulatedMetadata(extensionKey));
|
|
108
112
|
return jsx("div", {
|
|
109
113
|
onMouseEnter: initShowCard,
|
|
110
114
|
onMouseLeave: initHideCard,
|
|
@@ -118,6 +122,9 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
118
122
|
}
|
|
119
123
|
}, jsx(TitleBlock, {
|
|
120
124
|
actions: [openAction]
|
|
125
|
+
}), jsx(MetadataBlock, {
|
|
126
|
+
primary: metadataElements.primary,
|
|
127
|
+
secondary: metadataElements.secondary
|
|
121
128
|
}), jsx(SnippetBlock, null), jsx(FooterBlock, {
|
|
122
129
|
actions: smartlinkActions
|
|
123
130
|
})));
|
|
@@ -131,7 +138,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
131
138
|
isOpen: isOpen,
|
|
132
139
|
onClose: onClose,
|
|
133
140
|
placement: "bottom-start",
|
|
134
|
-
content:
|
|
141
|
+
content: CardComponent,
|
|
135
142
|
trigger: function trigger(triggerProps) {
|
|
136
143
|
return jsx("span", _extends({}, triggerProps, {
|
|
137
144
|
onMouseEnter: initShowCard,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export var getSimulatedMetadata = function getSimulatedMetadata(extensionKey) {
|
|
2
|
+
switch (extensionKey) {
|
|
3
|
+
case 'confluence-object-provider':
|
|
4
|
+
return {
|
|
5
|
+
metadata: {
|
|
6
|
+
primary: ['AuthorGroup', 'CreatedBy', 'CommentCount', 'ReactCount'],
|
|
7
|
+
secondary: []
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
case 'jira-object-provider':
|
|
12
|
+
return {
|
|
13
|
+
metadata: {
|
|
14
|
+
primary: ['AuthorGroup', 'State', 'Priority'],
|
|
15
|
+
secondary: []
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
default:
|
|
20
|
+
return {
|
|
21
|
+
metadata: {
|
|
22
|
+
primary: ['ModifiedOn'],
|
|
23
|
+
secondary: []
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
2
|
import { InProductTestPageObject, CypressType } from '@atlaskit/in-product-testing';
|
|
3
|
-
import { CardType } from '
|
|
4
|
-
import { CardAppearance } from '../../view/Card';
|
|
3
|
+
import { CardType, CardAppearance } from '@atlaskit/linking-common';
|
|
5
4
|
export declare class BaseCardPageObject extends InProductTestPageObject {
|
|
6
5
|
protected cy: CypressType;
|
|
7
6
|
protected appearance: CardAppearance;
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { JsonLd } from 'json-ld-types';
|
|
3
|
-
import { CardClient as CardClientInterface, EnvironmentsKeys } from './types';
|
|
4
|
-
import { InvokePayload } from '../model/invoke-opts';
|
|
5
|
-
import { InvokeRequest } from './types/requests';
|
|
6
|
-
export default class CardClient implements CardClientInterface {
|
|
7
|
-
private resolverUrl;
|
|
8
|
-
private loadersByDomain;
|
|
9
|
-
private retryConfig;
|
|
10
|
-
private resolvedCache;
|
|
11
|
-
constructor(envKey?: EnvironmentsKeys);
|
|
12
|
-
private batchResolve;
|
|
13
|
-
private createLoader;
|
|
14
|
-
private getLoader;
|
|
15
|
-
prefetchData(url: string): Promise<JsonLd.Response | undefined>;
|
|
16
|
-
fetchData(url: string): Promise<JsonLd.Response>;
|
|
17
|
-
postData(data: InvokePayload<InvokeRequest>): Promise<JsonLd.Response>;
|
|
18
|
-
}
|
|
1
|
+
export { CardClient as default } from '@atlaskit/link-provider';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
2
3
|
import { LinkPerson } from '../common/person/types';
|
|
3
4
|
import { ExtractBlockOpts } from './types';
|
|
4
|
-
import { CardProviderRenderers } from '../../state/context/types';
|
|
5
5
|
import { BlockCardResolvedViewProps } from '../../view/BlockCard';
|
|
6
6
|
import { ActionProps } from '../../view/BlockCard/components/Action';
|
|
7
7
|
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined, platform?: JsonLd.Primitives.Platforms | undefined) => ActionProps[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
|
-
import { CardProviderRenderers } from '
|
|
3
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
4
4
|
import { CardAppearance } from '../../../view/Card';
|
|
5
5
|
export declare const extractTitlePrefix: (jsonLd: JsonLd.Data.BaseData, renderers?: CardProviderRenderers | undefined, type?: CardAppearance | undefined) => string | React.ReactNode | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
-
import { CardProviderRenderers } from '
|
|
2
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
3
3
|
declare const extractIconRenderer: (data: JsonLd.Data.BaseData, renderers?: CardProviderRenderers | undefined) => (() => React.ReactNode) | undefined;
|
|
4
4
|
export default extractIconRenderer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
3
4
|
import { IconType, SmartLinkStatus } from '../../../constants';
|
|
4
|
-
import { CardProviderRenderers } from '../../../state/context/types';
|
|
5
5
|
export declare const extractLinkIcon: (response: JsonLd.Response, renderers?: CardProviderRenderers | undefined) => {
|
|
6
6
|
render: (() => import("react").ReactNode) | undefined;
|
|
7
7
|
icon?: IconType | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
2
3
|
import { FlexibleUiDataContext } from '../../state/flexible-ui-context/types';
|
|
3
|
-
import { CardProviderRenderers } from '../../state/context/types';
|
|
4
4
|
declare const extractFlexibleUiContext: (response?: JsonLd.Response<JsonLd.Data.BaseData> | undefined, renderers?: CardProviderRenderers | undefined) => FlexibleUiDataContext | undefined;
|
|
5
5
|
export default extractFlexibleUiContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
|
-
import { CardProviderRenderers } from '
|
|
3
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
4
4
|
import { InlineCardResolvedViewProps } from '../../view/InlineCard/ResolvedView';
|
|
5
5
|
export declare const extractInlineIcon: (jsonLd: JsonLd.Data.BaseData) => import("react").ReactNode;
|
|
6
6
|
export declare const extractInlineProps: (jsonLd: JsonLd.Data.BaseData, renderers?: CardProviderRenderers | undefined) => InlineCardResolvedViewProps;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { JsonLd } from 'json-ld-types';
|
|
|
2
2
|
export declare type ResolveResponse = JsonLd.Response;
|
|
3
3
|
export { SmartCardProvider as Provider, SmartCardContext } from './state';
|
|
4
4
|
export type { ProviderProps, CardType } from './state';
|
|
5
|
-
export { EditorCardProvider, editorCardProvider } from '
|
|
6
|
-
export type { CardAdf, InlineCardAdf, BlockCardAdf, EmbedCardAdf, } from '
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
5
|
+
export { EditorCardProvider, editorCardProvider, } from '@atlaskit/link-provider';
|
|
6
|
+
export type { CardAdf, InlineCardAdf, BlockCardAdf, EmbedCardAdf, } from '@atlaskit/linking-common';
|
|
7
|
+
export { APIError } from '@atlaskit/linking-common';
|
|
8
|
+
export { CardClient as Client } from '@atlaskit/link-provider';
|
|
9
9
|
export { Card } from './view/Card';
|
|
10
10
|
export type { CardProps, CardAppearance, CardPlatform } from './view/Card';
|
|
11
|
-
export {
|
|
12
|
-
export type { CardContext } from '
|
|
11
|
+
export { SmartCardContext as Context } from '@atlaskit/link-provider';
|
|
12
|
+
export type { CardContext } from '@atlaskit/link-provider';
|
|
13
13
|
export { EmbedResizeMessageListener } from './view/EmbedCard/EmbedResizeMessageListener';
|
|
14
14
|
export { embedHeaderHeight } from './view/EmbedCard/components/styled';
|
|
15
15
|
export { SmartLinkEvents } from './utils/analytics/analytics';
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InvokePayload, ServerActionOpts } from '@atlaskit/linking-common';
|
|
2
2
|
import { CardInnerAppearance } from '../view/Card/types';
|
|
3
3
|
export declare type InvokeType = 'server' | 'client';
|
|
4
|
-
export interface InvokePayload<T> {
|
|
5
|
-
key: string;
|
|
6
|
-
context?: string;
|
|
7
|
-
action: T;
|
|
8
|
-
}
|
|
9
4
|
export declare type InvokeOpts<T> = {
|
|
10
5
|
type: InvokeType;
|
|
11
6
|
source?: CardInnerAppearance;
|
|
@@ -16,14 +11,6 @@ export declare type InvokeClientOpts = InvokeOpts<ClientActionOpts> & {
|
|
|
16
11
|
export declare type InvokeServerOpts = InvokeOpts<ServerActionOpts> & {
|
|
17
12
|
type: 'server';
|
|
18
13
|
};
|
|
19
|
-
export interface ServerActionOpts {
|
|
20
|
-
type: string;
|
|
21
|
-
payload: ServerActionPayload;
|
|
22
|
-
}
|
|
23
|
-
export interface ServerActionPayload {
|
|
24
|
-
id: string;
|
|
25
|
-
context?: JsonLd.Primitives.Object | JsonLd.Primitives.Link;
|
|
26
|
-
}
|
|
27
14
|
export interface ClientActionOpts {
|
|
28
15
|
type: string;
|
|
29
16
|
promise: () => Promise<void>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export declare const ACTION_PENDING = "pending";
|
|
2
|
-
export declare const ACTION_RESOLVING = "resolving";
|
|
3
|
-
export declare const ACTION_RESOLVED = "resolved";
|
|
4
|
-
export declare const ACTION_ERROR = "errored";
|
|
5
|
-
export declare const ACTION_ERROR_FALLBACK = "fallback";
|
|
6
|
-
export declare const ACTION_PRELOAD = "preload";
|
|
7
1
|
export declare const ANALYTICS_RESOLVING = "resolving";
|
|
8
2
|
export declare const ANALYTICS_ERROR = "errored";
|
|
9
3
|
export declare const ANALYTICS_FALLBACK = "fallback";
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { APIError } from '../../client/errors';
|
|
4
|
-
export declare type CardActionType = 'pending' | 'resolving' | 'resolved' | 'errored' | 'fallback';
|
|
5
|
-
export interface CardAction<T = JsonLd.Response> extends AnyAction {
|
|
6
|
-
type: CardActionType;
|
|
7
|
-
url: string;
|
|
8
|
-
payload?: T;
|
|
9
|
-
}
|
|
10
|
-
export declare type CardActionParams = {
|
|
11
|
-
url: string;
|
|
12
|
-
};
|
|
13
|
-
export declare type CardBaseActionCreator<T = JsonLd.Response> = (type: CardActionType, params: CardActionParams, payload?: T, error?: APIError) => CardAction<T>;
|
|
1
|
+
import { CardActionType } from '@atlaskit/linking-common';
|
|
2
|
+
export type { CardActionType };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { CardType, APIError } from '@atlaskit/linking-common';
|
|
1
2
|
import { AnalyticsHandler } from '../../utils/types';
|
|
2
3
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
3
4
|
import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
|
|
4
|
-
import { CardType } from '../store/types';
|
|
5
|
-
import { APIError } from '../../client/errors';
|
|
6
5
|
import { InvokeType } from '../../model/invoke-opts';
|
|
7
6
|
export declare const useSmartLinkAnalytics: (dispatchAnalytics: AnalyticsHandler) => {
|
|
8
7
|
ui: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CardContext } from '
|
|
1
|
+
import { CardContext } from '@atlaskit/link-provider';
|
|
2
2
|
export declare const useSmartLinkConfig: () => CardContext['config'] | undefined;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
-
import { CardType, CardStore } from '
|
|
3
|
-
import { Store } from 'redux';
|
|
2
|
+
import { CardType, CardStore } from '@atlaskit/linking-common';
|
|
4
3
|
export declare const getByDefinitionId: (definitionId: string | undefined, store: CardStore) => string[];
|
|
5
|
-
export declare const getUrl: (store: Store<CardStore>, url: string) => import("./store/types").CardState;
|
|
6
4
|
export declare const getClickUrl: (url: string, jsonLd?: JsonLd.Response<JsonLd.Data.BaseData> | undefined) => string;
|
|
7
5
|
export declare const getDefinitionId: (details?: JsonLd.Response<JsonLd.Data.BaseData> | undefined) => any;
|
|
8
6
|
export declare const getExtensionKey: (details?: JsonLd.Response<JsonLd.Data.BaseData> | undefined) => any;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AnalyticsHandler } from '../../utils/types';
|
|
2
2
|
export declare function useSmartLink(id: string, url: string, dispatchAnalytics: AnalyticsHandler): {
|
|
3
|
-
state: import("
|
|
3
|
+
state: import("@atlaskit/linking-common").CardState;
|
|
4
4
|
actions: {
|
|
5
5
|
register: () => Promise<void>;
|
|
6
6
|
reload: () => void;
|
|
7
|
-
authorize: (appearance: import("
|
|
8
|
-
invoke: (opts: import("../../model/invoke-opts").InvokeClientOpts | import("../../model/invoke-opts").InvokeServerOpts, appearance: import("
|
|
7
|
+
authorize: (appearance: import("@atlaskit/linking-common").CardAppearance) => void;
|
|
8
|
+
invoke: (opts: import("../../model/invoke-opts").InvokeClientOpts | import("../../model/invoke-opts").InvokeServerOpts, appearance: import("@atlaskit/linking-common").CardAppearance) => Promise<void | import("json-ld-types").JsonLd.Response<import("json-ld-types").JsonLd.Data.BaseData>>;
|
|
9
9
|
};
|
|
10
|
-
config: (import("
|
|
10
|
+
config: (import("@atlaskit/link-provider").CardProviderCacheOpts & import("@atlaskit/link-provider").CardAuthFlowOpts) | undefined;
|
|
11
11
|
analytics: {
|
|
12
12
|
ui: {
|
|
13
13
|
authEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
@@ -27,7 +27,7 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
27
27
|
invokeFailedEvent: (id: string, providerKey: string, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, reason: string) => void;
|
|
28
28
|
connectSucceededEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
29
29
|
connectFailedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, status?: string | undefined) => void;
|
|
30
|
-
instrument: (id: string, status: import("
|
|
30
|
+
instrument: (id: string, status: import("@atlaskit/linking-common/types").CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: import("@atlaskit/linking-common").APIError | undefined) => void;
|
|
31
31
|
};
|
|
32
32
|
track: {
|
|
33
33
|
appAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
@@ -36,6 +36,6 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
36
36
|
authPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
renderers: import("
|
|
39
|
+
renderers: import("@atlaskit/link-provider").CardProviderRenderers | undefined;
|
|
40
40
|
error: Error | null;
|
|
41
41
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SmartCardContext, SmartCardProvider, useSmartLinkContext, } from '
|
|
2
|
-
export type { CardContext, ProviderProps } from '
|
|
1
|
+
export { SmartCardContext, SmartCardProvider, useSmartLinkContext, } from '@atlaskit/link-provider';
|
|
2
|
+
export type { CardContext, ProviderProps } from '@atlaskit/link-provider';
|
|
3
|
+
export type { CardType } from '@atlaskit/linking-common';
|
|
3
4
|
export { useSmartLink, usePrefetch } from './hooks';
|
|
4
|
-
export type { CardType } from './store/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardAction, CardActionType } from '../actions/types';
|
|
2
1
|
import { Reducer } from 'react';
|
|
2
|
+
import { CardAction, CardActionType } from '@atlaskit/linking-common';
|
|
3
3
|
export declare type CardReducerMap<StateType, ActionType> = Record<CardActionType, CardReducer<StateType, ActionType>>;
|
|
4
4
|
export declare type CardReducer<StateType, ActionType> = Reducer<StateType, CardAction<ActionType>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CardContext } from '
|
|
1
|
+
import { CardContext } from '@atlaskit/link-provider';
|
|
2
2
|
export declare const useSmartLinkRenderers: () => CardContext['renderers'] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { CardStore, CardState } from '
|
|
1
|
+
export type { CardStore, CardState } from '@atlaskit/linking-common';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { RequestAccessMessageKey } from '@atlaskit/media-ui/messages';
|
|
3
|
+
export type { CardContext } from '@atlaskit/link-provider';
|
|
2
4
|
import { AccessContext } from './view/types';
|
|
3
5
|
import { ActionProps } from './view/BlockCard/components/Action';
|
|
4
|
-
import { RequestAccessMessageKey } from '@atlaskit/media-ui/messages';
|
|
5
6
|
export declare type ResolveResponse = JsonLd.Response;
|
|
6
7
|
export type { ProviderProps, CardType } from './state';
|
|
7
8
|
export type { CardProps, CardAppearance, CardPlatform, } from './view/Card/types';
|
|
8
|
-
export type { CardContext } from './state/context/types';
|
|
9
9
|
export interface RequestAccessContextProps extends AccessContext {
|
|
10
10
|
action?: ActionProps;
|
|
11
11
|
callToActionMessageKey?: RequestAccessMessageKey;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { APIError } from '@atlaskit/linking-common';
|
|
2
3
|
import { AnalyticsPayload } from '../types';
|
|
3
4
|
import { ErrorInfo } from 'react';
|
|
4
5
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
5
6
|
import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
|
|
6
|
-
import { APIError } from '../../client/errors';
|
|
7
7
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
8
8
|
export declare const context: {
|
|
9
9
|
componentName: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CardType } from '
|
|
2
|
-
import { APIError } from '../../client/errors';
|
|
1
|
+
import { APIError, CardType } from '@atlaskit/linking-common';
|
|
3
2
|
import { AnalyticsPayload } from '../types';
|
|
4
3
|
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, } from './analytics';
|
|
5
4
|
export declare const instrumentEvent: (id: string, status: CardType, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => AnalyticsPayload | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardType } from '
|
|
1
|
+
import { CardType } from '@atlaskit/linking-common';
|
|
2
2
|
export declare const getMarkName: (id: string, status: CardType) => string;
|
|
3
3
|
export declare const getMeasureName: (id: string, status: CardType) => string;
|
|
4
4
|
export declare const clearMarks: (id: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { CardProviderRenderers, CardAuthFlowOpts } from '@atlaskit/link-provider';
|
|
2
3
|
import { CardState } from '../../state/types';
|
|
3
4
|
import { InvokeHandler } from '../../model/invoke-handler';
|
|
4
|
-
import { CardAuthFlowOpts, CardProviderRenderers } from '../../state/context/types';
|
|
5
5
|
import { AnalyticsHandler } from '../../utils/types';
|
|
6
6
|
import { OnResolveCallback, CardPlatform } from '../Card/types';
|
|
7
7
|
export declare type BlockCardProps = {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import {
|
|
3
|
+
import { CardAppearance, CardPlatform } from '@atlaskit/linking-common';
|
|
4
4
|
import { FlexibleUiOptions } from '../FlexibleCard/types';
|
|
5
5
|
import { InlinePreloaderStyle } from '../types';
|
|
6
|
-
export
|
|
6
|
+
export type { CardAppearance, CardPlatform };
|
|
7
7
|
export declare type CardInnerAppearance = CardAppearance | 'preview' | 'flexible';
|
|
8
|
-
export declare type CardPlatform = JsonLd.Primitives.Platforms;
|
|
9
8
|
export declare type OnResolveCallback = (data: {
|
|
10
9
|
url?: string;
|
|
11
10
|
title?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MessageDescriptor } from 'react-intl-next';
|
|
3
|
-
import { CardState } from '
|
|
3
|
+
import { CardState } from '@atlaskit/linking-common';
|
|
4
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
4
5
|
import { SmartLinkSize, SmartLinkTheme } from '../../constants';
|
|
5
6
|
import { CardAppearance } from '../../view/Card';
|
|
6
|
-
import { CardProviderRenderers } from '../../state/context/types';
|
|
7
7
|
export declare type FlexibleCardProps = {
|
|
8
8
|
appearance?: CardAppearance;
|
|
9
9
|
cardState: CardState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
2
3
|
import { RetryOptions } from './types';
|
|
3
4
|
import { SmartLinkStatus } from '../../constants';
|
|
4
5
|
import { FlexibleUiDataContext } from '../../state/flexible-ui-context/types';
|
|
5
|
-
import { CardProviderRenderers } from '../../state/context/types';
|
|
6
6
|
export declare const getContextByStatus: (url: string, status?: SmartLinkStatus | undefined, details?: JsonLd.Response<JsonLd.Data.BaseData> | undefined, renderers?: CardProviderRenderers | undefined) => FlexibleUiDataContext | undefined;
|
|
7
7
|
export declare const getRetryOptions: (url: string, status?: SmartLinkStatus | undefined, details?: JsonLd.Response<JsonLd.Data.BaseData> | undefined, onAuthorize?: (() => void) | undefined) => RetryOptions | undefined;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
|
+
import { ElementItem } from '../FlexibleCard/components/blocks/types';
|
|
2
3
|
export interface HoverCardProps extends WithAnalyticsEventsProps {
|
|
3
4
|
url: string;
|
|
4
5
|
}
|
|
5
6
|
export declare type PreviewDisplay = 'card' | 'embed';
|
|
6
7
|
export declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
|
|
8
|
+
export interface MetadataOptions {
|
|
9
|
+
primary: Array<ElementItem>;
|
|
10
|
+
secondary: Array<ElementItem>;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventHandler, MouseEvent, KeyboardEvent } from 'react';
|
|
2
|
+
import { CardProviderRenderers } from '@atlaskit/link-provider';
|
|
2
3
|
import { CardState } from '../../state/types';
|
|
3
|
-
import { CardProviderRenderers } from '../../state/context/types';
|
|
4
4
|
import { InlinePreloaderStyle } from '../types';
|
|
5
5
|
export declare type InlineCardProps = {
|
|
6
6
|
url: string;
|