@atlaskit/smart-card 23.3.0 → 23.4.0

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 (418) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/cjs/constants.js +7 -2
  3. package/dist/cjs/extractors/common/actions/extractActions.js +3 -0
  4. package/dist/cjs/extractors/flexible/actions/extract-download-action.js +26 -0
  5. package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +36 -0
  6. package/dist/cjs/extractors/flexible/actions/extract-view-action.js +26 -0
  7. package/dist/cjs/extractors/flexible/index.js +9 -0
  8. package/dist/cjs/messages.js +15 -0
  9. package/dist/cjs/state/flexible-ui-context/index.js +15 -2
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/cjs/view/{BlockCard/utils → EmbedCard}/constants.js +4 -4
  12. package/dist/cjs/view/EmbedCard/views/ForbiddenView.js +1 -1
  13. package/dist/cjs/view/EmbedCard/views/NotFoundView.js +1 -1
  14. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +23 -5
  15. package/dist/cjs/view/EmbedCard/views/UnresolvedView.js +9 -5
  16. package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +110 -0
  17. package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/types.js +5 -0
  18. package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +167 -0
  19. package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/types.js +5 -0
  20. package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +92 -0
  21. package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/types.js +5 -0
  22. package/dist/cjs/view/FlexibleCard/components/actions/index.js +26 -2
  23. package/dist/cjs/view/FlexibleCard/components/actions/utils.js +51 -2
  24. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +19 -13
  25. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +9 -4
  26. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +1 -1
  27. package/dist/cjs/view/FlexibleCard/index.js +6 -3
  28. package/dist/cjs/view/common/Icon.js +25 -13
  29. package/dist/es2019/constants.js +5 -0
  30. package/dist/es2019/extractors/common/actions/extractActions.js +1 -2
  31. package/dist/es2019/extractors/flexible/actions/extract-download-action.js +13 -0
  32. package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +23 -0
  33. package/dist/es2019/extractors/flexible/actions/extract-view-action.js +13 -0
  34. package/dist/es2019/extractors/flexible/index.js +7 -1
  35. package/dist/es2019/messages.js +15 -0
  36. package/dist/es2019/state/flexible-ui-context/index.js +8 -1
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/es2019/view/{BlockCard/utils → EmbedCard}/constants.js +2 -2
  39. package/dist/es2019/view/EmbedCard/views/ForbiddenView.js +1 -1
  40. package/dist/es2019/view/EmbedCard/views/NotFoundView.js +1 -1
  41. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +19 -5
  42. package/dist/es2019/view/EmbedCard/views/UnresolvedView.js +9 -5
  43. package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +66 -0
  44. package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/types.js +1 -0
  45. package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +104 -0
  46. package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/types.js +1 -0
  47. package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +46 -0
  48. package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/types.js +1 -0
  49. package/dist/es2019/view/FlexibleCard/components/actions/index.js +23 -2
  50. package/dist/es2019/view/FlexibleCard/components/actions/utils.js +48 -2
  51. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +12 -9
  52. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +9 -4
  53. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +1 -1
  54. package/dist/es2019/view/FlexibleCard/index.js +7 -4
  55. package/dist/es2019/view/common/Icon.js +31 -13
  56. package/dist/esm/constants.js +5 -0
  57. package/dist/esm/extractors/common/actions/extractActions.js +1 -2
  58. package/dist/esm/extractors/flexible/actions/extract-download-action.js +15 -0
  59. package/dist/esm/extractors/flexible/actions/extract-preview-action.js +23 -0
  60. package/dist/esm/extractors/flexible/actions/extract-view-action.js +15 -0
  61. package/dist/esm/extractors/flexible/index.js +7 -1
  62. package/dist/esm/messages.js +15 -0
  63. package/dist/esm/state/flexible-ui-context/index.js +9 -0
  64. package/dist/esm/version.json +1 -1
  65. package/dist/esm/view/{BlockCard/utils → EmbedCard}/constants.js +2 -2
  66. package/dist/esm/view/EmbedCard/views/ForbiddenView.js +1 -1
  67. package/dist/esm/view/EmbedCard/views/NotFoundView.js +1 -1
  68. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +19 -5
  69. package/dist/esm/view/EmbedCard/views/UnresolvedView.js +9 -5
  70. package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +96 -0
  71. package/dist/esm/view/FlexibleCard/components/actions/action/download-action/types.js +1 -0
  72. package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +136 -0
  73. package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/types.js +1 -0
  74. package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +77 -0
  75. package/dist/esm/view/FlexibleCard/components/actions/action/view-action/types.js +1 -0
  76. package/dist/esm/view/FlexibleCard/components/actions/index.js +23 -2
  77. package/dist/esm/view/FlexibleCard/components/actions/utils.js +45 -2
  78. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +19 -13
  79. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +9 -4
  80. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +1 -1
  81. package/dist/esm/view/FlexibleCard/index.js +7 -4
  82. package/dist/esm/view/common/Icon.js +27 -13
  83. package/dist/types/constants.d.ts +4 -0
  84. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +112 -0
  85. package/dist/types/extractors/common/actions/extractActions.d.ts +1 -0
  86. package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +3 -0
  87. package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +3 -0
  88. package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +3 -0
  89. package/dist/types/messages.d.ts +1 -1
  90. package/dist/types/state/flexible-ui-context/index.d.ts +76 -0
  91. package/dist/types/state/flexible-ui-context/types.d.ts +32 -0
  92. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +2 -2
  93. package/dist/types/view/{BlockCard/utils → EmbedCard}/constants.d.ts +1 -1
  94. package/dist/types/view/EmbedCard/types.d.ts +1 -0
  95. package/dist/types/view/EmbedModal/index.d.ts +20 -2
  96. package/dist/types/view/EmbedModal/types.d.ts +1 -2
  97. package/dist/types/view/FlexibleCard/components/actions/action/download-action/index.d.ts +4 -0
  98. package/dist/types/view/FlexibleCard/components/actions/action/download-action/types.d.ts +8 -0
  99. package/dist/types/view/FlexibleCard/components/actions/action/preview-action/index.d.ts +5 -0
  100. package/dist/types/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +15 -0
  101. package/dist/types/view/FlexibleCard/components/actions/action/view-action/index.d.ts +5 -0
  102. package/dist/types/view/FlexibleCard/components/actions/action/view-action/types.d.ts +8 -0
  103. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +21 -0
  104. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +50 -3
  105. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -1
  106. package/dist/types/view/FlexibleCard/types.d.ts +6 -0
  107. package/dist/types/view/common/Icon.d.ts +2 -1
  108. package/package.json +2 -10
  109. package/report.api.md +30 -2
  110. package/tmp/api-report-tmp.d.ts +25 -3
  111. package/dist/types-ts4.0/__fixtures__/flexible-ui-data-context.d.ts +0 -3
  112. package/dist/types-ts4.0/__tests_external__/index.d.ts +0 -6
  113. package/dist/types-ts4.0/__tests_external__/page-objects/BaseCard.d.ts +0 -16
  114. package/dist/types-ts4.0/__tests_external__/page-objects/BlockCard.d.ts +0 -6
  115. package/dist/types-ts4.0/__tests_external__/page-objects/EmbedCard.d.ts +0 -6
  116. package/dist/types-ts4.0/__tests_external__/page-objects/InlineCard.d.ts +0 -6
  117. package/dist/types-ts4.0/__tests_external__/test-cases/card.d.ts +0 -3
  118. package/dist/types-ts4.0/__tests_external__/test-cases/embed.d.ts +0 -3
  119. package/dist/types-ts4.0/__tests_external__/test-cases/inline.d.ts +0 -3
  120. package/dist/types-ts4.0/__tests_external__/test-cases/types.d.ts +0 -5
  121. package/dist/types-ts4.0/classNames.d.ts +0 -11
  122. package/dist/types-ts4.0/client/index.d.ts +0 -1
  123. package/dist/types-ts4.0/constants.d.ts +0 -187
  124. package/dist/types-ts4.0/extractors/block/index.d.ts +0 -9
  125. package/dist/types-ts4.0/extractors/block/types.d.ts +0 -12
  126. package/dist/types-ts4.0/extractors/common/__mocks__/jsonld.d.ts +0 -234
  127. package/dist/types-ts4.0/extractors/common/__mocks__/render.d.ts +0 -2
  128. package/dist/types-ts4.0/extractors/common/actions/extractActions.d.ts +0 -4
  129. package/dist/types-ts4.0/extractors/common/actions/extractPreviewAction.d.ts +0 -9
  130. package/dist/types-ts4.0/extractors/common/byline/extractByline.d.ts +0 -3
  131. package/dist/types-ts4.0/extractors/common/context/extractAccessContext.d.ts +0 -7
  132. package/dist/types-ts4.0/extractors/common/context/index.d.ts +0 -1
  133. package/dist/types-ts4.0/extractors/common/detail/extractAttachmentCount.d.ts +0 -4
  134. package/dist/types-ts4.0/extractors/common/detail/extractCommentCount.d.ts +0 -4
  135. package/dist/types-ts4.0/extractors/common/detail/extractDownloadUrl.d.ts +0 -2
  136. package/dist/types-ts4.0/extractors/common/detail/extractProgrammingLanguage.d.ts +0 -4
  137. package/dist/types-ts4.0/extractors/common/detail/extractSubscriberCount.d.ts +0 -4
  138. package/dist/types-ts4.0/extractors/common/detail/index.d.ts +0 -9
  139. package/dist/types-ts4.0/extractors/common/detail/types.d.ts +0 -5
  140. package/dist/types-ts4.0/extractors/common/icon/extractFileFormat.d.ts +0 -2
  141. package/dist/types-ts4.0/extractors/common/icon/extractIcon.d.ts +0 -14
  142. package/dist/types-ts4.0/extractors/common/icon/extractIconFromDocument.d.ts +0 -4
  143. package/dist/types-ts4.0/extractors/common/icon/extractIconFromTask.d.ts +0 -3
  144. package/dist/types-ts4.0/extractors/common/icon/index.d.ts +0 -4
  145. package/dist/types-ts4.0/extractors/common/icon/priority.d.ts +0 -4
  146. package/dist/types-ts4.0/extractors/common/lozenge/extractLozenge.d.ts +0 -3
  147. package/dist/types-ts4.0/extractors/common/lozenge/extractState.d.ts +0 -3
  148. package/dist/types-ts4.0/extractors/common/lozenge/extractTag.d.ts +0 -3
  149. package/dist/types-ts4.0/extractors/common/lozenge/extractTaskStatus.d.ts +0 -3
  150. package/dist/types-ts4.0/extractors/common/lozenge/extractTaskType.d.ts +0 -7
  151. package/dist/types-ts4.0/extractors/common/lozenge/index.d.ts +0 -5
  152. package/dist/types-ts4.0/extractors/common/lozenge/types.d.ts +0 -8
  153. package/dist/types-ts4.0/extractors/common/lozenge/utils.d.ts +0 -4
  154. package/dist/types-ts4.0/extractors/common/meta/extractIsTrusted.d.ts +0 -2
  155. package/dist/types-ts4.0/extractors/common/primitives/extractSummary.d.ts +0 -2
  156. package/dist/types-ts4.0/extractors/common/primitives/extractTitleTextColor.d.ts +0 -2
  157. package/dist/types-ts4.0/extractors/common/primitives/extractVisitUrl.d.ts +0 -2
  158. package/dist/types-ts4.0/extractors/common/primitives/index.d.ts +0 -2
  159. package/dist/types-ts4.0/extractors/common/title-prefix/extractTitlePrefix.d.ts +0 -5
  160. package/dist/types-ts4.0/extractors/common/title-prefix/index.d.ts +0 -1
  161. package/dist/types-ts4.0/extractors/constants.d.ts +0 -12
  162. package/dist/types-ts4.0/extractors/embed/index.d.ts +0 -3
  163. package/dist/types-ts4.0/extractors/flexible/collaboratorGroup/index.d.ts +0 -4
  164. package/dist/types-ts4.0/extractors/flexible/extract-preview.d.ts +0 -4
  165. package/dist/types-ts4.0/extractors/flexible/extract-priority.d.ts +0 -4
  166. package/dist/types-ts4.0/extractors/flexible/icon/extract-document-type-icon.d.ts +0 -3
  167. package/dist/types-ts4.0/extractors/flexible/icon/extract-file-formatIcon.d.ts +0 -3
  168. package/dist/types-ts4.0/extractors/flexible/icon/extract-icon-renderer.d.ts +0 -4
  169. package/dist/types-ts4.0/extractors/flexible/icon/extract-jira-task-icon.d.ts +0 -3
  170. package/dist/types-ts4.0/extractors/flexible/icon/extract-jsonld-data-icon.d.ts +0 -4
  171. package/dist/types-ts4.0/extractors/flexible/icon/extract-provider-icon.d.ts +0 -4
  172. package/dist/types-ts4.0/extractors/flexible/icon/extract-url-icon.d.ts +0 -4
  173. package/dist/types-ts4.0/extractors/flexible/icon/index.d.ts +0 -17
  174. package/dist/types-ts4.0/extractors/flexible/icon/types.d.ts +0 -6
  175. package/dist/types-ts4.0/extractors/flexible/index.d.ts +0 -5
  176. package/dist/types-ts4.0/extractors/flexible/latest-commit/index.d.ts +0 -2
  177. package/dist/types-ts4.0/extractors/flexible/utils.d.ts +0 -13
  178. package/dist/types-ts4.0/extractors/hover/extractMetadata.d.ts +0 -3
  179. package/dist/types-ts4.0/extractors/index.d.ts +0 -14
  180. package/dist/types-ts4.0/extractors/inline/index.d.ts +0 -6
  181. package/dist/types-ts4.0/hooks.d.ts +0 -2
  182. package/dist/types-ts4.0/i18n/cs.d.ts +0 -71
  183. package/dist/types-ts4.0/i18n/da.d.ts +0 -71
  184. package/dist/types-ts4.0/i18n/de.d.ts +0 -71
  185. package/dist/types-ts4.0/i18n/en.d.ts +0 -71
  186. package/dist/types-ts4.0/i18n/en_GB.d.ts +0 -71
  187. package/dist/types-ts4.0/i18n/en_ZZ.d.ts +0 -38
  188. package/dist/types-ts4.0/i18n/es.d.ts +0 -71
  189. package/dist/types-ts4.0/i18n/et.d.ts +0 -94
  190. package/dist/types-ts4.0/i18n/fi.d.ts +0 -71
  191. package/dist/types-ts4.0/i18n/fr.d.ts +0 -71
  192. package/dist/types-ts4.0/i18n/hu.d.ts +0 -71
  193. package/dist/types-ts4.0/i18n/index.d.ts +0 -35
  194. package/dist/types-ts4.0/i18n/is.d.ts +0 -70
  195. package/dist/types-ts4.0/i18n/it.d.ts +0 -71
  196. package/dist/types-ts4.0/i18n/ja.d.ts +0 -71
  197. package/dist/types-ts4.0/i18n/ko.d.ts +0 -71
  198. package/dist/types-ts4.0/i18n/languages.d.ts +0 -27
  199. package/dist/types-ts4.0/i18n/nb.d.ts +0 -71
  200. package/dist/types-ts4.0/i18n/nl.d.ts +0 -71
  201. package/dist/types-ts4.0/i18n/pl.d.ts +0 -71
  202. package/dist/types-ts4.0/i18n/pt_BR.d.ts +0 -71
  203. package/dist/types-ts4.0/i18n/pt_PT.d.ts +0 -94
  204. package/dist/types-ts4.0/i18n/ro.d.ts +0 -70
  205. package/dist/types-ts4.0/i18n/ru.d.ts +0 -71
  206. package/dist/types-ts4.0/i18n/sk.d.ts +0 -94
  207. package/dist/types-ts4.0/i18n/sv.d.ts +0 -71
  208. package/dist/types-ts4.0/i18n/th.d.ts +0 -71
  209. package/dist/types-ts4.0/i18n/tr.d.ts +0 -71
  210. package/dist/types-ts4.0/i18n/uk.d.ts +0 -71
  211. package/dist/types-ts4.0/i18n/vi.d.ts +0 -71
  212. package/dist/types-ts4.0/i18n/zh.d.ts +0 -71
  213. package/dist/types-ts4.0/i18n/zh_TW.d.ts +0 -71
  214. package/dist/types-ts4.0/in-product.d.ts +0 -1
  215. package/dist/types-ts4.0/index.d.ts +0 -22
  216. package/dist/types-ts4.0/messages.d.ts +0 -8
  217. package/dist/types-ts4.0/model/invoke-handler.d.ts +0 -3
  218. package/dist/types-ts4.0/model/invoke-opts.d.ts +0 -17
  219. package/dist/types-ts4.0/ssr.d.ts +0 -6
  220. package/dist/types-ts4.0/state/actions/constants.d.ts +0 -6
  221. package/dist/types-ts4.0/state/actions/index.d.ts +0 -12
  222. package/dist/types-ts4.0/state/actions/types.d.ts +0 -2
  223. package/dist/types-ts4.0/state/analytics/index.d.ts +0 -3
  224. package/dist/types-ts4.0/state/analytics/types.d.ts +0 -9
  225. package/dist/types-ts4.0/state/analytics/ufoExperiences.d.ts +0 -7
  226. package/dist/types-ts4.0/state/analytics/useSmartLinkAnalytics.d.ts +0 -195
  227. package/dist/types-ts4.0/state/config/index.d.ts +0 -2
  228. package/dist/types-ts4.0/state/flexible-ui-context/index.d.ts +0 -8
  229. package/dist/types-ts4.0/state/flexible-ui-context/types.d.ts +0 -165
  230. package/dist/types-ts4.0/state/helpers.d.ts +0 -16
  231. package/dist/types-ts4.0/state/hooks/index.d.ts +0 -2
  232. package/dist/types-ts4.0/state/hooks/usePrefetch.d.ts +0 -1
  233. package/dist/types-ts4.0/state/hooks/useSmartLink.d.ts +0 -50
  234. package/dist/types-ts4.0/state/hooks-external/useSmartLinkActions.d.ts +0 -49
  235. package/dist/types-ts4.0/state/hooks-external/useSmartLinkReload.d.ts +0 -19
  236. package/dist/types-ts4.0/state/index.d.ts +0 -5
  237. package/dist/types-ts4.0/state/reducers/types.d.ts +0 -4
  238. package/dist/types-ts4.0/state/renderers/index.d.ts +0 -2
  239. package/dist/types-ts4.0/state/store/index.d.ts +0 -3
  240. package/dist/types-ts4.0/state/types.d.ts +0 -1
  241. package/dist/types-ts4.0/types.d.ts +0 -20
  242. package/dist/types-ts4.0/utils/analytics/__mocks__/analytics.d.ts +0 -2
  243. package/dist/types-ts4.0/utils/analytics/analytics.d.ts +0 -32
  244. package/dist/types-ts4.0/utils/analytics/index.d.ts +0 -4
  245. package/dist/types-ts4.0/utils/analytics/types.d.ts +0 -93
  246. package/dist/types-ts4.0/utils/flexible.d.ts +0 -5
  247. package/dist/types-ts4.0/utils/index.d.ts +0 -12
  248. package/dist/types-ts4.0/utils/jsonld.d.ts +0 -3
  249. package/dist/types-ts4.0/utils/mocks.d.ts +0 -75
  250. package/dist/types-ts4.0/utils/performance.d.ts +0 -8
  251. package/dist/types-ts4.0/utils/test-utils.d.ts +0 -4
  252. package/dist/types-ts4.0/utils/token.d.ts +0 -16
  253. package/dist/types-ts4.0/utils/types.d.ts +0 -14
  254. package/dist/types-ts4.0/view/BlockCard/actions/AuthorizeAction.d.ts +0 -2
  255. package/dist/types-ts4.0/view/BlockCard/actions/DownloadAction.d.ts +0 -8
  256. package/dist/types-ts4.0/view/BlockCard/actions/ForbiddenAction.d.ts +0 -2
  257. package/dist/types-ts4.0/view/BlockCard/actions/PreviewAction.d.ts +0 -30
  258. package/dist/types-ts4.0/view/BlockCard/actions/RetryAction.d.ts +0 -2
  259. package/dist/types-ts4.0/view/BlockCard/actions/ViewAction.d.ts +0 -8
  260. package/dist/types-ts4.0/view/BlockCard/components/Action.d.ts +0 -13
  261. package/dist/types-ts4.0/view/BlockCard/components/ActionIcon.d.ts +0 -12
  262. package/dist/types-ts4.0/view/BlockCard/components/ActionList.d.ts +0 -7
  263. package/dist/types-ts4.0/view/BlockCard/components/CollaboratorList.d.ts +0 -15
  264. package/dist/types-ts4.0/view/BlockCard/components/Content.d.ts +0 -9
  265. package/dist/types-ts4.0/view/BlockCard/components/ContentFooter.d.ts +0 -9
  266. package/dist/types-ts4.0/view/BlockCard/components/ContentHeader.d.ts +0 -10
  267. package/dist/types-ts4.0/view/BlockCard/components/Emoji.d.ts +0 -7
  268. package/dist/types-ts4.0/view/BlockCard/components/Frame.d.ts +0 -16
  269. package/dist/types-ts4.0/view/BlockCard/components/Link.d.ts +0 -8
  270. package/dist/types-ts4.0/view/BlockCard/components/Name.d.ts +0 -12
  271. package/dist/types-ts4.0/view/BlockCard/components/Provider.d.ts +0 -8
  272. package/dist/types-ts4.0/view/BlockCard/components/Thumbnail.d.ts +0 -10
  273. package/dist/types-ts4.0/view/BlockCard/components/UnresolvedText.d.ts +0 -8
  274. package/dist/types-ts4.0/view/BlockCard/index.d.ts +0 -14
  275. package/dist/types-ts4.0/view/BlockCard/types.d.ts +0 -25
  276. package/dist/types-ts4.0/view/BlockCard/utils/constants.d.ts +0 -3
  277. package/dist/types-ts4.0/view/BlockCard/utils/handlers.d.ts +0 -2
  278. package/dist/types-ts4.0/view/BlockCard/views/ErroredView.d.ts +0 -14
  279. package/dist/types-ts4.0/view/BlockCard/views/ForbiddenView.d.ts +0 -23
  280. package/dist/types-ts4.0/view/BlockCard/views/NotFoundView.d.ts +0 -17
  281. package/dist/types-ts4.0/view/BlockCard/views/ResolvedView.d.ts +0 -34
  282. package/dist/types-ts4.0/view/BlockCard/views/ResolvingView.d.ts +0 -9
  283. package/dist/types-ts4.0/view/BlockCard/views/UnauthorizedView.d.ts +0 -19
  284. package/dist/types-ts4.0/view/Card/index.d.ts +0 -5
  285. package/dist/types-ts4.0/view/Card/types.d.ts +0 -37
  286. package/dist/types-ts4.0/view/CardWithData/component.d.ts +0 -5
  287. package/dist/types-ts4.0/view/CardWithData/loader.d.ts +0 -9
  288. package/dist/types-ts4.0/view/CardWithData/types.d.ts +0 -15
  289. package/dist/types-ts4.0/view/CardWithUrl/component-lazy/LazyFallback.d.ts +0 -4
  290. package/dist/types-ts4.0/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.d.ts +0 -3
  291. package/dist/types-ts4.0/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.d.ts +0 -3
  292. package/dist/types-ts4.0/view/CardWithUrl/component-lazy/index.d.ts +0 -3
  293. package/dist/types-ts4.0/view/CardWithUrl/component.d.ts +0 -3
  294. package/dist/types-ts4.0/view/CardWithUrl/loader.d.ts +0 -3
  295. package/dist/types-ts4.0/view/CardWithUrl/types.d.ts +0 -29
  296. package/dist/types-ts4.0/view/EmbedCard/EmbedResizeMessageListener.d.ts +0 -15
  297. package/dist/types-ts4.0/view/EmbedCard/components/ExpandedFrame.d.ts +0 -23
  298. package/dist/types-ts4.0/view/EmbedCard/components/Frame.d.ts +0 -7
  299. package/dist/types-ts4.0/view/EmbedCard/components/ImageIcon.d.ts +0 -9
  300. package/dist/types-ts4.0/view/EmbedCard/components/styled.d.ts +0 -45
  301. package/dist/types-ts4.0/view/EmbedCard/index.d.ts +0 -3
  302. package/dist/types-ts4.0/view/EmbedCard/types.d.ts +0 -46
  303. package/dist/types-ts4.0/view/EmbedCard/views/ErroredView.d.ts +0 -9
  304. package/dist/types-ts4.0/view/EmbedCard/views/ForbiddenView.d.ts +0 -13
  305. package/dist/types-ts4.0/view/EmbedCard/views/NotFoundView.d.ts +0 -11
  306. package/dist/types-ts4.0/view/EmbedCard/views/ResolvedView.d.ts +0 -27
  307. package/dist/types-ts4.0/view/EmbedCard/views/UnauthorisedView.d.ts +0 -12
  308. package/dist/types-ts4.0/view/EmbedCard/views/UnresolvedView.d.ts +0 -18
  309. package/dist/types-ts4.0/view/EmbedModal/components/analytics/index.d.ts +0 -5
  310. package/dist/types-ts4.0/view/EmbedModal/components/analytics/types.d.ts +0 -6
  311. package/dist/types-ts4.0/view/EmbedModal/components/embed-content/index.d.ts +0 -5
  312. package/dist/types-ts4.0/view/EmbedModal/components/embed-content/types.d.ts +0 -6
  313. package/dist/types-ts4.0/view/EmbedModal/components/error-boundary/index.d.ts +0 -4
  314. package/dist/types-ts4.0/view/EmbedModal/components/link-info/index.d.ts +0 -4
  315. package/dist/types-ts4.0/view/EmbedModal/components/link-info/link-info-button/index.d.ts +0 -4
  316. package/dist/types-ts4.0/view/EmbedModal/components/link-info/link-info-button/types.d.ts +0 -9
  317. package/dist/types-ts4.0/view/EmbedModal/components/link-info/styled.d.ts +0 -4
  318. package/dist/types-ts4.0/view/EmbedModal/components/link-info/types.d.ts +0 -13
  319. package/dist/types-ts4.0/view/EmbedModal/constants.d.ts +0 -2
  320. package/dist/types-ts4.0/view/EmbedModal/index.d.ts +0 -4
  321. package/dist/types-ts4.0/view/EmbedModal/types.d.ts +0 -31
  322. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-button/index.d.ts +0 -5
  323. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-button/types.d.ts +0 -8
  324. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-dropdown-item/index.d.ts +0 -4
  325. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-dropdown-item/types.d.ts +0 -8
  326. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-icon/index.d.ts +0 -5
  327. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +0 -7
  328. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/index.d.ts +0 -13
  329. package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/types.d.ts +0 -48
  330. package/dist/types-ts4.0/view/FlexibleCard/components/actions/index.d.ts +0 -20
  331. package/dist/types-ts4.0/view/FlexibleCard/components/actions/utils.d.ts +0 -4
  332. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/action-group/index.d.ts +0 -11
  333. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/action-group/types.d.ts +0 -37
  334. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/block/index.d.ts +0 -12
  335. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/element-group/index.d.ts +0 -15
  336. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/element-group/types.d.ts +0 -10
  337. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/footer-block/index.d.ts +0 -11
  338. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/footer-block/types.d.ts +0 -10
  339. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/index.d.ts +0 -5
  340. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +0 -11
  341. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/metadata-block/types.d.ts +0 -26
  342. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/preview-block/index.d.ts +0 -10
  343. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/preview-block/types.d.ts +0 -8
  344. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +0 -10
  345. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +0 -8
  346. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +0 -12
  347. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/index.d.ts +0 -16
  348. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +0 -9
  349. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +0 -11
  350. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/types.d.ts +0 -92
  351. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/types.d.ts +0 -300
  352. package/dist/types-ts4.0/view/FlexibleCard/components/blocks/utils.d.ts +0 -13
  353. package/dist/types-ts4.0/view/FlexibleCard/components/common/atlaskit-icon/index.d.ts +0 -4
  354. package/dist/types-ts4.0/view/FlexibleCard/components/common/atlaskit-icon/types.d.ts +0 -6
  355. package/dist/types-ts4.0/view/FlexibleCard/components/common/image-icon/index.d.ts +0 -5
  356. package/dist/types-ts4.0/view/FlexibleCard/components/common/image-icon/types.d.ts +0 -7
  357. package/dist/types-ts4.0/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +0 -5
  358. package/dist/types-ts4.0/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +0 -16
  359. package/dist/types-ts4.0/view/FlexibleCard/components/container/index.d.ts +0 -16
  360. package/dist/types-ts4.0/view/FlexibleCard/components/container/layered-link/index.d.ts +0 -10
  361. package/dist/types-ts4.0/view/FlexibleCard/components/container/layered-link/types.d.ts +0 -12
  362. package/dist/types-ts4.0/view/FlexibleCard/components/container/types.d.ts +0 -25
  363. package/dist/types-ts4.0/view/FlexibleCard/components/elements/avatar-group/index.d.ts +0 -12
  364. package/dist/types-ts4.0/view/FlexibleCard/components/elements/avatar-group/types.d.ts +0 -21
  365. package/dist/types-ts4.0/view/FlexibleCard/components/elements/badge/index.d.ts +0 -18
  366. package/dist/types-ts4.0/view/FlexibleCard/components/elements/badge/types.d.ts +0 -17
  367. package/dist/types-ts4.0/view/FlexibleCard/components/elements/date-time/index.d.ts +0 -12
  368. package/dist/types-ts4.0/view/FlexibleCard/components/elements/date-time/types.d.ts +0 -16
  369. package/dist/types-ts4.0/view/FlexibleCard/components/elements/icon/index.d.ts +0 -11
  370. package/dist/types-ts4.0/view/FlexibleCard/components/elements/icon/types.d.ts +0 -27
  371. package/dist/types-ts4.0/view/FlexibleCard/components/elements/index.d.ts +0 -129
  372. package/dist/types-ts4.0/view/FlexibleCard/components/elements/link/index.d.ts +0 -11
  373. package/dist/types-ts4.0/view/FlexibleCard/components/elements/link/types.d.ts +0 -35
  374. package/dist/types-ts4.0/view/FlexibleCard/components/elements/lozenge/index.d.ts +0 -11
  375. package/dist/types-ts4.0/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -13
  376. package/dist/types-ts4.0/view/FlexibleCard/components/elements/media/index.d.ts +0 -11
  377. package/dist/types-ts4.0/view/FlexibleCard/components/elements/media/types.d.ts +0 -17
  378. package/dist/types-ts4.0/view/FlexibleCard/components/elements/text/index.d.ts +0 -11
  379. package/dist/types-ts4.0/view/FlexibleCard/components/elements/text/types.d.ts +0 -17
  380. package/dist/types-ts4.0/view/FlexibleCard/components/elements/types.d.ts +0 -24
  381. package/dist/types-ts4.0/view/FlexibleCard/components/elements/utils.d.ts +0 -3
  382. package/dist/types-ts4.0/view/FlexibleCard/components/types.d.ts +0 -6
  383. package/dist/types-ts4.0/view/FlexibleCard/components/utils.d.ts +0 -15
  384. package/dist/types-ts4.0/view/FlexibleCard/index.d.ts +0 -10
  385. package/dist/types-ts4.0/view/FlexibleCard/types.d.ts +0 -113
  386. package/dist/types-ts4.0/view/FlexibleCard/utils.d.ts +0 -7
  387. package/dist/types-ts4.0/view/HoverCard/components/HoverCardComponent.d.ts +0 -4
  388. package/dist/types-ts4.0/view/HoverCard/components/HoverCardContent.d.ts +0 -9
  389. package/dist/types-ts4.0/view/HoverCard/components/HoverCardLoadingView.d.ts +0 -4
  390. package/dist/types-ts4.0/view/HoverCard/components/SnippetOrPreview.d.ts +0 -4
  391. package/dist/types-ts4.0/view/HoverCard/index.d.ts +0 -3
  392. package/dist/types-ts4.0/view/HoverCard/styled.d.ts +0 -12
  393. package/dist/types-ts4.0/view/HoverCard/types.d.ts +0 -45
  394. package/dist/types-ts4.0/view/HoverCard/utils.d.ts +0 -3
  395. package/dist/types-ts4.0/view/InlineCard/ErroredView/index.d.ts +0 -21
  396. package/dist/types-ts4.0/view/InlineCard/ForbiddenView/index.d.ts +0 -25
  397. package/dist/types-ts4.0/view/InlineCard/Frame/index.d.ts +0 -16
  398. package/dist/types-ts4.0/view/InlineCard/Frame/styled.d.ts +0 -8
  399. package/dist/types-ts4.0/view/InlineCard/Icon.d.ts +0 -4
  400. package/dist/types-ts4.0/view/InlineCard/IconAndTitleLayout/index.d.ts +0 -19
  401. package/dist/types-ts4.0/view/InlineCard/IconAndTitleLayout/styled.d.ts +0 -13
  402. package/dist/types-ts4.0/view/InlineCard/ResolvedView/index.d.ts +0 -30
  403. package/dist/types-ts4.0/view/InlineCard/ResolvingView/index.d.ts +0 -18
  404. package/dist/types-ts4.0/view/InlineCard/ResolvingView/styled.d.ts +0 -14
  405. package/dist/types-ts4.0/view/InlineCard/UnauthorisedView/index.d.ts +0 -20
  406. package/dist/types-ts4.0/view/InlineCard/index.d.ts +0 -9
  407. package/dist/types-ts4.0/view/InlineCard/styled.d.ts +0 -9
  408. package/dist/types-ts4.0/view/InlineCard/types.d.ts +0 -21
  409. package/dist/types-ts4.0/view/LinkView/index.d.ts +0 -8
  410. package/dist/types-ts4.0/view/SmartLinkEvents/useSmartLinkEvents.d.ts +0 -2
  411. package/dist/types-ts4.0/view/__mocks__/intersection-observer.d.ts +0 -26
  412. package/dist/types-ts4.0/view/__mocks__/intersection-observer.mock.d.ts +0 -12
  413. package/dist/types-ts4.0/view/common/Byline.d.ts +0 -10
  414. package/dist/types-ts4.0/view/common/Icon.d.ts +0 -11
  415. package/dist/types-ts4.0/view/common/Metadata.d.ts +0 -10
  416. package/dist/types-ts4.0/view/common/MetadataList.d.ts +0 -9
  417. package/dist/types-ts4.0/view/common/utils.d.ts +0 -5
  418. package/dist/types-ts4.0/view/types.d.ts +0 -29
