@atlaskit/smart-card 26.46.2 → 26.46.4

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 (80) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/constants.js +2 -2
  3. package/dist/cjs/extractors/common/context/extractAccessContext.js +34 -31
  4. package/dist/cjs/messages.js +44 -76
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/BlockCard/index.js +1 -1
  7. package/dist/cjs/view/BlockCard/views/ForbiddenView.js +6 -2
  8. package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -2
  9. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +28 -0
  10. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +35 -0
  11. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.js +22 -0
  12. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +116 -0
  13. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +35 -0
  14. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +35 -0
  15. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +5 -0
  16. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +37 -28
  17. package/dist/cjs/view/FlexibleCard/utils.js +1 -1
  18. package/dist/cjs/view/LinkUrl/index.js +1 -1
  19. package/dist/cjs/view/common/ai-icon-loading/index.js +60 -0
  20. package/dist/es2019/constants.js +1 -1
  21. package/dist/es2019/extractors/common/context/extractAccessContext.js +35 -31
  22. package/dist/es2019/messages.js +44 -76
  23. package/dist/es2019/utils/analytics/analytics.js +1 -1
  24. package/dist/es2019/view/BlockCard/index.js +1 -1
  25. package/dist/es2019/view/BlockCard/views/ForbiddenView.js +5 -2
  26. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -2
  27. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +22 -0
  28. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +29 -0
  29. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.js +12 -0
  30. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +105 -0
  31. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +29 -0
  32. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +26 -0
  33. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +1 -0
  34. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +36 -31
  35. package/dist/es2019/view/FlexibleCard/utils.js +1 -1
  36. package/dist/es2019/view/LinkUrl/index.js +1 -1
  37. package/dist/es2019/view/common/ai-icon-loading/index.js +64 -0
  38. package/dist/esm/constants.js +1 -1
  39. package/dist/esm/extractors/common/context/extractAccessContext.js +34 -31
  40. package/dist/esm/messages.js +44 -76
  41. package/dist/esm/utils/analytics/analytics.js +1 -1
  42. package/dist/esm/view/BlockCard/index.js +1 -1
  43. package/dist/esm/view/BlockCard/views/ForbiddenView.js +6 -2
  44. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -2
  45. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +21 -0
  46. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +25 -0
  47. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.js +15 -0
  48. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +108 -0
  49. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +28 -0
  50. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +27 -0
  51. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +1 -0
  52. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +40 -31
  53. package/dist/esm/view/FlexibleCard/utils.js +1 -1
  54. package/dist/esm/view/LinkUrl/index.js +1 -1
  55. package/dist/esm/view/common/ai-icon-loading/index.js +54 -0
  56. package/dist/types/constants.d.ts +1 -0
  57. package/dist/types/extractors/common/context/extractAccessContext.d.ts +2 -2
  58. package/dist/types/messages.d.ts +2 -2
  59. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.d.ts +4 -0
  60. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.d.ts +4 -0
  61. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.d.ts +3 -0
  62. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.d.ts +5 -0
  63. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.d.ts +4 -0
  64. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.d.ts +4 -0
  65. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +18 -0
  66. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -1
  67. package/dist/types/view/common/ai-icon-loading/index.d.ts +7 -0
  68. package/dist/types-ts4.5/constants.d.ts +1 -0
  69. package/dist/types-ts4.5/extractors/common/context/extractAccessContext.d.ts +2 -2
  70. package/dist/types-ts4.5/messages.d.ts +2 -2
  71. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.d.ts +4 -0
  72. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.d.ts +4 -0
  73. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.d.ts +3 -0
  74. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.d.ts +5 -0
  75. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.d.ts +4 -0
  76. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.d.ts +4 -0
  77. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +18 -0
  78. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -1
  79. package/dist/types-ts4.5/view/common/ai-icon-loading/index.d.ts +7 -0
  80. package/package.json +1 -1
