import { http, HttpResponse } from "msw"; import preview from "../../.storybook/preview.tsx"; import { LetterheadParagraph } from "../Letterhead/index.tsx"; import { sleep } from "../sleep.ts"; import { SubscribeByEmailCard } from "./SubscribeByEmailCard.tsx"; const handlers = { subscribe() { return http.post( "http://mock.api/v1/newsletters/changelog/subscriptions", async () => { await sleep(2000); return HttpResponse.json( { tokenId: "1", message: "Ok" }, { status: 201 }, ); }, ); }, confirm() { return http.put( "http://mock.api/v1/newsletters/changelog/newsletter-signup-tokens/:tokenId", async () => { await sleep(2000); return HttpResponse.json({ message: "Ok" }, { status: 201 }); }, ); }, }; const meta = preview.meta({ title: "Newsletter/Subscribe By Email Card", component: SubscribeByEmailCard, tags: ["autodocs"], args: { content: { SUBSCRIBE: { title: "Space Gits on Indie Tabletop Club", description: ( Space Gits is getting a fancy gang builder and{" "} smart rules in late 2025 in collaboration with Indie Tabletop Club. Subscribe to ITC's{" "} at‑most‑one‑a‑month newsletter and be among the first to gain early access. It's gonna be rad. ), }, SUBSCRIBE_SUCCESS: { title: "Subscribed!", description: "Thank you for being awesome. Once Space Gits is available for " + "early access, you will be among the first to know!", }, }, }, parameters: { msw: { handlers: { subscribe: handlers.subscribe(), confirm: handlers.confirm(), }, }, }, }); export const Default = meta.story({});