1 import { toPublicId } from "../../public-id.js"
2 import type { BannerDefinition } from "../types.js"
3 import { CLOUD_CHANGELOG_SPEC, type CloudChangelogSpec } from "./spec.js"
4 import { buildCloudChangelog, type CloudChangelogInput } from "./template.js"
5
6 /** The banner that heads an entry in the Medusa Cloud changelog. */
7 export const cloudChangelogBanner: BannerDefinition<
8 CloudChangelogSpec,
9 CloudChangelogInput
10 > = {
11 spec: CLOUD_CHANGELOG_SPEC,
12 folder: "Cloud Changelog",
13 normalize: (input) => ({ ...input, date: input.date.trim() }),
14 build: buildCloudChangelog,
15 // The date is the only thing that varies between these banners, so it is also
16 // what identifies one. Pass a date that carries its year if two entries a year
17 // apart must not overwrite each other.
18 publicId: ({ date }) => toPublicId(date),
19 label: ({ date }) => toPublicId(date),
20 preview: {
21 // A short date, a wider one, and one carrying a year — enough to see the
22 // pill size correctly around whatever the date turns out to be.
23 inputs: [
24 { type: "cloud-changelog", date: "Aug 17" },
25 { type: "cloud-changelog", date: "Sep 30" },
26 { type: "cloud-changelog", date: "Dec 1, 2026" },
27 ],
28 },
29 }
30
31 export { CLOUD_CHANGELOG_SPEC } from "./spec.js"
32 export type {
33 CloudChangelogContentSpec,
34 CloudChangelogSpec,
35 CloudPillSpec,
36 } from "./spec.js"
37 export type { CloudChangelogInput } from "./template.js"