@atlaskit/smart-card 26.27.1 → 26.27.2

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 (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +6 -2
  3. package/dist/cjs/state/helpers.js +11 -2
  4. package/dist/cjs/utils/analytics/analytics.js +5 -3
  5. package/dist/cjs/utils/mocks.js +53 -71
  6. package/dist/cjs/view/CardWithUrl/component.js +4 -2
  7. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +5 -2
  8. package/dist/cjs/view/LinkUrl/index.js +1 -1
  9. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -2
  10. package/dist/es2019/state/helpers.js +5 -0
  11. package/dist/es2019/utils/analytics/analytics.js +5 -3
  12. package/dist/es2019/utils/mocks.js +51 -71
  13. package/dist/es2019/view/CardWithUrl/component.js +5 -3
  14. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +5 -2
  15. package/dist/es2019/view/LinkUrl/index.js +1 -1
  16. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +6 -2
  17. package/dist/esm/state/helpers.js +7 -0
  18. package/dist/esm/utils/analytics/analytics.js +5 -3
  19. package/dist/esm/utils/mocks.js +53 -71
  20. package/dist/esm/view/CardWithUrl/component.js +5 -3
  21. package/dist/esm/view/HoverCard/components/views/resolved/index.js +5 -2
  22. package/dist/esm/view/LinkUrl/index.js +1 -1
  23. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  24. package/dist/types/state/helpers.d.ts +3 -0
  25. package/dist/types/state/hooks/useSmartLink.d.ts +1 -1
  26. package/dist/types/utils/analytics/analytics.d.ts +1 -1
  27. package/dist/types/utils/analytics/types.d.ts +1 -0
  28. package/dist/types/utils/mocks.d.ts +42 -1
  29. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  30. package/dist/types-ts4.5/state/helpers.d.ts +3 -0
  31. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -1
  32. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -1
  33. package/dist/types-ts4.5/utils/analytics/types.d.ts +1 -0
  34. package/dist/types-ts4.5/utils/mocks.d.ts +42 -1
  35. package/package.json +5 -5
  36. package/report.api.md +2 -0
  37. package/tmp/api-report-tmp.d.ts +2 -1
@@ -346,6 +346,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
346
346
  * @param id The unique ID for this Smart Link.
347
347
  * @param definitionId The definitionId of the Smart Link resolver invoked.
348
348
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
349
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
349
350
  */
350
351
  renderSuccessEvent: function renderSuccessEvent(_ref9) {
351
352
  var display = _ref9.display,
@@ -356,7 +357,9 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
356
357
  resourceType = _ref9.resourceType,
357
358
  destinationProduct = _ref9.destinationProduct,
358
359
  destinationSubproduct = _ref9.destinationSubproduct,
359
- location = _ref9.location;
360
+ location = _ref9.location,
361
+ _ref9$canBeDatasource = _ref9.canBeDatasource,
362
+ canBeDatasource = _ref9$canBeDatasource === void 0 ? false : _ref9$canBeDatasource;
360
363
  var experienceId = id ? id : defaultId;
361
364
  succeedUfoExperience('smart-link-rendered', experienceId, {
362
365
  extensionKey: extensionKey,
@@ -375,7 +378,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
375
378
  resourceType: resourceType,
376
379
  destinationProduct: destinationProduct,
377
380
  destinationSubproduct: destinationSubproduct,
378
- location: location
381
+ location: location,
382
+ canBeDatasource: canBeDatasource
379
383
  }), commonAttributes));
380
384
  },