@@ -0,0 +1,23 @@
1
+ import { extractDownloadUrl } from '../../common/detail';
2
+ import { extractPreview as extractPreviewData } from '@atlaskit/linking-common';
3
+ import { extractLink, extractProvider, extractTitle } from '@atlaskit/linking-common/extractors';
4
+ import { extractLinkIcon } from '../icon';
5
+ export const extractPreviewAction = response => {
6
+ var _extractPreviewData;
7
+
8
+ const data = response.data;
9
+ const src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
10
+
11
+ if (src) {
12
+ var _extractProvider;
13
+
14
+ return {
15
+ downloadUrl: extractDownloadUrl(data),
16
+ providerName: (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
17
+ src,
18
+ title: extractTitle(data),
19
+ linkIcon: extractLinkIcon(response),
20
+ url: extractLink(data)
21
+ };
22
+ }
23
+ };
@@ -0,0 +1,13 @@
1
+ import { extractLink } from '@atlaskit/linking-common/extractors';
2
+ import { getActionsFromJsonLd } from '../../common/actions/extractActions';
3
+ export const extractViewAction = data => {
4
+ const viewActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'ViewAction');
5
+
6
+ if (viewActionExists) {
7
+ return {
8
+ viewUrl: extractLink(data)
9
+ };
10
+ }
11
+
12
+ return undefined;
13
+ };
@@ -3,11 +3,14 @@ import { extractLozenge } from '../common/lozenge';
3
3
  import { extractLinkIcon } from './icon';
