@atlaskit/smart-card 16.2.0 → 17.0.1

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 (156) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/cjs/client/api.js +6 -4
  3. package/dist/cjs/client/errors.js +3 -1
  4. package/dist/cjs/client/types/responses.js +1 -1
  5. package/dist/cjs/client/utils/environments.js +1 -1
  6. package/dist/cjs/constants.js +77 -0
  7. package/dist/cjs/extractors/block/index.js +5 -5
  8. package/dist/cjs/extractors/common/actions/extractActions.js +2 -2
  9. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +4 -4
  10. package/dist/cjs/extractors/common/byline/extractByline.js +17 -5
  11. package/dist/cjs/extractors/common/context/extractAccessContext.js +2 -2
  12. package/dist/cjs/extractors/common/lozenge/utils.js +1 -1
  13. package/dist/cjs/extractors/common/utils.js +1 -1
  14. package/dist/cjs/extractors/constants.js +1 -1
  15. package/dist/cjs/extractors/embed/index.js +2 -2
  16. package/dist/cjs/extractors/flexible/index.js +22 -0
  17. package/dist/cjs/in-product.js +8 -8
  18. package/dist/cjs/index.js +74 -32
  19. package/dist/cjs/providers/editor/transformer.js +5 -1
  20. package/dist/cjs/state/actions/constants.js +1 -1
  21. package/dist/cjs/state/actions/index.js +1 -1
  22. package/dist/cjs/state/analytics/index.js +8 -8
  23. package/dist/cjs/state/analytics/ufoExperiences.js +18 -15
  24. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +12 -4
  25. package/dist/cjs/state/context/index.js +3 -2
  26. package/dist/cjs/state/flexible-ui-context/index.js +17 -0
  27. package/dist/cjs/state/flexible-ui-context/types.js +5 -0
  28. package/dist/cjs/state/helpers.js +1 -1
  29. package/dist/cjs/state/index.js +4 -4
  30. package/dist/cjs/state/reducers/index.js +2 -2
  31. package/dist/cjs/utils/analytics/analytics.js +9 -9
  32. package/dist/cjs/utils/analytics/index.js +29 -29
  33. package/dist/cjs/utils/index.js +1 -1
  34. package/dist/cjs/utils/mocks.js +1 -1
  35. package/dist/cjs/utils/performance.js +1 -1
  36. package/dist/cjs/version.json +1 -1
  37. package/dist/cjs/view/BlockCard/index.js +1 -1
  38. package/dist/cjs/view/Card/index.js +9 -2
  39. package/dist/cjs/view/CardWithUrl/component-lazy/LazyFallback.js +1 -1
  40. package/dist/cjs/view/CardWithUrl/loader.js +27 -32
  41. package/dist/cjs/view/EmbedCard/index.js +1 -1
  42. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +87 -0
  43. package/dist/cjs/view/FlexibleCard/components/blocks/types.js +5 -0
  44. package/dist/cjs/view/FlexibleCard/components/container/index.js +117 -0
  45. package/dist/cjs/view/FlexibleCard/components/container/types.js +5 -0
  46. package/dist/cjs/view/FlexibleCard/components/elements/icon/atlaskit-icon/index.js +244 -0
  47. package/dist/cjs/view/FlexibleCard/components/elements/icon/atlaskit-icon/types.js +5 -0
  48. package/dist/cjs/view/FlexibleCard/components/elements/icon/image-icon/index.js +32 -0
  49. package/dist/cjs/view/FlexibleCard/components/elements/icon/image-icon/types.js +5 -0
  50. package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +144 -0
  51. package/dist/cjs/view/FlexibleCard/components/elements/icon/types.js +5 -0
  52. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +135 -0
  53. package/dist/cjs/view/FlexibleCard/components/elements/link/types.js +5 -0
  54. package/dist/cjs/view/FlexibleCard/components/elements/types.js +5 -0
  55. package/dist/es2019/constants.js +67 -0
  56. package/dist/es2019/extractors/block/index.js +2 -2
  57. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +2 -2
  58. package/dist/es2019/extractors/common/byline/extractByline.js +16 -5
  59. package/dist/es2019/extractors/flexible/index.js +14 -0
  60. package/dist/es2019/index.js +1 -1
  61. package/dist/es2019/providers/editor/transformer.js +3 -1
  62. package/dist/es2019/state/actions/index.js +1 -1
  63. package/dist/es2019/state/analytics/ufoExperiences.js +17 -14
  64. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +18 -4
  65. package/dist/es2019/state/flexible-ui-context/index.js +3 -0
  66. package/dist/es2019/state/flexible-ui-context/types.js +1 -0
  67. package/dist/es2019/utils/analytics/analytics.js +6 -6
  68. package/dist/es2019/version.json +1 -1
  69. package/dist/es2019/view/BlockCard/index.js +2 -2
  70. package/dist/es2019/view/Card/index.js +8 -2
  71. package/dist/es2019/view/CardWithUrl/loader.js +30 -37
  72. package/dist/es2019/view/EmbedCard/index.js +2 -2
  73. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +62 -0
  74. package/dist/es2019/view/FlexibleCard/components/blocks/types.js +1 -0
  75. package/dist/es2019/view/FlexibleCard/components/container/index.js +89 -0
  76. package/dist/es2019/view/FlexibleCard/components/container/types.js +1 -0
  77. package/dist/es2019/view/FlexibleCard/components/elements/icon/atlaskit-icon/index.js +175 -0
  78. package/dist/es2019/view/FlexibleCard/components/elements/icon/atlaskit-icon/types.js +1 -0
  79. package/dist/es2019/view/FlexibleCard/components/elements/icon/image-icon/index.js +19 -0
  80. package/dist/es2019/view/FlexibleCard/components/elements/icon/image-icon/types.js +1 -0
  81. package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +112 -0
  82. package/dist/es2019/view/FlexibleCard/components/elements/icon/types.js +1 -0
  83. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +118 -0
  84. package/dist/es2019/view/FlexibleCard/components/elements/link/types.js +1 -0
  85. package/dist/es2019/view/FlexibleCard/components/elements/types.js +1 -0
  86. package/dist/esm/client/api.js +4 -3
  87. package/dist/esm/client/errors.js +2 -1
  88. package/dist/esm/constants.js +67 -0
  89. package/dist/esm/extractors/block/index.js +4 -4
  90. package/dist/esm/extractors/common/actions/extractActions.js +2 -2
  91. package/dist/esm/extractors/common/actions/extractPreviewAction.js +4 -4
  92. package/dist/esm/extractors/common/byline/extractByline.js +16 -5
  93. package/dist/esm/extractors/common/context/extractAccessContext.js +2 -2
  94. package/dist/esm/extractors/embed/index.js +2 -2
  95. package/dist/esm/extractors/flexible/index.js +14 -0
  96. package/dist/esm/index.js +1 -1
  97. package/dist/esm/providers/editor/transformer.js +5 -1
  98. package/dist/esm/state/actions/index.js +1 -1
  99. package/dist/esm/state/analytics/ufoExperiences.js +17 -14
  100. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +13 -5
  101. package/dist/esm/state/flexible-ui-context/index.js +5 -0
  102. package/dist/esm/state/flexible-ui-context/types.js +1 -0
  103. package/dist/esm/state/reducers/index.js +2 -2
  104. package/dist/esm/utils/analytics/analytics.js +8 -8
  105. package/dist/esm/utils/analytics/index.js +2 -2
  106. package/dist/esm/version.json +1 -1
  107. package/dist/esm/view/BlockCard/index.js +2 -2
  108. package/dist/esm/view/Card/index.js +8 -2
  109. package/dist/esm/view/CardWithUrl/loader.js +28 -33
  110. package/dist/esm/view/EmbedCard/index.js +2 -2
  111. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +74 -0
  112. package/dist/esm/view/FlexibleCard/components/blocks/types.js +1 -0
  113. package/dist/esm/view/FlexibleCard/components/container/index.js +102 -0
  114. package/dist/esm/view/FlexibleCard/components/container/types.js +1 -0
  115. package/dist/esm/view/FlexibleCard/components/elements/icon/atlaskit-icon/index.js +224 -0
  116. package/dist/esm/view/FlexibleCard/components/elements/icon/atlaskit-icon/types.js +1 -0
  117. package/dist/esm/view/FlexibleCard/components/elements/icon/image-icon/index.js +20 -0
  118. package/dist/esm/view/FlexibleCard/components/elements/icon/image-icon/types.js +1 -0
  119. package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +124 -0
  120. package/dist/esm/view/FlexibleCard/components/elements/icon/types.js +1 -0
  121. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +120 -0
  122. package/dist/esm/view/FlexibleCard/components/elements/link/types.js +1 -0
  123. package/dist/esm/view/FlexibleCard/components/elements/types.js +1 -0
  124. package/dist/types/constants.d.ts +56 -0
  125. package/dist/types/extractors/block/types.d.ts +1 -1
  126. package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
  127. package/dist/types/extractors/flexible/index.d.ts +4 -0
  128. package/dist/types/index.d.ts +1 -1
  129. package/dist/types/state/analytics/ufoExperiences.d.ts +1 -1
  130. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  131. package/dist/types/state/context/provider.d.ts +1 -0
  132. package/dist/types/state/flexible-ui-context/index.d.ts +4 -0
  133. package/dist/types/state/flexible-ui-context/types.d.ts +3 -0
  134. package/dist/types/state/hooks/useSmartLink.d.ts +1 -1
  135. package/dist/types/utils/analytics/analytics.d.ts +3 -3
  136. package/dist/types/utils/test-utils.d.ts +1 -0
  137. package/dist/types/view/Card/index.d.ts +2 -1
  138. package/dist/types/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.d.ts +1 -0
  139. package/dist/types/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.d.ts +1 -0
  140. package/dist/types/view/CardWithUrl/component-lazy/index.d.ts +1 -0
  141. package/dist/types/view/CardWithUrl/component.d.ts +1 -0
  142. package/dist/types/view/CardWithUrl/loader.d.ts +1 -0
  143. package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +7 -0
  144. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +6 -0
  145. package/dist/types/view/FlexibleCard/components/container/index.d.ts +7 -0
  146. package/dist/types/view/FlexibleCard/components/container/types.d.ts +8 -0
  147. package/dist/types/view/FlexibleCard/components/elements/icon/atlaskit-icon/index.d.ts +4 -0
  148. package/dist/types/view/FlexibleCard/components/elements/icon/atlaskit-icon/types.d.ts +6 -0
  149. package/dist/types/view/FlexibleCard/components/elements/icon/image-icon/index.d.ts +5 -0
  150. package/dist/types/view/FlexibleCard/components/elements/icon/image-icon/types.d.ts +6 -0
  151. package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +5 -0
  152. package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +7 -0
  153. package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +5 -0
  154. package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +8 -0
  155. package/dist/types/view/FlexibleCard/components/elements/types.d.ts +5 -0
  156. package/package.json +23 -18
