@atlaskit/smart-card 26.60.0 → 26.62.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 (82) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/analytics.spec.yaml +6 -0
  3. package/dist/cjs/extractors/common/icon/extractIcon.js +19 -1
  4. package/dist/cjs/extractors/common/icon/index.js +7 -0
  5. package/dist/cjs/extractors/embed/index.js +26 -1
  6. package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -4
  7. package/dist/cjs/messages.js +15 -0
  8. package/dist/cjs/utils/analytics/analytics.js +1 -1
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/action-icon/index.js +4 -6
  10. package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -1
  11. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +1 -1
  12. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +59 -0
  13. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +20 -51
  14. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +62 -0
  15. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/goal-icon/index.js +1 -1
  16. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/projects-icon/index.js +1 -1
  17. package/dist/cjs/view/LinkUrl/index.js +1 -1
  18. package/dist/cjs/view/common/ai-icon/index.js +23 -20
  19. package/dist/cjs/view/common/ai-summary/index.js +1 -0
  20. package/dist/es2019/extractors/common/icon/extractIcon.js +21 -1
  21. package/dist/es2019/extractors/common/icon/index.js +1 -0
  22. package/dist/es2019/extractors/embed/index.js +28 -2
  23. package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +34 -3
  24. package/dist/es2019/messages.js +15 -0
  25. package/dist/es2019/utils/analytics/analytics.js +1 -1
  26. package/dist/es2019/view/FlexibleCard/components/actions/action/action-icon/index.js +4 -6
  27. package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -1
  28. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +1 -1
  29. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +49 -0
  30. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +19 -45
  31. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +36 -0
  32. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/goal-icon/index.js +1 -1
  33. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/projects-icon/index.js +1 -1
  34. package/dist/es2019/view/LinkUrl/index.js +1 -1
  35. package/dist/es2019/view/common/ai-icon/index.js +104 -99
  36. package/dist/es2019/view/common/ai-summary/index.js +1 -0
  37. package/dist/esm/extractors/common/icon/extractIcon.js +19 -1
  38. package/dist/esm/extractors/common/icon/index.js +1 -0
  39. package/dist/esm/extractors/embed/index.js +27 -2
  40. package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -3
  41. package/dist/esm/messages.js +15 -0
  42. package/dist/esm/utils/analytics/analytics.js +1 -1
  43. package/dist/esm/view/FlexibleCard/components/actions/action/action-icon/index.js +4 -6
  44. package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -1
  45. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +1 -1
  46. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +49 -0
  47. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +20 -48
  48. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +52 -0
  49. package/dist/esm/view/FlexibleCard/components/actions/follow-action/goal-icon/index.js +1 -1
  50. package/dist/esm/view/FlexibleCard/components/actions/follow-action/projects-icon/index.js +1 -1
  51. package/dist/esm/view/LinkUrl/index.js +1 -1
  52. package/dist/esm/view/common/ai-icon/index.js +23 -20
  53. package/dist/esm/view/common/ai-summary/index.js +1 -0
  54. package/dist/types/common/analytics/generated/analytics.types.d.ts +5 -1
  55. package/dist/types/extractors/common/icon/index.d.ts +1 -0
  56. package/dist/types/extractors/embed/index.d.ts +3 -3
  57. package/dist/types/messages.d.ts +2 -2
  58. package/dist/types/view/FlexibleCard/components/actions/action/action-icon/index.d.ts +1 -1
  59. package/dist/types/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +1 -1
  60. package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +1 -1
  61. package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +1 -1
  62. package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.d.ts +8 -0
  63. package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.d.ts +3 -3
  64. package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.d.ts +6 -0
  65. package/dist/types/view/FlexibleCard/components/actions/follow-action/goal-icon/index.d.ts +1 -1
  66. package/dist/types/view/FlexibleCard/components/actions/follow-action/projects-icon/index.d.ts +1 -1
  67. package/dist/types/view/common/ai-summary/index.d.ts +1 -1
  68. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +5 -1
  69. package/dist/types-ts4.5/extractors/common/icon/index.d.ts +1 -0
  70. package/dist/types-ts4.5/extractors/embed/index.d.ts +3 -3
  71. package/dist/types-ts4.5/messages.d.ts +2 -2
  72. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/index.d.ts +1 -1
  73. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +1 -1
  74. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +1 -1
  75. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/index.d.ts +1 -1
  76. package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.d.ts +8 -0
  77. package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.d.ts +3 -3
  78. package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.d.ts +6 -0
  79. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/goal-icon/index.d.ts +1 -1
  80. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/projects-icon/index.d.ts +1 -1
  81. package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +1 -1
  82. package/package.json +5 -5
