@atlaskit/smart-card 26.5.4 → 26.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +2 -2
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +3 -4
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -25
- package/dist/cjs/utils/analytics/analytics.js +134 -147
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/PreviewAction.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +4 -30
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -6
- package/dist/cjs/view/HoverCard/utils.js +2 -33
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +1 -4
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +4 -6
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +3 -24
- package/dist/es2019/utils/analytics/analytics.js +0 -13
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/PreviewAction.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +3 -20
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -7
- package/dist/es2019/view/HoverCard/utils.js +0 -20
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -2
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -5
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -26
- package/dist/esm/utils/analytics/analytics.js +130 -142
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +4 -27
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -7
- package/dist/esm/view/HoverCard/utils.js +0 -29
- package/dist/types/model/invoke-opts.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +1 -5
- package/dist/types/utils/analytics/analytics.d.ts +0 -3
- package/dist/types/view/BlockCard/components/Action.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
- package/dist/types/view/HoverCard/utils.d.ts +0 -3
- package/dist/types-ts4.5/model/invoke-opts.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types-ts4.5/state/hooks-external/useSmartLinkActions.d.ts +1 -5
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -3
- package/dist/types-ts4.5/view/BlockCard/components/Action.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
- package/dist/types-ts4.5/view/HoverCard/utils.d.ts +0 -3
- package/package.json +1 -1
- package/dist/cjs/extractors/common/lozenge/extractLozengeText.js +0 -16
- package/dist/es2019/extractors/common/lozenge/extractLozengeText.js +0 -10
- package/dist/esm/extractors/common/lozenge/extractLozengeText.js +0 -9
- package/dist/types/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
- package/dist/types-ts4.5/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
1
|
import { ElementName } from '../../constants';
|
|
5
2
|
import { extractType } from '@atlaskit/linking-common/extractors';
|
|
6
3
|
import { extractOwnedBy } from '../../extractors/flexible/utils';
|
|
@@ -78,30 +75,4 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
78
75
|
}
|
|
79
76
|
};
|
|
80
77
|
}
|
|
81
|
-
};
|
|
82
|
-
export var toActionableMetadata = function toActionableMetadata(onActionClick, extensionKey) {
|
|
83
|
-
var types = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
84
|
-
var cardActions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
85
|
-
var elementItems = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
86
|
-
// Actionable State for Jira issue
|
|
87
|
-
if (extensionKey === 'jira-object-provider' && types !== null && types !== void 0 && types.includes('atlassian:Task')) {
|
|
88
|
-
var previewAction = cardActions.find(function (action) {
|
|
89
|
-
return action.id === 'preview-content';
|
|
90
|
-
});
|
|
91
|
-
if (previewAction) {
|
|
92
|
-
return elementItems.map(function (elementItem) {
|
|
93
|
-
return elementItem.name === ElementName.State ? _objectSpread(_objectSpread({}, elementItem), {}, {
|
|
94
|
-
onClick: function onClick() {
|
|
95
|
-
if (onActionClick) {
|
|
96
|
-
onActionClick(previewAction.id);
|
|
97
|
-
}
|
|
98
|
-
return previewAction.invoke({
|
|
99
|
-
isReloadRequired: true
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}) : elementItem;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return elementItems;
|
|
107
78
|
};
|
|
@@ -241,7 +241,8 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
|
|
|
241
241
|
*/
|
|
242
242
|
appAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => void;
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
244
|
+
* Removed in EDM-5153: This is an even from an experiment.
|
|
245
|
+
* @deprecated
|
|
245
246
|
*/
|
|
246
247
|
linkUpdated: (props: CommonEventProps & {
|
|
247
248
|
[key: string]: any;
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
3
|
import type { AnalyticsHandler, AnalyticsOrigin } from '../../utils/types';
|
|
4
4
|
import type { CardInnerAppearance } from '../../view/Card/types';
|
|
5
|
-
type ExperimentInvokeOpts = {
|
|
6
|
-
isReloadRequired?: boolean;
|
|
7
|
-
};
|
|
8
5
|
export interface LinkAction {
|
|
9
6
|
/**
|
|
10
7
|
* Unique ID for the action.
|
|
@@ -21,7 +18,7 @@ export interface LinkAction {
|
|
|
21
18
|
* Promise to invoke on triggering this action.
|
|
22
19
|
* @example Clicking on `Delete` leading to deletion of content.
|
|
23
20
|
*/
|
|
24
|
-
invoke: (
|
|
21
|
+
invoke: () => Promise<any>;
|
|
25
22
|
}
|
|
26
23
|
export interface UseSmartLinkActionsOpts {
|
|
27
24
|
/**
|
|
@@ -53,4 +50,3 @@ export interface UseSmartLinkActionsOpts {
|
|
|
53
50
|
origin?: AnalyticsOrigin;
|
|
54
51
|
}
|
|
55
52
|
export declare function useSmartLinkActions({ url, appearance, analyticsHandler, platform, origin, }: UseSmartLinkActionsOpts): LinkAction[];
|
|
56
|
-
export {};
|
|
@@ -29,9 +29,6 @@ export declare const connectSucceededEvent: ({ definitionId, extensionKey, desti
|
|
|
29
29
|
export declare const connectFailedEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, reason, }: ConnectFailedEventProps) => AnalyticsPayload;
|
|
30
30
|
export declare const trackAppAccountConnected: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
|
|
31
31
|
export declare const trackAppAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
|
|
32
|
-
export declare const trackLinkUpdated: ({ actionSubjectId, ...attributes }: CommonEventProps & {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}) => AnalyticsPayload;
|
|
35
32
|
export declare const trackSmartLinkQuickActionStarted: ({ smartLinkActionType, ...attributes }: CommonEventProps & {
|
|
36
33
|
smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
|
|
37
34
|
}) => AnalyticsPayload;
|
|
@@ -5,7 +5,7 @@ import { Appearance } from '@atlaskit/button/types';
|
|
|
5
5
|
export interface ActionProps {
|
|
6
6
|
id: string;
|
|
7
7
|
text: React.ReactNode;
|
|
8
|
-
promise:
|
|
8
|
+
promise: () => Promise<any>;
|
|
9
9
|
buttonAppearance?: Appearance;
|
|
10
10
|
}
|
|
11
11
|
export type ActionState = 'init' | 'loading' | 'success' | 'failure';
|
|
@@ -11,11 +11,6 @@ export type LozengeProps = ElementProps & {
|
|
|
11
11
|
* Determines the appearance of the Atlaskit lozenge.
|
|
12
12
|
*/
|
|
13
13
|
appearance?: LozengeAppearance;
|
|
14
|
-
/**
|
|
15
|
-
* DO NOT USE! This is an experiment code and may be removed at any given time.
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
onClick?: () => void;
|
|
19
14
|
/**
|
|
20
15
|
* The text to display within the lozenge.
|
|
21
16
|
*/
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
-
import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
|
|
3
|
-
import { ElementItem } from '../FlexibleCard/components/blocks/types';
|
|
4
2
|
export declare const getSimulatedMetadata: (extensionKey: string | undefined, data: JsonLd.Data.BaseData) => JsonLd.Primitives.Property<any>;
|
|
5
|
-
export declare const toActionableMetadata: (onActionClick: (actionId: string) => void, extensionKey?: string, types?: JsonLd.Primitives.ObjectType[], cardActions?: LinkAction[], elementItems?: ElementItem[]) => ElementItem[];
|
|
@@ -241,7 +241,8 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
|
|
|
241
241
|
*/
|
|
242
242
|
appAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => void;
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
244
|
+
* Removed in EDM-5153: This is an even from an experiment.
|
|
245
|
+
* @deprecated
|
|
245
246
|
*/
|
|
246
247
|
linkUpdated: (props: CommonEventProps & {
|
|
247
248
|
[key: string]: any;
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
3
|
import type { AnalyticsHandler, AnalyticsOrigin } from '../../utils/types';
|
|
4
4
|
import type { CardInnerAppearance } from '../../view/Card/types';
|
|
5
|
-
type ExperimentInvokeOpts = {
|
|
6
|
-
isReloadRequired?: boolean;
|
|
7
|
-
};
|
|
8
5
|
export interface LinkAction {
|
|
9
6
|
/**
|
|
10
7
|
* Unique ID for the action.
|
|
@@ -21,7 +18,7 @@ export interface LinkAction {
|
|
|
21
18
|
* Promise to invoke on triggering this action.
|
|
22
19
|
* @example Clicking on `Delete` leading to deletion of content.
|
|
23
20
|
*/
|
|
24
|
-
invoke: (
|
|
21
|
+
invoke: () => Promise<any>;
|
|
25
22
|
}
|
|
26
23
|
export interface UseSmartLinkActionsOpts {
|
|
27
24
|
/**
|
|
@@ -53,4 +50,3 @@ export interface UseSmartLinkActionsOpts {
|
|
|
53
50
|
origin?: AnalyticsOrigin;
|
|
54
51
|
}
|
|
55
52
|
export declare function useSmartLinkActions({ url, appearance, analyticsHandler, platform, origin, }: UseSmartLinkActionsOpts): LinkAction[];
|
|
56
|
-
export {};
|
|
@@ -29,9 +29,6 @@ export declare const connectSucceededEvent: ({ definitionId, extensionKey, desti
|
|
|
29
29
|
export declare const connectFailedEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, reason, }: ConnectFailedEventProps) => AnalyticsPayload;
|
|
30
30
|
export declare const trackAppAccountConnected: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
|
|
31
31
|
export declare const trackAppAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
|
|
32
|
-
export declare const trackLinkUpdated: ({ actionSubjectId, ...attributes }: CommonEventProps & {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}) => AnalyticsPayload;
|
|
35
32
|
export declare const trackSmartLinkQuickActionStarted: ({ smartLinkActionType, ...attributes }: CommonEventProps & {
|
|
36
33
|
smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
|
|
37
34
|
}) => AnalyticsPayload;
|
|
@@ -5,7 +5,7 @@ import { Appearance } from '@atlaskit/button/types';
|
|
|
5
5
|
export interface ActionProps {
|
|
6
6
|
id: string;
|
|
7
7
|
text: React.ReactNode;
|
|
8
|
-
promise:
|
|
8
|
+
promise: () => Promise<any>;
|
|
9
9
|
buttonAppearance?: Appearance;
|
|
10
10
|
}
|
|
11
11
|
export type ActionState = 'init' | 'loading' | 'success' | 'failure';
|
|
@@ -11,11 +11,6 @@ export type LozengeProps = ElementProps & {
|
|
|
11
11
|
* Determines the appearance of the Atlaskit lozenge.
|
|
12
12
|
*/
|
|
13
13
|
appearance?: LozengeAppearance;
|
|
14
|
-
/**
|
|
15
|
-
* DO NOT USE! This is an experiment code and may be removed at any given time.
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
onClick?: () => void;
|
|
19
14
|
/**
|
|
20
15
|
* The text to display within the lozenge.
|
|
21
16
|
*/
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
-
import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
|
|
3
|
-
import { ElementItem } from '../FlexibleCard/components/blocks/types';
|
|
4
2
|
export declare const getSimulatedMetadata: (extensionKey: string | undefined, data: JsonLd.Data.BaseData) => JsonLd.Primitives.Property<any>;
|
|
5
|
-
export declare const toActionableMetadata: (onActionClick: (actionId: string) => void, extensionKey?: string, types?: JsonLd.Primitives.ObjectType[], cardActions?: LinkAction[], elementItems?: ElementItem[]) => ElementItem[];
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extractLozengeText = void 0;
|
|
7
|
-
var _extractLozenge = require("./extractLozenge");
|
|
8
|
-
var extractLozengeText = function extractLozengeText(response) {
|
|
9
|
-
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
10
|
-
if (data) {
|
|
11
|
-
var _ref = (0, _extractLozenge.extractLozenge)(data) || {},
|
|
12
|
-
text = _ref.text;
|
|
13
|
-
return text;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.extractLozengeText = extractLozengeText;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { extractLozenge } from './extractLozenge';
|
|
2
|
-
export const extractLozengeText = response => {
|
|
3
|
-
const data = response === null || response === void 0 ? void 0 : response.data;
|
|
4
|
-
if (data) {
|
|
5
|
-
const {
|
|
6
|
-
text
|
|
7
|
-
} = extractLozenge(data) || {};
|
|
8
|
-
return text;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { extractLozenge } from './extractLozenge';
|
|
2
|
-
export var extractLozengeText = function extractLozengeText(response) {
|
|
3
|
-
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
4
|
-
if (data) {
|
|
5
|
-
var _ref = extractLozenge(data) || {},
|
|
6
|
-
text = _ref.text;
|
|
7
|
-
return text;
|
|
8
|
-
}
|
|
9
|
-
};
|