@@ -0,0 +1,224 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ var _importIconMapper;
4
+
5
+ import React from 'react';
6
+ import Loadable from 'react-loadable';
7
+ import { B200, B400, N700 } from '@atlaskit/theme/colors';
8
+ import { IconType } from '../../../../../../constants';
9
+ // prettier-ignore
10
+ var importIconMapper = (_importIconMapper = {}, _defineProperty(_importIconMapper, IconType.Archive, function () {
11
+ return import(
12
+ /* webpackChunkName: "glyphArchive" */
13
+ '@atlaskit/icon-file-type/glyph/archive/16');
14
+ }), _defineProperty(_importIconMapper, IconType.Audio, function () {
15
+ return import(
16
+ /* webpackChunkName: "glyphAudio" */
17
+ '@atlaskit/icon-file-type/glyph/audio/16');
18
+ }), _defineProperty(_importIconMapper, IconType.Blog, function () {
19
+ return import(
20
+ /* webpackChunkName: "glyphBlog" */
21
+ '@atlaskit/icon-object/glyph/blog/16');
22
+ }), _defineProperty(_importIconMapper, IconType.Code, function () {
23
+ return import(
24
+ /* webpackChunkName: "glyphCode" */
25
+ '@atlaskit/icon-file-type/glyph/source-code/16');
26
+ }), _defineProperty(_importIconMapper, IconType.Document, function () {
27
+ return import(
28
+ /* webpackChunkName: "glyphDocument" */
29
+ '@atlaskit/icon-file-type/glyph/document/16');
30
+ }), _defineProperty(_importIconMapper, IconType.Executable, function () {
31
+ return import(
32
+ /* webpackChunkName: "glyphExecutable" */
33
+ '@atlaskit/icon-file-type/glyph/executable/16');
34
+ }), _defineProperty(_importIconMapper, IconType.File, function () {
35
+ return import(
36
+ /* webpackChunkName: "glyphFile" */
37
+ '@atlaskit/icon-file-type/glyph/generic/16');
38
+ }), _defineProperty(_importIconMapper, IconType.Folder, function () {
39
+ return import(
40
+ /* webpackChunkName: "glyphFolder" */
41
+ '@atlaskit/icon-file-type/glyph/folder/16');
42
+ }), _defineProperty(_importIconMapper, IconType.Generic, function () {
43
+ return import(
44
+ /* webpackChunkName: "glyphGeneric" */
45
+ '@atlaskit/icon-file-type/glyph/generic/16');
46
+ }), _defineProperty(_importIconMapper, IconType.GIF, function () {
47
+ return import(
48
+ /* webpackChunkName: "glyphGIF" */
49
+ '@atlaskit/icon-file-type/glyph/gif/16');
50
+ }), _defineProperty(_importIconMapper, IconType.GoogleDocs, function () {
51
+ return import(
52
+ /* webpackChunkName: "glyphGoogleDocs" */
53
+ '@atlaskit/icon-file-type/glyph/google-doc/16');
54
+ }), _defineProperty(_importIconMapper, IconType.GoogleForms, function () {
55
+ return import(
56
+ /* webpackChunkName: "glyphGoogleForms" */
57
+ '@atlaskit/icon-file-type/glyph/google-form/16');
58
+ }), _defineProperty(_importIconMapper, IconType.GoogleSheets, function () {
59
+ return import(
60
+ /* webpackChunkName: "glyphGoogleSheets" */
61
+ '@atlaskit/icon-file-type/glyph/google-sheet/16');
62
+ }), _defineProperty(_importIconMapper, IconType.GoogleSlides, function () {
63
+ return import(
64
+ /* webpackChunkName: "glyphGoogleSlides" */
65
+ '@atlaskit/icon-file-type/glyph/google-slide/16');
66
+ }), _defineProperty(_importIconMapper, IconType.Image, function () {
67
+ return import(
68
+ /* webpackChunkName: "glyphImage" */
69
+ '@atlaskit/icon-file-type/glyph/image/16');
70
+ }), _defineProperty(_importIconMapper, IconType.MSExcel, function () {
71
+ return import(
72
+ /* webpackChunkName: "glyphMSExcel" */
73
+ '@atlaskit/icon-file-type/glyph/excel-spreadsheet/16');
74
+ }), _defineProperty(_importIconMapper, IconType.MSPowerpoint, function () {
75
+ return import(
76
+ /* webpackChunkName: "glyphMSPowerpoint" */
77
+ '@atlaskit/icon-file-type/glyph/powerpoint-presentation/16');
78
+ }), _defineProperty(_importIconMapper, IconType.MSWord, function () {
79
+ return import(
80
+ /* webpackChunkName: "glyphMSWord" */
81
+ '@atlaskit/icon-file-type/glyph/word-document/16');
82
+ }), _defineProperty(_importIconMapper, IconType.PDF, function () {
83
+ return import(
84
+ /* webpackChunkName: "glyphPDF" */
85
+ '@atlaskit/icon-file-type/glyph/pdf-document/16');
86
+ }), _defineProperty(_importIconMapper, IconType.Presentation, function () {
87
+ return import(
88
+ /* webpackChunkName: "glyphPresentation" */
89
+ '@atlaskit/icon-file-type/glyph/presentation/16');
90
+ }), _defineProperty(_importIconMapper, IconType.Sketch, function () {
91
+ return import(
92
+ /* webpackChunkName: "glyphSketch" */
93
+ '@atlaskit/icon-file-type/glyph/sketch/16');
94
+ }), _defineProperty(_importIconMapper, IconType.Spreadsheet, function () {
95
+ return import(
96
+ /* webpackChunkName: "glyphSpreadsheet" */
97
+ '@atlaskit/icon-file-type/glyph/spreadsheet/16');
98
+ }), _defineProperty(_importIconMapper, IconType.Template, function () {
99
+ return import(
100
+ /* webpackChunkName: "glyphTemplate" */
101
+ '@atlaskit/icon/glyph/document-filled');
102
+ }), _defineProperty(_importIconMapper, IconType.Video, function () {
103
+ return import(
104
+ /* webpackChunkName: "glyphVideo" */
105
+ '@atlaskit/icon-file-type/glyph/video/16');
106
+ }), _defineProperty(_importIconMapper, IconType.Branch, function () {
107
+ return import(
108
+ /* webpackChunkName: "glyphBranch" */
109
+ '@atlaskit/icon-object/glyph/branch/16');
110
+ }), _defineProperty(_importIconMapper, IconType.Commit, function () {
111
+ return import(
112
+ /* webpackChunkName: "glyphCommit" */
113
+ '@atlaskit/icon-object/glyph/commit/16');
114
+ }), _defineProperty(_importIconMapper, IconType.Project, function () {
115
+ return import(
116
+ /* webpackChunkName: "glyphProject" */
117
+ '@atlaskit/icon/glyph/people-group');
118
+ }), _defineProperty(_importIconMapper, IconType.PullRequest, function () {
119
+ return import(
120
+ /* webpackChunkName: "glyphPullRequest" */
121
+ '@atlaskit/icon-object/glyph/pull-request/16');
122
+ }), _defineProperty(_importIconMapper, IconType.Repo, function () {
123
+ return import(
124
+ /* webpackChunkName: "glyphRepo" */
125
+ '@atlaskit/icon-object/glyph/code/16');
126
+ }), _defineProperty(_importIconMapper, IconType.Bug, function () {
127
+ return import(
128
+ /* webpackChunkName: "glyphBug" */
129
+ '@atlaskit/icon-object/glyph/bug/16');
130
+ }), _defineProperty(_importIconMapper, IconType.Change, function () {
131
+ return import(
132
+ /* webpackChunkName: "glyphChange" */
133
+ '@atlaskit/icon-object/glyph/changes/16');
134
+ }), _defineProperty(_importIconMapper, IconType.Epic, function () {
135
+ return import(
136
+ /* webpackChunkName: "glyphEpic" */
137
+ '@atlaskit/icon-object/glyph/epic/16');
138
+ }), _defineProperty(_importIconMapper, IconType.Incident, function () {
139
+ return import(
140
+ /* webpackChunkName: "glyphIncident" */
141
+ '@atlaskit/icon-object/glyph/incident/16');
142
+ }), _defineProperty(_importIconMapper, IconType.Problem, function () {
143
+ return import(
144
+ /* webpackChunkName: "glyphProblem" */
145
+ '@atlaskit/icon-object/glyph/problem/16');
146
+ }), _defineProperty(_importIconMapper, IconType.ServiceRequest, function () {
147
+ return import(
148
+ /* webpackChunkName: "glyphServiceRequest" */
149
+ '@atlaskit/icon-object/glyph/issue/16');
150
+ }), _defineProperty(_importIconMapper, IconType.Story, function () {
151
+ return import(
152
+ /* webpackChunkName: "glyphStory" */
153
+ '@atlaskit/icon-object/glyph/story/16');
154
+ }), _defineProperty(_importIconMapper, IconType.SubTask, function () {
155
+ return import(
156
+ /* webpackChunkName: "glyphSubTask" */
157
+ '@atlaskit/icon-object/glyph/subtask/16');
158
+ }), _defineProperty(_importIconMapper, IconType.Task, function () {
159
+ return import(
160
+ /* webpackChunkName: "glyphTask" */
161
+ '@atlaskit/icon-object/glyph/task/16');
162
+ }), _defineProperty(_importIconMapper, IconType.Confluence, function () {
163
+ return import(
164
+ /* webpackChunkName: "glyphConfluence" */
165
+ '@atlaskit/logo/confluence-icon').then(function (_ref) {
166
+ var ConfluenceIcon = _ref.ConfluenceIcon;
167
+ return {
168
+ default: ConfluenceIcon
169
+ };
170
+ });
171
+ }), _defineProperty(_importIconMapper, IconType.Jira, function () {
172
+ return import(
173
+ /* webpackChunkName: "glyphJira" */
174
+ '@atlaskit/logo/jira-icon').then(function (_ref2) {
175
+ var JiraIcon = _ref2.JiraIcon;
176
+ return {
177
+ default: JiraIcon
178
+ };
179
+ });
180
+ }), _importIconMapper);
181
+
182
+ var getIconImportFn = function getIconImportFn(icon) {
183
+ return importIconMapper[icon];
184
+ };
185
+
186
+ var importIcon = function importIcon(importFn) {
187
+ return Loadable({
188
+ loader: function loader() {
189
+ return importFn().then(function (module) {
190
+ return module.default;
191
+ });
192
+ },
193
+ loading: function loading() {
194
+ return null;
195
+ }
196
+ }); // Because we're using dynamic loading here, TS will not be able to infer the type.
197
+ };
198
+
199
+ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
200
+ var icon = _ref3.icon,
201
+ label = _ref3.label,
202
+ testId = _ref3.testId;
203
+ var importFn = getIconImportFn(icon);
204
+
205
+ if (!importFn) {
206
+ return null;
207
+ }
208
+
209
+ var ImportedIcon = importIcon(importFn); // Logo component has a different prop set from other icon components
210
+ // and yet to support the token system.
211
+
212
+ var importedIcon = icon === IconType.Confluence || icon === IconType.Jira ? /*#__PURE__*/React.createElement(ImportedIcon, {
213
+ textColor: N700,
214
+ iconColor: B200,
215
+ iconGradientStart: B400,
216
+ iconGradientStop: B200
217
+ }) : /*#__PURE__*/React.createElement(ImportedIcon, {
218
+ label: label,
219
+ testId: testId
220
+ });
221
+ return importedIcon;
222
+ };
223
+
224
+ export default AtlaskitIcon;
@@ -0,0 +1,20 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/core';
4
+ import ImageLoader from 'react-render-image';
5
+
6
+ var ImageIcon = function ImageIcon(_ref) {
7
+ var defaultIcon = _ref.defaultIcon,
8
+ testId = _ref.testId,
9
+ url = _ref.url;
10
+ return jsx(ImageLoader, {
11
+ src: url,
12
+ loaded: jsx("img", {
13
+ src: url,
14
+ "data-testid": "".concat(testId, "-image")
15
+ }),
16
+ errored: defaultIcon
17
+ });
18
+ };
19
+
20
+ export default ImageIcon;
@@ -0,0 +1,124 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ /** @jsx jsx */
8
+ import React, { useMemo } from 'react';
9
+ import LinkIcon from '@atlaskit/icon/glyph/link';
10
+ import { css, jsx } from '@emotion/core';
11
+ import { SmartLinkSize } from '../../../../../constants';
12
+ import AtlaskitIcon from './atlaskit-icon';
13
+ import ImageIcon from './image-icon';
14
+
15
+ var getDimensionStyles = function getDimensionStyles(value) {
16
+ return {
17
+ maxHeight: value,
18
+ maxWidth: value,
19
+ minHeight: value,
20
+ minWidth: value,
21
+ height: value,
22
+ width: value
23
+ };
24
+ };
25
+
26
+ var getSizeStyles = function getSizeStyles(size) {
27
+ switch (size) {
28
+ case SmartLinkSize.XLarge:
29
+ return getDimensionStyles('1.75rem');
30
+
31
+ case SmartLinkSize.Large:
32
+ return getDimensionStyles('1.5rem');
33
+
34
+ case SmartLinkSize.Medium:
35
+ return getDimensionStyles('1rem');
36
+
37
+ case SmartLinkSize.Small:
38
+ default:
39
+ return getDimensionStyles('.75rem');
40
+ }
41
+ };
42
+
43
+ var getMargin = function getMargin(size) {
44
+ switch (size) {
45
+ case SmartLinkSize.XLarge:
46
+ return '0.12em 0 0 0';
47
+
48
+ case SmartLinkSize.Large:
49
+ return '0';
50
+
51
+ case SmartLinkSize.Medium:
52
+ return '0';
53
+
54
+ case SmartLinkSize.Small:
55
+ default:
56
+ return '-.05em 0 0 0';
57
+ }
58
+ };
59
+
60
+ var getIconStyles = function getIconStyles(size) {
61
+ var styles = getSizeStyles(size);
62
+ return css(_objectSpread(_objectSpread({
63
+ flex: '0 0 auto',
64
+ alignSelf: 'flex-start',
65
+ margin: getMargin(size)
66
+ }, styles), {}, {
67
+ '[class$="-Icon"],[class$="-Wrapper"]': _objectSpread(_objectSpread({}, styles), {}, {
68
+ '> svg': _objectSpread(_objectSpread({}, styles), {}, {
69
+ padding: 0
70
+ })
71
+ }),
72
+ '& > img': styles
73
+ }));
74
+ };
75
+
76
+ var renderAtlaskitIcon = function renderAtlaskitIcon(icon, label, testId) {
77
+ if (icon) {
78
+ return jsx(AtlaskitIcon, {
79
+ icon: icon,
80
+ label: label,
81
+ testId: "".concat(testId, "-icon")
82
+ });
83
+ }
84
+ };
85
+
86
+ var renderDefaultIcon = function renderDefaultIcon(label, testId) {
87
+ return jsx(LinkIcon, {
88
+ label: label,
89
+ testId: "".concat(testId, "-default")
90
+ });
91
+ };
92
+
93
+ var renderImageIcon = function renderImageIcon(defaultIcon, icon, url, testId) {
94
+ if (url) {
95
+ return jsx(ImageIcon, {
96
+ defaultIcon: defaultIcon,
97
+ testId: testId,
98
+ url: url
99
+ });
100
+ }
101
+ };
102
+
103
+ var Icon = function Icon(_ref) {
104
+ var icon = _ref.icon,
105
+ _ref$label = _ref.label,
106
+ label = _ref$label === void 0 ? 'Link' : _ref$label,
107
+ _ref$size = _ref.size,
108
+ size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
109
+ _ref$testId = _ref.testId,
110
+ testId = _ref$testId === void 0 ? 'smart-element-icon' : _ref$testId,
111
+ url = _ref.url;
112
+ var element = useMemo(function () {
113
+ var defaultIcon = renderDefaultIcon(label, testId);
114
+ return renderImageIcon(defaultIcon, icon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
115
+ }, [icon, label, testId, url]);
116
+ var styles = getIconStyles(size);
117
+ return jsx("div", {
118
+ css: styles,
119
+ "data-smart-element-icon": true,
120
+ "data-testid": testId
121
+ }, element);
122
+ };
123
+
124
+ export default Icon;
@@ -0,0 +1,120 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ /** @jsx jsx */
8
+ import React from 'react';
9
+ import { B400, N800, N900, B500 } from '@atlaskit/theme/colors';
10
+ import { h200, h400, h600, h800 } from '@atlaskit/theme/typography';
11
+ import { token } from '@atlaskit/tokens';
12
+ import { css, jsx } from '@emotion/core';
13
+ import { SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
14
+ var DEFAULT_MAX_LINES = 2;
15
+ var MAXIMUM_MAX_LINES = 2;
16
+ var MINIMUM_MAX_LINES = 1;
17
+
18
+ var getSizeStyles = function getSizeStyles(size) {
19
+ var overrides = {
20
+ marginTop: 'unset'
21
+ };
22
+
23
+ switch (size) {
24
+ case SmartLinkSize.XLarge:
25
+ return _objectSpread(_objectSpread({}, h800()), overrides);
26
+
27
+ case SmartLinkSize.Large:
28
+ return _objectSpread(_objectSpread({}, h600()), overrides);
29
+
30
+ case SmartLinkSize.Medium:
31
+ return _objectSpread(_objectSpread({}, h400()), overrides);
32
+
33
+ case SmartLinkSize.Small:
34
+ default:
35
+ return _objectSpread(_objectSpread({}, h200()), overrides);
36
+ }
37
+ };
38
+
39
+ var getThemeStyles = function getThemeStyles(theme) {
40
+ switch (theme) {
41
+ case SmartLinkTheme.Black:
42
+ return {
43
+ color: token('color.text.subtle', N800),
44
+ fontWeight: 500,
45
+ ':active': {
46
+ color: token('color.text', N900)
47
+ },
48
+ ':hover': {
49
+ color: token('color.text.subtle', N800),
50
+ textDecoration: 'underline'
51
+ }
52
+ };
53
+
54
+ case SmartLinkTheme.Link:
55
+ default:
56
+ return {
57
+ color: token('color.link', B400),
58
+ ':active': {
59
+ color: token('color.link.pressed', B500)
60
+ },
61
+ ':hover': {
62
+ color: token('color.link', B400),
63
+ textDecoration: 'underline'
64
+ }
65
+ };
66
+ }
67
+ };
68
+
69
+ var getTruncateStyles = function getTruncateStyles(maxLines) {
70
+ var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
71
+ return {
72
+ display: '-webkit-box',
73
+ flex: '1 1 auto',
74
+ overflow: 'hidden',
75
+ textOverflow: 'ellipsis',
76
+ wordBreak: 'break-word',
77
+ WebkitLineClamp: maxLines,
78
+ WebkitBoxOrient: 'vertical',
79
+ // Fallback options.
80
+ maxHeight: "".concat((maxLines * lineHeight).toFixed(3), "em")
81
+ };
82
+ };
83
+
84
+ var getStyles = function getStyles(size, theme, maxLines) {
85
+ var sizeStyles = getSizeStyles(size);
86
+ return css(_objectSpread(_objectSpread(_objectSpread({}, sizeStyles), getTruncateStyles(maxLines, sizeStyles === null || sizeStyles === void 0 ? void 0 : sizeStyles.lineHeight)), getThemeStyles(theme)));
87
+ };
88
+
89
+ var getMaxLines = function getMaxLines(maxLines) {
90
+ if (maxLines > MAXIMUM_MAX_LINES) {
91
+ return DEFAULT_MAX_LINES;
92
+ }
93
+
94
+ if (maxLines < MINIMUM_MAX_LINES) {
95
+ return MINIMUM_MAX_LINES;
96
+ }
97
+
98
+ return maxLines;
99
+ };
100
+
101
+ var Link = function Link(_ref) {
102
+ var _ref$maxLines = _ref.maxLines,
103
+ maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
104
+ _ref$size = _ref.size,
105
+ size = _ref$size === void 0 ? SmartLinkSize.Medium : _ref$size,
106
+ _ref$testId = _ref.testId,
107
+ testId = _ref$testId === void 0 ? 'smart-element-link' : _ref$testId,
108
+ text = _ref.text,
109
+ _ref$theme = _ref.theme,
110
+ theme = _ref$theme === void 0 ? SmartLinkTheme.Link : _ref$theme,
111
+ url = _ref.url;
112
+ return jsx("a", {
113
+ css: getStyles(size, theme, getMaxLines(maxLines)),
114
+ href: url,
115
+ "data-smart-element-link": true,
116
+ "data-testid": testId
117
+ }, text);
118
+ };
119
+
120
+ export default Link;
@@ -0,0 +1,56 @@
1
+ export declare enum SmartLinkDirection {
2
+ Horizontal = "Horizontal",
3
+ Vertical = "Vertical"
4
+ }
5
+ export declare enum SmartLinkSize {
6
+ XLarge = "xlarge",
7
+ Large = "large",
8
+ Medium = "medium",
9
+ Small = "small"
10
+ }
11
+ export declare enum SmartLinkTheme {
12
+ Black = "Black",
13
+ Link = "Link"
14
+ }
15
+ export declare enum IconType {
16
+ Archive = "FileType:Archive",
17
+ Audio = "FileType:Audio",
18
+ Blog = "FileType:Blog",
19
+ Code = "FileType:Code",
20
+ Document = "FileType:Document",
21
+ Executable = "FileType:Executable",
22
+ File = "FileType:File",
23
+ Folder = "FileType:Folder",
24
+ Generic = "FileType:Generic",
25
+ GIF = "FileType:GIF",
26
+ GoogleDocs = "FileType:GoogleDocs",
27
+ GoogleForms = "FileType:GoogleForms",
28
+ GoogleSheets = "FileType:GoogleSheets",
29
+ GoogleSlides = "FileType:GoogleSlides",
30
+ Image = "FileType.Image",
31
+ MSExcel = "FileType:Excel",
32
+ MSPowerpoint = "FileType:Powerpoint",
33
+ MSWord = "FileType:WordDocument",
34
+ PDF = "FileType:PDF",
35
+ Presentation = "FileType:Presentation",
36
+ Sketch = "FileType:Sketch",
37
+ Spreadsheet = "FileType:Spreadsheet",
38
+ Template = "FileType:Template",
39
+ Video = "FileType:Video",
40
+ Branch = "BitBucket:Branch",
41
+ Commit = "BitBucket:Commit",
42
+ Project = "BitBucket:Project",
43
+ PullRequest = "BitBucket:PullRequest",
44
+ Repo = "BitBucket:Repo",
45
+ Bug = "Jira:Bug",
46
+ Change = "Jira:Change",
47
+ Epic = "Jira:Epic",
48
+ Incident = "Jira:Incident",
49
+ Problem = "Jira:Problem",
50
+ ServiceRequest = "Jira:ServiceRequest",
51
+ Story = "Jira:Story",
52
+ SubTask = "Jira:SubTask",
53
+ Task = "Jira:Task",
54
+ Confluence = "Provider:Confluence",
55
+ Jira = "Provider:Jira"
56
+ }
@@ -3,6 +3,6 @@ import { AnalyticsHandler } from '../../utils/types';
3
3
  export interface ExtractBlockOpts {
4
4
  handleInvoke: InvokeHandler;
5
5
  handleAnalytics: AnalyticsHandler;
6
- definitionId?: string;
6
+ extensionKey?: string;
7
7
  testId?: string;
8
8
  }
@@ -2,4 +2,4 @@ import { BlockCardResolvedViewProps } from '@atlaskit/media-ui';
2
2
  import { JsonLd } from 'json-ld-types';
3
3
  import { InvokeHandler } from '../../../model/invoke-handler';
4
4
  import { AnalyticsHandler } from '../../../utils/types';
5
- export declare const extractPreviewAction: (definitionId: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: "web" | "mobile" | undefined) => import("@atlaskit/media-ui").ActionProps | undefined;
5
+ export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: "web" | "mobile" | undefined) => import("@atlaskit/media-ui").ActionProps | undefined;
@@ -0,0 +1,4 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ import { FlexibleUiDataContext } from '../../state/flexible-ui-context/types';
3
+ declare const extractFlexibleUiContext: (response?: JsonLd.Response<JsonLd.Data.BaseData> | undefined) => FlexibleUiDataContext | undefined;
4
+ export default extractFlexibleUiContext;
@@ -14,5 +14,5 @@ export { EmbedResizeMessageListener } from './view/EmbedCard/EmbedResizeMessageL
14
14
  export { embedHeaderHeight } from '@atlaskit/media-ui/embeds';
15
15
  export { SmartLinkEvents } from './utils/analytics/analytics';
16
16
  export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents';
17
- export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, } from '@atlaskit/media-ui/classNames';
17
+ export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName, } from '@atlaskit/media-ui/classNames';
18
18
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
@@ -1,5 +1,5 @@
1
1
  import { CustomData } from '@atlaskit/ufo';