381
385
  /**
@@ -55,4 +55,11 @@ export var getStatusDetails = function getStatusDetails(details) {
55
55
  };
56
56
  export var isFinalState = function isFinalState(status) {
57
57
  return ['unauthorized', 'forbidden', 'errored', 'resolved', 'not_found'].indexOf(status) > -1;
58
+ };
59
+ export var getDatasources = function getDatasources(details) {
60
+ return details === null || details === void 0 ? void 0 : details.datasources;
61
+ };
62
+ export var getCanBeDatasource = function getCanBeDatasource(details) {
63
+ var datasources = getDatasources(details);
64
+ return !!datasources && datasources.length > 0;
58
65
  };
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.27.1"
18
+ packageVersion: "26.27.2"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -487,7 +487,8 @@ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
487
487
  definitionId = _ref20.definitionId,
488
488
  destinationProduct = _ref20.destinationProduct,
489
489
  destinationSubproduct = _ref20.destinationSubproduct,
490
- location = _ref20.location;
490
+ location = _ref20.location,
491
+ canBeDatasource = _ref20.canBeDatasource;
491
492
  return {
492
493
  action: 'renderSuccess',
493
494
  actionSubject: 'smartLink',
@@ -499,7 +500,8 @@ export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
499
500
  destinationProduct: destinationProduct,
500
501
  destinationSubproduct: destinationSubproduct,
501
502
  location: location,
502
- display: display
503
+ display: display,
504
+ canBeDatasource: canBeDatasource
503
505
  })
504
506
  };
505
507
  };
@@ -4,9 +4,12 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
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); }; }
9
10
  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; } }
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
13
  import { CardClient } from '@atlaskit/link-provider';
11
14
  export var mockContext = {
12
15
  '@vocab': 'https://www.w3.org/ns/activitystreams#',
@@ -44,6 +47,29 @@ export var mockByUrl = function mockByUrl(url) {
44
47
  }
45
48
  };
46
49
  };
50
+ var errorResponseData = {
51
+ '@context': {
52
+ '@vocab': 'https://www.w3.org/ns/activitystreams#',
53
+ atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
54
+ schema: 'http://schema.org/'
55
+ },
56
+ '@type': 'Object',
57
+ name: 'I love cheese',
58
+ url: 'https://some.url'
59
+ };
60
+ var successfulResponseData = _objectSpread(_objectSpread({}, errorResponseData), {}, {
61
+ summary: 'Here is your serving of cheese: 🧀',
62
+ 'schema:potentialAction': {
63
+ '@id': 'download',
64
+ '@type': 'DownloadAction',
65
+ identifier: 'object-provider',
66
+ name: 'Download'
67
+ },
68
+ 'atlassian:downloadUrl': 'https://some-download.url',
69
+ preview: {
70
+ href: 'https://www.ilovecheese.com'
71
+ }
72
+ });
47
73
  export var mocks = {
48
74
  success: {
49
75
  meta: {
@@ -53,27 +79,7 @@ export var mocks = {
53
79
  definitionId: 'd1',
54
80
  key: 'object-provider'
55
81
  },
56
- data: {
57
- '@context': {
58
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
59
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
60
- schema: 'http://schema.org/'
61
- },
62
- '@type': 'Object',
63
- name: 'I love cheese',
64
- summary: 'Here is your serving of cheese: 🧀',
65
- 'schema:potentialAction': {
66
- '@id': 'download',
67
- '@type': 'DownloadAction',
68
- identifier: 'object-provider',
69
- name: 'Download'
70
- },
71
- 'atlassian:downloadUrl': 'https://some-download.url',
72
- preview: {
73
- href: 'https://www.ilovecheese.com'
74
- },
75
- url: 'https://some.url'
76
- }
82
+ data: successfulResponseData
77
83
  },
78
84
  notFound: {
79
85
  meta: {
@@ -83,16 +89,7 @@ export var mocks = {
83
89
  definitionId: 'd1',
84
90
  key: 'object-provider'
85
91
  },
86
- data: {
87
- '@context': {
88
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
89
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
90
- schema: 'http://schema.org/'
91
- },
92
- '@type': 'Object',
93
- name: 'I love cheese',
94
- url: 'https://some.url'
95
- }
92
+ data: errorResponseData
96
93
  },
97
94
  forbidden: {
98
95
  meta: {
@@ -106,16 +103,7 @@ export var mocks = {
106
103
  definitionId: 'd1',
107
104
  key: 'object-provider'
108
105
  },
109
- data: {
110
- '@context': {
111
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
112
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
113
- schema: 'http://schema.org/'
114
- },
115
- '@type': 'Object',
116
- name: 'I love cheese',
117
- url: 'https://some.url'
118
- }
106
+ data: errorResponseData
119
107
  },
120
108
  forbiddenWithNoAuth: {
121
109
  meta: {
@@ -125,16 +113,7 @@ export var mocks = {
125
113
  definitionId: 'd1',
126
114
  key: 'object-provider'
127
115
  },
128
- data: {
129
- '@context': {
130
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
131
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
132
- schema: 'http://schema.org/'
133
- },
134
- '@type': 'Object',
135
- name: 'I love cheese',
136
- url: 'https://some.url'
137
- }
116
+ data: errorResponseData
138
117
  },
139
118
  unauthorized: {
140
119
  meta: {
@@ -148,16 +127,7 @@ export var mocks = {
148
127
  definitionId: 'd1',
149
128
  key: 'object-provider'
150
129
  },
151
- data: {
152
- '@context': {
153
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
154
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
155
- schema: 'http://schema.org/'
156
- },
157
- '@type': 'Object',
158
- name: 'I love cheese',
159
- url: 'https://some.url'
160
- }
130
+ data: errorResponseData
161
131
  },
162
132
  unauthorizedWithNoAuth: {
163
133
  meta: {
@@ -167,16 +137,7 @@ export var mocks = {
167
137
  definitionId: 'd1',
168
138
  key: 'object-provider'
169
139
  },
170
- data: {
171
- '@context': {
172
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
173
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
174
- schema: 'http://schema.org/'
175
- },
176
- '@type': 'Object',
177
- name: 'I love cheese',
178
- url: 'https://some.url'
179
- }
140
+ data: errorResponseData
180
141
  },
181
142
  actionSuccess: {
182
143
  meta: {
@@ -200,6 +161,27 @@ export var mocks = {
200
161
  product: 'spaghetti-product'
201
162
  }
202
163
  }
164
+ },
165
+ withDatasource: {
166
+ meta: {
167
+ visibility: 'public',
168
+ access: 'granted',
169
+ auth: [],
170
+ definitionId: 'd1',
171
+ key: 'object-provider'
172
+ },
173
+ data: successfulResponseData,
174
+ datasources: [{
175
+ key: 'datasource-jira-issues',
176
+ parameters: {
177
+ jql: '(text ~ "test*" OR summary ~ "test*") order by created DESC',
178
+ cloudId: '16f8b71e'
179
+ },
180
+ id: '1234-test-id-321',
181
+ ari: 'ari:cloud:linking-platform::datasource/1234-test-id-321',
182
+ description: 'For extracting a list of Jira issues using JQL',
183
+ name: 'Jira issues'
184
+ }]
203
185
  }
204
186
  };
205
187
  export var fakeResponse = function fakeResponse() {
@@ -3,7 +3,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
3
  import { useFeatureFlag } from '@atlaskit/link-provider';
4
4
  import { isSpecialEvent } from '../../utils';
5
5
  import * as measure from '../../utils/performance';
6
- import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct } from '../../state/helpers';
6
+ import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct, getCanBeDatasource } from '../../state/helpers';
7
7
  import { useSmartLink } from '../../state';
8
8
  import { BlockCard } from '../BlockCard';
9
9
  import { InlineCard } from '../InlineCard';
@@ -57,6 +57,7 @@ function Component(_ref) {
57
57
  var product = getProduct(state.details);
58
58
  var subproduct = getSubproduct(state.details);
59
59
  var services = getServices(state.details);
60
+ var canBeDatasource = getCanBeDatasource(state.details);
60
61
  var isFlexibleUi = useMemo(function () {
61
62
  return isFlexibleUiCard(children);
62
63
  }, [children]);
@@ -134,10 +135,11 @@ function Component(_ref) {
134
135
  status: state.status,
135
136
  id: id,
136
137
  definitionId: definitionId,
137
- extensionKey: extensionKey
138
+ extensionKey: extensionKey,
139
+ canBeDatasource: canBeDatasource
138
140
  });
139
141
  }
140
- }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id]);
142
+ }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
141
143
  var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
142
144
  analytics.ui.iframeDwelledEvent({
143
145
  id: id,
@@ -11,6 +11,7 @@ import { extractMetadata, elementNamesToItems } from '../../../../../extractors/
11
11
  import { messages } from '../../../../../messages';
12
12
  import { FormattedMessage } from 'react-intl-next';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
+ import { getCanBeDatasource } from '../../../../../state/helpers';
14
15
  export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
15
16
  var followAction = {
16
17
  hideIcon: true,
@@ -58,14 +59,16 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
58
59
  cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
59
60
  onActionClick = _ref.onActionClick,
60
61
  extensionKey = _ref.extensionKey;
62
+ var canBeDatasource = getCanBeDatasource(cardState.details);
61
63
  useEffect(function () {
62
64
  // Since this hover view is only rendered on resolved status,
63
65
  // there is no need to check for statuses.
64
66
  analytics.ui.renderSuccessEvent({
65
67
  display: CardDisplay.HoverCardPreview,
66
- status: cardState.status
68
+ status: cardState.status,
69
+ canBeDatasource: canBeDatasource
67
70
  });
68
- }, [analytics.ui, cardState.status]);
71
+ }, [analytics.ui, cardState.status, canBeDatasource]);
69
72
  var footerActions = useMemo(function () {
70
73
  return toFooterActions(cardActions, onActionClick);
71
74
  }, [cardActions, onActionClick]);
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.27.1",
14
+ packageVersion: "26.27.2",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -125,8 +125,9 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
125
125
  * @param id The unique ID for this Smart Link.
126
126
  * @param definitionId The definitionId of the Smart Link resolver invoked.
127
127
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
128
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
128
129
  */
