@atlaskit/media-card 77.2.3 → 77.3.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 (42) 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/ui/imageRenderer/imageRenderer.js +6 -3
  5. package/dist/cjs/card/v2/cardV2.js +18 -1037
  6. package/dist/cjs/card/v2/externalImageCard.js +299 -0
  7. package/dist/cjs/card/v2/fileCard.js +1001 -0
  8. package/dist/cjs/inline/loader.js +1 -1
  9. package/dist/cjs/utils/ufoExperiences.js +1 -1
  10. package/dist/cjs/utils/useCurrentValueRef.js +12 -0
  11. package/dist/cjs/utils/usePrevious.js +14 -0
  12. package/dist/es2019/card/card.js +1 -1
  13. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  14. package/dist/es2019/card/ui/imageRenderer/imageRenderer.js +6 -3
  15. package/dist/es2019/card/v2/cardV2.js +17 -1021
  16. package/dist/es2019/card/v2/externalImageCard.js +261 -0
  17. package/dist/es2019/card/v2/fileCard.js +881 -0
  18. package/dist/es2019/inline/loader.js +1 -1
  19. package/dist/es2019/utils/ufoExperiences.js +1 -1
  20. package/dist/es2019/utils/useCurrentValueRef.js +6 -0
  21. package/dist/es2019/utils/usePrevious.js +8 -0
  22. package/dist/esm/card/card.js +1 -1
  23. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  24. package/dist/esm/card/ui/imageRenderer/imageRenderer.js +6 -3
  25. package/dist/esm/card/v2/cardV2.js +19 -1036
  26. package/dist/esm/card/v2/externalImageCard.js +289 -0
  27. package/dist/esm/card/v2/fileCard.js +991 -0
  28. package/dist/esm/inline/loader.js +1 -1
  29. package/dist/esm/utils/ufoExperiences.js +1 -1
  30. package/dist/esm/utils/useCurrentValueRef.js +6 -0
  31. package/dist/esm/utils/usePrevious.js +8 -0
  32. package/dist/types/card/v2/cardV2.d.ts +4 -60
  33. package/dist/types/card/v2/externalImageCard.d.ts +14 -0
  34. package/dist/types/card/v2/fileCard.d.ts +19 -0
  35. package/dist/types/utils/useCurrentValueRef.d.ts +2 -0
  36. package/dist/types/utils/usePrevious.d.ts +1 -0
  37. package/dist/types-ts4.5/card/v2/cardV2.d.ts +4 -60
  38. package/dist/types-ts4.5/card/v2/externalImageCard.d.ts +14 -0
  39. package/dist/types-ts4.5/card/v2/fileCard.d.ts +19 -0
  40. package/dist/types-ts4.5/utils/useCurrentValueRef.d.ts +2 -0
  41. package/dist/types-ts4.5/utils/usePrevious.d.ts +1 -0
  42. package/package.json +2 -2
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
103
103
  ErrorBoundary = _this$state.ErrorBoundary;
104
104
  var analyticsContext = {
105
105
  packageVersion: "@atlaskit/media-card",
106
- packageName: "77.2.3",
106
+ packageName: "77.3.0",
107
107
  componentName: 'mediaInlineCard',
108
108
  component: 'mediaInlineCard'
109
109
  };
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
7
7
  import { MediaCardError } from '../errors';
8
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
9
9
  var packageName = "@atlaskit/media-card";
10
- var packageVersion = "77.2.3";
10
+ var packageVersion = "77.3.0";
11
11
  var concurrentExperience;
