npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@atlaskit/media-card-relay

v1.0.1

Published

A relay-driven media card component to accept mediaItemRef and pass SSR data through ssrFileState prop

Downloads

385

Readme

@atlaskit/media-card-relay

A Relay-aware wrapper around @atlaskit/media-card's Card component for Media SSR metadata.

Overview

This package implements the fragment colocation architecture for media cards (Phase 5 of BMPT-7771). Products can spread a Media-owned GraphQL fragment and pass a fragment ref to the card, without knowing media internals.

Prerequisites

⚠️ AGG MediaItem hydration must be enabled (Phases 1–4 of BMPT-7771) for this package to deliver SSR benefits. The card renders correctly without it, but SSR metadata will not be populated from the fragment.

This package requires:

  • react-relay (as a peer dependency — provided by your host app)
  • The MediaItem type registered in AGG with Nadel hydration enabled

Usage

1. Spread the fragment in your query

# In your product query:
query MyAttachmentQuery($attachmentId: ID!) {
  jiraPlatformAttachment(id: $attachmentId) {
    mediaItem {
      ...cardRelay_mediaItem  # spread the Media-owned fragment
    }
  }
}

2. Pass the fragment ref to MediaCardRelay

import { MediaCardRelay } from '@atlaskit/media-card-relay';

function MyAttachment({ attachment }) {
  return (
    <MediaCardRelay
      identifier={{ id: attachment.fileId, mediaItemType: 'file', collectionName: '' }}
      mediaItemRef={attachment.mediaItem}  // fragment ref from the query
      mediaClientConfig={mediaClientConfig}
    />
  );
}

Production usage (post-AGG schema)

Note: This pattern requires the AGG MediaItem schema to be registered (BMPT-7771 Phases 1–4). Until then, use the mock-based examples for development and testing.

Once the schema is available, spread ...cardRelay_mediaItem in your product query and pass the ref to <MediaCardRelay>:

query MyAttachmentQuery($id: ID!) {
  jira_attachment(id: $id) {
    mediaItem {
      ...cardRelay_mediaItem
    }
  }
}
import { MediaCardRelay } from '@atlaskit/media-card-relay';
import { useFragment, useLazyLoadQuery, graphql } from 'react-relay';

function AttachmentCard({ id }: { id: string }) {
  const data = useLazyLoadQuery(graphql`
    query AttachmentCardQuery($id: ID!) {
      jira_attachment(id: $id) {
        mediaItem {
          ...cardRelay_mediaItem
        }
      }
    }
  `, { id });

  return (
    <MediaCardRelay
      mediaItemRef={data?.jira_attachment?.mediaItem ?? null}
      identifier={{ mediaItemType: 'file', id, collectionName: 'my-collection' }}
      dimensions={{ width: 300, height: 200 }}
    />
  );
}

Examples

Runnable examples (using relay-test-utils mock refs until the AGG schema lands):

| File | Demonstrates | |------|--------------| | examples/00-basic.tsx | Basic image card via mock fragment ref | | examples/01-gate-on-vs-off.tsx | Side-by-side platform_media_ssr_data_seed gate ON vs OFF | | examples/02-loading-and-error-states.tsx | Processing, failed, and no-ref (client-fetch) fallback states | | examples/03-different-file-types.tsx | Image, video, PDF, audio, unknown file type matrix | | examples/04-card-actions.tsx | CardProps extras (actions, onClick, selected) flow-through |

API

<MediaCardRelay>

Accepts all props from @atlaskit/media-card's Card except ssrFileState (which is derived from the fragment), plus:

| Prop | Type | Description | |------|------|-------------| | mediaItemRef | cardRelay_mediaItem$key \| null | A Relay fragment ref obtained by spreading ...cardRelay_mediaItem on a MediaItem in your query. |

Phase 5b: Statsig-gated SSR Behavior

Phase 5b introduces a feature gate (platform_media_ssr_data_seed) to control how SSR data is passed to the Card:

Gate Behavior

| State | Behavior | Notes | |-------|----------|-------| | ON (platform_media_ssr_data_seed=true) | <Card> receives full ssrFileState from fragment | Rich SSR metadata (cdnUrl, artifacts, representations, processingStatus, etc.) is passed directly. This is the target state for all consumers. | | OFF (platform_media_ssr_data_seed=false) | <Card> receives no SSR seed (gate evaluated inside Card/FileCard) | The gate is off; SSR data is not forwarded. Used for gradual rollout. |

Adoption Guide

Products consuming <MediaCardRelay> should:

  1. Spread the fragment in your query (see Usage section above)
  2. Provide mediaItemRef to <MediaCardRelay mediaItemRef={...} />
  3. Monitor the gate state — once platform_media_ssr_data_seed is enabled for your tenant, your card will automatically use the rich SSR data
  4. No code changes required — the component handles gate transitions transparently

Note: @atlaskit/media-card's Card component accepts ssrFileState in Phase 5b. This wrapper derives it from the fragment and forwards it, with gate decisions evaluated inside Card/FileCard.

Team

Owned by Media Experience (Media Platform team).