@@ -1,108 +1,113 @@
1
1
  import React from 'react';
2
2
  import SVG from '@atlaskit/icon/svg';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import { B200, B400 } from '@atlaskit/theme/colors';
4
5
  /**
5
6
  * The bulk of this file is originally from
6
7
  * https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
7
8
  * with modifications
8
9
  */
9
- const AiIcon = props => /*#__PURE__*/React.createElement(SVG, props, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
10
- id: "ai_icon_lg0",
11
- x1: "21",
12
- y1: "12",
13
- x2: "17.5",
14
- y2: "12",
15
- gradientUnits: "userSpaceOnUse"
16
- }, /*#__PURE__*/React.createElement("stop", {
17
- offset: "0.270833",
18
- stopColor: `var(--ds-icon-accent-blue, ${B200})`,
19
- color: `var(--ds-icon-accent-blue, ${B200})`
20
- }), /*#__PURE__*/React.createElement("stop", {
21
- offset: "1",
22
- stopColor: `var(--ds-text-accent-blue, ${B400})`,
23
- color: `var(--ds-text-accent-blue, ${B400})`
24
- })), /*#__PURE__*/React.createElement("linearGradient", {
25
- id: "ai_icon_lg1",
26
- x1: "12.5",
27
- y1: "3",
28
- x2: "12.5",
29
- y2: "6.5",
30
- gradientUnits: "userSpaceOnUse"
31
- }, /*#__PURE__*/React.createElement("stop", {
32
- offset: "0.1875",
33
- stopColor: `var(--ds-icon-accent-blue, ${B200})`,
34
- color: `var(--ds-icon-accent-blue, ${B200})`
35
- }), /*#__PURE__*/React.createElement("stop", {
36
- offset: "1",
37
- stopColor: `var(--ds-text-accent-blue, ${B400})`,
38
- color: `var(--ds-text-accent-blue, ${B400})`
39
- })), /*#__PURE__*/React.createElement("linearGradient", {
40
- id: "ai_icon_lg2",
41
- x1: "6.82996",
42
- y1: "12",
43
- x2: "3.32996",
44
- y2: "12",
45
- gradientUnits: "userSpaceOnUse"
46
- }, /*#__PURE__*/React.createElement("stop", {
47
- stopColor: `var(--ds-text-accent-blue, ${B400})`,
48
- color: `var(--ds-text-accent-blue, ${B400})`
49
- }), /*#__PURE__*/React.createElement("stop", {
50
- offset: "0.791667",
51
- stopColor: `var(--ds-icon-accent-blue, ${B200})`,
52
- color: `var(--ds-icon-accent-blue, ${B200})`
53
- })), /*#__PURE__*/React.createElement("linearGradient", {
54
- id: "ai_icon_lg3",
55
- x1: "12.5",
56
- y1: "17",
57
- x2: "12.5",
58
- y2: "21",
59
- gradientUnits: "userSpaceOnUse"
60
- }, /*#__PURE__*/React.createElement("stop", {
61
- stopColor: `var(--ds-text-accent-blue, ${B400})`,
62
- color: `var(--ds-text-accent-blue, ${B400})`
63
- }), /*#__PURE__*/React.createElement("stop", {
64
- offset: "0.802083",
65
- stopColor: `var(--ds-icon-accent-blue, ${B200})`,
66
- color: `var(--ds-icon-accent-blue, ${B200})`
67
- }))), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
68
- fillRule: "evenodd",
69
- clipRule: "evenodd",
70
- d: "M17.17 12C17.17 11.4477 17.6177 11 18.17 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H18.17C17.6177 13 17.17 12.5523 17.17 12Z",
71
- fill: "url(#ai_icon_lg0)"
72
- }), /*#__PURE__*/React.createElement("path", {
73
- fillRule: "evenodd",
74
- clipRule: "evenodd",
75
- d: "M12 3C12.5523 3 13 3.44772 13 4V5.83C13 6.38228 12.5523 6.83 12 6.83C11.4477 6.83 11 6.38228 11 5.83V4C11 3.44772 11.4477 3 12 3Z",
76
- fill: "url(#ai_icon_lg1)"
77
- }), /*#__PURE__*/React.createElement("path", {
78
- fillRule: "evenodd",
79
- clipRule: "evenodd",
80
- d: "M3 12C3 11.4477 3.44772 11 4 11H5.83C6.38228 11 6.83 11.4477 6.83 12C6.83 12.5523 6.38228 13 5.83 13H4C3.44772 13 3 12.5523 3 12Z",
81
- fill: "url(#ai_icon_lg2)"
82
- }), /*#__PURE__*/React.createElement("path", {
83
- fillRule: "evenodd",
84
- clipRule: "evenodd",
85
- d: "M12 17.17C12.5523 17.17 13 17.6177 13 18.17V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V18.17C11 17.6177 11.4477 17.17 12 17.17Z",
86
- fill: "url(#ai_icon_lg3)"
87
- }), /*#__PURE__*/React.createElement("path", {
88
- fillRule: "evenodd",
89
- clipRule: "evenodd",
90
- d: "M14.2929 14.2929C14.6835 13.9024 15.3166 13.9024 15.7071 14.2929L19.7071 18.2929C20.0977 18.6834 20.0977 19.3166 19.7071 19.7071C19.3166 20.0976 18.6835 20.0976 18.2929 19.7071L14.2929 15.7071C13.9024 15.3166 13.9024 14.6834 14.2929 14.2929Z",
91
- fill: `var(--ds-icon-accent-blue, ${B200})`
92
- }), /*#__PURE__*/React.createElement("path", {
93
- fillRule: "evenodd",
94
- clipRule: "evenodd",
95
- d: "M19.7071 4.29289C20.0977 4.68342 20.0977 5.31658 19.7071 5.70711L15.7071 9.70711C15.3166 10.0976 14.6835 10.0976 14.2929 9.70711C13.9024 9.31658 13.9024 8.68342 14.2929 8.29289L18.2929 4.29289C18.6835 3.90237 19.3166 3.90237 19.7071 4.29289Z",
96
- fill: `var(--ds-icon-accent-blue, ${B200})`
97
- }), /*#__PURE__*/React.createElement("path", {
98
- fillRule: "evenodd",
99
- clipRule: "evenodd",
100
- d: "M4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C10.0976 8.68342 10.0976 9.31658 9.70711 9.70711C9.31658 10.0976 8.68342 10.0976 8.29289 9.70711L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289Z",
101
- fill: `var(--ds-icon-accent-blue, ${B200})`
102
- }), /*#__PURE__*/React.createElement("path", {
103
- fillRule: "evenodd",
104
- clipRule: "evenodd",
105
- d: "M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071C3.90237 19.3166 3.90237 18.6834 4.29289 18.2929L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",
106
- fill: `var(--ds-icon-accent-blue, ${B200})`
107
- })));
10
+ const AiIcon = props => {
11
+ const iconColor = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? "var(--ds-icon, #44546F)" : `var(--ds-icon-accent-blue, ${B200})`;
12
+ const textColor = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? "var(--ds-icon, #44546F)" : `var(--ds-text-accent-blue, ${B400})`;
13
+ return /*#__PURE__*/React.createElement(SVG, props, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
14
+ id: "ai_icon_lg0",
15
+ x1: "21",
16
+ y1: "12",
17
+ x2: "17.5",
18
+ y2: "12",
19
+ gradientUnits: "userSpaceOnUse"
20
+ }, /*#__PURE__*/React.createElement("stop", {
21
+ offset: "0.270833",
22
+ stopColor: iconColor,
23
+ color: iconColor
24
+ }), /*#__PURE__*/React.createElement("stop", {
25
+ offset: "1",
26
+ stopColor: textColor,
27
+ color: textColor
28
+ })), /*#__PURE__*/React.createElement("linearGradient", {
29
+ id: "ai_icon_lg1",
30
+ x1: "12.5",
31
+ y1: "3",
32
+ x2: "12.5",
33
+ y2: "6.5",
34
+ gradientUnits: "userSpaceOnUse"
35
+ }, /*#__PURE__*/React.createElement("stop", {
36
+ offset: "0.1875",
37
+ stopColor: iconColor,
38
+ color: iconColor
39
+ }), /*#__PURE__*/React.createElement("stop", {
40
+ offset: "1",
41
+ stopColor: textColor,
42
+ color: textColor
43
+ })), /*#__PURE__*/React.createElement("linearGradient", {
44
+ id: "ai_icon_lg2",
45
+ x1: "6.82996",
46
+ y1: "12",
47
+ x2: "3.32996",
48
+ y2: "12",
49
+ gradientUnits: "userSpaceOnUse"
50
+ }, /*#__PURE__*/React.createElement("stop", {
51
+ stopColor: textColor,
52
+ color: textColor
53
+ }), /*#__PURE__*/React.createElement("stop", {
54
+ offset: "0.791667",
55
+ stopColor: iconColor,
56
+ color: iconColor
57
+ })), /*#__PURE__*/React.createElement("linearGradient", {
58
+ id: "ai_icon_lg3",
59
+ x1: "12.5",
60
+ y1: "17",
61
+ x2: "12.5",
62
+ y2: "21",
63
+ gradientUnits: "userSpaceOnUse"
64
+ }, /*#__PURE__*/React.createElement("stop", {
65
+ stopColor: textColor,
66
+ color: textColor
67
+ }), /*#__PURE__*/React.createElement("stop", {
68
+ offset: "0.802083",
69
+ stopColor: iconColor,
70
+ color: iconColor
71
+ }))), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
72
+ fillRule: "evenodd",
73
+ clipRule: "evenodd",
74
+ d: "M17.17 12C17.17 11.4477 17.6177 11 18.17 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H18.17C17.6177 13 17.17 12.5523 17.17 12Z",
75
+ fill: "url(#ai_icon_lg0)"
76
+ }), /*#__PURE__*/React.createElement("path", {
77
+ fillRule: "evenodd",
78
+ clipRule: "evenodd",
79
+ d: "M12 3C12.5523 3 13 3.44772 13 4V5.83C13 6.38228 12.5523 6.83 12 6.83C11.4477 6.83 11 6.38228 11 5.83V4C11 3.44772 11.4477 3 12 3Z",
80
+ fill: "url(#ai_icon_lg1)"
81
+ }), /*#__PURE__*/React.createElement("path", {
82
+ fillRule: "evenodd",
83
+ clipRule: "evenodd",
84
+ d: "M3 12C3 11.4477 3.44772 11 4 11H5.83C6.38228 11 6.83 11.4477 6.83 12C6.83 12.5523 6.38228 13 5.83 13H4C3.44772 13 3 12.5523 3 12Z",
85
+ fill: "url(#ai_icon_lg2)"
86
+ }), /*#__PURE__*/React.createElement("path", {
87
+ fillRule: "evenodd",
88
+ clipRule: "evenodd",
89
+ d: "M12 17.17C12.5523 17.17 13 17.6177 13 18.17V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V18.17C11 17.6177 11.4477 17.17 12 17.17Z",
90
+ fill: "url(#ai_icon_lg3)"
91
+ }), /*#__PURE__*/React.createElement("path", {
92
+ fillRule: "evenodd",
93
+ clipRule: "evenodd",
94
+ d: "M14.2929 14.2929C14.6835 13.9024 15.3166 13.9024 15.7071 14.2929L19.7071 18.2929C20.0977 18.6834 20.0977 19.3166 19.7071 19.7071C19.3166 20.0976 18.6835 20.0976 18.2929 19.7071L14.2929 15.7071C13.9024 15.3166 13.9024 14.6834 14.2929 14.2929Z",
95
+ fill: iconColor
96
+ }), /*#__PURE__*/React.createElement("path", {
97
+ fillRule: "evenodd",
98
+ clipRule: "evenodd",
99
+ d: "M19.7071 4.29289C20.0977 4.68342 20.0977 5.31658 19.7071 5.70711L15.7071 9.70711C15.3166 10.0976 14.6835 10.0976 14.2929 9.70711C13.9024 9.31658 13.9024 8.68342 14.2929 8.29289L18.2929 4.29289C18.6835 3.90237 19.3166 3.90237 19.7071 4.29289Z",
100
+ fill: iconColor
101
+ }), /*#__PURE__*/React.createElement("path", {
102
+ fillRule: "evenodd",
103
+ clipRule: "evenodd",
104
+ d: "M4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C10.0976 8.68342 10.0976 9.31658 9.70711 9.70711C9.31658 10.0976 8.68342 10.0976 8.29289 9.70711L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289Z",
105
+ fill: iconColor
106
+ }), /*#__PURE__*/React.createElement("path", {
107
+ fillRule: "evenodd",
108
+ clipRule: "evenodd",
109
+ d: "M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071C3.90237 19.3166 3.90237 18.6834 4.29289 18.2929L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",
110
+ fill: iconColor
111
+ })));
112
+ };
108
113
  export default AiIcon;
