@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.
Files changed (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +2 -2
  3. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +3 -4
  4. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -25
  5. package/dist/cjs/utils/analytics/analytics.js +134 -147
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +3 -3
  8. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +4 -30
  9. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -6
  10. package/dist/cjs/view/HoverCard/utils.js +2 -33
  11. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +1 -4
  12. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +4 -6
  13. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +3 -24
  14. package/dist/es2019/utils/analytics/analytics.js +0 -13
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +1 -2
  17. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +3 -20
  18. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -7
  19. package/dist/es2019/view/HoverCard/utils.js +0 -20
  20. package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -2
  21. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -5
  22. package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -26
  23. package/dist/esm/utils/analytics/analytics.js +130 -142
  24. package/dist/esm/version.json +1 -1
  25. package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
  26. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +4 -27
  27. package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -7
  28. package/dist/esm/view/HoverCard/utils.js +0 -29
  29. package/dist/types/model/invoke-opts.d.ts +1 -1
  30. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  31. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +1 -5
  32. package/dist/types/utils/analytics/analytics.d.ts +0 -3
  33. package/dist/types/view/BlockCard/components/Action.d.ts +1 -1
  34. package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
  35. package/dist/types/view/HoverCard/utils.d.ts +0 -3
  36. package/dist/types-ts4.5/model/invoke-opts.d.ts +1 -1
  37. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  38. package/dist/types-ts4.5/state/hooks-external/useSmartLinkActions.d.ts +1 -5
  39. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -3
  40. package/dist/types-ts4.5/view/BlockCard/components/Action.d.ts +1 -1
  41. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
  42. package/dist/types-ts4.5/view/HoverCard/utils.d.ts +0 -3
  43. package/package.json +1 -1
  44. package/dist/cjs/extractors/common/lozenge/extractLozengeText.js +0 -16
  45. package/dist/es2019/extractors/common/lozenge/extractLozengeText.js +0 -10
  46. package/dist/esm/extractors/common/lozenge/extractLozengeText.js +0 -9
  47. package/dist/types/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
  48. 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
  };
@@ -13,5 +13,5 @@ export type InvokeServerOpts = InvokeOpts<ServerActionOpts> & {
13
13
  };
14
14
  export interface ClientActionOpts {
15
15
  type: string;
16
- promise: <T>(opts?: T) => Promise<void>;
16
+ promise: () => Promise<void>;
17
17
  }
@@ -241,7 +241,8 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
241
241
  */
242
242
  appAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => void;
243
243
  /**
244
- * This fires a tracking event before and after link updated.
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: (opts?: ExperimentInvokeOpts) => Promise<any>;
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: <T>(opts?: T) => Promise<any>;
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[];
@@ -13,5 +13,5 @@ export type InvokeServerOpts = InvokeOpts<ServerActionOpts> & {
13
13
  };
14
14
  export interface ClientActionOpts {
15
15
  type: string;
16
- promise: <T>(opts?: T) => Promise<void>;
16
+ promise: () => Promise<void>;
17
17
  }
@@ -241,7 +241,8 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
241
241
  */
242
242
  appAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => void;
243
243
  /**
244
- * This fires a tracking event before and after link updated.
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: (opts?: ExperimentInvokeOpts) => Promise<any>;
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: <T>(opts?: T) => Promise<any>;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.5.4",
3
+ "version": "26.5.5",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -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
- };
@@ -1,2 +0,0 @@
1
- import { JsonLd } from 'json-ld-types';
2
- export declare const extractLozengeText: (response?: JsonLd.Response) => string | undefined;
@@ -1,2 +0,0 @@
1
- import { JsonLd } from 'json-ld-types';
2
- export declare const extractLozengeText: (response?: JsonLd.Response) => string | undefined;