2
- declare type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated';
2
+ declare type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated' | 'smart-link-action-invocation';
3
3
  export declare const startUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
4
4
  export declare const succeedUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
5
5
  export declare const failUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
@@ -2,12 +2,13 @@ import { AnalyticsHandler } from '../../utils/types';
2
2
  import { CardInnerAppearance } from '../../view/Card/types';
3
3
  import { CardType } from '../store/types';
4
4
  import { APIError } from '../../client/errors';
5
+ import { InvokeType } from '../../model/invoke-opts';
5
6
  export declare const useSmartLinkAnalytics: (dispatchAnalytics: AnalyticsHandler) => {
6
7
  ui: {
7
8
  authEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
8
9
  authAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
9
10
  cardClickedEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
10
- actionClickedEvent: (providerKey: string, actionType: string, display?: "inline" | "block" | "embed" | "preview" | undefined) => void;
11
+ actionClickedEvent: (id: string, extensionKey: string, actionType: string, display: CardInnerAppearance, invokeType: InvokeType) => void;
11
12
  closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
12
13
  renderSuccessEvent: (display: CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
13
14
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CardProviderProps } from './types';
2
3
  export declare function SmartCardProvider({ storeOptions, client: customClient, authFlow: customAuthFlow, children, renderers, }: CardProviderProps): JSX.Element;
3
4
  export type { CardProviderProps as ProviderProps };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { FlexibleUiDataContext } from './types';
3
+ export declare const FlexibleUiContext: import("react").Context<FlexibleUiDataContext | undefined>;
4
+ export declare const useFlexibleUiContext: () => FlexibleUiDataContext | undefined;
@@ -0,0 +1,3 @@
1
+ export declare type FlexibleUiDataContext = {
2
+ title?: string;
3
+ };
@@ -13,7 +13,7 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
13
13
  authEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
14
14
  authAlternateAccountEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
15
15
  cardClickedEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
16
- actionClickedEvent: (providerKey: string, actionType: string, display?: "inline" | "block" | "embed" | "preview" | undefined) => void;
16
+ actionClickedEvent: (id: string, extensionKey: string, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, invokeType: import("../../model/invoke-opts").InvokeType) => void;
17
17
  closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
18
18
  renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
19
19
  };