@@ -13,6 +13,7 @@ const AISummaryCSSStyles = css({
13
13
  fontSize: '0.75rem',
14
14
  lineHeight: '1rem',
15
15
  wordWrap: 'break-word',
16
+ wordBreak: 'break-word',
16
17
  whiteSpace: 'normal',
17
18
  WebkitUserSelect: 'text',
18
19
  MozUserSelect: 'text',
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
3
  import ProjectIcon from '@atlaskit/icon/glyph/people-group';
3
4
  import CommitIcon from '@atlaskit/icon-object/glyph/commit/16';
4
5
  import PullRequestIcon from '@atlaskit/icon-object/glyph/pull-request/16';
@@ -11,6 +12,7 @@ import { extractFileFormat } from './extractFileFormat';
11
12
  import { extractIconFromDocument } from './extractIconFromDocument';
12
13
  import { extractIconFromTask } from './extractIconFromTask';
13
14
  import { extractTaskType } from '../lozenge/extractTaskType';
15
+ import { prioritiseIcon } from './prioritiseIcon';
14
16
  export var extractIcon = function extractIcon(jsonLd) {
15
17
  var priority = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'type';
16
18
  var type = jsonLd['@type'];
@@ -87,6 +89,22 @@ var extractIconByType = function extractIconByType(type, opts) {
87
89
  case 'atlassian:Task':
88
90
  return extractIconFromTask(opts);
89
91
  default:
90
- return opts.provider && opts.provider.icon;
92
+ return getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour') ? extractDefaultIcon(opts) : opts.provider && opts.provider.icon;
91
93
  }
94
+ };
95
+
96
+ /**
97
+ * Choose which icon to show when the type is not recognized.
98
+ */
99
+ var extractDefaultIcon = function extractDefaultIcon(opts) {
100
+ var _opts$provider;
101
+ var provider = opts.provider;
102
+ var providerId = provider === null || provider === void 0 ? void 0 : provider.id;
103
+ return prioritiseIcon({
104
+ providerId: providerId,
105
+ fileFormatIcon: undefined,
106
+ documentTypeIcon: undefined,
107
+ urlIcon: opts.icon,
108
+ providerIcon: (_opts$provider = opts.provider) === null || _opts$provider === void 0 ? void 0 : _opts$provider.icon
109
+ });
92
110
  };
@@ -1,4 +1,5 @@
1
1
  export { extractFileFormat } from './extractFileFormat';
2
+ export { prioritiseIcon } from './prioritiseIcon';
2
3
  export { extractIcon } from './extractIcon';
3
4
  export { extractIconFromDocument } from './extractIconFromDocument';
4
5
  export { extractIconFromTask } from './extractIconFromTask';
@@ -1,9 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { extractLink, extractTitle, extractProvider, extractPreview } from '@atlaskit/link-extractors';
4
+ import { extractLink, extractTitle, extractProvider, extractProviderIcon, extractPreview, extractUrlFromIconJsonLd } from '@atlaskit/link-extractors';
5
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { extractIsTrusted } from '../common/meta/extractIsTrusted';
6
7
  import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
8
+ import { prioritiseIcon } from '../common/icon';
7
9
  var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform, iframeUrlType) {
8
10
  var preview = extractPreview(jsonLd, platform, iframeUrlType);
9
11
  if (preview && preview.src) {
@@ -12,11 +14,34 @@ var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform, iframeU
12
14
  });
13
15
  }