@@ -1,7 +1,4 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
-
3
- // | 'forbidden_access_crossjoin'
4
- // | 'forbidden_description_crossjoin';
5
2
  export const messages = defineMessages({
6
3
  actions: {
7
4
  id: 'fabric.linking.actions',
@@ -18,6 +15,21 @@ export const messages = defineMessages({
18
15
  defaultMessage: 'Summarize',
19
16
  description: 'Action to summarize link resource content with AI'
20
17
  },
18
+ ai_summarized: {
19
+ id: 'fabric.linking.ai_summarized',
20
+ defaultMessage: 'Summarized by Atlassian Intelligence',
21
+ description: 'Shown with the content summarised by AI.'
22
+ },
23
+ ai_summarized_info: {
24
+ id: 'fabric.linking.ai_summarized_info',
25
+ defaultMessage: 'Information quality may vary. <a>Learn more</a>',
26
+ description: 'Additional info about the content summarised by AI.'
27
+ },
28
+ ai_summarizing: {
29
+ id: 'fabric.linking.ai_summarizing',
30
+ defaultMessage: 'Atlassian Intelligence is working...',
31
+ description: 'Shown when AI summary is summarising the link resource content.'
32
+ },
21
33
  assigned_to: {
22
34
  id: 'fabric.linking.assigned_to',
23
35
  defaultMessage: 'Assigned to {context}',
@@ -153,11 +165,6 @@ export const messages = defineMessages({
153
165
  defaultMessage: 'Follow',
154
166
  description: 'Click to follow a project.'
155
167
  },
156
- forbidden_description: {
157
- id: 'fabric.linking.forbidden_description',
158
- defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
159
- description: 'Informs the user that they cannot view this content.'
160
- },
161
168
  go_back: {
162
169
  id: 'fabric.linking.go_back',
163
170
  defaultMessage: 'Go back',
@@ -213,16 +220,6 @@ export const messages = defineMessages({
213
220
  defaultMessage: 'More actions',
214
221
  description: 'Allows the users to see more link actions'
215
222
  },
216
- not_found_description: {
217
- id: 'fabric.linking.not_found_description',
218
- defaultMessage: "We couldn't find the link. Check the url and try editing or paste again.",
219
- description: 'Error case for when a provided item is not found within the list of items'
220
- },
221
- not_found_title: {
222
- id: 'fabric.linking.not_found_title',
223
- defaultMessage: "Uh oh. We can't find this link!",
224
- description: 'Error case for when a provided link is not found'
225
- },
226
223
  open_issue_in_jira: {
227
224
  id: 'fabric.linking.open_issue_in_jira',
228
225
  defaultMessage: 'Open issue in Jira',
@@ -333,26 +330,6 @@ export const messages = defineMessages({
333
330
  defaultMessage: 'Restricted link, try another account',
334
331
  description: 'Message shown when a user does not have permissions to view an item'
335
332
  },
336
- request_access: {
337
- id: 'fabric.linking.request_access',
338
- defaultMessage: 'Request access',
339
- description: 'Allows the user to request access to a product or service'
340
- },
341
- request_access_description: {
342
- id: 'fabric.linking.request_access_description',
343
- defaultMessage: 'Request access to {context} view this preview.',
344
- description: 'Allows the user to request access to a product'
345
- },
346
- request_access_pending: {
347
- id: 'fabric.linking.request_access_pending',
348
- defaultMessage: 'Access pending',
349
- description: 'Allows the user to try an action again with their current account'
350
- },
351
- request_access_pending_description: {
352
- id: 'fabric.linking.request_access_pending_description',
353
- defaultMessage: 'Your access request is pending.',
354
- description: 'Informs the user that their request to view this content is pending'
355
- },
356
333
  request_access_to_view: {
357
334
  id: 'fabric.linking.request_access_to_view',
358
335
  defaultMessage: 'Request access to {context} to view this issue',
@@ -363,11 +340,6 @@ export const messages = defineMessages({
363
340
  defaultMessage: 'Your access request was denied',
364
341
  description: 'The user had request access but the request was denied by a product or service'
365
342
  },
366
- request_denied_description: {
367
- id: 'fabric.linking.request_denied_description',
368
- defaultMessage: 'Your access request was denied. Contact the site admin if you still need access.',
369
- description: 'Informs the user that their request to view this content was denied'
370
- },
371
343
  retry: {
372
344
  id: 'fabric.linking.retry',
373
345
  defaultMessage: 'Retry',
@@ -468,82 +440,78 @@ export const messages = defineMessages({
468
440
  defaultMessage: 'View Original',
469
441
  description: "We have a link in our preview modals to the original document. This is for when we don't know the provider name"
470
442
  },
471
- /**
472
- * Temp messages to put behind a feature flag for the cross join stream, replace the messages with the message of the same
473
- * title (without _crossjoin) during cleanup in EDM-7977 [https://product-fabric.atlassian.net/browse/EDM-7977].
474
- */
475
- default_no_access_title_crossjoin: {
476
- id: 'fabric.linking.no_access_title_crossjoin',
443
+ default_no_access_title: {
444
+ id: 'fabric.linking.no_access_title',
477
445
  defaultMessage: 'Join {product} to view this content',
478
446
  description: 'Informs the user that they dont have access to certain content'
479
447
  },
480
- direct_access_title_crossjoin: {
481
- id: 'fabric.linking.direct_access_title_crossjoin',
448
+ direct_access_title: {
449
+ id: 'fabric.linking.direct_access_title',
482
450
  defaultMessage: 'Join {product} to view this content',
483
451
  description: 'Informs the user that they have access to this product, and can sign up or join right away.'
484
452
  },
485
- direct_access_description_crossjoin: {
486
- id: 'fabric.linking.direct_access_description_crossjoin',
453
+ direct_access_description: {
454
+ id: 'fabric.linking.direct_access_description',
487
455
  defaultMessage: 'Your team uses {product} to collaborate and you can start using it right away!',
488
456
  description: 'Informs the user that they have access to this product, and can sign up or join right away.'
489
457
  },
490
- direct_access_crossjoin: {
491
- id: 'fabric.linking.direct_access_crossjoin',
458
+ direct_access: {
459
+ id: 'fabric.linking.direct_access',
492
460
  defaultMessage: 'Join now',
493
461
  description: 'Allows the user join the product or service immediately'
494
462
  },
495
- request_access_description_crossjoin: {
496
- id: 'fabric.linking.request_access_description_crossjoin',
463
+ request_access_description: {
464
+ id: 'fabric.linking.request_access_description',
497
465
  defaultMessage: 'Your team uses {product} to collaborate. Send your admin a request for access.',
498
466
  description: 'Informs the user to request access to a product by talking to the website administrator'
499
467
  },
500
- request_access_crossjoin: {
501
- id: 'fabric.linking.request_access_crossjoin',
468
+ request_access: {
469
+ id: 'fabric.linking.request_access',
502
470
  defaultMessage: 'Request access',
503
471
  description: 'Allows the user to request access to a product or service'
504
472
  },
505
- request_access_pending_title_crossjoin: {
506
- id: 'fabric.linking.request_access_pending_title_crossjoin',
473
+ request_access_pending_title: {
474
+ id: 'fabric.linking.request_access_pending_title',
507
475
  defaultMessage: 'Access to {product} is pending',
508
476
  description: 'Informs the user that their request to view this content is pending'
509
477
  },
510
- request_access_pending_description_crossjoin: {
511
- id: 'fabric.linking.request_access_pending_description_crossjoin',
478
+ request_access_pending_description: {
479
+ id: 'fabric.linking.request_access_pending_description',
512
480
  defaultMessage: 'Your request to access {hostname} is awaiting admin approval.',
513
481
  description: 'Informs the user that their request to view this content is pending website administrator approval'
514
482
  },
515
- request_access_pending_crossjoin: {
516
- id: 'fabric.linking.request_access_pending_crossjoin',
483
+ request_access_pending: {
484
+ id: 'fabric.linking.request_access_pending',
517
485
  defaultMessage: 'Pending approval',
518
486
  description: 'Informs the user that their request to view this content is pending'
519
487
  },
520
- request_denied_description_crossjoin: {
521
- id: 'fabric.linking.request_denied_description_crossjoin',
488
+ request_denied_description: {
489
+ id: 'fabric.linking.request_denied_description',
522
490
  defaultMessage: "Your admin didn't approve your request to view {product} pages from {hostname}.",
523
491
  description: 'Informs the user that their request to view this content was denied'
524
492
  },
525
- access_exists_description_crossjoin: {
493
+ access_exists_description: {
526
494
  id: 'fabric.linking.access_exists_description',
527
495
  defaultMessage: 'Request access to view this content from {hostname}.',
528
496
  description: 'Informs the user to contact the website administrator to request access to a product'
529
497
  },
530
- not_found_description_crossjoin: {
531
- id: 'fabric.linking.not_found_description_crossjoin',
498
+ not_found_description: {
499
+ id: 'fabric.linking.not_found_description',
532
500
  defaultMessage: "The page doesn't exist or it may have changed after this link was added.",
533
501
  description: 'Error case for when a provided item is not found within the list of items'
534
502
  },
535
- not_found_title_crossjoin: {
536
- id: 'fabric.linking.not_found_title_crossjoin',
503
+ not_found_title: {
504
+ id: 'fabric.linking.not_found_title',
537
505
  defaultMessage: "We can't show you this {product} page",
538
506
  description: 'Error case for when a provided link is not found'
539
507
  },
540
- forbidden_title_crossjoin: {
541
- id: 'fabric.linking.forbidden_title_crossjoin',
508
+ forbidden_title: {
509
+ id: 'fabric.linking.forbidden_title',
542
510
  defaultMessage: "You don't have access to this content",
543
511
  description: 'Informs the user that they do not have access to the linked content.'
544
512
  },
545
- forbidden_description_crossjoin: {
546
- id: 'fabric.linking.forbidden_description_crossjoin',
513
+ forbidden_description: {
514
+ id: 'fabric.linking.forbidden_description',
547
515
  defaultMessage: 'Contact your admin to request access to {hostname}.',
548
516
  description: 'Informs the user that they must contact the site administrator for access.'
549
517
  },
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "26.46.2"
7
+ packageVersion: "26.46.4"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -159,7 +159,7 @@ export const BlockCard = ({
159
159
  const requestAccessContext = extractRequestAccessContext({
160
160
  jsonLd: cardMetadata,
161
161
  url,
162
- context: (_forbiddenViewProps$c = forbiddenViewProps.context) === null || _forbiddenViewProps$c === void 0 ? void 0 : _forbiddenViewProps$c.text
162
+ product: (_forbiddenViewProps$c = forbiddenViewProps.context) === null || _forbiddenViewProps$c === void 0 ? void 0 : _forbiddenViewProps$c.text
163
163
  });
164
164
  return jsx(BlockCardForbiddenView, _extends({}, forbiddenViewProps, {
165
165
  isSelected: isSelected,
@@ -32,7 +32,8 @@ export const ForbiddenView = ({
32
32
  const handleClick = event => handleClickCommon(event, onClick);
33
33
  const {
34
34
  action,
35
- descriptiveMessageKey = 'invalid_permissions_description'
35
+ descriptiveMessageKey = 'invalid_permissions_description',
36
+ hostname = ''
36
37
  } = requestAccessContext;
37
38
  const items = action ? [...actions, action] : actions;
38
39
  return jsx(Frame, {
@@ -58,7 +59,9 @@ export const ForbiddenView = ({
58
59
  }),
59
60
  text: jsx(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
60
61
  values: {
61
- context: context.text
62
+ product: context.text,
63
+ context: context.text,
64
+ hostname
62
65
  }
63
66
  }))
64
67
  }))), jsx(ContentFooter, null, jsx(Provider, {
@@ -29,11 +29,11 @@ const FlexibleNotFoundView = ({
29
29
  const provider = extractProvider(cardState === null || cardState === void 0 ? void 0 : (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data);
30
30
  return (_provider$text = provider === null || provider === void 0 ? void 0 : provider.text) !== null && _provider$text !== void 0 ? _provider$text : '';
31
31
  }, [cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data]);
32
- const title = useMemo(() => intl.formatMessage(messages.not_found_title_crossjoin, {
32
+ const title = useMemo(() => intl.formatMessage(messages.not_found_title, {
33
33
  product
34
34
  }), [intl, product]);
35
35
  const description = useMemo(() => ({
36
- descriptor: messages.not_found_description_crossjoin
36
+ descriptor: messages.not_found_description
37
37
  }), []);
38
38
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
39
39
  showPreview: true,
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Inline, xcss } from '@atlaskit/primitives';
3
+ const contentStyles = xcss({
4
+ color: 'color.text.subtle',
5
+ fontSize: '12px',
6
+ fontWeight: '400',
7
+ lineHeight: '16px'
8
+ });
9
+ const AIIndicatorContainer = ({
10
+ icon,
11
+ content,
12
+ testId
13
+ }) => {
14
+ return /*#__PURE__*/React.createElement(Inline, {
15
+ alignBlock: "center",
16
+ alignInline: "start",
17
+ space: "space.050",
18
+ xcss: contentStyles,
19
+ testId: testId
20
+ }, icon, content);
21
+ };
22
+ export default AIIndicatorContainer;
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import styled from '@emotion/styled';
4
+ import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
5
+ import { Box, xcss } from '@atlaskit/primitives';
6
+ const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)`
7
+ border-radius: ${"var(--ds-border-radius, 3px)"};
8
+ background-color: ${"var(--ds-surface-raised, white)"};
9
+ box-shadow: ${"var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))"};
10
+ box-sizing: content-box;
11
+ padding: ${"var(--ds-space-200, 16px)"};
12
+ max-width: 350px;
13
+ `;
14
+ const triggerStyles = xcss({
15
+ display: 'inline-flex'
16
+ });
17
+ const AIIndicatorTooltip = ({
18
+ content,
19
+ trigger
20
+ }) => {
21
+ return /*#__PURE__*/React.createElement(Tooltip, {
22
+ component: AIIndicatorTooltipPrimitive,
23
+ content: content,
24
+ tag: "span"
25
+ }, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
26
+ xcss: triggerStyles
27
+ }, tooltipProps), trigger));
28
+ };
29
+ export default AIIndicatorTooltip;
@@ -0,0 +1,12 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { CONTENT_URL_AI } from '../../../../../../constants';
4
+ const AILearnMoreAnchor = ({
5
+ children,
6
+ ...props
7
+ }) => /*#__PURE__*/React.createElement("a", _extends({
8
+ href: CONTENT_URL_AI,
9
+ target: "_blank",
10
+ rel: "noopener noreferrer"
11
+ }, props), children);
12
+ export default AILearnMoreAnchor;
@@ -0,0 +1,105 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import React from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { css, jsx } from '@emotion/react';
6
+ import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
7
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
8
+ import { messages } from '../../../../../../messages';
9
+ import AIIcon from '../../../../../common/ai-icon';
10
+ import AIIndicatorTooltip from './ai-indicator-tooltip';
11
+ import AIIndicatorContainer from './ai-indicator-container';
12
+ import AILearnMoreAnchor from './ai-learn-more-anchor';
13
+ const tooltipMsgStyles = xcss({
14
+ color: 'color.text',
15
+ fontSize: '14px',
16
+ fontWeight: '400',
17
+ lineHeight: '20px'
18
+ });
19
+ const iconTooltipLinkStyles = css({
20
+ color: "var(--ds-text-subtlest, #626F86)",
21
+ '&:link, :visited': {
22
+ color: "var(--ds-text-subtlest, #626F86)"
23
+ },
24
+ '&:hover': {
25
+ color: "var(--ds-text-subtle, #44546F)"
26
+ },
27
+ '&:active': {
28
+ color: "var(--ds-text, #172B4D)"
29
+ },
30
+ textDecoration: 'underline'
31
+ });
32
+ const iconTooltipTitleStyles = xcss({
33
+ color: 'color.text',
34
+ fontSize: '12px',
35
+ fontWeight: '400',
36
+ lineHeight: '16px'
37
+ });
38
+ const iconTooltipDescStyles = xcss({
39
+ color: 'color.text.subtlest',
40
+ fontSize: '11px',
41
+ fontWeight: '400',
42
+ lineHeight: '14px'
43
+ });
44
+ const AIStateDone = ({
45
+ appearance,
46
+ testId
47
+ }) => {
48
+ const icon = jsx(AIIcon, {
49
+ label: "AI",
50
+ size: "small",
51
+ testId: `${testId}-done-icon`
52
+ });
53
+ switch (appearance) {
54
+ case 'icon-only':
55
+ return jsx(AIIndicatorTooltip, {
56
+ content: jsx(Inline, {
57
+ alignBlock: "center",
58
+ space: "space.100"
59
+ }, jsx(AIIcon, {
60
+ label: "AI",
61
+ size: "medium",
62
+ testId: `${testId}-done-tooltip-icon`
63
+ }), jsx(Stack, null, jsx(Box, {
64
+ xcss: iconTooltipTitleStyles,
65
+ testId: `${testId}-done-tooltip-title`
66
+ }, jsx(FormattedMessage, messages.ai_summarized)), jsx(Box, {
67
+ xcss: iconTooltipDescStyles
68
+ }, jsx(FormattedMessage, _extends({}, messages.ai_summarized_info, {
69
+ values: {
70
+ a: chunks => jsx(AILearnMoreAnchor, {
71
+ css: iconTooltipLinkStyles
72
+ }, chunks)
73
+ }
74
+ }))))),
75
+ trigger: icon
76
+ });
77
+ default:
78
+ return jsx(AIIndicatorContainer, {
79
+ icon: icon,
80
+ content: jsx(Inline, {
81
+ alignBlock: "center",
82
+ alignInline: "start",
83
+ space: "space.050"
84
+ }, jsx(Box, {
85
+ testId: `${testId}-done-message`
86
+ }, jsx(FormattedMessage, messages.ai_summarized)), jsx(AIIndicatorTooltip, {
87
+ content: jsx(Box, {
88
+ xcss: tooltipMsgStyles,
89
+ testId: `${testId}-done-tooltip`
90
+ }, jsx(FormattedMessage, _extends({}, messages.ai_summarized_info, {
91
+ values: {
92
+ a: chunks => jsx(AILearnMoreAnchor, null, chunks)
93
+ }
94
+ }))),
95
+ trigger: jsx(EditorPanelIcon, {
96
+ label: "Info",
97
+ size: "small",
98
+ testId: `${testId}-done-info`
99
+ })
100
+ })),
101
+ testId: `${testId}-done`
102
+ });
103
+ }
104
+ };
105
+ export default AIStateDone;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { FormattedMessage } from 'react-intl-next';
3
+ import { Box } from '@atlaskit/primitives';
4
+ import { messages } from '../../../../../../messages';
5
+ import AIIconLoading from '../../../../../common/ai-icon-loading';
6
+ import AIIndicatorContainer from './ai-indicator-container';
7
+ const AIStateLoading = ({
8
+ appearance,
9
+ testId
10
+ }) => {
11
+ const icon = /*#__PURE__*/React.createElement(AIIconLoading, {
12
+ label: "AI",
13
+ size: "small",
14
+ testId: `${testId}-loading-icon`
15
+ });
16
+ switch (appearance) {
17
+ case 'icon-only':
18
+ return icon;
19
+ default:
20
+ return /*#__PURE__*/React.createElement(AIIndicatorContainer, {
21
+ icon: icon,
22
+ content: /*#__PURE__*/React.createElement(Box, {
23
+ testId: `${testId}-loading-message`
24
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarizing)),
25
+ testId: `${testId}-loading`
26
+ });
27
+ }
28
+ };
29
+ export default AIStateLoading;
@@ -0,0 +1,26 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import React from 'react';
4
+ import AIStateLoading from './ai-state-loading';
5
+ import AIStateDone from './ai-state-done';
6
+ const AIStateIndicator = ({
7
+ state,
8
+ appearance = 'default',
9
+ testId = 'ai-state-indicator'
10
+ }) => {
11
+ switch (state) {
12
+ case 'loading':
13
+ return jsx(AIStateLoading, {
14
+ appearance: appearance,
15
+ testId: testId
16
+ });
17
+ case 'done':
18
+ return jsx(AIStateDone, {
19
+ appearance: appearance,
20
+ testId: testId
21
+ });
22
+ default:
23
+ return null;
24
+ }
25
+ };
26
+ export default AIStateIndicator;
@@ -1,12 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback, useMemo } from 'react';
2
+ import React, { useCallback, useMemo, useState } from 'react';
3
3
  import { FormattedMessage } from 'react-intl-next';
4
- import { ActionName, SmartLinkAlignment, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
5
- import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
4
+ import { Box, Inline } from '@atlaskit/primitives';
5
+ import { ActionName, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
6
6
  import ActionGroup from '../../action-group';
7
7
  import Block from '../../block';
8
8
  import ElementGroup from '../../element-group';
9
- import { filterActionItems, getActionGroupStyles, renderElementItems } from '../../utils';
9
+ import AIStateIndicator from '../ai-state-indicator';
10
+ import { renderElementItems } from '../../utils';
10
11
  import { messages } from '../../../../../../messages';
11
12
  import AiIcon from '../../../../../common/ai-icon';
12
13
  const AISummaryBlockResolvedView = props => {
@@ -18,29 +19,29 @@ const AISummaryBlockResolvedView = props => {
18
19
  onAIActionChange,
19
20
  size = SmartLinkSize.Medium
20
21
  } = props;
21
- const context = useFlexibleUiContext();
22
+ const [aiState, setAIState] = useState('ready');
22
23
  const metadataElements = renderElementItems(metadata);
23
24
  const onAIActionClick = useCallback(() => {
25
+ setAIState('loading');
24
26
  if (onAIActionChange) {
25
- onAIActionChange();
27
+ onAIActionChange('loading');
26
28
  }
27
29
  }, [onAIActionChange]);
28
30
  const combinedActions = useMemo(() => {
29
- const aiAction = {
30
- content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
31
- name: ActionName.CustomAction,
32
- onClick: onAIActionClick,
33
- testId: `${testId}-ai-summary-action`,
34
- icon: /*#__PURE__*/React.createElement(AiIcon, {
35
- label: "AiIcon"
36
- })
37
- };
38
- return [aiAction, ...actions];
39
- }, [actions, onAIActionClick, testId]);
40
- const hasActions = useMemo(() => {
41
- var _filterActionItems;
42
- return ((_filterActionItems = filterActionItems(combinedActions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
43
- }, [combinedActions, context]);
31
+ if (aiState === 'ready') {
32
+ const aiAction = {
33
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
34
+ name: ActionName.CustomAction,
35
+ onClick: onAIActionClick,
36
+ testId: `${testId}-ai-summary-action`,
37
+ icon: /*#__PURE__*/React.createElement(AiIcon, {
38
+ label: "AiIcon"
39
+ })
40
+ };
41
+ return [aiAction, ...actions];
42
+ }
43
+ return actions;
44
+ }, [actions, aiState, onAIActionClick, testId]);
44
45
  const onDropdownOpenChange = useCallback(isOpen => {
45
46
  if (onActionMenuOpenChange) {
46
47
  onActionMenuOpenChange({
@@ -50,17 +51,21 @@ const AISummaryBlockResolvedView = props => {
50
51
  }, [onActionMenuOpenChange]);
51
52
  return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
52
53
  testId: `${testId}-resolved-view`
53
- }), /*#__PURE__*/React.createElement(ElementGroup, {
54
- width: SmartLinkWidth.Flexible
55
- }, metadataElements), hasActions && /*#__PURE__*/React.createElement(ElementGroup, {
56
- testId: "smart-element-group-actions",
57
- align: SmartLinkAlignment.Right,
58
- overrideCss: getActionGroupStyles(size),
59
- width: SmartLinkWidth.Flexible
60
- }, /*#__PURE__*/React.createElement(ActionGroup, {
54
+ }), /*#__PURE__*/React.createElement(Inline, {
55
+ alignBlock: "center",
56
+ alignInline: "end",
57
+ grow: "fill",
58
+ spread: "space-between"
59
+ }, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
60
+ state: aiState,
61
+ testId: testId
62
+ }) : /*#__PURE__*/React.createElement(ElementGroup, {
63
+ width: SmartLinkWidth.FitToContent
64
+ }, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
61
65
  onDropdownOpenChange: onDropdownOpenChange,
62
66
  items: combinedActions,
63
- appearance: "default"
64
- })));
67
+ appearance: "default",
68
+ size: size
69
+ }))));
65
70
  };
66
71
  export default AISummaryBlockResolvedView;
@@ -73,7 +73,7 @@ export const getRetryOptions = (url, status, response, onAuthorize) => {
73
73
  const access = extractRequestAccessContext({
74
74
  jsonLd: meta,
75
75
  url,
76
- context
76
+ product: context
77
77
  });
78
78
  const messageKey = getForbiddenMessageKey(meta);
79
79
  const descriptor = messages[messageKey];
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "26.46.2",
10
+ packageVersion: "26.46.4",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');