12
12
  var getExperience = function getExperience(id) {
13
13
  if (!concurrentExperience) {
@@ -0,0 +1,6 @@
1
+ import { useRef } from 'react';
2
+ export function useCurrentValueRef(value) {
3
+ var ref = useRef(value);
4
+ ref.current = value;
5
+ return ref;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { useEffect, useRef } from 'react';
2
+ export function usePrevious(value) {
3
+ var ref = useRef();
4
+ useEffect(function () {
5
+ ref.current = value;
6
+ }, [value]);
7
+ return ref.current;
8
+ }
@@ -1,63 +1,7 @@
1
- import React, { Component } from 'react';
2
- import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
- import { FileState, MediaSubscription } from '@atlaskit/media-client';
1
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
+ import React from 'react';
4
3
  import { WrappedComponentProps } from 'react-intl-next';
5
- import { CardAction } from '../actions';
6
- import { CardProps, CardState, CardStatus } from '../../types';
4
+ import { CardProps } from '../../types';
7
5
  export type CardV2BaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
8
- export declare class CardV2Base extends Component<CardV2BaseProps, CardState> {
9
- private internalOccurrenceKey;
10
- private hasBeenMounted;
11
- private fileStateFlags;
12
- private ssrReliability;
13
- private timeElapsedTillCommenced;
14
- subscription?: MediaSubscription;
15
- private ssrData?;
16
- private traceContext;
17
- static defaultProps: Partial<CardProps>;
18
- constructor(props: CardV2BaseProps);
19
- private getSSRPreview;
20
- componentDidMount(): void;
21
- componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
22
- componentWillUnmount(): void;
23
- updateStateForIdentifier(): void;
24
- private getImageURLParams;
25
- private getMediaBlobUrlAttrs;
26
- private getCardPreviewParams;
27
- private setCacheSSRPreview;
28
- private refetchSSRPreview;
29
- private resolveUpfrontPreview;
30
- private fetchAndCacheRemotePreview;
31
- private resolvePreview;
32
- updateFileStateFlag(fileState?: FileState): void;
33
- private subscribeFileState;
34
- private get requestedDimensions();
35
- private get metadata();
36
- private get fileAttributes();
37
- private getPerformanceAttributes;
38
- private logSSRImageError;
39
- private onImageError;
40
- private onImageLoad;
41
- private fireOperationalEvent;
42
- private fireCommencedEvent;
43
- private fireAbortedEvent;
44
- private fireCopiedEvent;
45
- private fireScreenEvent;
46
- private fireNonCriticalErrorEvent;
47
- private safeSetState;
48
- get actions(): CardAction[];
49
- onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
50
- onInlinePlayerError: () => void;
51
- setRef: (cardRef: HTMLDivElement | null) => void;
52
- renderInlinePlayer: () => JSX.Element;
53
- onMediaViewerClose: () => void;
54
- private onDisplayImage;
55
- renderMediaViewer: () => React.ReactPortal | undefined;
56
- renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus, izLazyOverride?: boolean) => JSX.Element;
57
- private storeSSRData;
58
- render(): JSX.Element;
59
- private onCardInViewport;
60
- onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
61
- onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
62
- }
6
+ export declare const CardV2Base: ({ identifier, ...otherProps }: CardV2BaseProps & WrappedComponentProps) => JSX.Element;
63
7
  export declare const CardV2: React.ComponentType<CardV2BaseProps>;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { ExternalImageIdentifier, Identifier, MediaClient } from '@atlaskit/media-client';
4
+ import { CardEventProps, SharedCardProps } from '../../types';
5
+ export interface ExternalImageCardProps extends SharedCardProps, CardEventProps {
6
+ readonly mediaClient: MediaClient;
7
+ readonly identifier: ExternalImageIdentifier;
8
+ readonly shouldOpenMediaViewer?: boolean;
9
+ readonly mediaViewerItems?: Identifier[];
10
+ readonly contextId?: string;
11
+ readonly shouldHideTooltip?: boolean;
12
+ }
13
+ export type ExternalImageCardBaseProps = ExternalImageCardProps & WithAnalyticsEventsProps;
14
+ export declare const ExternalImageCard: ({ mediaClient, appearance, resizeMode, disableOverlay, featureFlags, identifier, dimensions, contextId, alt, actions, shouldOpenMediaViewer, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: ExternalImageCardBaseProps) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileIdentifier, Identifier, MediaClient } from '@atlaskit/media-client';
4
+ import { SSR } from '@atlaskit/media-common';
5
+ import { CardEventProps, SharedCardProps } from '../../types';
6
+ export interface FileCardProps extends SharedCardProps, CardEventProps {
7
+ readonly mediaClient: MediaClient;
8
+ readonly identifier: FileIdentifier;
9
+ readonly isLazy?: boolean;
10
+ readonly useInlinePlayer?: boolean;
11
+ readonly shouldOpenMediaViewer?: boolean;
12
+ readonly mediaViewerItems?: Identifier[];
13
+ readonly contextId?: string;
14
+ readonly shouldEnableDownloadButton?: boolean;
15
+ readonly ssr?: SSR;
16
+ readonly shouldHideTooltip?: boolean;
17
+ }
18
+ export type FileCardBaseProps = FileCardProps & WithAnalyticsEventsProps;
19
+ export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, mediaClient, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: FileCardBaseProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { MutableRefObject } from 'react';
2
+ export declare function useCurrentValueRef<T>(value: T): MutableRefObject<T>;
@@ -0,0 +1 @@
1
+ export declare function usePrevious<T>(value: T | undefined): T | undefined;
@@ -1,63 +1,7 @@
1
- import React, { Component } from 'react';
2
- import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
- import { FileState, MediaSubscription } from '@atlaskit/media-client';
1
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
+ import React from 'react';
4
3
  import { WrappedComponentProps } from 'react-intl-next';
5
- import { CardAction } from '../actions';
6
- import { CardProps, CardState, CardStatus } from '../../types';
4
+ import { CardProps } from '../../types';
7
5
  export type CardV2BaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
8
- export declare class CardV2Base extends Component<CardV2BaseProps, CardState> {
9
- private internalOccurrenceKey;
10
- private hasBeenMounted;
11
- private fileStateFlags;
12
- private ssrReliability;
13
- private timeElapsedTillCommenced;
14
- subscription?: MediaSubscription;
15
- private ssrData?;
16
- private traceContext;
17
- static defaultProps: Partial<CardProps>;
18
- constructor(props: CardV2BaseProps);
19
- private getSSRPreview;
20
- componentDidMount(): void;
21
- componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
22
- componentWillUnmount(): void;
23
- updateStateForIdentifier(): void;
24
- private getImageURLParams;
25
- private getMediaBlobUrlAttrs;
26
- private getCardPreviewParams;
27
- private setCacheSSRPreview;
28
- private refetchSSRPreview;
29
- private resolveUpfrontPreview;
30
- private fetchAndCacheRemotePreview;
31
- private resolvePreview;
32
- updateFileStateFlag(fileState?: FileState): void;
33
- private subscribeFileState;
34
- private get requestedDimensions();
35
- private get metadata();
36
- private get fileAttributes();
37
- private getPerformanceAttributes;
38
- private logSSRImageError;
39
- private onImageError;
40
- private onImageLoad;
41
- private fireOperationalEvent;
42
- private fireCommencedEvent;
43
- private fireAbortedEvent;
44
- private fireCopiedEvent;
45
- private fireScreenEvent;
46
- private fireNonCriticalErrorEvent;
47
- private safeSetState;
48
- get actions(): CardAction[];
49
- onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
50
- onInlinePlayerError: () => void;
51
- setRef: (cardRef: HTMLDivElement | null) => void;
52
- renderInlinePlayer: () => JSX.Element;
53
- onMediaViewerClose: () => void;
54
- private onDisplayImage;
55
- renderMediaViewer: () => React.ReactPortal | undefined;
56
- renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus, izLazyOverride?: boolean) => JSX.Element;
57
- private storeSSRData;
58
- render(): JSX.Element;
59
- private onCardInViewport;
60
- onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
61
- onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
62
- }
6
+ export declare const CardV2Base: ({ identifier, ...otherProps }: CardV2BaseProps & WrappedComponentProps) => JSX.Element;
63
7
  export declare const CardV2: React.ComponentType<CardV2BaseProps>;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { ExternalImageIdentifier, Identifier, MediaClient } from '@atlaskit/media-client';
4
+ import { CardEventProps, SharedCardProps } from '../../types';
5
+ export interface ExternalImageCardProps extends SharedCardProps, CardEventProps {
6
+ readonly mediaClient: MediaClient;
7
+ readonly identifier: ExternalImageIdentifier;
8
+ readonly shouldOpenMediaViewer?: boolean;
9
+ readonly mediaViewerItems?: Identifier[];
10
+ readonly contextId?: string;
11
+ readonly shouldHideTooltip?: boolean;
12
+ }
13
+ export type ExternalImageCardBaseProps = ExternalImageCardProps & WithAnalyticsEventsProps;
14
+ export declare const ExternalImageCard: ({ mediaClient, appearance, resizeMode, disableOverlay, featureFlags, identifier, dimensions, contextId, alt, actions, shouldOpenMediaViewer, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: ExternalImageCardBaseProps) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileIdentifier, Identifier, MediaClient } from '@atlaskit/media-client';
4
+ import { SSR } from '@atlaskit/media-common';
5
+ import { CardEventProps, SharedCardProps } from '../../types';
6
+ export interface FileCardProps extends SharedCardProps, CardEventProps {
7
+ readonly mediaClient: MediaClient;
8
+ readonly identifier: FileIdentifier;
9
+ readonly isLazy?: boolean;
10
+ readonly useInlinePlayer?: boolean;
11
+ readonly shouldOpenMediaViewer?: boolean;
12
+ readonly mediaViewerItems?: Identifier[];
13
+ readonly contextId?: string;
14
+ readonly shouldEnableDownloadButton?: boolean;
15
+ readonly ssr?: SSR;
16
+ readonly shouldHideTooltip?: boolean;
17
+ }
18
+ export type FileCardBaseProps = FileCardProps & WithAnalyticsEventsProps;
19
+ export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, mediaClient, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: FileCardBaseProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { MutableRefObject } from 'react';
2
+ export declare function useCurrentValueRef<T>(value: T): MutableRefObject<T>;
@@ -0,0 +1 @@
1
+ export declare function usePrevious<T>(value: T | undefined): T | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "77.2.3",
3
+ "version": "77.3.0",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@atlaskit/analytics-listeners": "^8.7.0",
68
68
  "@atlaskit/analytics-namespaced-context": "^6.7.0",
69
- "@atlaskit/inline-message": "^11.5.0",
69
+ "@atlaskit/inline-message": "^12.0.0",
70
70
  "@atlaskit/media-core": "^34.1.0",
71
71
  "@atlaskit/media-picker": "^66.2.0",
72
72
  "@atlaskit/media-state": "^1.0.0",