14
16
  };
17
+ function generateContext(jsonLd) {
18
+ var provider = extractProvider(jsonLd);
19
+ if (!provider) {
20
+ return undefined;
21
+ }
22
+
23
+ // If no icon is supplied, return existing context
24
+ if (!jsonLd.icon) {
25
+ return provider;
26
+ }
27
+ var generator = jsonLd.generator;
28
+ var icon = prioritiseIcon({
29
+ providerId: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' ? generator['@id'] : undefined,
30
+ fileFormatIcon: undefined,
31
+ documentTypeIcon: undefined,
32
+ urlIcon: extractUrlFromIconJsonLd(jsonLd.icon),
33
+ // We still attempt to follow the icon priority function even if no generator (and therefore provider icon) is defined
34
+ providerIcon: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' && extractProviderIcon(generator.icon)
35
+ });
36
+ return _objectSpread(_objectSpread({}, provider), {}, {
37
+ icon: icon ? icon : provider.icon
38
+ });
39
+ }
15
40
  export var extractEmbedProps = function extractEmbedProps(jsonLd, meta, platform, iframeUrlType) {
16
41
  return {
17
42
  link: extractLink(jsonLd) || '',
18
43
  title: extractTitle(jsonLd),
19
- context: extractProvider(jsonLd),
44
+ context: getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour') ? generateContext(jsonLd) : extractProvider(jsonLd),
20
45
  preview: extractEmbedPreview(jsonLd, platform, iframeUrlType),
21
46
  isTrusted: extractIsTrusted(meta),
22
47
  isSupportTheming: extractIsSupportTheming(meta)
@@ -9,7 +9,7 @@ import { extractTaskType } from '../../common/lozenge';
9
9
  import { extractTitle } from '@atlaskit/link-extractors';
10
10
  import { extractorPriorityMap as priorityMap } from '../../common/icon/priority';
11
11
  import { IconType } from '../../../constants';
12
- import { prioritiseIcon } from '../../common/icon/prioritiseIcon';
12
+ import { prioritiseIcon } from '../../common/icon';
13
13
  var extractTask = function extractTask(data, label) {
14
14
  var _ref = extractTaskType(data) || {},
15
15
  id = _ref.id,
@@ -123,7 +123,37 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
123
123
  label: label || 'Repository'
124
124
  };
125
125
  default:
126
- return providerIcon;
126
+ return getBooleanFF('platform.linking-platform.smart-card.standardise-smart-link-icon-behaviour') ? extractDefaultIcon({
127
+ data: data,
128
+ type: type,
129
+ label: label,
130
+ provider: provider,
131
+ urlIcon: urlIcon,
132
+ providerIcon: providerIcon
133
+ }) : providerIcon;
127
134
  }
128
135
  };
