@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.27.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cecab8d279d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cecab8d279d) - Added an attribute 'canBeDatasource' to 'smartLink renderSuccess' event to indicate which smart links can be converted to datasources
8
+
3
9
  ## 26.27.1
4
10
 
5
11
  ### Patch Changes
@@ -353,6 +353,7 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
353
353
  * @param id The unique ID for this Smart Link.
354
354
  * @param definitionId The definitionId of the Smart Link resolver invoked.
355
355
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
356
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
356
357
  */
357
358
  renderSuccessEvent: function renderSuccessEvent(_ref9) {
358
359
  var display = _ref9.display,
@@ -363,7 +364,9 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
363
364
  resourceType = _ref9.resourceType,
364
365
  destinationProduct = _ref9.destinationProduct,
365
366
  destinationSubproduct = _ref9.destinationSubproduct,
366
- location = _ref9.location;
367
+ location = _ref9.location,
368
+ _ref9$canBeDatasource = _ref9.canBeDatasource,
369
+ canBeDatasource = _ref9$canBeDatasource === void 0 ? false : _ref9$canBeDatasource;
367
370
  var experienceId = id ? id : defaultId;
368
371
  (0, _ufoExperiences.succeedUfoExperience)('smart-link-rendered', experienceId, {
369
372
  extensionKey: extensionKey,
@@ -382,7 +385,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
382
385
  resourceType: resourceType,
383
386
  destinationProduct: destinationProduct,
384
387
  destinationSubproduct: destinationSubproduct,
385
- location: location
388
+ location: location,
389
+ canBeDatasource: canBeDatasource
386
390
  }), commonAttributes));
387
391
  },
