@atlaskit/smart-card 30.3.0 → 30.3.2

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 (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +146 -216
  3. package/dist/cjs/utils/analytics/analytics.js +78 -140
  4. package/dist/cjs/utils/analytics/index.js +0 -6
  5. package/dist/cjs/view/BlockCard/components/Name.js +1 -3
  6. package/dist/cjs/view/BlockCard/views/ResolvingView.js +1 -2
  7. package/dist/cjs/view/CardWithUrl/component.js +14 -41
  8. package/dist/cjs/view/EmbedCard/components/styled.js +4 -11
  9. package/dist/cjs/view/EmbedCard/views/ErroredView.js +2 -2
  10. package/dist/cjs/view/EmbedCard/views/unresolved-view/index.js +1 -1
  11. package/dist/cjs/view/EmbedModal/components/link-info/styled.js +2 -3
  12. package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +1 -6
  13. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +1 -4
  14. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +1 -1
  15. package/dist/cjs/view/LinkUrl/index.js +1 -1
  16. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +1 -69
  17. package/dist/es2019/utils/analytics/analytics.js +1 -63
  18. package/dist/es2019/utils/analytics/index.js +1 -1
  19. package/dist/es2019/view/BlockCard/components/Name.js +1 -3
  20. package/dist/es2019/view/BlockCard/views/ResolvingView.js +1 -2
  21. package/dist/es2019/view/CardWithUrl/component.js +14 -41
  22. package/dist/es2019/view/EmbedCard/components/styled.js +4 -11
  23. package/dist/es2019/view/EmbedCard/views/ErroredView.js +2 -2
  24. package/dist/es2019/view/EmbedCard/views/unresolved-view/index.js +1 -1
  25. package/dist/es2019/view/EmbedModal/components/link-info/styled.js +2 -3
  26. package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +1 -6
  27. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +1 -4
  28. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +1 -1
  29. package/dist/es2019/view/LinkUrl/index.js +1 -1
  30. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +147 -217
  31. package/dist/esm/utils/analytics/analytics.js +77 -139
  32. package/dist/esm/utils/analytics/index.js +1 -1
  33. package/dist/esm/view/BlockCard/components/Name.js +1 -3
  34. package/dist/esm/view/BlockCard/views/ResolvingView.js +1 -2
  35. package/dist/esm/view/CardWithUrl/component.js +14 -41
  36. package/dist/esm/view/EmbedCard/components/styled.js +4 -11
  37. package/dist/esm/view/EmbedCard/views/ErroredView.js +2 -2
  38. package/dist/esm/view/EmbedCard/views/unresolved-view/index.js +1 -1
  39. package/dist/esm/view/EmbedModal/components/link-info/styled.js +2 -3
  40. package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +1 -6
  41. package/dist/esm/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +1 -4
  42. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +1 -1
  43. package/dist/esm/view/LinkUrl/index.js +1 -1
  44. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +1 -29
  45. package/dist/types/state/hooks/useSmartLink.d.ts +0 -2
  46. package/dist/types/utils/analytics/analytics.d.ts +1 -9
  47. package/dist/types/utils/analytics/index.d.ts +1 -1
  48. package/dist/types/utils/analytics/types.d.ts +0 -12
  49. package/dist/types/utils/mocks.d.ts +0 -2
  50. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +1 -29
  51. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -2
  52. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -9
  53. package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
  54. package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -12
  55. package/dist/types-ts4.5/utils/mocks.d.ts +0 -2
  56. package/package.json +3 -6
@@ -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: "30.3.0"
7
+ packageVersion: "30.3.2"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -394,68 +394,6 @@ export const uiCardClickedEvent = ({
394
394
  destinationSubproduct
395
395
  }
396
396
  });
