@atlaskit/smart-card 44.9.6 → 44.9.8

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 (54) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/extractors/flexible/icon/index.js +12 -2
  3. package/dist/cjs/extractors/inline/index.js +7 -5
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/EmbedCard/views/ResolvedView.js +10 -4
  6. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +93 -32
  7. package/dist/cjs/view/LinkUrl/index.js +1 -1
  8. package/dist/es2019/extractors/flexible/icon/index.js +12 -2
  9. package/dist/es2019/extractors/inline/index.js +8 -6
  10. package/dist/es2019/utils/analytics/analytics.js +1 -1
  11. package/dist/es2019/view/EmbedCard/views/ResolvedView.js +11 -5
  12. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +86 -30
  13. package/dist/es2019/view/LinkUrl/index.js +1 -1
  14. package/dist/esm/extractors/flexible/icon/index.js +12 -2
  15. package/dist/esm/extractors/inline/index.js +8 -6
  16. package/dist/esm/utils/analytics/analytics.js +1 -1
  17. package/dist/esm/view/EmbedCard/views/ResolvedView.js +10 -4
  18. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +93 -32
  19. package/dist/esm/view/LinkUrl/index.js +1 -1
  20. package/dist/types/__fixtures__/atlas-project-with-ai-summary.d.ts +2 -1
  21. package/dist/types/__fixtures__/atlas-project.d.ts +2 -2
  22. package/dist/types/__fixtures__/bitbucket-pull-request.d.ts +3 -75
  23. package/dist/types/__fixtures__/compass-scorecard.d.ts +3 -46
  24. package/dist/types/__fixtures__/confluence-blog.d.ts +3 -51
  25. package/dist/types/__fixtures__/confluence-page.d.ts +3 -51
  26. package/dist/types/__fixtures__/confluence-space.d.ts +3 -38
  27. package/dist/types/__fixtures__/confluence-template.d.ts +3 -33
  28. package/dist/types/__fixtures__/dropbox-file.d.ts +2 -2
  29. package/dist/types/__fixtures__/figma-entity.d.ts +3 -58
  30. package/dist/types/__fixtures__/figma.d.ts +3 -45
  31. package/dist/types/__fixtures__/jira-roadmap.d.ts +3 -37
  32. package/dist/types/__fixtures__/jira-task.d.ts +3 -80
  33. package/dist/types/__fixtures__/jira-timeline.d.ts +3 -37
  34. package/dist/types/__fixtures__/youtube-video.d.ts +3 -46
  35. package/dist/types/extractors/flexible/icon/index.d.ts +3 -3
  36. package/dist/types/view/EmbedCard/types.d.ts +1 -0
  37. package/dist/types-ts4.5/__fixtures__/atlas-project-with-ai-summary.d.ts +2 -1
  38. package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +2 -2
  39. package/dist/types-ts4.5/__fixtures__/bitbucket-pull-request.d.ts +3 -75
  40. package/dist/types-ts4.5/__fixtures__/compass-scorecard.d.ts +3 -46
  41. package/dist/types-ts4.5/__fixtures__/confluence-blog.d.ts +3 -51
  42. package/dist/types-ts4.5/__fixtures__/confluence-page.d.ts +3 -51
  43. package/dist/types-ts4.5/__fixtures__/confluence-space.d.ts +3 -38
  44. package/dist/types-ts4.5/__fixtures__/confluence-template.d.ts +3 -33
  45. package/dist/types-ts4.5/__fixtures__/dropbox-file.d.ts +2 -2
  46. package/dist/types-ts4.5/__fixtures__/figma-entity.d.ts +3 -58
  47. package/dist/types-ts4.5/__fixtures__/figma.d.ts +3 -45
  48. package/dist/types-ts4.5/__fixtures__/jira-roadmap.d.ts +3 -37
  49. package/dist/types-ts4.5/__fixtures__/jira-task.d.ts +3 -80
  50. package/dist/types-ts4.5/__fixtures__/jira-timeline.d.ts +3 -37
  51. package/dist/types-ts4.5/__fixtures__/youtube-video.d.ts +3 -46
  52. package/dist/types-ts4.5/extractors/flexible/icon/index.d.ts +3 -3
  53. package/dist/types-ts4.5/view/EmbedCard/types.d.ts +1 -0
  54. package/package.json +8 -5