4
4
  import { extractAttachmentCount, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
5
5
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
6
- import { extractPersonCreatedBy, extractLink, extractTitle, extractDateUpdated, extractDateCreated } from '@atlaskit/linking-common/extractors';
6
+ import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
7
7
  import extractPriority from './extract-priority';
8
8
  import extractProviderIcon from './icon/extract-provider-icon';
9
9
  import extractPreview from './extract-preview';
10
10
  import { extractLatestCommit } from './latest-commit';
11
+ import { extractPreviewAction } from './actions/extract-preview-action';
12
+ import { extractDownloadAction } from './actions/extract-download-action';
13
+ import { extractViewAction } from './actions/extract-view-action';
11
14
 
12
15
  const extractFlexibleUiContext = (response, renderers) => {
13
16
  if (!response) {
@@ -27,6 +30,9 @@ const extractFlexibleUiContext = (response, renderers) => {
27
30
  createdBy: extractCreatedBy(data),
28
31
  createdOn: extractDateCreated(data),
29
32
  dueOn: extractDueOn(data),
33
+ previewAction: extractPreviewAction(response),
34
+ viewAction: extractViewAction(data),
35
+ downloadAction: extractDownloadAction(data),
30
36
  latestCommit: extractLatestCommit(data),
31
37
  linkIcon: extractLinkIcon(response, renderers),
32
38
  modifiedBy: extractModifiedBy(data),
@@ -70,6 +70,16 @@ export const messages = defineMessages({
70
70
  defaultMessage: 'To show a preview of this link, connect your {context} account.',
71
71
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view. Displayed in byline.'
72
72
  },
73
+ connect_unauthorised_account_action: {
74
+ id: 'fabric.linking.connect_unauthorised_account_action',
75
+ defaultMessage: 'Connect to {context}',
76
+ description: 'Shown on a button to connect user external account to their Atlassian account.'
77
+ },
78
+ connect_unauthorised_account_description: {
79
+ id: 'fabric.linking.connect_unauthorised_account_description',
80
+ defaultMessage: 'Connect {context} to Atlassian to view more details from your work and collaboration from one place.',
81
+ description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
82
+ },
73
83
  could_not_load_link: {
74
84
  id: 'fabric.linking.couldnt_load_link',
75
85
  defaultMessage: "We couldn't load this link for an unknown reason.",
@@ -125,6 +135,11 @@ export const messages = defineMessages({
125
135
  defaultMessage: 'Join {context} to view this issue',
126
136
  description: 'Allows the user join the product or service immediately'
127
137
  },
138
+ learn_more_about_smart_links_security: {
139
+ id: 'fabric.linking.learn_more_about_smart_links_security',
140
+ defaultMessage: 'Learn more about smart link security and permissions.',
141
+ description: 'An anchor link to redirect user to a page about smart link security and permissions.'
142
+ },
128
143
  loading: {
129
144
  id: 'fabric.linking.loading',
130
145
  defaultMessage: 'Loading...',
@@ -5,4 +5,11 @@ import { useContext, createContext } from 'react';
5
5
  * underlying elements.
6
6
  */
7
7
  export const FlexibleUiContext = /*#__PURE__*/createContext(undefined);
8
- export const useFlexibleUiContext = () => useContext(FlexibleUiContext);
8
+ export const useFlexibleUiContext = () => useContext(FlexibleUiContext);
9
+ /**
10
+ * This provides the data that will be used by Smart Links Flexible UI to populate it's
11
+ * underlying elements.
12
+ */
13
+
14
+ export const FlexibleUiAnalyticsContext = /*#__PURE__*/createContext(undefined);
15
+ export const useFlexibleUiAnalyticsContext = () => useContext(FlexibleUiAnalyticsContext);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.3.0",
3
+ "version": "23.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
1
  const CDN_BASE_URL = 'https://smart-links-cdn.us-east-1.prod.public.atl-paas.net';
2
2
  export const LockImage = `${CDN_BASE_URL}/lock.svg`;
3
- export const CelebrationImage = `${CDN_BASE_URL}/celebration.svg`;
4
- export const NotFoundImage = `${CDN_BASE_URL}/not_found.svg`;
3
+ export const NotFoundImage = `${CDN_BASE_URL}/not_found.svg`;
4
+ export const UnauthorisedImage = `${CDN_BASE_URL}/unauth.svg`;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { EmbedCardUnresolvedView } from './UnresolvedView';
3
- import { LockImage } from '../../BlockCard/utils/constants';
3
+ import { LockImage } from '../constants';
4
4
  import { ExpandedFrame } from '../components/ExpandedFrame';
5
5
  import { ImageIcon } from '../components/ImageIcon';
6
6
  export const EmbedCardForbiddenView = ({
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { EmbedCardUnresolvedView } from './UnresolvedView';
3
- import { NotFoundImage } from '../../BlockCard/utils/constants';
3
+ import { NotFoundImage } from '../constants';
4
4
  import { ExpandedFrame } from '../components/ExpandedFrame';
5
5
  import { ImageIcon } from '../components/ImageIcon';
6
6
  export const EmbedCardNotFoundView = ({
@@ -1,8 +1,12 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
2
4
  import { EmbedCardUnresolvedView } from './UnresolvedView';
3
- import { CelebrationImage } from '../../BlockCard/utils/constants';
5
+ import { UnauthorisedImage } from '../constants';
4
6
  import { ExpandedFrame } from '../components/ExpandedFrame';
5
7
  import { ImageIcon } from '../components/ImageIcon';
8
+ import { messages } from '../../../messages';
9
+ import { CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../../constants';
6
10
  export const EmbedCardUnauthorisedView = ({
7
11
  link,
8
12
  context,
@@ -12,6 +16,8 @@ export const EmbedCardUnauthorisedView = ({
12
16
  inheritDimensions,
13
17
  onClick
14
18
  }) => {
19
+ var _context$image;
20
+
15
21
  const icon = context && context.icon && /*#__PURE__*/React.createElement(ImageIcon, {
16
22
  src: typeof context.icon === 'string' ? context.icon : undefined
17
23
  });
@@ -25,16 +31,24 @@ export const EmbedCardUnauthorisedView = ({
25
31
  onClick: onClick,
26
32
  testId: testId
27
33
  }, /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
28
- image: CelebrationImage,
34
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
29
35
  title: "connect_link_account_card_name",
30
- description: "connect_link_account_card_description",
36
+ description: "connect_unauthorised_account_description",
31
37
  context: context && context.text,
32
38
  button: {
33
39
  appearance: 'primary',
34
- text: 'connect_link_account_card',
40
+ text: 'connect_unauthorised_account_action',
35
41
  testId: 'connect-account'
36
42
  },
37
43
  onClick: onAuthorise,
38
44
  testId: testId
39
- }));
45
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
46
+ values: {
47
+ context: context === null || context === void 0 ? void 0 : context.text
48
+ }
49
+ })), ' ', /*#__PURE__*/React.createElement("a", {
50
+ href: CONTENT_URL_SECURITY_AND_PERMISSIONS,
51
+ target: "_blank",
52
+ "data-testid": `${testId}-learn-more`
53
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.learn_more_about_smart_links_security))));
40
54
  };
@@ -14,7 +14,8 @@ export const EmbedCardUnresolvedView = ({
14
14
  button,
15
15
  context,
16
16
  onClick,
17
- testId
17
+ testId,
18
+ children
18
19
  }) => {
19
20
  return jsx("div", {
20
21
  css: {
@@ -31,14 +32,16 @@ export const EmbedCardUnresolvedView = ({
31
32
  css: {
32
33
  height: gridSize(14),
33
34
  marginBottom: gridSize(4)
34
- }
35
+ },
36
+ "data-testid": `${testId}-unresolved-image`
35
37
  }), jsx("span", {
36
38
  css: {
37
39
  fontSize: gridSize(2.5),
38
40
  marginBottom: gridSize(1.5),
39
41
  width: gridSize(50),
40
42
  textAlign: 'center'
41
- }
43
+ },
44
+ "data-testid": `${testId}-unresolved-title`
42
45
  }, jsx(FormattedMessage, _extends({}, messages[title], {
43
46
  values: {
44
47
  context
@@ -50,8 +53,9 @@ export const EmbedCardUnresolvedView = ({
50
53
  textAlign: 'center',
51
54
  width: gridSize(50),
52
55
  lineHeight: gridSize(3)
53
- }
54
- }, jsx(FormattedMessage, _extends({}, messages[description], {
56
+ },
57
+ "data-testid": `${testId}-unresolved-description`
58
+ }, children !== null && children !== void 0 ? children : jsx(FormattedMessage, _extends({}, messages[description], {
55
59
  values: {
56
60
  context
57
61
  }
@@ -0,0 +1,66 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import Action from '../index';
4
+
5
+ const DownloadAction = props => {
6
+ const {
7
+ appearance,
8
+ asDropDownItem,
9
+ downloadUrl,
10
+ onClick,
11
+ testId,
12
+ url
13
+ } = props;
14
+
15
+ if (downloadUrl && url) {
16
+ const action = { ...props,
17
+ onClick: () => {
18
+ downloadFunction({
19
+ url: downloadUrl
20
+ });
21
+
22
+ if (onClick) {
23
+ onClick();
24
+ }
25
+ }
26
+ };
27
+ return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
28
+ appearance: appearance,
29
+ asDropDownItem: asDropDownItem,
30
+ testId: testId
31
+ }));
32
+ } else {
33
+ return null;
34
+ }
35
+ };
36
+
37
+ async function downloadFunction({
38
+ url
39
+ }) {
40
+ if (!url) {
41
+ return;
42
+ }
43
+
44
+ const isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
45
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
46
+ const iframeName = 'media-download-iframe';
47
+ const link = document.createElement('a');
48
+ let iframe = document.getElementById(iframeName);
49
+
50
+ if (!iframe) {
51
+ iframe = document.createElement('iframe');
52
+ iframe.style.display = 'none';
53
+ iframe.id = iframeName;
54
+ iframe.name = iframeName;
55
+ document.body.appendChild(iframe);
56
+ }
57
+
58
+ link.href = url;
59
+ link.download = url;
60
+ link.target = isIE11 || isSafari ? '_blank' : iframeName;
61
+ document.body.appendChild(link);
62
+ link.click();
63
+ document.body.removeChild(link);
64
+ }
65
+
66
+ export default DownloadAction;
@@ -0,0 +1,104 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import Action from '../index';
4
+ import ReactDOM from 'react-dom';
5
+ import { IntlProvider } from 'react-intl-next';
6
+ import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
7
+ import { useSmartLinkAnalytics } from '../../../../../../state';
8
+ import Icon from '../../../elements/icon';
9
+
10
+ const PreviewAction = props => {
11
+ const {
12
+ appearance,
13
+ asDropDownItem,
14
+ testId,
15
+ onClick,
16
+ linkIcon,
17
+ src,
18
+ url,
19
+ title,
20
+ providerName,
21
+ downloadUrl
22
+ } = props;
23
+ const defaultAnalytics = useSmartLinkAnalytics(url, () => {});
24
+ const analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
25
+ const EmbedIcon = {
26
+ icon: /*#__PURE__*/React.createElement(Icon, linkIcon),
27
+ isFlexibleUi: true
28
+ };
29
+
30
+ if (src && url) {
31
+ const embedModal = () => previewFunction({
32
+ popupMountPointId: 'twp-editor-preview-iframe',
33
+ showModal: true,
34
+ iframeName: 'twp-editor-preview-iframe',
35
+ onClose: () => {},
36
+ download: downloadUrl,
37
+ icon: EmbedIcon,
38
+ providerName: providerName || 'Preview',
39
+ src,
40
+ title,
41
+ url,
42
+ analytics,
43
+ origin: 'smartLinkCard'
44
+ });
45
+
46
+ const action = { ...props,
47
+ onClick: () => {
48
+ embedModal();
49
+
50
+ if (onClick) {
51
+ onClick();
52
+ }
53
+ }
54
+ };
55
+ return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
56
+ appearance: appearance,
57
+ asDropDownItem: asDropDownItem,
58
+ testId: testId
59
+ }));
60
+ } else {
61
+ return null;
62
+ }
63
+ };
64
+ /*
65
+ Explanatory note:
66
+ Actions don't have access to the react tree of whatever is rendered them
67
+ (and this concept is fraught inside editor anyway) so we want to ensure
68
+ it is mounting to a new unique place. This function manages that, including
69
+ creating an element if it doesn't exist, as well as tidying up the react tree
70
+ (but not the element) upon closing the modal.
71
+
72
+ This may strike you as really uncomfortable as you read it, so I wanted to note
73
+ that a) this was discussed and agreed upon, and b) it's definitely odd, and if
74
+ you find an elegant solution around this, you should definitely feel free to
75
+ refactor it.
76
+ */
77
+
78
+
79
+ export async function previewFunction({
80
+ popupMountPointId,
81
+ ...rest
82
+ }) {
83
+ let popupMountPoint;
84
+ popupMountPoint = document.getElementById(popupMountPointId);
85
+
86
+ if (!popupMountPoint) {
87
+ popupMountPoint = document.createElement('div');
88
+ popupMountPoint.id = popupMountPointId;
89
+ popupMountPoint.setAttribute('data-testid', 'preview-modal');
90
+ document.body.appendChild(popupMountPoint);
91
+ }
92
+
93
+ let Modal = await import('../../../../../EmbedModal');
94
+ ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
95
+ locale: "en"
96
+ }, /*#__PURE__*/React.createElement(Modal.default, _extends({}, rest, {
97
+ onClose: _context => {
98
+ if (popupMountPoint) {
99
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
100
+ }
101
+ }
102
+ }))), popupMountPoint);
103
+ }
104
+ export default PreviewAction;
@@ -0,0 +1,46 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import Action from '../index';
4
+
5
+ const ViewAction = props => {
6
+ const {
7
+ appearance,
8
+ asDropDownItem,
9
+ testId,
10
+ onClick,
11
+ viewUrl,
12
+ url
13
+ } = props;
14
+
15
+ if (viewUrl && url) {
16
+ const action = { ...props,
17
+ onClick: () => {
18
+ viewFunction({
19
+ url: viewUrl
20
+ });
21
+
22
+ if (onClick) {
23
+ onClick();
24
+ }
25
+ }
26
+ };
27
+ return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
28
+ appearance: appearance,
29
+ asDropDownItem: asDropDownItem,
30
+ testId: testId
31
+ }));
32
+ } else {
33
+ return null;
34
+ }
35
+ };
36
+
37
+ export async function viewFunction({
38
+ url
39
+ }) {
40
+ if (!url) {
41
+ return;
42
+ }
43
+
44
+ window.open(url, '_blank', 'noopener=yes');
45
+ }
46
+ export default ViewAction;
@@ -1,5 +1,6 @@
1
1
  import { ActionName } from '../../../../constants';
2
- import { createUIAction } from './utils'; // Attention: Keep the export name and action name the same.
2
+ import { createDataAction, createUIAction } from './utils';
3
+ // Attention: Keep the export name and action name the same.
3
4
  // This will help reducing the code for mapping action inside
4
5
  // createAction and renderActionItems
5
6
 
@@ -8,7 +9,6 @@ import { createUIAction } from './utils'; // Attention: Keep the export name and
8
9
  * the icon to a cross icon.
9
10
  * @see Action
10
11
  */
11
-
12
12
  export const DeleteAction = createUIAction(ActionName.DeleteAction);
13
13
  /**
14
14
  * Creates a EditAction component. Accepts default ActionProps, but defaults
@@ -17,6 +17,27 @@ export const DeleteAction = createUIAction(ActionName.DeleteAction);
17
17
  */
18
18
 
19
19
  export const EditAction = createUIAction(ActionName.EditAction);
20
+ /**
21
+ * Creates a PreviewAction component. Accepts default PreviewActionProps, and defaults
22
+ * to the text 'Preview' inside the button.
23
+ * @see Action
24
+ */
25
+
26
+ export const PreviewAction = createDataAction(ActionName.PreviewAction);
27
+ /**
28
+ * Creates a ViewAction component. Accepts default ViewActionProps, and defaults
29
+ * to the text 'View' inside the button.
30
+ * @see Action
31
+ */
32
+
33
+ export const ViewAction = createDataAction(ActionName.ViewAction);
34
+ /**
35
+ * Creates a DownloadAction component. Accepts default DownloadActionProps, and defaults
36
+ * to the text 'Download' inside the button.
37
+ * @see Action
38
+ */
39
+
40
+ export const DownloadAction = createDataAction(ActionName.DownloadAction);
20
41
  /**
21
42
  * Creates a CustomAction component. Accepts default ActionProps. Required to provide
22
43
  * your own icon or text.
@@ -7,6 +7,12 @@ import { FormattedMessage } from 'react-intl-next';
7
7
  import { messages } from '../../../../messages';
8
8
  import CrossIcon from '@atlaskit/icon/glyph/cross';
9
9
  import EditIcon from '@atlaskit/icon/glyph/edit';
10
+ import PreviewAction from './action/preview-action';
11
+ import VidFullScreenOnIcon from '@atlaskit/icon/glyph/vid-full-screen-on';
12
+ import ViewAction from './action/view-action';
13
+ import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
14
+ import DownloadAction from './action/download-action';
15
+ import DownloadIcon from '@atlaskit/icon/glyph/download';
10
16
  const actionMappings = {
11
17
  [ActionName.CustomAction]: {
12
18
  component: Action,
@@ -33,6 +39,39 @@ const actionMappings = {
33
39
  }),
34
40
  tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.edit)
35
41
  }
42
+ },
43
+ [ActionName.PreviewAction]: {
44
+ component: PreviewAction,
45
+ props: {
46
+ testId: 'smart-action-preview-action',
47
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview),
48
+ icon: /*#__PURE__*/React.createElement(VidFullScreenOnIcon, {
49
+ label: "Preview"
50
+ }),
51
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview)
52
+ }
53
+ },
54
+ [ActionName.ViewAction]: {
55
+ component: ViewAction,
56
+ props: {
57
+ testId: 'smart-action-view-action',
58
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.view),
59
+ icon: /*#__PURE__*/React.createElement(ShortcutIcon, {
60
+ label: "View"
61
+ }),
62
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.view)
63
+ }
64
+ },
65
+ [ActionName.DownloadAction]: {
66
+ component: DownloadAction,
67
+ props: {
68
+ testId: 'smart-action-download-action',
69
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.download),
70
+ icon: /*#__PURE__*/React.createElement(DownloadIcon, {
71
+ label: "Download"
72
+ }),
73
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.download)
74
+ }
36
75
  }
