import { Meta, StoryObj } from "@storybook/nextjs-vite"; import { CouponTemplate } from "./CouponTemplate"; import { fn } from "storybook/test"; import { buildCouponDefaults } from "@/lib/admin/builder/state/defaults/coupon"; import type { CouponScreenDefinition } from "@/lib/funnel/types"; // Получаем дефолтные значения из builder const defaultScreen = buildCouponDefaults("coupon-screen-story") as CouponScreenDefinition; /** CouponTemplate - экраны с купонами и промокодами */ const meta: Meta = { title: "Funnel Templates/CouponTemplate", component: CouponTemplate, tags: ["autodocs"], parameters: { layout: "fullscreen", }, args: { screen: defaultScreen, onContinue: fn(), canGoBack: true, onBack: fn(), screenProgress: { current: 8, total: 10 }, defaultTexts: { nextButton: "Next", continueButton: "Continue" }, }, argTypes: { screen: { control: { type: "object" }, }, screenProgress: { control: { type: "object" }, }, onContinue: { action: "continue" }, onBack: { action: "back" }, }, }; export default meta; type Story = StoryObj; /** Дефолтный купон экран */ export const Default: Story = {}; /** Купон с показом прогресса */ export const WithProgress: Story = { args: { screen: { ...defaultScreen, header: { show: true, showBackButton: true, showProgress: true, // Показываем прогресс }, }, }, }; /** Экран без header */ export const WithoutHeader: Story = { args: { screen: { ...defaultScreen, header: { show: false, }, }, }, }; /** Купон с другой скидкой */ export const CustomDiscount: Story = { args: { screen: { ...defaultScreen, coupon: { ...defaultScreen.coupon, offer: { title: { text: "50% OFF", font: "manrope", weight: "bold", align: "center", size: "3xl", color: "primary", }, description: { text: "Скидка на первую покупку", font: "inter", weight: "medium", color: "muted", align: "center", size: "md", }, }, promoCode: { text: "FIRST50", font: "geistMono", weight: "bold", align: "center", size: "lg", color: "accent", }, }, }, }, };