> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Content Marketplace

> Browse and filter platform-curated clinical content bundles; view bundle items, tags, and version; and import bundles into your organization.

The Content Marketplace screen lets users browse and preview platform-curated clinical content bundles at route `/cl/marketplace`.

## Overview

The Content Marketplace displays all non-deprecated bundles from the `cl_marketplace_bundles` table, ordered by `published_at` descending. Bundles are global records with no `organization_id` — any authenticated user with the `cl.marketplace.browse` permission can browse them. The catalogue is displayed as a responsive card grid (`sm:grid-cols-2`, `xl:grid-cols-3`). A filter sidebar (`MarketplaceFilterSidebar`) allows narrowing by accreditation tag, clinical area tag, and free-text search. Import status — indicating whether your organization already has a version of a bundle — is surfaced on each `MarketplaceBundleCard` via the `useImportedBundleKeys` hook. Selecting a card navigates to the bundle detail page at `/cl/marketplace/:bundleId`.

## Who it's for

Requires permission `cl.marketplace.browse`. The **Import** button is additionally gated on `cl.marketplace.import`.

## Before you start

You must hold the `cl.marketplace.browse` permission. The marketplace catalogue is read-only for browse users; importing a bundle requires the separate `cl.marketplace.import` permission (handled at `/cl/marketplace/imports`).

## Steps

<Steps>
  <Step title="Open the Content Marketplace">
    Navigate to `/cl/marketplace`. The catalogue loads all non-deprecated bundles, ordered by most recently published.
  </Step>

  <Step title="Filter bundles (optional)">
    Use the filter sidebar on the left to narrow by accreditation tags (Joint Commission, CARF, SAMHSA, NCQA), clinical area tags (SUD, MH, Co-Occurring, Crisis, Residential, Outpatient, IOP/PHP, MAT/MOUD), or enter a search term to match against bundle name and description.
  </Step>

  <Step title="Review a bundle card">
    Each `MarketplaceBundleCard` shows the bundle name, description, and accreditation/clinical-area tags. If your organization has already imported a version, the imported version number is shown.
  </Step>

  <Step title="View bundle details">
    Click a card to navigate to `/cl/marketplace/:bundleId` for the full bundle detail, including its items list.
  </Step>

  <Step title="Clear filters">
    If no bundles match the current filters, an empty state appears with a "Clear filters" action that resets all filters to `{}`.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Bundle key and version">
    Each bundle has a `bundle_key` (stable identifier) and an integer `version`. Subsequent bundle versions reuse the same `bundle_key` with a higher `version` number. The catalogue displays only the non-deprecated entries.
  </Accordion>

  <Accordion title="Import status">
    The `useImportedBundleKeys` hook returns a `Map` of `bundle_key` to the currently imported record for your organization. A badge on the card reflects the imported version so you can tell if a newer version is available.
  </Accordion>

  <Accordion title="Empty and error states">
    If the bundles query or the imported-keys query errors, an "Error Loading Marketplace" empty state appears with a Retry action. If filters match nothing, a "No bundles match these filters" state appears with a Clear filters action.
  </Accordion>
</AccordionGroup>

## Viewing a bundle

The Bundle Details page displays the detail of a single marketplace bundle at route `/cl/marketplace/:bundleId` (permission: `cl.marketplace.browse`). The **Import** button requires `cl.marketplace.import`.

The page loads a marketplace bundle from `cl_marketplace_bundles` by `bundleId` and its items from `cl_marketplace_bundle_items` via separate hooks. The page header shows the bundle name, optional description, `accreditation_tags` (outline badges), `clinical_area_tags` (secondary badges), version number, and published timestamp. If a prior version of this bundle has already been imported (tracked by `bundle_key` in `cl_marketplace_imports`), and the catalogue version is higher, an `UpdateBanner` is shown prompting the user to view the update. Clicking **Import** or **View Update** opens the `ImportPreviewSheet`, which shows the bundle contents and confirms the import via `useImportMarketplaceBundle`. A `BundleItemList` below the header lists all items with their count.

1. Navigate from `/cl/marketplace` and select a bundle, or follow a direct link to `/cl/marketplace/:bundleId`. The page loads bundle metadata and items.
2. Inspect the bundle name, description, accreditation tags, clinical area tags, version, and published date.
3. The **Bundle Contents** section lists all items via `BundleItemList`, showing the total item count.
4. If an `UpdateBanner` appears, a newer version of this bundle is available compared to the version already imported. Click **View Update** to preview changes.
5. Click **Import** (requires `cl.marketplace.import`) to open the `ImportPreviewSheet`. Review items and confirm the import. On success, the sheet closes and the import is recorded in `cl_marketplace_imports` for the organization.

<AccordionGroup>
  <Accordion title="Bundle item types">
    Bundles can contain items of the following types: `assessment_template`, `note_template`, `cds_rule`, `pathway_definition`, `treatment_plan_template`, `goal_bank_entry`, `order_set`, `locus_instrument`, `group_curriculum`, `screening_instrument`.
  </Accordion>

  <Accordion title="Accreditation and clinical area tags">
    Accreditation tags include `Joint Commission`, `CARF`, `SAMHSA`, and `NCQA`. Clinical area tags include `SUD`, `MH`, `Co-Occurring`, `Crisis`, `Residential`, `Outpatient`, `IOP/PHP`, and `MAT/MOUD`.
  </Accordion>

  <Accordion title="Update detection">
    The page compares the imported version (from `useImportedBundleKeys`) against the current catalogue version. If `bundle.version > importedVersion`, the `UpdateBanner` is shown.
  </Accordion>

  <Accordion title="Not-found and error states">
    A bundle load error renders "Error Loading Bundle" with a sanitized message and a back button. A missing bundle renders "Bundle not found." with a back button.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Clinical" icon="stethoscope" href="/cl/overview">
    Overview of the Clinical core.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/cl.tsx
  * src/cores/cl/pages/MarketplaceCataloguePage.tsx
  * src/cores/cl/hooks/useMarketplaceBundles.ts
  * src/cores/cl/types/marketplace.ts
  * src/cores/cl/pages/MarketplaceBundleDetailPage.tsx
  * src/cores/cl/hooks/useMarketplaceBundleItems.ts
  * src/cores/cl/hooks/useMarketplaceImports.ts
</Accordion>
