@atlaskit/media-card 77.1.2 → 77.2.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 (149) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  4. package/dist/cjs/card/useBreakpoint.js +29 -0
  5. package/dist/cjs/card/v2/cardV2.js +3 -5
  6. package/dist/cjs/card/v2/cardViewV2.js +5 -22
  7. package/dist/cjs/card/v2/inlinePlayerLazyV2.js +35 -0
  8. package/dist/cjs/card/v2/inlinePlayerV2.js +222 -0
  9. package/dist/cjs/inline/loader.js +1 -1
  10. package/dist/cjs/utils/ufoExperiences.js +1 -1
  11. package/dist/es2019/card/card.js +1 -1
  12. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  13. package/dist/es2019/card/useBreakpoint.js +22 -0
  14. package/dist/es2019/card/v2/cardV2.js +3 -5
  15. package/dist/es2019/card/v2/cardViewV2.js +4 -18
  16. package/dist/es2019/card/v2/inlinePlayerLazyV2.js +10 -0
  17. package/dist/es2019/card/v2/inlinePlayerV2.js +164 -0
  18. package/dist/es2019/inline/loader.js +1 -1
  19. package/dist/es2019/utils/ufoExperiences.js +1 -1
  20. package/dist/esm/card/card.js +1 -1
  21. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  22. package/dist/esm/card/useBreakpoint.js +24 -0
  23. package/dist/esm/card/v2/cardV2.js +3 -5
  24. package/dist/esm/card/v2/cardViewV2.js +7 -24
  25. package/dist/esm/card/v2/inlinePlayerLazyV2.js +23 -0
  26. package/dist/esm/card/v2/inlinePlayerV2.js +212 -0
  27. package/dist/esm/inline/loader.js +1 -1
  28. package/dist/esm/utils/ufoExperiences.js +1 -1
  29. package/dist/types/card/useBreakpoint.d.ts +3 -0
  30. package/dist/types/card/v2/inlinePlayerLazyV2.d.ts +2 -0
  31. package/dist/types/card/v2/inlinePlayerV2.d.ts +23 -0
  32. package/dist/types-ts4.5/card/actions.d.ts +9 -0
  33. package/dist/types-ts4.5/card/card.d.ts +64 -0
  34. package/dist/types-ts4.5/card/cardAnalytics.d.ts +10 -0
  35. package/dist/types-ts4.5/card/cardConstants.d.ts +1 -0
  36. package/dist/types-ts4.5/card/cardLoader.d.ts +6 -0
  37. package/dist/types-ts4.5/card/cardState.d.ts +9 -0
  38. package/dist/types-ts4.5/card/cardSwitcher.d.ts +4 -0
  39. package/dist/types-ts4.5/card/cardView.d.ts +78 -0
  40. package/dist/types-ts4.5/card/classnames.d.ts +2 -0
  41. package/dist/types-ts4.5/card/getCardPreview/cache.d.ts +21 -0
  42. package/dist/types-ts4.5/card/getCardPreview/filePreviewStatus.d.ts +4 -0
  43. package/dist/types-ts4.5/card/getCardPreview/helpers.d.ts +10 -0
  44. package/dist/types-ts4.5/card/getCardPreview/index.d.ts +53 -0
  45. package/dist/types-ts4.5/card/getCardStatus.d.ts +4 -0
  46. package/dist/types-ts4.5/card/index.d.ts +1 -0
  47. package/dist/types-ts4.5/card/inlinePlayer.d.ts +52 -0
  48. package/dist/types-ts4.5/card/inlinePlayerLazy.d.ts +2 -0
  49. package/dist/types-ts4.5/card/inlinePlayerWrapper.d.ts +4 -0
  50. package/dist/types-ts4.5/card/inlinePlayerWrapperStyles.d.ts +6 -0
  51. package/dist/types-ts4.5/card/media-card-analytics-error-boundary.d.ts +14 -0
  52. package/dist/types-ts4.5/card/types.d.ts +13 -0
  53. package/dist/types-ts4.5/card/ui/actionsBar/actionsBar.d.ts +5 -0
  54. package/dist/types-ts4.5/card/ui/actionsBar/actionsBarWrapper.d.ts +4 -0
  55. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionButton.d.ts +3 -0
  56. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +12 -0
  57. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.d.ts +14 -0
  58. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsView.d.ts +16 -0
  59. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/index.d.ts +7 -0
  60. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/styles.d.ts +18 -0
  61. package/dist/types-ts4.5/card/ui/actionsBar/styles.d.ts +6 -0
  62. package/dist/types-ts4.5/card/ui/actionsBar/types.d.ts +10 -0
  63. package/dist/types-ts4.5/card/ui/blanket/blanket.d.ts +6 -0
  64. package/dist/types-ts4.5/card/ui/blanket/styles.d.ts +6 -0
  65. package/dist/types-ts4.5/card/ui/common.d.ts +23 -0
  66. package/dist/types-ts4.5/card/ui/iconMessage/iconMessageWrapper.d.ts +4 -0
  67. package/dist/types-ts4.5/card/ui/iconMessage/index.d.ts +8 -0
  68. package/dist/types-ts4.5/card/ui/iconMessage/styles.d.ts +5 -0
  69. package/dist/types-ts4.5/card/ui/iconMessage/types.d.ts +19 -0
  70. package/dist/types-ts4.5/card/ui/iconWrapper/iconWrapper.d.ts +4 -0
  71. package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +7 -0
  72. package/dist/types-ts4.5/card/ui/iconWrapper/types.d.ts +6 -0
  73. package/dist/types-ts4.5/card/ui/imageRenderer/imageRenderer.d.ts +15 -0
  74. package/dist/types-ts4.5/card/ui/imageRenderer/resizeModeToMediaImageProps.d.ts +5 -0
  75. package/dist/types-ts4.5/card/ui/playButton/playButton.d.ts +2 -0
  76. package/dist/types-ts4.5/card/ui/playButton/playButtonBackground.d.ts +3 -0
  77. package/dist/types-ts4.5/card/ui/playButton/playButtonWrapper.d.ts +3 -0
  78. package/dist/types-ts4.5/card/ui/playButton/styles.d.ts +5 -0
  79. package/dist/types-ts4.5/card/ui/progressBar/progressBar.d.ts +10 -0
  80. package/dist/types-ts4.5/card/ui/progressBar/styledBar.d.ts +4 -0
  81. package/dist/types-ts4.5/card/ui/progressBar/styles.d.ts +7 -0
  82. package/dist/types-ts4.5/card/ui/progressBar/types.d.ts +7 -0
  83. package/dist/types-ts4.5/card/ui/styles.d.ts +13 -0
  84. package/dist/types-ts4.5/card/ui/tickBox/styles.d.ts +7 -0
  85. package/dist/types-ts4.5/card/ui/tickBox/tickBox.d.ts +3 -0
  86. package/dist/types-ts4.5/card/ui/tickBox/tickBoxWrapper.d.ts +4 -0
  87. package/dist/types-ts4.5/card/ui/tickBox/types.d.ts +4 -0
  88. package/dist/types-ts4.5/card/ui/titleBox/failedTitleBox.d.ts +3 -0
  89. package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +15 -0
  90. package/dist/types-ts4.5/card/ui/titleBox/titleBox.d.ts +4 -0
  91. package/dist/types-ts4.5/card/ui/titleBox/titleBoxComponents.d.ts +8 -0
  92. package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +34 -0
  93. package/dist/types-ts4.5/card/ui/unhandledErrorCard/index.d.ts +7 -0
  94. package/dist/types-ts4.5/card/ui/unhandledErrorCard/types.d.ts +6 -0
  95. package/dist/types-ts4.5/card/ui/wrapper/index.d.ts +1 -0
  96. package/dist/types-ts4.5/card/ui/wrapper/styles.d.ts +5 -0
  97. package/dist/types-ts4.5/card/ui/wrapper/types.d.ts +25 -0
  98. package/dist/types-ts4.5/card/ui/wrapper/wrapper.d.ts +4 -0
  99. package/dist/types-ts4.5/card/useBreakpoint.d.ts +3 -0
  100. package/dist/types-ts4.5/card/v2/cardV2.d.ts +63 -0
  101. package/dist/types-ts4.5/card/v2/cardV2Loader.d.ts +4 -0
  102. package/dist/types-ts4.5/card/v2/cardViewV2.d.ts +44 -0
  103. package/dist/types-ts4.5/card/v2/inlinePlayerLazyV2.d.ts +2 -0
  104. package/dist/types-ts4.5/card/v2/inlinePlayerV2.d.ts +23 -0
  105. package/dist/types-ts4.5/classnames.d.ts +5 -0
  106. package/dist/types-ts4.5/errors.d.ts +53 -0
  107. package/dist/types-ts4.5/index.d.ts +15 -0
  108. package/dist/types-ts4.5/inline/index.d.ts +1 -0
  109. package/dist/types-ts4.5/inline/loader.d.ts +26 -0
  110. package/dist/types-ts4.5/inline/mediaInlineAnalyticsErrorBoundary.d.ts +12 -0
  111. package/dist/types-ts4.5/inline/mediaInlineCard.d.ts +15 -0
  112. package/dist/types-ts4.5/inline/mediaInlineCardAnalytics.d.ts +6 -0
  113. package/dist/types-ts4.5/types.d.ts +105 -0
  114. package/dist/types-ts4.5/utils/analytics.d.ts +101 -0
  115. package/dist/types-ts4.5/utils/cardDimensions.d.ts +14 -0
  116. package/dist/types-ts4.5/utils/containsPixelUnit.d.ts +1 -0
  117. package/dist/types-ts4.5/utils/dimensionComparer.d.ts +3 -0
  118. package/dist/types-ts4.5/utils/document.d.ts +2 -0
  119. package/dist/types-ts4.5/utils/generateUniqueId.d.ts +1 -0
  120. package/dist/types-ts4.5/utils/getCSSUnitValue.d.ts +1 -0
  121. package/dist/types-ts4.5/utils/getDataURIDimension.d.ts +9 -0
  122. package/dist/types-ts4.5/utils/getElementDimension.d.ts +2 -0
  123. package/dist/types-ts4.5/utils/getMediaCardCursor.d.ts +6 -0
  124. package/dist/types-ts4.5/utils/globalScope/getSSRData.d.ts +3 -0
  125. package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +21 -0
  126. package/dist/types-ts4.5/utils/globalScope/index.d.ts +4 -0
  127. package/dist/types-ts4.5/utils/globalScope/types.d.ts +8 -0
  128. package/dist/types-ts4.5/utils/index.d.ts +6 -0
  129. package/dist/types-ts4.5/utils/isRetina.d.ts +1 -0
  130. package/dist/types-ts4.5/utils/isValidPercentageUnit.d.ts +1 -0
  131. package/dist/types-ts4.5/utils/lightCards/cardError.d.ts +12 -0
  132. package/dist/types-ts4.5/utils/lightCards/cardLoading.d.ts +5 -0
  133. package/dist/types-ts4.5/utils/lightCards/errorIcon/index.d.ts +12 -0
  134. package/dist/types-ts4.5/utils/lightCards/errorIcon/styles.d.ts +1 -0
  135. package/dist/types-ts4.5/utils/lightCards/getDimensionsWithDefault.d.ts +2 -0
  136. package/dist/types-ts4.5/utils/lightCards/lightCardWrappers.d.ts +4 -0
  137. package/dist/types-ts4.5/utils/lightCards/styles.d.ts +2 -0
  138. package/dist/types-ts4.5/utils/lightCards/types.d.ts +15 -0
  139. package/dist/types-ts4.5/utils/metadata.d.ts +2 -0
  140. package/dist/types-ts4.5/utils/mockIntersectionObserver.d.ts +20 -0
  141. package/dist/types-ts4.5/utils/objectURLCache.d.ts +12 -0
  142. package/dist/types-ts4.5/utils/preventClickThrough.d.ts +8 -0
  143. package/dist/types-ts4.5/utils/printScript.d.ts +2 -0
  144. package/dist/types-ts4.5/utils/ufoExperiences.d.ts +14 -0
  145. package/dist/types-ts4.5/utils/videoIsPlayable.d.ts +2 -0
  146. package/dist/types-ts4.5/utils/videoSnapshot.d.ts +1 -0
  147. package/dist/types-ts4.5/utils/viewportDetector.d.ts +6 -0
  148. package/package.json +5 -4
  149. package/tmp/api-report-tmp.d.ts +345 -0