129
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
130
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
130
131
  /**
131
132
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
132
133
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -1,6 +1,7 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  import { CardType, CardStore } from '@atlaskit/linking-common';
3
3
  import { DestinationProduct, DestinationSubproduct } from '../utils/analytics/types';
4
+ import { DatasourceResolveResponse, JsonLdDatasourceResponse } from '@atlaskit/link-client-extension';
4
5
  export declare const getByDefinitionId: (definitionId: string | undefined, store: CardStore) => string[];
5
6
  export declare const getClickUrl: (url: string, jsonLd?: JsonLd.Response) => string;
6
7
  export declare const getDefinitionId: (details?: JsonLd.Response) => string | undefined;
@@ -14,3 +15,5 @@ export declare const isAccessible: ({ meta: { access } }: JsonLd.Response) => bo
14
15
  export declare const isVisible: ({ meta: { visibility } }: JsonLd.Response) => boolean;
15
16
  export declare const getStatusDetails: (details?: JsonLd.Response) => string | undefined;
16
17
  export declare const isFinalState: (status: CardType) => boolean;
18
+ export declare const getDatasources: (details?: JsonLdDatasourceResponse) => DatasourceResolveResponse[] | undefined;
19
+ export declare const getCanBeDatasource: (details?: JsonLdDatasourceResponse) => boolean;
@@ -30,7 +30,7 @@ dispatchAnalytics?: AnalyticsHandler): {
30
30
  modalClosedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
31
31
  actionSubjectId: string;
32
32
  }) => void;
33
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
33
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
34
34
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
35
35
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
36
36
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -49,7 +49,7 @@ export declare const uiIframeFocusedEvent: ({ id, display, status, definitionId,
49
49
  export declare const uiActionClickedEvent: ({ id, actionType, extensionKey, display, definitionId, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => AnalyticsPayload;
50
50
  export declare const uiClosedAuthEvent: ({ display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => AnalyticsPayload;
51
51
  export declare const screenAuthPopupEvent: ({ extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => AnalyticsPayload;
52
- export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => AnalyticsPayload;
52
+ export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => AnalyticsPayload;
53
53
  export declare const uiRenderFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => AnalyticsPayload;
54
54
  export declare const uiHoverCardViewedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardViewedEventProps) => AnalyticsPayload;
55
55
  export declare const uiHoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardDismissedEventProps) => AnalyticsPayload;
@@ -85,6 +85,7 @@ export type UiClosedAuthEventProps = CommonEventProps & {
85
85
  export type UiRenderSuccessEventProps = CommonEventProps & {
86
86
  display: CardInnerAppearance;
87
87
  status: CardType;
88
+ canBeDatasource?: boolean;
88
89
  };
89
90
  export type UiRenderFailedEventProps = CommonEventProps & {
90
91
  display: CardInnerAppearance;
@@ -35,6 +35,47 @@ export declare const mocks: {
35
35
  };
36
36
  };
37
37
  };
38
+ withDatasource: {
39
+ meta: {
40
+ visibility: string;
41
+ access: string;
42
+ auth: never[];
43
+ definitionId: string;
44
+ key: string;
45
+ };
46
+ data: {
47
+ summary: string;
48
+ 'schema:potentialAction': {
49
+ '@id': string;
50
+ '@type': string;
51
+ identifier: string;
52
+ name: string;
53
+ };
54
+ 'atlassian:downloadUrl': string;
55
+ preview: {
56
+ href: string;
57
+ };
58
+ '@context': {
59
+ '@vocab': string;
60
+ atlassian: string;
61
+ schema: string;
62
+ };
63
+ '@type': string;
64
+ name: string;
65
+ url: string;
66
+ };
67
+ datasources: {
68
+ key: string;
69
+ parameters: {
70
+ jql: string;
71
+ cloudId: string;
72
+ };
73
+ id: string;
74
+ ari: string;
75
+ description: string;
76
+ name: string;
77
+ }[];
78
+ };
38
79
  };
39
80
  export declare const fakeResponse: () => Promise<JsonLd.Response<JsonLd.Data.BaseData>>;
40
81
  export declare const fakeFactory: any;
@@ -55,7 +96,7 @@ export declare const mockAnalytics: {
55
96
  modalClosedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
56
97
  actionSubjectId: string;
57
98
  }) => void;
58
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
99
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
59
100
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderFailedEventProps) => void;
60
101
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardViewedEventProps) => void;
61
102
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -125,8 +125,9 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
125
125
  * @param id The unique ID for this Smart Link.
126
126
  * @param definitionId The definitionId of the Smart Link resolver invoked.
127
127
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
128
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
128
129
  */