129
- export default extractJsonldDataIcon;
136
+ export default extractJsonldDataIcon;
137
+
138
+ /**
139
+ * Choose which icon to show when the type is not recognized.
140
+ */
141
+ var extractDefaultIcon = function extractDefaultIcon(_ref2) {
142
+ var data = _ref2.data,
143
+ type = _ref2.type,
144
+ label = _ref2.label,
145
+ provider = _ref2.provider,
146
+ urlIcon = _ref2.urlIcon,
147
+ providerIcon = _ref2.providerIcon;
148
+ var documentData = data;
149
+ var fileFormat = documentData === null || documentData === void 0 ? void 0 : documentData['schema:fileFormat'];
150
+ var fileFormatIcon = extractFileFormatIcon(fileFormat);
151
+ var documentTypeIcon = extractDocumentTypeIcon(type, label);
152
+ return prioritiseIcon({
153
+ providerId: provider,
154
+ fileFormatIcon: fileFormatIcon,
155
+ documentTypeIcon: documentTypeIcon,
156
+ urlIcon: urlIcon,
157
+ providerIcon: providerIcon
158
+ });
159
+ };
@@ -205,6 +205,21 @@ export var messages = defineMessages({
205
205
  defaultMessage: 'Summarize the content of this link using Atlassian Intelligence.',
206
206
  description: 'Description of what the summarize link with AI action does'
207
207
  },
208
+ copy_summary_action: {
209
+ id: 'fabric.linking.copy_summary_action.nonfinal',
210
+ defaultMessage: 'Copy summary',
211
+ description: 'Allow a user to copy a generated summary'
212
+ },
213
+ copy_summary_action_description: {
214
+ id: 'fabric.linking.copy_summary_action.nonfinal',
215
+ defaultMessage: 'Copy summary',
216
+ description: 'Description of what the copy summary AI action does'
217
+ },
218
+ copied_summary_action_description: {
219
+ id: 'fabric.linking.copied_summary_action_description.nonfinal',
220
+ defaultMessage: 'Copied summary to clipboard',
221
+ description: 'Confirmation to the user that the summry has been copied'
222
+ },
208
223
  edit: {
209
224
  id: 'fabric.linking.edit',
210
225
  defaultMessage: 'Edit',
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.60.0"
18
+ packageVersion: "26.62.0"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -19,10 +19,8 @@ var getIconStyles = function getIconStyles(isDisabled) {
19
19
  color: isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"
20
20
  });
21
21
  };