397
-
398
- /**
399
- * @deprecated
400
- */
401
- export const uiIframeDwelledEvent = ({
402
- id,
403
- display,
404
- status,
405
- definitionId,
406
- extensionKey,
407
- location,
408
- destinationProduct,
409
- destinationSubproduct,
410
- dwellTime,
411
- dwellPercentVisible
412
- }) => ({
413
- action: 'dwelled',
414
- actionSubject: 'smartLinkIframe',
415
- eventType: 'ui',
416
- attributes: {
417
- ...context,
418
- id,
419
- status,
420
- definitionId,
421
- extensionKey,
422
- display,
423
- location,
424
- destinationProduct,
425
- destinationSubproduct,
426
- dwellTime,
427
- dwellPercentVisible
428
- }
429
- });
430
-
431
- /**
432
- * @deprecated
433
- */
434
- export const uiIframeFocusedEvent = ({
435
- id,
436
- display,
437
- status,
438
- definitionId,
439
- extensionKey,
440
- location,
441
- destinationProduct,
442
- destinationSubproduct
443
- }) => ({
444
- action: 'focused',
445
- actionSubject: 'smartLinkIframe',
446
- eventType: 'ui',
447
- attributes: {
448
- ...context,
449
- id,
450
- status,
451
- definitionId,
452
- extensionKey,
453
- display,
454
- location,
455
- destinationProduct,
456
- destinationSubproduct
457
- }
458
- });
459
397
  export const uiActionClickedEvent = ({
460
398
  id,
461
399
  actionType,
@@ -1,6 +1,6 @@
1
1
  import { getMeasure } from '../performance';
2
2
  import { resolvedEvent, unresolvedEvent } from './analytics';
3
- export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, chunkloadFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountAuthStarted, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiLearnMoreLinkClickedEvent, uiIframeDwelledEvent, uiSmartLinkStatusLozengeButtonClicked, uiSmartLinkStatusListItemButtonClicked, uiSmartLinkStatusOpenPreviewButtonClicked } from './analytics';
3
+ export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, chunkloadFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountAuthStarted, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiLearnMoreLinkClickedEvent, uiSmartLinkStatusLozengeButtonClicked, uiSmartLinkStatusListItemButtonClicked, uiSmartLinkStatusOpenPreviewButtonClicked } from './analytics';
4
4
  export const instrumentEvent = ({
5
5
  id,
6
6
  status,
@@ -4,7 +4,6 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
- import { fontSize } from '@atlaskit/theme/constants';
8
7
  import { gs } from '../../common/utils';
9
8
  /**
10
9
  * Class name for selecting non-flexible block card header name
@@ -14,8 +13,7 @@ import { gs } from '../../common/utils';
14
13
  */
15
14
  export const blockCardContentHeaderNameClassName = 'block-card-content-header-name';
16
15
  const baseStyles = css({
17
- fontSize: `${fontSize()}px`,
18
- fontWeight: 500,
16
+ font: "var(--ds-font-heading-xsmall, normal 600 14px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
19
17
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
20
18
  lineHeight: gs(2.5),
21
19
  // Spec: show max two lines.
@@ -7,7 +7,6 @@ import { css, jsx } from '@emotion/react';
7
7
  import { FormattedMessage } from 'react-intl-next';
8
8
  import DocumentFilledIcon from '@atlaskit/icon/core/migration/file--editor-file';
9
9
  import { N50, N90 } from '@atlaskit/theme/colors';
10
- import { fontSize } from '@atlaskit/theme/constants';
11
10
  import { messages } from '../../../messages';
12
11
  import { gs } from '../../common/utils';
13
12
  import { Frame } from '../components/Frame';
@@ -19,7 +18,7 @@ import { Frame } from '../components/Frame';
19
18
  */
20
19
  export const blockCardResolvingViewClassName = 'block-card-resolving-view';
21
20
  const messageStyles = css({
22
- fontSize: `${fontSize()}px`,
21
+ font: "var(--ds-font-heading-xsmall, normal 600 14px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
23
22
  color: `var(--ds-text-subtlest, ${N90})`,
24
23
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
25
24
  marginLeft: gs(0.5)
@@ -1,6 +1,5 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
2
  import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
5
4
  import { CardDisplay } from '../../constants';
6
5
  import { useSmartLink } from '../../state';
@@ -148,47 +147,21 @@ function Component({
148
147
  }
149
148
  }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
150
149
  const onIframeDwell = useCallback((dwellTime, dwellPercentVisible) => {
151
- if (fg('smart-card-migrate-smartlinkiframe-analytics')) {
152
- fireEvent('ui.smartLinkIframe.dwelled', {
153
- id,
154
- definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
155
- display: isFlexibleUi ? 'flexible' : appearance,
156
- dwellPercentVisible,
157
- dwellTime
158
- });
159
- } else {
160
- analytics.ui.iframeDwelledEvent({
161
- id,
162
- display: isFlexibleUi ? 'flexible' : appearance,
163
- status: state.status,
164
- definitionId,
165
- extensionKey,
166
- destinationProduct: product,
167
- destinationSubproduct: subproduct,
168
- dwellTime: dwellTime,
169
- dwellPercentVisible: dwellPercentVisible
170
- });
171
- }
172
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
150
+ fireEvent('ui.smartLinkIframe.dwelled', {
151
+ id,
152
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
153
+ display: isFlexibleUi ? 'flexible' : appearance,
154
+ dwellPercentVisible,
155
+ dwellTime
156
+ });
157
+ }, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
173
158
  const onIframeFocus = useCallback(() => {
174
- if (fg('smart-card-migrate-smartlinkiframe-analytics')) {
175
- fireEvent('ui.smartLinkIframe.focus', {
176
- id,
177
- definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
178
- display: isFlexibleUi ? 'flexible' : appearance
179
- });
180
- } else {
181
- analytics.ui.iframeFocusedEvent({
182
- id,
183
- display: isFlexibleUi ? 'flexible' : appearance,
184
- status: state.status,
185
- definitionId,
186
- extensionKey,
187
- destinationProduct: product,
188
- destinationSubproduct: subproduct
189
- });
190
- }
191
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
159
+ fireEvent('ui.smartLinkIframe.focus', {
160
+ id,
161
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
162
+ display: isFlexibleUi ? 'flexible' : appearance
163
+ });
164
+ }, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
192
165
  if (isFlexibleUi) {
193
166
  let cardState = state;
194
167
  if (error) {
@@ -214,8 +214,7 @@ ${/* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-va
214
214
  }, {
215
215
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
216
216
  color: `var(--ds-text-subtlest, ${colors.N300})`,
217
- fontSize: '12px',
218
- lineHeight: '16px'
217
+ font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
219
218
  },
220
219
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
221
220
  ellipsis('none'));
@@ -292,9 +291,7 @@ export const ContentWrapper = styled.div({
292
291
  export const Title = styled.div({
293
292
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
294
293
  color: `var(--ds-text, ${colors.N900})`,
295
- fontSize: '16px',
296
- fontWeight: 500,
297
- lineHeight: 20 / 16,
294
+ font: "var(--ds-font-heading-small, normal 600 16px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
298
295
  maxHeight: `${20 * 4}px`,
299
296
  overflow: 'hidden'
300
297
  });
@@ -304,9 +301,7 @@ export const Byline = styled.div({
304
301
  marginTop: "var(--ds-space-050, 4px)",
305
302
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
306
303
  color: `var(--ds-text-subtlest, ${colors.N300})`,
307
- fontSize: '12px',
308
- fontWeight: 'normal',
309
- lineHeight: 16 / 12
304
+ font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
310
305
  },
311
306
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
312
307
  ellipsis('100%'));
@@ -316,9 +311,7 @@ export const Description = styled.div({
316
311
  marginTop: `calc(${"var(--ds-space-100, 8px)"} - 1px)`,
317
312
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
318
313
  color: `var(--ds-text, ${colors.N800})`,
319
- fontSize: '12px',
320
- fontWeight: 'normal',
321
- lineHeight: 18 / 12,
314
+ font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
322
315
  maxHeight: `${18 * 3}px`,
323
316
  overflow: 'hidden'
324
317
  });
@@ -8,12 +8,12 @@ import { FormattedMessage } from 'react-intl-next';
8
8
  import Button from '@atlaskit/button';
9
9
  import ErrorIcon from '@atlaskit/icon/core/migration/error';
10
10
  import { R300 } from '@atlaskit/theme/colors';
11
- import { fontSize } from '@atlaskit/theme/constants';
12
11
  import { messages } from '../../../messages';
13
12
  import { Frame } from '../../BlockCard/components/Frame';
14
13
  import { gs } from '../../common/utils';
15
14
  const messageStyles = css({
16
- fontSize: `${fontSize()}px`,
15
+ font: "var(--ds-font-heading-xsmall, normal 600 14px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
16
+ fontWeight: "var(--ds-font-weight-regular, 400)",
17
17
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
18
18
  marginLeft: gs(0.5),
19
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
@@ -26,7 +26,7 @@ const contentStyles = css({
26
26
  maxWidth: gs(50)
27
27
  });
28
28
  const descriptionStyles = css({
29
- fontSize: '1em',
29
+ font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
30
30
  textAlign: 'center'
31
31
  });
32
32
  const imageStyles = css({
@@ -34,9 +34,8 @@ export const titleCss = css({
34
34
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
35
35
  h3: {
36
36
  flex: '1 1 auto',
37
- fontSize: '16px',
38
- fontWeight: 400,
39
- lineHeight: height,
37
+ font: "var(--ds-font-heading-small, normal 600 16px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
38
+ fontWeight: "var(--ds-font-weight-regular, 400)",
40
39
  display: '-webkit-box',
41
40
  marginBottom: 0,
42
41
  overflow: 'hidden',
@@ -17,12 +17,7 @@ const buttonStyles = xcss({
17
17
  });
18
18
  const contentStyles = xcss({
19
19
  color: 'color.text',
20
- // Replace with font token once it becomes stable (currently alpha)
21
- // font: 'font.body.small',
22
- fontSize: '12px',
23
- fontStyle: 'normal',
24
- fontWeight: '400',
25
- lineHeight: '20px'
20
+ font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
26
21
  });
27
22
  const ActionButton = ({
28
23
  content,
@@ -23,10 +23,7 @@ const errorContentStyles = xcss({
23
23
  });
24
24
  const titleStyles = xcss({
25
25
  color: 'color.text.subtle',
26
- fontSize: '12px',
27
- fontStyle: 'normal',
28
- fontWeight: '400',
29
- lineHeight: '16px'
26
+ font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
30
27
  });
31
28
  const getIcon = appearance => {
32
29
  switch (appearance) {
@@ -30,7 +30,7 @@ const getThemeStyles = theme => {
30
30
  color: "var(--ds-text-subtlest, #626F86)",
31
31
  textDecoration: 'underline'
32
32
  },
33
- fontSize: '12px'
33
+ font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
34
34
  }
35
35
  });
36
36
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
@@ -7,7 +7,7 @@ import LinkWarningModal from './LinkWarningModal';
7
7
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "30.3.0",
10
+ packageVersion: "30.3.2",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');