388
392
  /**
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isVisible = exports.isFinalState = exports.isAccessible = exports.hasResolved = exports.getSubproduct = exports.getStatusDetails = exports.getServices = exports.getResourceType = exports.getProduct = exports.getExtensionKey = exports.getDefinitionId = exports.getClickUrl = exports.getByDefinitionId = void 0;
6
+ exports.isVisible = exports.isFinalState = exports.isAccessible = exports.hasResolved = exports.getSubproduct = exports.getStatusDetails = exports.getServices = exports.getResourceType = exports.getProduct = exports.getExtensionKey = exports.getDefinitionId = exports.getDatasources = exports.getClickUrl = exports.getCanBeDatasource = exports.getByDefinitionId = void 0;
7
7
  var _extractVisitUrl = require("../extractors/common/primitives/extractVisitUrl");
8
8
  var getByDefinitionId = function getByDefinitionId(definitionId, store) {
9
9
  var urls = Object.keys(store);
@@ -74,4 +74,13 @@ exports.getStatusDetails = getStatusDetails;
74
74
  var isFinalState = function isFinalState(status) {
75
75
  return ['unauthorized', 'forbidden', 'errored', 'resolved', 'not_found'].indexOf(status) > -1;
76
76
  };
77
- exports.isFinalState = isFinalState;
77
+ exports.isFinalState = isFinalState;
78
+ var getDatasources = function getDatasources(details) {
79
+ return details === null || details === void 0 ? void 0 : details.datasources;
80
+ };
81
+ exports.getDatasources = getDatasources;
82
+ var getCanBeDatasource = function getCanBeDatasource(details) {
83
+ var datasources = getDatasources(details);
84
+ return !!datasources && datasources.length > 0;
85
+ };
86
+ exports.getCanBeDatasource = getCanBeDatasource;
@@ -23,7 +23,7 @@ exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
23
23
  var context = {
24
24
  componentName: 'smart-cards',
25
25
  packageName: "@atlaskit/smart-card",
26
- packageVersion: "26.27.1"
26
+ packageVersion: "26.27.2"
27
27
  };
28
28
  exports.context = context;
29
29
  var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
@@ -522,7 +522,8 @@ var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
522
522
  definitionId = _ref20.definitionId,
523
523
  destinationProduct = _ref20.destinationProduct,
524
524
  destinationSubproduct = _ref20.destinationSubproduct,
525
- location = _ref20.location;
525
+ location = _ref20.location,
526
+ canBeDatasource = _ref20.canBeDatasource;
526
527
  return {
527
528
  action: 'renderSuccess',
528
529
  actionSubject: 'smartLink',
@@ -534,7 +535,8 @@ var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref20) {
534
535
  destinationProduct: destinationProduct,
535
536
  destinationSubproduct: destinationSubproduct,
536
537
  location: location,
537
- display: display
538
+ display: display,
539
+ canBeDatasource: canBeDatasource
538
540
  })
539
541
  };
540
542
  };
@@ -12,9 +12,12 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
16
  var _linkProvider = require("@atlaskit/link-provider");
16
17
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
17
18
  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; } }
19
+ 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; }
20
+ 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) { (0, _defineProperty2.default)(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; }
18
21
  var mockContext = {
19
22
  '@vocab': 'https://www.w3.org/ns/activitystreams#',
20
23
  atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
@@ -53,6 +56,29 @@ var mockByUrl = function mockByUrl(url) {
53
56
  };
54
57
  };
55
58
  exports.mockByUrl = mockByUrl;
59
+ var errorResponseData = {
60
+ '@context': {
61
+ '@vocab': 'https://www.w3.org/ns/activitystreams#',
62
+ atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
63
+ schema: 'http://schema.org/'
64
+ },
65
+ '@type': 'Object',
66
+ name: 'I love cheese',
67
+ url: 'https://some.url'
68
+ };
69
+ var successfulResponseData = _objectSpread(_objectSpread({}, errorResponseData), {}, {
70
+ summary: 'Here is your serving of cheese: 🧀',
71
+ 'schema:potentialAction': {
72
+ '@id': 'download',
73
+ '@type': 'DownloadAction',
74
+ identifier: 'object-provider',
75
+ name: 'Download'
76
+ },
77
+ 'atlassian:downloadUrl': 'https://some-download.url',
78
+ preview: {
79
+ href: 'https://www.ilovecheese.com'
80
+ }
81
+ });
56
82
  var mocks = {
57
83
  success: {
58
84
  meta: {
@@ -62,27 +88,7 @@ var mocks = {
62
88
  definitionId: 'd1',
63
89
  key: 'object-provider'
64
90
  },
65
- data: {
66
- '@context': {
67
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
68
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
69
- schema: 'http://schema.org/'
70
- },
71
- '@type': 'Object',
72
- name: 'I love cheese',
73
- summary: 'Here is your serving of cheese: 🧀',
74
- 'schema:potentialAction': {
75
- '@id': 'download',
76
- '@type': 'DownloadAction',
77
- identifier: 'object-provider',
78
- name: 'Download'
79
- },
80
- 'atlassian:downloadUrl': 'https://some-download.url',
81
- preview: {
82
- href: 'https://www.ilovecheese.com'
83
- },
84
- url: 'https://some.url'
85
- }
91
+ data: successfulResponseData
86
92
  },
87
93
  notFound: {
88
94
  meta: {
@@ -92,16 +98,7 @@ var mocks = {
92
98
  definitionId: 'd1',
93
99
  key: 'object-provider'
94
100
  },
95
- data: {
96
- '@context': {
97
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
98
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
99
- schema: 'http://schema.org/'
100
- },
101
- '@type': 'Object',
102
- name: 'I love cheese',
103
- url: 'https://some.url'
104
- }
101
+ data: errorResponseData
105
102
  },
106
103
  forbidden: {
107
104
  meta: {
@@ -115,16 +112,7 @@ var mocks = {
115
112
  definitionId: 'd1',
116
113
  key: 'object-provider'
117
114
  },
118
- data: {
119
- '@context': {
120
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
121
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
122
- schema: 'http://schema.org/'
123
- },
124
- '@type': 'Object',
125
- name: 'I love cheese',
126
- url: 'https://some.url'
127
- }
115
+ data: errorResponseData
128
116
  },
129
117
  forbiddenWithNoAuth: {
130
118
  meta: {
@@ -134,16 +122,7 @@ var mocks = {
134
122
  definitionId: 'd1',
135
123
  key: 'object-provider'
136
124
  },
137
- data: {
138
- '@context': {
139
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
140
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
141
- schema: 'http://schema.org/'
142
- },
143
- '@type': 'Object',
144
- name: 'I love cheese',
145
- url: 'https://some.url'
146
- }
125
+ data: errorResponseData
147
126
  },
148
127
  unauthorized: {
149
128
  meta: {
@@ -157,16 +136,7 @@ var mocks = {
157
136
  definitionId: 'd1',
158
137
  key: 'object-provider'
159
138
  },
160
- data: {
161
- '@context': {
162
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
163
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
164
- schema: 'http://schema.org/'
165
- },
166
- '@type': 'Object',
167
- name: 'I love cheese',
168
- url: 'https://some.url'
169
- }
139
+ data: errorResponseData
170
140
  },
171
141
  unauthorizedWithNoAuth: {
172
142
  meta: {
@@ -176,16 +146,7 @@ var mocks = {
176
146
  definitionId: 'd1',
177
147
  key: 'object-provider'
178
148
  },
179
- data: {
180
- '@context': {
181
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
182
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
183
- schema: 'http://schema.org/'
184
- },
185
- '@type': 'Object',
186
- name: 'I love cheese',
187
- url: 'https://some.url'
188
- }
149
+ data: errorResponseData
189
150
  },
190
151
  actionSuccess: {
191
152
  meta: {
@@ -209,6 +170,27 @@ var mocks = {
209
170
  product: 'spaghetti-product'
210
171
  }
211
172
  }
173
+ },
174
+ withDatasource: {
175
+ meta: {
176
+ visibility: 'public',
177
+ access: 'granted',
178
+ auth: [],
179
+ definitionId: 'd1',
180
+ key: 'object-provider'
181
+ },
182
+ data: successfulResponseData,
183
+ datasources: [{
184
+ key: 'datasource-jira-issues',
185
+ parameters: {
186
+ jql: '(text ~ "test*" OR summary ~ "test*") order by created DESC',
187
+ cloudId: '16f8b71e'
188
+ },
189
+ id: '1234-test-id-321',
190
+ ari: 'ari:cloud:linking-platform::datasource/1234-test-id-321',
191
+ description: 'For extracting a list of Jira issues using JQL',
192
+ name: 'Jira issues'
193
+ }]
212
194
  }
213
195
  };
214
196
  exports.mocks = mocks;
@@ -67,6 +67,7 @@ function Component(_ref) {
67
67
  var product = (0, _helpers.getProduct)(state.details);
68
68
  var subproduct = (0, _helpers.getSubproduct)(state.details);
69
69
  var services = (0, _helpers.getServices)(state.details);
70
+ var canBeDatasource = (0, _helpers.getCanBeDatasource)(state.details);
70
71
  var isFlexibleUi = (0, _react.useMemo)(function () {
71
72
  return (0, _flexible.isFlexibleUiCard)(children);
72
73
  }, [children]);
@@ -144,10 +145,11 @@ function Component(_ref) {
144
145
  status: state.status,
145
146
  id: id,
146
147
  definitionId: definitionId,
147
- extensionKey: extensionKey
148
+ extensionKey: extensionKey,
149
+ canBeDatasource: canBeDatasource
148
150
  });
149
151
  }
150
- }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id]);
152
+ }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
151
153
  var onIframeDwell = (0, _react.useCallback)(function (dwellTime, dwellPercentVisible) {
152
154
  analytics.ui.iframeDwelledEvent({
153
155
  id: id,
@@ -19,6 +19,7 @@ var _extractMetadata = require("../../../../../extractors/hover/extractMetadata"
19
19
  var _messages = require("../../../../../messages");
20
20
  var _reactIntlNext = require("react-intl-next");
21
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
+ var _helpers = require("../../../../../state/helpers");
22
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
25
  var toFooterActions = function toFooterActions(cardActions, onActionClick) {
@@ -69,14 +70,16 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
69
70
  cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
70
71
  onActionClick = _ref.onActionClick,
71
72
  extensionKey = _ref.extensionKey;
73
+ var canBeDatasource = (0, _helpers.getCanBeDatasource)(cardState.details);
72
74
  (0, _react.useEffect)(function () {
73
75
  // Since this hover view is only rendered on resolved status,
74
76
  // there is no need to check for statuses.
75
77
  analytics.ui.renderSuccessEvent({
76
78
  display: _constants.CardDisplay.HoverCardPreview,
77
- status: cardState.status
79
+ status: cardState.status,
80
+ canBeDatasource: canBeDatasource
78
81
  });
79
- }, [analytics.ui, cardState.status]);
82
+ }, [analytics.ui, cardState.status, canBeDatasource]);
80
83
  var footerActions = (0, _react.useMemo)(function () {
81
84
  return toFooterActions(cardActions, onActionClick);
82
85
  }, [cardActions, onActionClick]);
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
18
18
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
19
19
  var PACKAGE_DATA = {
20
20
  packageName: "@atlaskit/smart-card",
21
- packageVersion: "26.27.1",
21
+ packageVersion: "26.27.2",
22
22
  componentName: 'linkUrl'
23
23
  };
24
24
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -336,6 +336,7 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
336
336
  * @param id The unique ID for this Smart Link.
337
337
  * @param definitionId The definitionId of the Smart Link resolver invoked.
338
338
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
339
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
339
340
  */