37
76
  };
38
77
 
@@ -50,8 +89,13 @@ const getActionData = (actionName, contextKey, context) => {
50
89
  const data = context[contextKey];
51
90
 
52
91
  switch (actionName) {
53
- default:
92
+ case ActionName.PreviewAction:
93
+ case ActionName.ViewAction:
94
+ case ActionName.DownloadAction:
54
95
  return data;
96
+
97
+ default:
98
+ return undefined;
55
99
  }
56
100
  };
57
101
 
@@ -69,7 +113,9 @@ export const createDataAction = name => {
69
113
  return overrides => {
70
114
  const context = useContext(FlexibleUiContext);
71
115
  const data = getActionData(name, contextKey, context);
72
- return /*#__PURE__*/React.createElement(BaseAction, _extends({}, props, data, overrides));
116
+ return data ? /*#__PURE__*/React.createElement(BaseAction, _extends({}, props, data, overrides, {
117
+ url: context === null || context === void 0 ? void 0 : context.url
118
+ })) : null;
73
119
  };
74
120
  };
75
121
  export const createUIAction = name => {
@@ -46,13 +46,7 @@ const ActionGroup = ({
46
46
  onDropdownOpenChange,
47
47
  testId
48
48
  }) => {
49
- const [isOpen, setIsOpen] = useState(false);
50
- const [buttonActions, dropdownItemActions] = useMemo(() => {
51
- const isMoreThenTwoItems = items.length > visibleButtonsNum;
52
- const buttons = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
53
- const dropdownItems = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
54
- return [buttons, dropdownItems];
55
- }, [items, visibleButtonsNum]); // Stop AK dropdown menu to propagate event on click.
49
+ const [isOpen, setIsOpen] = useState(false); // Stop AK dropdown menu to propagate event on click.
56
50
 
57
51
  const onClick = useCallback(e => e.stopPropagation(), []);
58
52
  const onOpenChange = useCallback(attrs => {
@@ -69,11 +63,20 @@ const ActionGroup = ({
69
63
  });
70
64
  }
71
65
  }, [isOpen, onOpenChange]);
66
+ const renderableActions = items.filter(action => renderActionItems([action]));
67
+ const [buttonActions, dropdownItemActions] = useMemo(() => {
68
+ const isMoreThenTwoItems = renderableActions && renderableActions.length > visibleButtonsNum;
69
+ const buttons = isMoreThenTwoItems ? renderableActions.slice(0, visibleButtonsNum - 1) : renderableActions;
70
+ const dropdownItems = isMoreThenTwoItems ? renderableActions.slice(visibleButtonsNum - 1) : [];
71
+ return [buttons, dropdownItems];
72
+ }, [renderableActions, visibleButtonsNum]);
73
+ const dropdownMenuElement = renderActionItems(dropdownItemActions, size, appearance, true, onActionClick);
74
+ const buttonGroupElement = renderActionItems(buttonActions, size, appearance, false, onActionClick);
72
75
  return jsx("div", {
73
76
  css: styles,
74
77
  className: "actions-button-group",
75
78
  onClick: onClick
76
- }, jsx(ButtonGroup, null, renderActionItems(buttonActions, size, appearance, false, onActionClick), dropdownItemActions.length > 0 ? jsx(DropdownMenu, {
79
+ }, jsx(ButtonGroup, null, buttonGroupElement, dropdownItemActions.length > 0 && dropdownMenuElement && dropdownMenuElement.length > 0 ? jsx(DropdownMenu, {
77
80
  isOpen: isOpen,
78
81
  onOpenChange: onOpenChange,
79
82
  trigger: ({
@@ -93,7 +96,7 @@ const ActionGroup = ({
93
96
  ref: triggerRef
94
97
  }))),
95
98
  testId: "action-group-dropdown"
96
- }, renderActionItems(dropdownItemActions, size, appearance, true, onActionClick)) : null));
99
+ }, dropdownMenuElement) : null));
97
100
  };
