#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import type { Meta, StoryObj } from "@storybook/react-vite";
import { http, HttpResponse } from "msw";
import { StripeCheckoutModal } from "@processor/components/billing/StripeCheckoutModal";
import "@processor/components/billing/billing.css";
/**
* Two-step "turn on the Processor" flow. Step 1 sets the monthly spend cap
* (its own page, since Stripe owns the card iframe on step 2). Storybook has no
* Stripe key, so step 2 renders the card placeholder rather than the live
* embedded form.
*/
const meta: Meta<typeof StripeCheckoutModal> = {
title: "Portal/Billing/StripeCheckoutModal",
component: StripeCheckoutModal,
args: {
open: true,
onClose: () => console.log("close"),
teamId: 1,
initialCapUsd: 100,
onComplete: () => Promise.resolve(true),
},
// Let the cap step's "Continue" succeed so the flow can advance to payment.
parameters: {
layout: "fullscreen",
msw: {
handlers: [
http.post("http://saas.mock/functions/v1/create-checkout-session", () =>
HttpResponse.json({
success: true,
currency: "usd",
currency_locked: false,
unit_amount_minor: 1,
}),
),
http.patch(
"http://saas.mock/api/v1/payg/cap",
() => new HttpResponse(null, { status: 204 }),
),
],
},
},
};
export default meta;
type Story = StoryObj<typeof StripeCheckoutModal>;
/** Step 1 — set the monthly spend limit before adding a card. */
export const SetCap: Story = {};
/** Step 1 seeded with no cap (uncapped) selected. */
export const Uncapped: Story = { args: { initialCapUsd: null } };