@@ -0,0 +1,101 @@
1
+ import { FileDetails, FileStatus, MediaClientErrorReason, RequestMetadata } from '@atlaskit/media-client';
2
+ import { FileAttributes, PerformanceAttributes, OperationalEventPayload, UIEventPayload, WithFileAttributes, WithPerformanceAttributes, SuccessAttributes, FailureAttributes, ScreenEventPayload, ScreenAttributes, MediaTraceContext, WithTraceContext } from '@atlaskit/media-common';
3
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { MediaCardError, MediaCardErrorPrimaryReason } from '../errors';
5
+ import { CardPreviewSource, CardDimensions, CardStatus } from '../types';
6
+ export type CardPreviewAttributes = {
7
+ fileId: string;
8
+ prevDimensions: CardDimensions | undefined;
9
+ currentDimensions: CardDimensions | undefined;
10
+ dimensionsPercentageDiff?: CardDimensions | undefined;
11
+ source: CardPreviewSource;
12
+ };
13
+ type WithCardPreviewCacheAttributes = {
14
+ cardPreviewAttributes: CardPreviewAttributes;
15
+ };
16
+ export type FileUriFailReason = 'local-uri' | 'remote-uri' | `unknown-uri`;
17
+ export type FailedErrorFailReason = MediaCardErrorPrimaryReason | 'nativeError';
18
+ export type MediaCardErrorInfo = {
19
+ failReason: FailedErrorFailReason;
20
+ error: MediaClientErrorReason | 'nativeError';
21
+ errorDetail: string;
22
+ metadataTraceContext?: MediaTraceContext;
23
+ };
24
+ export type SSRStatusFail = MediaCardErrorInfo & {
25
+ status: 'fail';
26
+ };
27
+ type SSRStatusSuccess = SuccessAttributes;
28
+ type SSRStatusUnknown = {
29
+ status: 'unknown';
30
+ };
31
+ type SSRStatusAttributes = SSRStatusSuccess | SSRStatusFail | SSRStatusUnknown;
32
+ export type SSRStatus = {
33
+ server: SSRStatusAttributes;
34
+ client: SSRStatusAttributes;
35
+ };
36
+ export type WithSSRReliability = {
37
+ ssrReliability?: SSRStatus;
38
+ };
39
+ export type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & WithTraceContext & FailureAttributes & {
40
+ failReason: FailedErrorFailReason | 'failed-processing';
41
+ error?: MediaClientErrorReason | 'nativeError';
42
+ request?: RequestMetadata;
43
+ }, 'failed', 'mediaCardRender'>;
44
+ export type ErrorEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & WithTraceContext & FailureAttributes & {
45
+ cardStatus: CardStatus;
46
+ failReason: FailedErrorFailReason | 'failed-processing';
47
+ error?: MediaClientErrorReason | 'nativeError';
48
+ request?: RequestMetadata;
49
+ }, 'nonCriticalFail', 'mediaCardRender'>;
50
+ export type ErrorBoundaryErrorInfo = {
51
+ componentStack: string;
52
+ };
53
+ export type AnalyticsErrorBoundaryAttributes = {
54
+ error?: Error | string;
55
+ info?: ErrorBoundaryErrorInfo;
56
+ browserInfo: string;
57
+ failReason: string;
58
+ };
59
+ export type AnalyticsErrorBoundaryCardPayload = OperationalEventPayload<AnalyticsErrorBoundaryAttributes, 'failed', 'mediaCardRender'>;
60
+ export type AnalyticsErrorBoundaryInlinePayload = OperationalEventPayload<AnalyticsErrorBoundaryAttributes, 'failed', 'mediaInlineRender'>;
61
+ export type RenderInlineCardSucceededEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & SuccessAttributes, 'succeeded', 'mediaInlineRender'>;
62
+ export type RenderInlineCardFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & FailureAttributes & {
63
+ failReason: FailedErrorFailReason | 'failed-processing';
64
+ error?: MediaClientErrorReason | 'nativeError';
65
+ request?: RequestMetadata;
66
+ }, 'failed', 'mediaInlineRender'>;
67
+ export type RenderSucceededEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithSSRReliability & SuccessAttributes & WithTraceContext, 'succeeded', 'mediaCardRender'>;
68
+ export type RenderCommencedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & WithTraceContext, 'commenced', 'mediaCardRender'>;
69
+ export type CacheHitEventPayload = OperationalEventPayload<WithCardPreviewCacheAttributes, 'cache-hit', 'mediaCardCache'>;
70
+ export type RemoteSuccessEventPayload = OperationalEventPayload<WithCardPreviewCacheAttributes, 'Remote-success', 'mediaCardCache'>;
71
+ export type CopiedFileEventPayload = UIEventPayload<{}, 'copied', string>;
72
+ export type ClickedEventPayload = UIEventPayload<{
73
+ label?: string;
74
+ }, 'clicked', string>;
75
+ export type RenderScreenEventPayload = Omit<ScreenEventPayload<ScreenAttributes, 'mediaCardRenderScreen'>, 'attributes'> & {
76
+ attributes: {
77
+ type: string | undefined;
78
+ fileAttributes: FileAttributes;
79
+ };
80
+ };
81
+ export type MediaCardAnalyticsEventPayload = RenderCommencedEventPayload | RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | RenderScreenEventPayload | CacheHitEventPayload | RemoteSuccessEventPayload | ErrorEventPayload | AnalyticsErrorBoundaryCardPayload | AnalyticsErrorBoundaryInlinePayload | RenderInlineCardFailedEventPayload | RenderInlineCardSucceededEventPayload;
82
+ export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: FileStatus) => FileAttributes;
83
+ export declare const getRenderPreviewableCardPayload: (fileAttributes: FileAttributes) => RenderScreenEventPayload;
84
+ export declare const getRenderCommencedEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, traceContext: MediaTraceContext) => RenderCommencedEventPayload;
85
+ export declare const getRenderSucceededEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderSucceededEventPayload;
86
+ export declare const getCacheHitEventPayload: (cardPreviewAttributes: CardPreviewAttributes) => CacheHitEventPayload;
87
+ export declare const getRemoteSuccessEventPayload: (cardPreviewAttributes: CardPreviewAttributes) => RemoteSuccessEventPayload;
88
+ export declare const getRenderFailedExternalUriPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderFailedEventPayload;
89
+ export declare const getRenderErrorFailReason: (error: MediaCardError) => FailedErrorFailReason;
90
+ export declare const getRenderErrorErrorReason: (error: MediaCardError) => MediaClientErrorReason | 'nativeError';
91
+ export declare const getRenderErrorErrorDetail: (error: MediaCardError) => string;
92
+ export declare const getErrorTraceContext: (error: MediaCardError) => MediaTraceContext | undefined;
93
+ export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestMetadata | undefined;
94
+ export declare const extractErrorInfo: (error: MediaCardError, metadataTraceContext?: MediaTraceContext) => MediaCardErrorInfo;
95
+ export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error: MediaCardError, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderFailedEventPayload;
96
+ export declare const getErrorEventPayload: (cardStatus: CardStatus, fileAttributes: FileAttributes, error: MediaCardError, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => ErrorEventPayload;
97
+ export declare const getRenderFailedFileStatusPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => RenderFailedEventPayload;
98
+ export declare const getCopiedFilePayload: (fileId: string) => CopiedFileEventPayload;
99
+ export declare function fireMediaCardEvent(payload: MediaCardAnalyticsEventPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
100
+ export declare const createAndFireMediaCardEvent: (payload: MediaCardAnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
101
+ export {};
@@ -0,0 +1,14 @@
1
+ import { CardAppearance, CardDimensions } from '../types';
2
+ export declare const defaultImageCardDimensions: {
3
+ width: number;
4
+ height: number;
5
+ };
6
+ export declare const defaultHorizontalCardDimensions: {
7
+ width: number;
8
+ height: number;
9
+ };
10
+ export declare const defaultSquareCardDimensions: {
11
+ width: number;
12
+ height: number;
13
+ };
14
+ export declare const getDefaultCardDimensions: (appearance?: CardAppearance) => Required<CardDimensions>;
@@ -0,0 +1 @@
1
+ export declare const containsPixelUnit: (value: string) => boolean;
@@ -0,0 +1,3 @@
1
+ import { CardDimensionValue, CardDimensions } from '../types';
2
+ export declare const canCompareDimension: (current?: CardDimensionValue, next?: CardDimensionValue) => boolean;
3
+ export declare const isBigger: (current?: CardDimensions, next?: CardDimensions) => boolean;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Document | undefined;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const generateUniqueId: () => string;
@@ -0,0 +1 @@
1
+ export declare function getCSSUnitValue(value: number | string): string;
@@ -0,0 +1,9 @@
1
+ import { CardDimensions } from '../types';
2
+ import { ElementDimension } from './getElementDimension';
3
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
4
+ export type getDataURIDimensionOptions = {
5
+ element?: Element | null;
6
+ dimensions?: CardDimensions;
7
+ };
8
+ export declare const getDataURIDimension: (dimension: ElementDimension, options: getDataURIDimensionOptions) => number;
9
+ export declare const getRequestedDimensions: (options: getDataURIDimensionOptions) => NumericalCardDimensions;
@@ -0,0 +1,2 @@
1
+ export type ElementDimension = 'height' | 'width';
2
+ export declare const getElementDimension: (element: Element, dimension: ElementDimension) => number;
@@ -0,0 +1,6 @@
1
+ import { MediaCardCursor } from '../types';
2
+ import { MediaType } from '@atlaskit/media-client';
3
+ /**
4
+ * When the returned value is undefined, we'd expect the media card to take the parent's cursor style.
5
+ */
6
+ export declare const getMediaCardCursor: (useInlinePlayer: boolean, useMediaViewer: boolean, isErrorStatus: boolean, hasCardPreview: boolean, mediaType?: MediaType) => MediaCardCursor | undefined;
@@ -0,0 +1,3 @@
1
+ import type { MediaCardSsrData } from './types';
2
+ import { FileIdentifier } from '@atlaskit/media-client';
3
+ export declare const getSSRData: (identifier: FileIdentifier) => MediaCardSsrData | undefined;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { FileIdentifier } from '@atlaskit/media-client';
3
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
4
+ import { MediaCardErrorInfo } from '../../utils/analytics';
5
+ import { MediaCardSsr } from './types';
6
+ export declare const GLOBAL_MEDIA_CARD_SSR = "mediaCardSsr";
7
+ export declare const GLOBAL_MEDIA_NAMESPACE = "__MEDIA_INTERNAL";
8
+ export type MediaGlobalScope = {
9
+ [GLOBAL_MEDIA_CARD_SSR]?: MediaCardSsr;
10
+ };
11
+ export declare function getMediaGlobalScope(globalScope?: any): MediaGlobalScope;
12
+ export declare function getMediaCardSSR(globalScope?: any): MediaCardSsr;
13
+ export declare const getKey: ({ id, collectionName, occurrenceKey }: FileIdentifier) => string;
14
+ export declare const storeDataURI: (key: string, dataURI?: string, dimensions?: NumericalCardDimensions, error?: MediaCardErrorInfo, globalScope?: any) => void;
15
+ export type StoreSSRDataScriptProps = {
16
+ identifier: FileIdentifier;
17
+ dataURI?: string;
18
+ dimensions?: NumericalCardDimensions;
19
+ error?: MediaCardErrorInfo;
20
+ };
21
+ export declare const StoreSSRDataScript: React.FC<StoreSSRDataScriptProps>;
@@ -0,0 +1,4 @@
1
+ export { StoreSSRDataScript, GLOBAL_MEDIA_NAMESPACE, GLOBAL_MEDIA_CARD_SSR, getKey, } from './globalScope';
2
+ export { getSSRData } from './getSSRData';
3
+ export type { MediaCardSsrData, MediaCardSsr } from './types';
4
+ export type { MediaGlobalScope } from './globalScope';
@@ -0,0 +1,8 @@
1
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
2
+ import { MediaCardErrorInfo } from '../../utils/analytics';
3
+ export type MediaCardSsrData = {
4
+ dataURI?: string;
5
+ dimensions?: NumericalCardDimensions;
6
+ error?: MediaCardErrorInfo;
7
+ };
8
+ export type MediaCardSsr = Record<string, MediaCardSsrData>;
@@ -0,0 +1,6 @@
1
+ export { isRetina } from './isRetina';
2
+ export { defaultHorizontalCardDimensions, defaultImageCardDimensions, defaultSquareCardDimensions, getDefaultCardDimensions, } from './cardDimensions';
3
+ export { isValidPercentageUnit } from './isValidPercentageUnit';
4
+ export { getElementDimension } from './getElementDimension';
5
+ export type { ElementDimension } from './getElementDimension';
6
+ export { containsPixelUnit } from './containsPixelUnit';
@@ -0,0 +1 @@
1
+ export declare function isRetina(): boolean;
@@ -0,0 +1 @@
1
+ export declare const isValidPercentageUnit: (value: string | number) => boolean;
@@ -0,0 +1,12 @@
1
+ import { Component } from 'react';
2
+ import { StaticCardProps } from './types';
3
+ export interface ErrorCardProps extends StaticCardProps {
4
+ readonly size: 'small' | 'medium' | 'large' | 'xlarge';
5
+ }
6
+ export declare class CardError extends Component<ErrorCardProps, {}> {
7
+ static defaultProps: {
8
+ size: string;
9
+ };
10
+ render(): JSX.Element;
11
+ get icon(): JSX.Element;
12
+ }
@@ -0,0 +1,5 @@
1
+ import { Component } from 'react';
2
+ import { StaticCardProps } from './types';
3
+ export declare class CardLoading extends Component<StaticCardProps, {}> {
4
+ render(): JSX.Element;
5
+ }
@@ -0,0 +1,12 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { Component } from 'react';
4
+ export interface ErrorIconProps {
5
+ readonly size: 'small' | 'medium' | 'large' | 'xlarge';
6
+ }
7
+ export declare class ErrorIcon extends Component<ErrorIconProps, {}> {
8
+ static defaultProps: {
9
+ size: string;
10
+ };
11
+ render(): jsx.JSX.Element;
12
+ }
@@ -0,0 +1 @@
1
+ export declare const errorIconWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,2 @@
1
+ import { CardDimensions } from '../../types';
2
+ export declare const getDimensionsWithDefault: (dimensions?: CardDimensions) => CardDimensions;
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { WrapperProps } from './types';
4
+ export declare const Wrapper: (props: WrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { WrapperProps } from './types';
2
+ export declare const wrapperStyles: ({ dimensions, theme }: WrapperProps) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { CardDimensions } from '../../types';
3
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
4
+ import { GlobalThemeTokens } from '@atlaskit/theme/components';
5
+ export interface StaticCardProps {
6
+ dimensions?: CardDimensions;
7
+ testId?: string;
8
+ featureFlags?: MediaFeatureFlags;
9
+ }
10
+ export interface WrapperProps {
11
+ dimensions: CardDimensions;
12
+ testId?: string;
13
+ children?: JSX.Element;
14
+ theme?: GlobalThemeTokens;
15
+ }
@@ -0,0 +1,2 @@
1
+ import { FileState, FileDetails, Identifier } from '@atlaskit/media-client';
2
+ export declare const getFileDetails: (identifier: Identifier, fileState?: FileState) => FileDetails;
@@ -0,0 +1,20 @@
1
+ type NestedPartial<T> = {
2
+ [K in keyof T]?: Partial<T[K]>;
3
+ };
4
+ type SetupOptions = {
5
+ observe?: () => void;
6
+ disconnect?: () => void;
7
+ };
8
+ export declare class MockIntersectionObserver {
9
+ private callback;
10
+ private originalObserver?;
11
+ private mockObserver?;
12
+ private mockObserverInstance?;
13
+ private storeMockObserver;
14
+ private addMockObserverToWindow;
15
+ private removeMockObserverFromWindow;
16
+ setup(options?: SetupOptions): void;
17
+ cleanup(): void;
18
+ triggerIntersect(entry: NestedPartial<IntersectionObserverEntry>): void;
19
+ }
20
+ export {};
@@ -0,0 +1,12 @@
1
+ import { CardPreview } from '../types';
2
+ export declare const PREVIEW_CACHE_LRU_SIZE = 50;
3
+ export declare class ObjectURLCache {
4
+ private readonly cache;
5
+ constructor(size: number);
6
+ has(key: string): boolean;
7
+ get(key: string): CardPreview | undefined;
8
+ set(key: string, value: CardPreview): void;
9
+ remove(key: string): void;
10
+ clear(): void;
11
+ }
12
+ export declare const createObjectURLCache: () => ObjectURLCache;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ export type PreventClickThroughProps = {
4
+ readonly children?: ReactNode;
5
+ };
6
+ export declare function PreventClickThrough({ children, }: PreventClickThroughProps): JSX.Element;
7
+ export type CreatePreventClickThrough = <T>(onClick: () => void) => (event: React.MouseEvent<T, MouseEvent>) => void;
8
+ export declare const createPreventClickThrough: CreatePreventClickThrough;
@@ -0,0 +1,2 @@
1
+ export declare const printFunctionCall: <T extends any[]>(fn: (...args: T) => void, ...args: T) => string;
2
+ export declare const printScript: (statements: string[]) => string;
@@ -0,0 +1,14 @@
1
+ import { CardStatus } from '../types';
2
+ import { FileAttributes } from '@atlaskit/media-common';
3
+ import { SSRStatus } from './analytics';
4
+ import { MediaCardError } from '../errors';
5
+ import { FileStateFlags } from '../types';
6
+ type SucceedUfoPayload = {
7
+ fileAttributes: FileAttributes;
8
+ ssrReliability: SSRStatus;
9
+ fileStateFlags: FileStateFlags;
10
+ };
11
+ export declare const startUfoExperience: (id: string) => void;
12
+ export declare const completeUfoExperience: (id: string, status: CardStatus, fileAttributes: FileAttributes, fileStateFlags: FileStateFlags, ssrReliability: SSRStatus, error?: MediaCardError) => void;
13
+ export declare const abortUfoExperience: (id: string, properties?: Partial<SucceedUfoPayload>) => void;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FileState } from '@atlaskit/media-client';
2
+ export declare const videoIsPlayable: (isBannedLocalPreview: boolean, fileState?: FileState, mimeType?: string) => boolean;
@@ -0,0 +1 @@
1
+ export declare const takeSnapshot: (blob: Blob) => Promise<string>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export type ViewportDetectorProps = {
3
+ cardEl: HTMLElement | null;
4
+ onVisible: () => void;
5
+ };
6
+ export declare const ViewportDetector: React.FC<ViewportDetectorProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "77.1.2",
3
+ "version": "77.2.0",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,18 +37,18 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/analytics-next": "^9.1.0",
40
- "@atlaskit/dropdown-menu": "^12.0.0",
40
+ "@atlaskit/dropdown-menu": "^12.1.0",
41
41
  "@atlaskit/editor-shared-styles": "^2.8.0",
42
42
  "@atlaskit/icon": "^21.12.0",
43
43
  "@atlaskit/media-client": "^24.0.0",
44
- "@atlaskit/media-client-react": "^1.0.0",
44
+ "@atlaskit/media-client-react": "^1.2.0",
45
45
  "@atlaskit/media-common": "^9.0.0",
46
46
  "@atlaskit/media-ui": "^25.0.0",
47
47
  "@atlaskit/media-viewer": "^48.1.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.2.2",
49
49
  "@atlaskit/spinner": "^15.6.0",
50
50
  "@atlaskit/theme": "^12.6.0",
51
- "@atlaskit/tokens": "^1.25.0",
51
+ "@atlaskit/tokens": "^1.28.0",
52
52
  "@atlaskit/tooltip": "^17.8.0",
53
53
  "@atlaskit/ufo": "^0.2.0",
54
54
  "@babel/runtime": "^7.0.0",
@@ -78,6 +78,7 @@
78
78
  "@atlassian/ufo": "^0.2.0",
79
79
  "@testing-library/dom": "^8.17.1",
80
80
  "@testing-library/react": "^12.1.5",
81
+ "@testing-library/react-hooks": "^8.0.1",
81
82
  "@testing-library/user-event": "^14.4.3",
82
83
  "@types/classnames": "^2.2.6",
83
84
  "@types/react-loadable": "^5.4.1",