22
- var backgroundStyles = css({
23
- backgroundColor: "var(--ds-background-brand-subtlest, #E9F2FF)",
24
- borderRadius: "var(--ds-border-radius-050, 2px)",
25
- color: "var(--ds-icon-brand, #0C66E4)",
22
+ var stackItemIconSizeStyles = getIconSizeStyles('20px');
23
+ var stackItemIconStyles = css(stackItemIconSizeStyles, {
26
24
  display: 'inline-block',
27
25
  lineHeight: 0,
28
26
  padding: "var(--ds-space-025, 2px)",
@@ -35,9 +33,9 @@ var ActionIcon = function ActionIcon(_ref) {
35
33
  testId = _ref.testId,
36
34
  icon = _ref.icon,
37
35
  isDisabled = _ref.isDisabled,
38
- showBackground = _ref.showBackground;
36
+ asStackItemIcon = _ref.asStackItemIcon;
39
37
  return jsx("span", {
40
- css: [getIconStyles(isDisabled), getIconSizeStyles(getIconWidth(size)), showBackground && backgroundStyles],
38
+ css: [getIconStyles(isDisabled), asStackItemIcon ? stackItemIconStyles : getIconSizeStyles(getIconWidth(size))],
41
39
  "data-testid": "".concat(testId, "-icon")
42
40
  }, icon);
43
41
  };
@@ -56,10 +56,10 @@ var ActionStackItem = function ActionStackItem(_ref) {
56
56
  }
57
57
  }, [isDisabled, isLoading, onClickCallback]);
58
58
  var icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
59
+ asStackItemIcon: true,
59
60
  icon: /*#__PURE__*/React.createElement(Spinner, {
60
61
  testId: "".concat(testId, "-loading")
61
62
  }),
62
- showBackground: true,
63
63
  size: size
64
64
  }) : iconOption;
