Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

793 B
Raw Blame
/**
 * Import types that ship a populated example CSV in Spree's
 * `core/db/sample_data`. Keyed by the API's type shorthand (`"products"`),
 * which is also the CSV's filename stem.
 *
 * Only used to decide whether to render the download link — the file itself is
 * served by each panel's own `imports/example` endpoint, which pins the URL to
 * the installed Spree version. A type missing from this list simply hides the link;
 * the endpoint is the authority and 404s for anything it has no example for.
 */
const TYPES_WITH_SAMPLE_CSV = new Set([
  'products',
  'customers',
  'product_translations',
  'price_list_prices',
])

/** Whether an import type has an example CSV to offer. */
export function hasSampleCsv(type: string): boolean {
  return TYPES_WITH_SAMPLE_CSV.has(type)
}