@@ -10,6 +10,7 @@ import React, { useState } from 'react';
10
10
  import { di } from 'react-magnetic-di';
11
11
  import ImageLoader from 'react-render-image';
12
12
  import LinkIcon from '@atlaskit/icon/core/link';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { Box } from '@atlaskit/primitives/compiled';
14
15
  import { isProfileType } from '../../../utils';
15
16
  import { Shimmer } from '../Icon';
@@ -58,46 +59,106 @@ export var IconAndTitleLayout = function IconAndTitleLayout(_ref2) {
58
59
  hasImageErrored = _useState2[0],
59
60
  setHasImageErrored = _useState2[1];
60
61
  var renderAtlaskitIcon = React.useCallback(function () {
61
- if (emoji) {
62
- return emoji;
63
- }
64
- if (!icon || typeof icon === 'string') {
65
- return null;
62
+ if (fg('platform_lp_use_entity_icon_url_for_icon')) {
63
+ if (emoji) {
64
+ return emoji;
65
+ }
66
+ if (!icon || typeof icon === 'string' || Array.isArray(icon)) {
67
+ return null;
68
+ }
69
+ return icon;
70
+ } else {
71
+ if (emoji) {
72
+ return emoji;
73
+ }
74
+ if (!icon || typeof icon === 'string') {
75
+ return null;
76
+ }
77
+ return icon;
66
78
  }
67
- return icon;
68
79
  }, [emoji, icon]);
69
80
  var profileType = isProfileType(type);
70
81
  var renderImageIcon = React.useCallback(function (errored, testId) {
71
- if (!icon || typeof icon !== 'string') {
72
- return null;
73
- }
74
- if (hideIconLoadingSkeleton) {
75
- if (hasImageErrored) {
76
- return errored;
82
+ if (fg('platform_lp_use_entity_icon_url_for_icon')) {
83
+ if (!icon) {
84
+ return null;
77
85
  }
78
- return /*#__PURE__*/React.createElement("img", {
86
+ var iconUrl;
87
+ var iconLabel = '';
88
+ if (Array.isArray(icon)) {
89
+ var _ref3 = icon,
90
+ _ref4 = _slicedToArray(_ref3, 2),
91
+ tupleIconUrl = _ref4[0],
92
+ tupleIconLabel = _ref4[1];
93
+ if (typeof tupleIconUrl !== 'string') {
94
+ return null;
95
+ }
96
+ iconUrl = tupleIconUrl;
97
+ iconLabel = typeof tupleIconLabel === 'string' ? tupleIconLabel : '';
98
+ } else if (typeof icon === 'string') {
99
+ iconUrl = icon;
100
+ } else {
101
+ return null;
102
+ }
103
+ if (hideIconLoadingSkeleton) {
104
+ if (hasImageErrored) {
105
+ return errored;
106
+ }
107
+ return /*#__PURE__*/React.createElement("img", {
108
+ src: iconUrl,
109
+ "data-testid": "".concat(testId, "-image"),
110
+ alt: iconLabel,
111
+ onError: function onError() {
112
+ return setHasImageErrored(true);
113
+ },
114
+ className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
115
+ });
116
+ }
117
+ return /*#__PURE__*/React.createElement(ImageLoader, {
118
+ src: iconUrl,
119
+ loaded: /*#__PURE__*/React.createElement("img", {
120
+ src: iconUrl,
121
+ "data-testid": "".concat(testId, "-image"),
122
+ alt: iconLabel,
123
+ className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
124
+ }),
125
+ errored: errored,
126
+ loading: /*#__PURE__*/React.createElement(Shimmer, {
127
+ testId: "".concat(testId, "-loading")
128
+ })
129
+ });
130
+ } else {
131
+ if (!icon || typeof icon !== 'string') {
132
+ return null;
133
+ }
134
+ if (hideIconLoadingSkeleton) {
135
+ if (hasImageErrored) {
136
+ return errored;
137
+ }
138
+ return /*#__PURE__*/React.createElement("img", {
139
+ src: icon,
140
+ "data-testid": "".concat(testId, "-image"),
141
+ alt: "",
142
+ onError: function onError() {
143
+ return setHasImageErrored(true);
144
+ },
145
+ className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
146
+ });
147
+ }
148
+ return /*#__PURE__*/React.createElement(ImageLoader, {
79
149
  src: icon,
80
- "data-testid": "".concat(testId, "-image"),
81
- alt: "",
82
- onError: function onError() {
83
- return setHasImageErrored(true);
84
- },
85
- className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
150
+ loaded: /*#__PURE__*/React.createElement("img", {
151
+ src: icon,
152
+ "data-testid": "".concat(testId, "-image"),
153
+ alt: "",
154
+ className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
155
+ }),
156
+ errored: errored,
157
+ loading: /*#__PURE__*/React.createElement(Shimmer, {
158
+ testId: "".concat(testId, "-loading")
159
+ })
86
160
  });
87
161
  }
88
- return /*#__PURE__*/React.createElement(ImageLoader, {
89
- src: icon,
90
- loaded: /*#__PURE__*/React.createElement("img", {
91
- src: icon,
92
- "data-testid": "".concat(testId, "-image"),
93
- alt: "",
94
- className: ax(["_c71l7vkz _p12f7vkz _1bsb1osq", profileType && styles.roundImageStyle])
95
- }),
96
- errored: errored,
97
- loading: /*#__PURE__*/React.createElement(Shimmer, {
98
- testId: "".concat(testId, "-loading")
99
- })
100
- });
101
162
  }, [icon, profileType, hideIconLoadingSkeleton, hasImageErrored]);
102
163
  var renderIconPlaceholder = React.useCallback(function (testId) {
103
164
  return defaultIcon || /*#__PURE__*/React.createElement(LinkIcon, {
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
15
15
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
16
16
  var PACKAGE_DATA = {
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "44.9.5",
18
+ packageVersion: "44.9.7",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
@@ -1,2 +1,3 @@
1
- declare const mockAtlasProjectWithAISummary: any;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const mockAtlasProjectWithAISummary: SmartLinkResponse;
2
3
  export default mockAtlasProjectWithAISummary;
@@ -1,3 +1,3 @@
1
- import { type JsonLd } from '@atlaskit/json-ld-types';
2
- declare const _default: JsonLd.Response;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
3
  export default _default;
@@ -1,75 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- visibility: string;
4
- access: string;
5
- resourceType: string;
6
- key: string;
7
- objectId: string;
8
- tenantId: string;
9
- };
10
- data: {
11
- '@id': string;
12
- '@context': {
13
- '@vocab': string;
14
- atlassian: string;
15
- schema: string;
16
- };
17
- '@type': string[];
18
- url: string;
19
- attributedTo: {
20
- '@type': string;
21
- name: string;
22
- icon: string;
23
- };
24
- 'schema:dateCreated': string;
25
- generator: {
26
- '@type': string;
27
- name: string;
28
- icon: {
29
- '@type': string;
30
- url: string;
31
- };
32
- };
33
- icon: {
34
- '@type': string;
35
- url: string;
36
- };
37
- name: string;
38
- summary: string;
39
- 'atlassian:mergeSource': {
40
- '@type': string;
41
- href: string;
42
- name: string;
43
- };
44
- 'atlassian:mergeDestination': {
45
- '@type': string;
46
- href: string;
47
- name: string;
48
- };
49
- updated: string;
50
- 'atlassian:internalId': string;
51
- 'atlassian:isMerged': boolean;
52
- 'atlassian:state': string;
53
- 'atlassian:reviewer': {
54
- '@type': string;
55
- name: string;
56
- icon: string;
57
- }[];
58
- 'atlassian:updatedBy': {
59
- '@type': string;
60
- name: string;
61
- icon: string;
62
- };
63
- audience: {
64
- '@type': string;
65
- name: string;
66
- icon: string;
67
- }[];
68
- context: {
69
- '@type': string;
70
- name: string;
71
- url: string;
72
- };
73
- };
74
- };
75
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,46 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- access: string;
4
- visibility: string;
5
- product: string;
6
- resourceType: string;
7
- key: string;
8
- objectId: string;
9
- tenantId: string;
10
- };
11
- data: {
12
- '@context': {
13
- '@vocab': string;
14
- atlassian: string;
15
- schema: string;
16
- };
17
- '@type': string[];
18
- url: string;
19
- name: string;
20
- icon: {
21
- '@type': string;
22
- url: string;
23
- };
24
- preview: {
25
- '@type': string;
26
- href: string;
27
- 'atlassian:supportedPlatforms': string[];
28
- };
29
- generator: {
30
- '@type': string;
31
- name: string;
32
- icon: {
33
- '@type': string;
34
- url: string;
35
- };
36
- };
37
- 'atlassian:ownedBy': {
38
- '@type': string;
39
- name: string;
40
- icon: string;
41
- };
42
- 'atlassian:appliedToComponentsCount': number;
43
- summary: string;
44
- };
45
- };
46
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,51 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- auth: never[];
4
- definitionId: string;
5
- visibility: string;
6
- access: string;
7
- resourceType: string;
8
- key: string;
9
- objectId: string;
10
- tenantId: string;
11
- };
12
- data: {
13
- '@context': {
14
- '@vocab': string;
15
- atlassian: string;
16
- schema: string;
17
- };
18
- generator: {
19
- '@type': string;
20
- '@id': string;
21
- name: string;
22
- };
23
- '@type': string[];
24
- url: string;
25
- name: string;
26
- 'atlassian:state': string;
27
- summary: string;
28
- 'schema:commentCount': number;
29
- 'atlassian:subscriberCount': number;
30
- 'atlassian:titlePrefix': {
31
- text: string;
32
- '@type': string;
33
- };
34
- 'atlassian:attributedTo': {
35
- '@type': string;
36
- name: string;
37
- icon: string;
38
- };
39
- 'atlassian:ownedBy': {
40
- '@type': string;
41
- name: string;
42
- icon: string;
43
- };
44
- preview: {
45
- '@type': string;
46
- href: string;
47
- 'atlassian:supportedPlatforms': string[];
48
- };
49
- };
50
- };
51
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,51 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- auth: never[];
4
- definitionId: string;
5
- visibility: string;
6
- access: string;
7
- resourceType: string;
8
- key: string;
9
- objectId: string;
10
- tenantId: string;
11
- };
12
- data: {
13
- '@context': {
14
- '@vocab': string;
15
- atlassian: string;
16
- schema: string;
17
- };
18
- generator: {
19
- '@type': string;
20
- '@id': string;
21
- name: string;
22
- };
23
- '@type': string[];
24
- url: string;
25
- name: string;
26
- 'atlassian:state': string;
27
- summary: string;
28
- 'schema:commentCount': number;
29
- 'atlassian:subscriberCount': number;
30
- 'atlassian:titlePrefix': {
31
- text: string;
32
- '@type': string;
33
- };
34
- 'atlassian:attributedTo': {
35
- '@type': string;
36
- name: string;
37
- icon: string;
38
- };
39
- 'atlassian:ownedBy': {
40
- '@type': string;
41
- name: string;
42
- icon: string;
43
- };
44
- preview: {
45
- '@type': string;
46
- href: string;
47
- 'atlassian:supportedPlatforms': string[];
48
- };
49
- };
50
- };
51
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,38 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- auth: never[];
4
- definitionId: string;
5
- visibility: string;
6
- access: string;
7
- resourceType: string;
8
- key: string;
9
- objectId: string;
10
- tenantId: string;
11
- };
12
- data: {
13
- '@context': {
14
- '@vocab': string;
15
- atlassian: string;
16
- schema: string;
17
- };
18
- generator: {
19
- '@type': string;
20
- '@id': string;
21
- name: string;
22
- };
23
- '@type': string[];
24
- url: string;
25
- icon: {
26
- '@type': string;
27
- url: string;
28
- };
29
- name: string;
30
- 'atlassian:state': string;
31
- summary: string;
32
- 'atlassian:titlePrefix': {
33
- text: string;
34
- '@type': string;
35
- };
36
- };
37
- };
38
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,33 +1,3 @@
1
- declare const _default_1: {
2
- data: {
3
- '@context': {
4
- '@vocab': string;
5
- atlassian: string;
6
- schema: string;
7
- };
8
- '@type': string[];
9
- generator: {
10
- '@id': string;
11
- '@type': string;
12
- name: string;
13
- };
14
- icon: undefined;
15
- name: string;
16
- summary: string;
17
- 'atlassian:titlePrefix': {
18
- '@type': string;
19
- text: string;
20
- };
21
- url: string;
22
- };
23
- meta: {
24
- access: string;
25
- auth: never[];
26
- definitionId: string;
27
- objectId: string;
28
- resourceType: string;
29
- tenantId: string;
30
- visibility: string;
31
- };
32
- };
33
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,3 +1,3 @@
1
- import { type JsonLd } from '@atlaskit/json-ld-types';
2
- declare const _default: JsonLd.Response;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
3
  export default _default;
@@ -1,58 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- access: string;
4
- visibility: string;
5
- auth: {
6
- key: string;
7
- displayName: string;
8
- url: string;
9
- }[];
10
- definitionId: string;
11
- key: string;
12
- objectId: string;
13
- resourceType: string;
14
- tenantId: string;
15
- version: string;
16
- };
17
- data: {
18
- url: string;
19
- '@context': {
20
- '@vocab': string;
21
- atlassian: string;
22
- schema: string;
23
- };
24
- '@type': string;
25
- name: string;
26
- updated: string;
27
- image: {
28
- '@type': string;
29
- url: string;
30
- };
31
- generator: {
32
- '@type': string;
33
- name: string;
34
- icon: {
35
- '@type': string;
36
- url: string;
37
- };
38
- };
39
- preview: {
40
- '@type': string;
41
- href: string;
42
- };
43
- };
44
- entityData: {
45
- id: string;
46
- displayName: string;
47
- url: string;
48
- lastUpdatedAt: string;
49
- thumbnail: {
50
- externalUrl: string;
51
- };
52
- liveEmbedUrl: string;
53
- type: string;
54
- inspectUrl: string;
55
- iconUrl: string;
56
- };
57
- };
58
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,45 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- access: string;
4
- visibility: string;
5
- auth: {
6
- key: string;
7
- displayName: string;
8
- url: string;
9
- }[];
10
- definitionId: string;
11
- key: string;
12
- objectId: string;
13
- resourceType: string;
14
- tenantId: string;
15
- version: string;
16
- };
17
- data: {
18
- url: string;
19
- '@context': {
20
- '@vocab': string;
21
- atlassian: string;
22
- schema: string;
23
- };
24
- '@type': string;
25
- name: string;
26
- updated: string;
27
- image: {
28
- '@type': string;
29
- url: string;
30
- };
31
- generator: {
32
- '@type': string;
33
- name: string;
34
- icon: {
35
- '@type': string;
36
- url: string;
37
- };
38
- };
39
- preview: {
40
- '@type': string;
41
- href: string;
42
- };
43
- };
44
- };
45
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,37 +1,3 @@
1
- declare const _default_1: {
2
- meta: {
3
- auth: never[];
4
- definitionId: string;
5
- visibility: string;
6
- access: string;
7
- resourceType: string;
8
- key: string;
9
- objectId: string;
10
- tenantId: string;
11
- };
12
- data: {
13
- '@context': {
14
- '@vocab': string;
15
- atlassian: string;
16
- schema: string;
17
- };
18
- generator: {
19
- '@type': string;
20
- '@id': string;
21
- name: string;
22
- };
23
- '@type': string[];
24
- url: string;
25
- name: string;
26
- summary: string;
27
- icon: {
28
- '@type': string;
29
- url: string;
30
- };
31
- preview: {
32
- href: string;
33
- 'atlassian:supportedPlatforms': string[];
34
- };
35
- };
36
- };
37
- export default _default_1;
1
+ import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;