65
65
 
@@ -44,10 +44,10 @@ var Action = function Action(_ref) {
44
44
  var isStackItem = as === 'stack-item';
45
45
  var isDropdownItem = as === 'dropdown-item' || asDropDownItem;
46
46
  var actionIcon = icon && jsx(ActionIcon, {
47
+ asStackItemIcon: isStackItem,
47
48
  isDisabled: isDisabled,
48
49
  icon: icon,
49
50
  size: size,
50
- showBackground: isStackItem,
51
51
  testId: testId
52
52
  });
53
53
  var iconBefore = icon && iconPosition === 'before' ? actionIcon : undefined;
@@ -0,0 +1,49 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["url", "ari", "product", "onClick", "onError", "testId", "status", "summariseUrl"];
4
+ import React, { useCallback } from 'react';
5
+ import { FormattedMessage } from 'react-intl-next';
6
+ import Action from '../action';
7
+ import AiIcon from '../../../../common/ai-icon';
8
+ import { messages } from '../../../../../messages';
9
+ import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
10
+ import { getErrorMessage } from './utils';
11
+ export function AISummariseAction(_ref) {
12
+ var url = _ref.url,
13
+ ari = _ref.ari,
14
+ product = _ref.product,
15
+ onClickCallback = _ref.onClick,
16
+ onErrorCallback = _ref.onError,
17
+ testId = _ref.testId,
18
+ status = _ref.status,
19
+ summariseUrl = _ref.summariseUrl,
20
+ props = _objectWithoutProperties(_ref, _excluded);
21
+ var _useAnalyticsEvents = useAnalyticsEvents(),
22
+ fireEvent = _useAnalyticsEvents.fireEvent;
23
+ var onCompleted = useCallback(function (state) {
24
+ if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
25
+ onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback(getErrorMessage(state.error));
26
+ }
27
+ }, [onErrorCallback]);
28
+ var handleActionClick = useCallback(function () {
29
+ var _summariseUrl;
30
+ fireEvent('ui.button.clicked.aiSummary', {});
31
+ fireEvent('track.aiInteraction.initiated', {
32
+ aiFeatureName: 'Smart Links Summary',
33
+ proactiveAIGenerated: 0,
34
+ userGeneratedAI: 1
35
+ });
36
+ (_summariseUrl = summariseUrl()) === null || _summariseUrl === void 0 || _summariseUrl.then(onCompleted, onCompleted);
37
+ onClickCallback === null || onClickCallback === void 0 || onClickCallback();
38
+ }, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
39
+ return /*#__PURE__*/React.createElement(Action, _extends({
40
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
41
+ icon: /*#__PURE__*/React.createElement(AiIcon, {
42
+ label: "Summarise with AI"
43
+ }),
44
+ onClick: handleActionClick,
45
+ testId: "".concat(testId, "-summarise-action"),
46
+ isLoading: status === 'loading',
47
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action_description)
48
+ }, props));
49
+ }
@@ -1,58 +1,30 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["onClick", "onError", "url", "ari", "product"];
4
- import React, { useCallback } from 'react';
5
- import { FormattedMessage } from 'react-intl-next';
2
+ import React from 'react';
6
3
  import { di } from 'react-magnetic-di';
