Files
better-auth/demo/nextjs/app/dashboard/upgrade-button.tsx
Bereket Engida 4f56078e4b feat: stripe plugin to handle subscriptions and customers (#1588)
* init

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* feat(stripe): enable subscription support and update pricing plans

* feat(stripe): add Vitest configuration and initial tests for Stripe integration

* feat(stripe): implement setCookieToHeader function and update tests for customer creation and subscription handling

* feat(stripe): add seats support for subscriptions and update related endpoints

* feat(stripe): update schema to include unique referenceId, stripeSubscriptionId, and periodEnd fields

* wip docs

* docs

* docs: imporves

* fix(stripe): update webhook handlers to use correct subscription identification

* refactor(stripe): simplify customer management by storing Stripe customer ID directly on user

* chore(stripe): update package configuration and build setup

- Migrated from tsup to unbuild for build configuration
- Updated package.json with improved export and dependency management
- Added build configuration for better module support
- Removed tsup configuration file

* chore(stripe): update pnpm lockfile dependencies

- Moved `better-auth` from devDependencies to dependencies
- Added `zod` as a direct dependency
- Reorganized package dependencies in the lockfile

* feat(stripe): enhance subscription management and error handling

- Added toast error handling for subscription upgrades in the dashboard
- Updated Stripe price IDs for different plans
- Improved Stripe plugin documentation with beta warning and team subscription details
- Implemented intermediate redirect for checkout success to handle race conditions
- Added support for fetching and updating subscription status after checkout
- Fixed Next.js cookie handling and build configuration

* chore: update snapshot
2025-03-01 01:20:17 +03:00

38 lines
1.2 KiB
TypeScript

"use client";
import { useState } from "react";
import { motion } from "framer-motion";
import { Sparkles } from "lucide-react";
export default function UpgradeButton() {
const [isHovered, setIsHovered] = useState(false);
return (
<motion.button
className="relative overflow-hidden px-6 py-3 rounded-md bg-gradient-to-r from-gray-900 to-black text-white font-bold text-lg shadow-lg transition-all duration-300 ease-out transform hover:scale-105 hover:shadow-xl"
onHoverStart={() => setIsHovered(true)}
onHoverEnd={() => setIsHovered(false)}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
>
<span className="relative z-10 flex items-center justify-center">
<Sparkles className="w-5 h-5 mr-2" />
Upgrade to Pro
</span>
<motion.div
className="absolute inset-0 bg-gradient-to-r from-gray-800 to-gray-700"
initial={{ opacity: 0 }}
animate={{ opacity: isHovered ? 1 : 0 }}
transition={{ duration: 0.3 }}
/>
<motion.div
className="absolute inset-0 bg-white opacity-10"
initial={{ scale: 0, x: "100%", y: "100%" }}
animate={{ scale: isHovered ? 2 : 0, x: "0%", y: "0%" }}
transition={{ duration: 0.4, ease: "easeOut" }}
style={{ borderRadius: "2px" }}
/>
</motion.button>
);
}