340
341
  renderSuccessEvent: ({
341
342
  display,
@@ -346,7 +347,8 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
346
347
  resourceType,
347
348
  destinationProduct,
348
349
  destinationSubproduct,
349
- location
350
+ location,
351
+ canBeDatasource = false
350
352
  }) => {
351
353
  const experienceId = id ? id : defaultId;
352
354
  succeedUfoExperience('smart-link-rendered', experienceId, {
@@ -366,7 +368,8 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
366
368
  resourceType,
367
369
  destinationProduct,
368
370
  destinationSubproduct,
369
- location
371
+ location,
372
+ canBeDatasource
370
373
  }), commonAttributes));
371
374
  },
372
375
  /**
@@ -55,4 +55,9 @@ export const getStatusDetails = details => {
55
55
  };
56
56
  export const isFinalState = status => {
57
57
  return ['unauthorized', 'forbidden', 'errored', 'resolved', 'not_found'].indexOf(status) > -1;
58
+ };
59
+ export const getDatasources = details => details === null || details === void 0 ? void 0 : details.datasources;
60
+ export const getCanBeDatasource = details => {
61
+ const datasources = getDatasources(details);
62
+ return !!datasources && datasources.length > 0;
58
63
  };
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "26.27.1"
7
+ packageVersion: "26.27.2"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -496,7 +496,8 @@ export const uiRenderSuccessEvent = ({
496
496
  definitionId,
497
497
  destinationProduct,
498
498
  destinationSubproduct,
499
- location
499
+ location,
500
+ canBeDatasource
500
501
  }) => ({
501
502
  action: 'renderSuccess',
502
503
  actionSubject: 'smartLink',
@@ -509,7 +510,8 @@ export const uiRenderSuccessEvent = ({
509
510
  destinationProduct,
510
511
  destinationSubproduct,
511
512
  location,
512
- display
513
+ display,
514
+ canBeDatasource
513
515
  }
514
516
  });
515
517
  export const uiRenderFailedEvent = ({
@@ -35,6 +35,30 @@ export const mockByUrl = url => {
35
35
  }
36
36
  };
37
37
  };
38
+ const errorResponseData = {
39
+ '@context': {
40
+ '@vocab': 'https://www.w3.org/ns/activitystreams#',
41
+ atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
42
+ schema: 'http://schema.org/'
43
+ },
44
+ '@type': 'Object',
45
+ name: 'I love cheese',
46
+ url: 'https://some.url'
47
+ };
48
+ const successfulResponseData = {
49
+ ...errorResponseData,
50
+ summary: 'Here is your serving of cheese: 🧀',
51
+ 'schema:potentialAction': {
52
+ '@id': 'download',
53
+ '@type': 'DownloadAction',
54
+ identifier: 'object-provider',
55
+ name: 'Download'
56
+ },
57
+ 'atlassian:downloadUrl': 'https://some-download.url',
58
+ preview: {
59
+ href: 'https://www.ilovecheese.com'
60
+ }
61
+ };
38
62
  export const mocks = {
39
63
  success: {
40
64
  meta: {
@@ -44,27 +68,7 @@ export const mocks = {
44
68
  definitionId: 'd1',
45
69
  key: 'object-provider'
46
70
  },
47
- data: {
48
- '@context': {
49
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
50
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
51
- schema: 'http://schema.org/'
52
- },
53
- '@type': 'Object',
54
- name: 'I love cheese',
55
- summary: 'Here is your serving of cheese: 🧀',
56
- 'schema:potentialAction': {
57
- '@id': 'download',
58
- '@type': 'DownloadAction',
59
- identifier: 'object-provider',
60
- name: 'Download'
61
- },
62
- 'atlassian:downloadUrl': 'https://some-download.url',
63
- preview: {
64
- href: 'https://www.ilovecheese.com'
65
- },
66
- url: 'https://some.url'
67
- }
71
+ data: successfulResponseData
68
72
  },
69
73
  notFound: {
70
74
  meta: {
@@ -74,16 +78,7 @@ export const mocks = {
74
78
  definitionId: 'd1',
75
79
  key: 'object-provider'
76
80
  },
77
- data: {
78
- '@context': {
79
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
80
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
81
- schema: 'http://schema.org/'
82
- },
83
- '@type': 'Object',
84
- name: 'I love cheese',
85
- url: 'https://some.url'
86
- }
81
+ data: errorResponseData
87
82
  },
88
83
  forbidden: {
89
84
  meta: {
@@ -97,16 +92,7 @@ export const mocks = {
97
92
  definitionId: 'd1',
98
93
  key: 'object-provider'
99
94
  },
100
- data: {
101
- '@context': {
102
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
103
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
104
- schema: 'http://schema.org/'
105
- },
106
- '@type': 'Object',
107
- name: 'I love cheese',
108
- url: 'https://some.url'
109
- }
95
+ data: errorResponseData
110
96
  },
111
97
  forbiddenWithNoAuth: {
112
98
  meta: {
@@ -116,16 +102,7 @@ export const mocks = {
116
102
  definitionId: 'd1',
117
103
  key: 'object-provider'
118
104
  },
119
- data: {
120
- '@context': {
121
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
122
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
123
- schema: 'http://schema.org/'
124
- },
125
- '@type': 'Object',
126
- name: 'I love cheese',
127
- url: 'https://some.url'
128
- }
105
+ data: errorResponseData
129
106
  },
130
107
  unauthorized: {
131
108
  meta: {
@@ -139,16 +116,7 @@ export const mocks = {
139
116
  definitionId: 'd1',
140
117
  key: 'object-provider'
141
118
  },
142
- data: {
143
- '@context': {
144
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
145
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
146
- schema: 'http://schema.org/'
147
- },
148
- '@type': 'Object',
149
- name: 'I love cheese',
150
- url: 'https://some.url'
151
- }
119
+ data: errorResponseData
152
120
  },
153
121
  unauthorizedWithNoAuth: {
154
122
  meta: {
@@ -158,16 +126,7 @@ export const mocks = {
158
126
  definitionId: 'd1',
159
127
  key: 'object-provider'
160
128
  },
161
- data: {
162
- '@context': {
163
- '@vocab': 'https://www.w3.org/ns/activitystreams#',
164
- atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
165
- schema: 'http://schema.org/'
166
- },
167
- '@type': 'Object',
168
- name: 'I love cheese',
169
- url: 'https://some.url'
170
- }
129
+ data: errorResponseData
171
130
  },
172
131
  actionSuccess: {
173
132
  meta: {
@@ -191,6 +150,27 @@ export const mocks = {
191
150
  product: 'spaghetti-product'
192
151
  }
193
152
  }
153
+ },
154
+ withDatasource: {
155
+ meta: {
156
+ visibility: 'public',
157
+ access: 'granted',
158
+ auth: [],
159
+ definitionId: 'd1',
160
+ key: 'object-provider'
161
+ },
162
+ data: successfulResponseData,
163
+ datasources: [{
164
+ key: 'datasource-jira-issues',
165
+ parameters: {
166
+ jql: '(text ~ "test*" OR summary ~ "test*") order by created DESC',
167
+ cloudId: '16f8b71e'
168
+ },
169
+ id: '1234-test-id-321',
170
+ ari: 'ari:cloud:linking-platform::datasource/1234-test-id-321',
171
+ description: 'For extracting a list of Jira issues using JQL',
172
+ name: 'Jira issues'
173
+ }]
194
174
  }
195
175
  };
196
176
  export const fakeResponse = () => Promise.resolve(mocks.success);
@@ -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';
@@ -60,6 +60,7 @@ function Component({
60
60
  const product = getProduct(state.details);
61
61
  const subproduct = getSubproduct(state.details);
62
62
  const services = getServices(state.details);
63
+ const canBeDatasource = getCanBeDatasource(state.details);
63
64
  let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
64
65
  const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
65
66
  const showServerActions = showServerActionsProp && platform !== 'mobile';
@@ -131,10 +132,11 @@ function Component({
131
132
  status: state.status,
132
133
  id,
133
134
  definitionId,
134
- extensionKey
135
+ extensionKey,
136
+ canBeDatasource
135
137
  });
136
138
  }
137
- }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id]);
139
+ }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
138
140
  const onIframeDwell = useCallback((dwellTime, dwellPercentVisible) => {
139
141
  analytics.ui.iframeDwelledEvent({
140
142
  id,
@@ -10,6 +10,7 @@ import { extractMetadata, elementNamesToItems } from '../../../../../extractors/
10
10
  import { messages } from '../../../../../messages';
11
11
  import { FormattedMessage } from 'react-intl-next';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
+ import { getCanBeDatasource } from '../../../../../state/helpers';
13
14
  export const toFooterActions = (cardActions, onActionClick) => {
14
15
  const followAction = {
15
16
  hideIcon: true,
@@ -56,14 +57,16 @@ const HoverCardResolvedView = ({
56
57
  extensionKey
57
58
  }) => {
58
59
  var _cardState$details;
60
+ const canBeDatasource = getCanBeDatasource(cardState.details);
59
61
  useEffect(() => {
60
62
  // Since this hover view is only rendered on resolved status,
61
63
  // there is no need to check for statuses.
62
64
  analytics.ui.renderSuccessEvent({
63
65
  display: CardDisplay.HoverCardPreview,
64
- status: cardState.status
66
+ status: cardState.status,
67
+ canBeDatasource
65
68
  });
66
- }, [analytics.ui, cardState.status]);
69
+ }, [analytics.ui, cardState.status, canBeDatasource]);
67
70
  const footerActions = useMemo(() => toFooterActions(cardActions, onActionClick), [cardActions, onActionClick]);
68
71
  const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
69
72
  const {
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.27.1",
11
+ packageVersion: "26.27.2",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');