98
101
 
99
102
  export default ActionGroup;
@@ -105,7 +105,7 @@ const isElementDisplayValid = (name, display) => {
105
105
  return (_ElementDisplaySchema = (_ElementDisplaySchema2 = ElementDisplaySchema[name]) === null || _ElementDisplaySchema2 === void 0 ? void 0 : _ElementDisplaySchema2.includes(display)) !== null && _ElementDisplaySchema !== void 0 ? _ElementDisplaySchema : false;
106
106
  };
107
107
 
108
- const isElementNull = children => {
108
+ const isJSXElementNull = children => {
109
109
  return Boolean(children.type() === null);
110
110
  };
111
111
 
@@ -138,7 +138,7 @@ export const renderElementItems = (items = [], display = 'inline') => {
138
138
  key: idx
139
139
  }, typedProps));
140
140
 
141
- if (!isElementNull(element)) {
141
+ if (!isJSXElementNull(element)) {
142
142
  return [...acc, element];
143
143
  }
144
144
  }
@@ -182,13 +182,18 @@ export const renderActionItems = (items = [], size = SmartLinkSize.Medium, appea
182
182
  }
183
183
  };
184
184
 
185
- return [...acc, /*#__PURE__*/React.createElement(Action, _extends({
185
+ const action = /*#__PURE__*/React.createElement(Action, _extends({
186
+ url: '',
186
187
  asDropDownItem: asDropDownItems,
187
188
  size: size,
188
189
  key: idx,
189
190
  appearance: appearance,
190
191
  onClick: handleOnClick
191
- }, actionProps))];
192
+ }, actionProps));
193
+
194
+ if (!isJSXElementNull(action)) {
195
+ return [...acc, action];
196
+ }
192
197
  }
193
198
 
194
199
  return acc;