129
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
130
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
130
131
  /**
131
132
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
132
133
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -1,6 +1,7 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  import { CardType, CardStore } from '@atlaskit/linking-common';
3
3
  import { DestinationProduct, DestinationSubproduct } from '../utils/analytics/types';
4
+ import { DatasourceResolveResponse, JsonLdDatasourceResponse } from '@atlaskit/link-client-extension';
4
5
  export declare const getByDefinitionId: (definitionId: string | undefined, store: CardStore) => string[];
5
6
  export declare const getClickUrl: (url: string, jsonLd?: JsonLd.Response) => string;
6
7
  export declare const getDefinitionId: (details?: JsonLd.Response) => string | undefined;
@@ -14,3 +15,5 @@ export declare const isAccessible: ({ meta: { access } }: JsonLd.Response) => bo
14
15
  export declare const isVisible: ({ meta: { visibility } }: JsonLd.Response) => boolean;
15
16
  export declare const getStatusDetails: (details?: JsonLd.Response) => string | undefined;
16
17
  export declare const isFinalState: (status: CardType) => boolean;
18
+ export declare const getDatasources: (details?: JsonLdDatasourceResponse) => DatasourceResolveResponse[] | undefined;
19
+ export declare const getCanBeDatasource: (details?: JsonLdDatasourceResponse) => boolean;
@@ -30,7 +30,7 @@ dispatchAnalytics?: AnalyticsHandler): {
30
30
  modalClosedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
31
31
  actionSubjectId: string;
32
32
  }) => void;
33
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
33
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
34
34
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
35
35
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
36
36
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -49,7 +49,7 @@ export declare const uiIframeFocusedEvent: ({ id, display, status, definitionId,
49
49
  export declare const uiActionClickedEvent: ({ id, actionType, extensionKey, display, definitionId, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => AnalyticsPayload;
50
50
  export declare const uiClosedAuthEvent: ({ display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => AnalyticsPayload;
51
51
  export declare const screenAuthPopupEvent: ({ extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => AnalyticsPayload;
52
- export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => AnalyticsPayload;
52
+ export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => AnalyticsPayload;
53
53
  export declare const uiRenderFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => AnalyticsPayload;
54
54
  export declare const uiHoverCardViewedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardViewedEventProps) => AnalyticsPayload;
55
55
  export declare const uiHoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardDismissedEventProps) => AnalyticsPayload;
@@ -85,6 +85,7 @@ export type UiClosedAuthEventProps = CommonEventProps & {
85
85
  export type UiRenderSuccessEventProps = CommonEventProps & {
86
86
  display: CardInnerAppearance;
87
87
  status: CardType;
88
+ canBeDatasource?: boolean;
88
89
  };
89
90
  export type UiRenderFailedEventProps = CommonEventProps & {
90
91
  display: CardInnerAppearance;
@@ -35,6 +35,47 @@ export declare const mocks: {
35
35
  };
36
36
  };
37
37
  };
38
+ withDatasource: {
39
+ meta: {
40
+ visibility: string;
41
+ access: string;
42
+ auth: never[];
43
+ definitionId: string;
44
+ key: string;
45
+ };
46
+ data: {
47
+ summary: string;
48
+ 'schema:potentialAction': {
49
+ '@id': string;
50
+ '@type': string;
51
+ identifier: string;
52
+ name: string;
53
+ };
54
+ 'atlassian:downloadUrl': string;
55
+ preview: {
56
+ href: string;
57
+ };
58
+ '@context': {
59
+ '@vocab': string;
60
+ atlassian: string;
61
+ schema: string;
62
+ };
63
+ '@type': string;
64
+ name: string;
65
+ url: string;
66
+ };
67
+ datasources: {
68
+ key: string;
69
+ parameters: {
70
+ jql: string;
71
+ cloudId: string;
72
+ };
73
+ id: string;
74
+ ari: string;
75
+ description: string;
76
+ name: string;
77
+ }[];
78
+ };
38
79
  };
39
80
  export declare const fakeResponse: () => Promise<JsonLd.Response<JsonLd.Data.BaseData>>;
40
81
  export declare const fakeFactory: any;
@@ -55,7 +96,7 @@ export declare const mockAnalytics: {
55
96
  modalClosedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
56
97
  actionSubjectId: string;
57
98
  }) => void;
58
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
99
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
59
100
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderFailedEventProps) => void;
60
101
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardViewedEventProps) => void;
61
102
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardDismissedEventProps) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.27.1",
3
+ "version": "26.27.2",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  "@atlaskit/avatar-group": "^9.4.0",
29
29
  "@atlaskit/badge": "^15.1.0",
30
30
  "@atlaskit/button": "^16.10.0",
31
- "@atlaskit/dropdown-menu": "^11.13.0",
31
+ "@atlaskit/dropdown-menu": "^11.14.0",
32
32
  "@atlaskit/frontend-utilities": "^2.7.0",
33
33
  "@atlaskit/icon": "^21.12.0",
34
34
  "@atlaskit/icon-file-type": "^6.4.0",
@@ -42,13 +42,13 @@
42
42
  "@atlaskit/linking-types": "^8.3.0",
43
43
  "@atlaskit/logo": "^13.14.0",
44
44
  "@atlaskit/lozenge": "^11.4.0",
45
- "@atlaskit/modal-dialog": "^12.6.0",
45
+ "@atlaskit/modal-dialog": "^12.7.0",
46
46
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
47
47
  "@atlaskit/platform-feature-flags": "^0.2.1",
48
- "@atlaskit/popup": "^1.9.0",
48
+ "@atlaskit/popup": "^1.10.0",
49
49
  "@atlaskit/spinner": "^15.5.0",
50
50
  "@atlaskit/theme": "^12.6.0",
51
- "@atlaskit/tokens": "^1.24.0",
51
+ "@atlaskit/tokens": "^1.25.0",
52
52
  "@atlaskit/tooltip": "^17.8.0",
53
53
  "@atlaskit/ufo": "^0.2.0",
54
54
  "@babel/runtime": "^7.0.0",
package/report.api.md CHANGED
@@ -1064,6 +1064,7 @@ type UiRenderFailedEventProps = CommonEventProps & {
1064
1064
  type UiRenderSuccessEventProps = CommonEventProps & {
1065
1065
  display: CardInnerAppearance;
1066
1066
  status: CardType;
1067
+ canBeDatasource?: boolean;
1067
1068
  };
1068
1069
 
1069
1070
  // @public (undocumented)
@@ -1181,6 +1182,7 @@ export const useSmartLinkAnalytics: (
1181
1182
  destinationProduct,
1182
1183
  destinationSubproduct,
1183
1184
  location,
1185
+ canBeDatasource,
1184
1186
  }: UiRenderSuccessEventProps) => void;
1185
1187
  renderFailedEvent: ({
1186
1188
  display,
@@ -912,6 +912,7 @@ type UiRenderFailedEventProps = CommonEventProps & {
912
912
  type UiRenderSuccessEventProps = CommonEventProps & {
913
913
  display: CardInnerAppearance;
914
914
  status: CardType;
915
+ canBeDatasource?: boolean;
915
916
  };
916
917
 
917
918
  // @public (undocumented)
@@ -936,7 +937,7 @@ export const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: Analytics
936
937
  modalClosedEvent: (data: Partial<AnalyticsPayload> & {
937
938
  actionSubjectId: Required<string>;
938
939
  }) => void;
939
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
940
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
940
941
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
941
942
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: UiHoverCardViewedEventProps) => void;
942
943
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: UiHoverCardDismissedEventProps) => void;