7
- import { messages } from '../../../../../messages';
8
- import Action from '../action';
9
- import AiIcon from '../../../../common/ai-icon';
10
- import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
11
4
  import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
12
- import { getErrorMessage } from './utils';
13
- export var AISummaryActionComponent = function AISummaryActionComponent(_ref) {
14
- var onClickCallback = _ref.onClick,
15
- onErrorCallback = _ref.onError,
16
- _ref$url = _ref.url,
17
- url = _ref$url === void 0 ? '' : _ref$url,
18
- _ref$ari = _ref.ari,
19
- ari = _ref$ari === void 0 ? '' : _ref$ari,
20
- product = _ref.product,
21
- props = _objectWithoutProperties(_ref, _excluded);
22
- var _useAnalyticsEvents = useAnalyticsEvents(),
23
- fireEvent = _useAnalyticsEvents.fireEvent;
5
+ import { CopySummaryAction } from './copy-summary-action';
6
+ import { AISummariseAction } from './ai-summarise-action';
7
+ export var AISummaryActionComponent = function AISummaryActionComponent(props) {
8
+ var url = props.url,
9
+ ari = props.ari,
10
+ product = props.product,
11
+ _props$testId = props.testId,
12
+ testId = _props$testId === void 0 ? 'smart-action-ai-summary-action' : _props$testId;
24
13
  var _useAISummary = useAISummary({
25
14
  url: url,
26
15
  ari: ari,
27
16
  product: product
28
17
  }),
29
- status = _useAISummary.state.status,
18
+ _useAISummary$state = _useAISummary.state,
19
+ status = _useAISummary$state.status,
20
+ content = _useAISummary$state.content,
30
21
  summariseUrl = _useAISummary.summariseUrl;
31
- var onCompleted = useCallback(function (state) {
32
- if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
33
- onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback(getErrorMessage(state.error));
34
- }
35
- }, [onErrorCallback]);
36
- var handleActionClick = useCallback(function () {
37
- var _summariseUrl;
38
- fireEvent('ui.button.clicked.aiSummary', {});
39
- fireEvent('track.aiInteraction.initiated', {
40
- aiFeatureName: 'Smart Links Summary',
41
- proactiveAIGenerated: 0,
42
- userGeneratedAI: 1
43
- });
44
- (_summariseUrl = summariseUrl()) === null || _summariseUrl === void 0 || _summariseUrl.then(onCompleted, onCompleted);
45
- onClickCallback === null || onClickCallback === void 0 || onClickCallback();
46
- }, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
47
- return /*#__PURE__*/React.createElement(Action, _extends({
48
- content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
49
- icon: /*#__PURE__*/React.createElement(AiIcon, {
50
- label: "Summarise with AI"
51
- }),
52
- isLoading: status === 'loading',
53
- onClick: handleActionClick,
54
- testId: "smart-action-ai-summary-action",
55
- tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action_description)
56
- }, props));
57
- return null;
22
+ return status === 'done' ? /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
23
+ testId: testId,
24
+ content: content
25
+ })) : /*#__PURE__*/React.createElement(AISummariseAction, _extends({}, props, {
26
+ testId: testId,
27
+ summariseUrl: summariseUrl,
28
+ status: status
29
+ }));
58
30
  };