Update authentication methods and UI components, remove redundant file
This commit accomplishes a few modifications including the elimination of `use-toast.tsx` due to redundancy. The authentication methods in `personal-accounts-server-actions.ts` were refactored to improve service integration and data handling. Additionally, UI components were updated for better readability and clarity. Cascading deletion was enabled in the `schema.sql` file for 'invited_by' reference.
This commit is contained in:
@@ -16,8 +16,8 @@ const authConfig = AuthConfigSchema.parse({
|
|||||||
// NB: Enable the providers below in the Supabase Console
|
// NB: Enable the providers below in the Supabase Console
|
||||||
// in your production project
|
// in your production project
|
||||||
providers: {
|
providers: {
|
||||||
password: false,
|
password: true,
|
||||||
magicLink: true,
|
magicLink: false,
|
||||||
oAuth: ['google'],
|
oAuth: ['google'],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,43 +15,43 @@
|
|||||||
"with-env": "dotenv -e ./.env.local --"
|
"with-env": "dotenv -e ./.env.local --"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kit/ui": "^0.1.0",
|
"@epic-web/invariant": "^1.0.0",
|
||||||
"@kit/i18n": "^0.1.0",
|
"@hookform/resolvers": "^3.3.4",
|
||||||
"@kit/auth": "^0.1.0",
|
|
||||||
"@kit/shared": "^0.1.0",
|
|
||||||
"@kit/admin": "^0.1.0",
|
|
||||||
"@kit/emails": "^0.1.0",
|
|
||||||
"@kit/accounts": "^0.1.0",
|
"@kit/accounts": "^0.1.0",
|
||||||
"@kit/team-accounts": "^0.1.0",
|
"@kit/admin": "^0.1.0",
|
||||||
"@kit/supabase": "^0.1.0",
|
"@kit/auth": "^0.1.0",
|
||||||
"@kit/billing": "^0.1.0",
|
"@kit/billing": "^0.1.0",
|
||||||
"@kit/billing-gateway": "^0.1.0",
|
"@kit/billing-gateway": "^0.1.0",
|
||||||
|
"@kit/emails": "^0.1.0",
|
||||||
|
"@kit/i18n": "^0.1.0",
|
||||||
"@kit/mailers": "^0.1.0",
|
"@kit/mailers": "^0.1.0",
|
||||||
"@hookform/resolvers": "^3.3.4",
|
"@kit/shared": "^0.1.0",
|
||||||
|
"@kit/supabase": "^0.1.0",
|
||||||
|
"@kit/team-accounts": "^0.1.0",
|
||||||
|
"@kit/ui": "^0.1.0",
|
||||||
"@next/mdx": "^14.1.0",
|
"@next/mdx": "^14.1.0",
|
||||||
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
"@supabase/ssr": "^0.1.0",
|
"@supabase/ssr": "^0.1.0",
|
||||||
"@supabase/supabase-js": "^2.39.8",
|
"@supabase/supabase-js": "^2.39.8",
|
||||||
"@tanstack/react-query": "^5.17.15",
|
"@tanstack/react-query": "5.28.6",
|
||||||
"@tanstack/react-query-next-experimental": "^5.28.6",
|
"@tanstack/react-query-next-experimental": "^5.28.6",
|
||||||
"@tanstack/react-table": "^8.11.3",
|
"@tanstack/react-table": "^8.11.3",
|
||||||
"@epic-web/invariant": "^1.0.0",
|
"contentlayer": "0.3.4",
|
||||||
"@radix-ui/react-icons": "^1.3.0",
|
"date-fns": "^3.2.0",
|
||||||
"edge-csrf": "^1.0.9",
|
"edge-csrf": "^1.0.9",
|
||||||
"i18next": "^23.10.1",
|
"i18next": "^23.10.1",
|
||||||
"i18next-resources-to-backend": "^1.2.0",
|
"i18next-resources-to-backend": "^1.2.0",
|
||||||
"contentlayer": "0.3.4",
|
|
||||||
"rehype-autolink-headings": "^7.1.0",
|
|
||||||
"rehype-slug": "^6.0.0",
|
|
||||||
"next-contentlayer": "0.3.4",
|
|
||||||
"react-i18next": "^14.1.0",
|
|
||||||
"date-fns": "^3.2.0",
|
|
||||||
"next": "canary",
|
"next": "canary",
|
||||||
|
"next-contentlayer": "0.3.4",
|
||||||
"next-sitemap": "^4.2.3",
|
"next-sitemap": "^4.2.3",
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-hook-form": "^7.51.1",
|
"react-hook-form": "^7.51.1",
|
||||||
|
"react-i18next": "^14.1.0",
|
||||||
"recharts": "^2.10.3",
|
"recharts": "^2.10.3",
|
||||||
|
"rehype-autolink-headings": "^7.1.0",
|
||||||
|
"rehype-slug": "^6.0.0",
|
||||||
"sonner": "^1.4.41",
|
"sonner": "^1.4.41",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
@@ -69,9 +69,9 @@
|
|||||||
"autoprefixer": "^10.4.17",
|
"autoprefixer": "^10.4.17",
|
||||||
"dotenv-cli": "^7.3.0",
|
"dotenv-cli": "^7.3.0",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.4",
|
||||||
"tailwindcss": "3.4.1",
|
"tailwindcss": "3.4.1",
|
||||||
"typescript": "^5.4.3"
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
"tooling/*",
|
"tooling/*",
|
||||||
"supabase"
|
"supabase"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"dependencies": {
|
||||||
"@manypkg/cli": "^0.21.2",
|
"@manypkg/cli": "^0.21.2",
|
||||||
"@turbo/gen": "^1.11.3",
|
"@turbo/gen": "^1.11.3",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
|||||||
@@ -14,20 +14,28 @@
|
|||||||
"./components": "./src/components/index.ts"
|
"./components": "./src/components/index.ts"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"zod": "^3.22.4",
|
|
||||||
"@kit/ui": "0.1.0",
|
|
||||||
"@kit/stripe": "0.1.0",
|
|
||||||
"@kit/billing": "0.1.0",
|
"@kit/billing": "0.1.0",
|
||||||
"@kit/supabase": "^0.1.0",
|
|
||||||
"@kit/shared": "^0.1.0",
|
"@kit/shared": "^0.1.0",
|
||||||
"lucide-react": "^0.361.0",
|
"@kit/stripe": "0.1.0",
|
||||||
"@supabase/supabase-js": "^2.39.8"
|
"@kit/supabase": "^0.1.0",
|
||||||
|
"@kit/ui": "0.1.0",
|
||||||
|
"@supabase/supabase-js": "^2.39.8",
|
||||||
|
"lucide-react": "^0.363.0",
|
||||||
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@kit/billing": "*",
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/shared": "*",
|
||||||
|
"@kit/stripe": "*",
|
||||||
|
"@kit/supabase": "*",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@kit/ui": "*",
|
||||||
|
"@supabase/supabase-js": "^2.39.8",
|
||||||
|
"lucide-react": "^0.363.0",
|
||||||
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
@@ -5,29 +5,17 @@ import { LoadingOverlay } from '@kit/ui/loading-overlay';
|
|||||||
|
|
||||||
type BillingProvider = Database['public']['Enums']['billing_provider'];
|
type BillingProvider = Database['public']['Enums']['billing_provider'];
|
||||||
|
|
||||||
const Fallback = (
|
const Fallback = <LoadingOverlay fullPage={false} />;
|
||||||
<LoadingOverlay fullPage={false}>Loading Checkout...</LoadingOverlay>
|
|
||||||
);
|
|
||||||
|
|
||||||
export function EmbeddedCheckout(
|
export function EmbeddedCheckout(
|
||||||
props: React.PropsWithChildren<{
|
props: React.PropsWithChildren<{
|
||||||
checkoutToken: string;
|
checkoutToken: string;
|
||||||
provider: BillingProvider;
|
provider: BillingProvider;
|
||||||
onClose?: () => void;
|
onClose: () => void;
|
||||||
}>,
|
|
||||||
) {
|
|
||||||
return <LazyCheckout {...props} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
function LazyCheckout(
|
|
||||||
props: React.PropsWithChildren<{
|
|
||||||
checkoutToken: string;
|
|
||||||
provider: BillingProvider;
|
|
||||||
onClose?: () => void;
|
|
||||||
}>,
|
}>,
|
||||||
) {
|
) {
|
||||||
const CheckoutComponent = useMemo(
|
const CheckoutComponent = useMemo(
|
||||||
() => memo(loadCheckoutComponent(props.provider)),
|
() => loadCheckoutComponent(props.provider),
|
||||||
[props.provider],
|
[props.provider],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -65,28 +53,37 @@ function loadCheckoutComponent(provider: BillingProvider) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildLazyComponent<
|
function buildLazyComponent<
|
||||||
Cmp extends React.ComponentType<
|
Component extends React.ComponentType<{
|
||||||
React.PropsWithChildren<{
|
onClose: (() => unknown) | undefined;
|
||||||
onClose?: (() => unknown) | undefined;
|
checkoutToken: string;
|
||||||
checkoutToken: string;
|
}>,
|
||||||
}>
|
|
||||||
>,
|
|
||||||
>(
|
>(
|
||||||
load: () => Promise<{
|
load: () => Promise<{
|
||||||
default: Cmp;
|
default: Component;
|
||||||
}>,
|
}>,
|
||||||
fallback = Fallback,
|
fallback = Fallback,
|
||||||
) {
|
) {
|
||||||
let LoadedComponent: ReturnType<typeof lazy> | null = null;
|
let LoadedComponent: ReturnType<typeof lazy<Component>> | null = null;
|
||||||
|
|
||||||
const LazyComponent = forwardRef(function LazyDynamicComponent(props, ref) {
|
const LazyComponent = forwardRef<
|
||||||
|
React.ElementRef<'div'>,
|
||||||
|
{
|
||||||
|
onClose: (() => unknown) | undefined;
|
||||||
|
checkoutToken: string;
|
||||||
|
}
|
||||||
|
>(function LazyDynamicComponent(props, ref) {
|
||||||
if (!LoadedComponent) {
|
if (!LoadedComponent) {
|
||||||
LoadedComponent = lazy(load);
|
LoadedComponent = lazy(load);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={fallback}>
|
<Suspense fallback={fallback}>
|
||||||
<LoadedComponent {...props} ref={ref} />
|
{/* @ts-ignore */}
|
||||||
|
<LoadedComponent
|
||||||
|
onClose={props.onClose}
|
||||||
|
checkoutToken={props.checkoutToken}
|
||||||
|
ref={ref}
|
||||||
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,16 +15,20 @@
|
|||||||
"./schema": "./src/schema/index.ts"
|
"./schema": "./src/schema/index.ts"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"zod": "^3.22.4",
|
|
||||||
"@kit/ui": "0.1.0",
|
|
||||||
"@kit/supabase": "0.1.0",
|
"@kit/supabase": "0.1.0",
|
||||||
"lucide-react": "^0.361.0"
|
"@kit/ui": "0.1.0",
|
||||||
|
"lucide-react": "^0.363.0",
|
||||||
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/supabase": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@kit/ui": "0.1.0",
|
||||||
|
"lucide-react": "^0.363.0",
|
||||||
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ export * from './create-billing-checkout.schema';
|
|||||||
export * from './create-biling-portal-session.schema';
|
export * from './create-biling-portal-session.schema';
|
||||||
export * from './retrieve-checkout-session.schema';
|
export * from './retrieve-checkout-session.schema';
|
||||||
export * from './cancel-subscription-params.schema';
|
export * from './cancel-subscription-params.schema';
|
||||||
|
export * from './report-billing-usage.schema';
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
export const ReportBillingUsageSchema = z.object({
|
||||||
|
subscriptionId: z.string(),
|
||||||
|
usage: z.object({
|
||||||
|
quantity: z.number(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
CreateBillingPortalSessionSchema,
|
CreateBillingPortalSessionSchema,
|
||||||
RetrieveCheckoutSessionSchema,
|
RetrieveCheckoutSessionSchema,
|
||||||
} from '../schema';
|
} from '../schema';
|
||||||
|
import { ReportBillingUsageSchema } from '../schema/report-billing-usage.schema';
|
||||||
|
|
||||||
export abstract class BillingStrategyProviderService {
|
export abstract class BillingStrategyProviderService {
|
||||||
abstract createBillingPortalSession(
|
abstract createBillingPortalSession(
|
||||||
@@ -37,4 +38,10 @@ export abstract class BillingStrategyProviderService {
|
|||||||
): Promise<{
|
): Promise<{
|
||||||
success: boolean;
|
success: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
abstract reportUsage(
|
||||||
|
params: z.infer<typeof ReportBillingUsageSchema>,
|
||||||
|
): Promise<{
|
||||||
|
success: boolean;
|
||||||
|
}>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "@kit/emails",
|
"name": "@kit/emails",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -17,8 +16,8 @@
|
|||||||
"@react-email/components": "0.0.15"
|
"@react-email/components": "0.0.15"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,15 +17,20 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/shared": "*",
|
||||||
|
"@kit/supabase": "*",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@kit/ui": "*",
|
||||||
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
|
"lucide-react": "^0.363.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
"@kit/shared": "0.1.0",
|
||||||
"@kit/supabase": "0.1.0",
|
"@kit/supabase": "0.1.0",
|
||||||
"@kit/ui": "0.1.0",
|
"@kit/ui": "0.1.0",
|
||||||
"@kit/shared": "0.1.0",
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
"lucide-react": "^0.360.0",
|
"lucide-react": "^0.363.0"
|
||||||
"@radix-ui/react-icons": "^1.3.0"
|
|
||||||
},
|
},
|
||||||
"prettier": "@kit/prettier-config",
|
"prettier": "@kit/prettier-config",
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@kit/prettier-config": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@kit/ui": "*"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": "./src/index.ts"
|
||||||
|
|||||||
@@ -16,16 +16,16 @@
|
|||||||
"./mfa": "./src/mfa.ts"
|
"./mfa": "./src/mfa.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/supabase": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0",
|
"@kit/tsconfig": "0.1.0",
|
||||||
"@radix-ui/react-icons": "^1.3.0",
|
|
||||||
"@kit/ui": "0.1.0",
|
"@kit/ui": "0.1.0",
|
||||||
"@kit/supabase": "0.1.0",
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
"react-i18next": "14.1.0",
|
"@tanstack/react-query": "5.28.6",
|
||||||
"sonner": "^1.4.41",
|
"react-i18next": "^14.1.0",
|
||||||
"@tanstack/react-query": "5.28.6"
|
"sonner": "^1.4.41"
|
||||||
},
|
},
|
||||||
"prettier": "@kit/prettier-config",
|
"prettier": "@kit/prettier-config",
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
@@ -12,19 +12,26 @@
|
|||||||
"./components": "./src/components/index.ts"
|
"./components": "./src/components/index.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@kit/accounts": "*",
|
||||||
|
"@kit/emails": "*",
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/mailers": "*",
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/shared": "*",
|
||||||
|
"@kit/supabase": "*",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@kit/ui": "*",
|
||||||
|
"lucide-react": "^0.363.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
"@kit/accounts": "0.1.0",
|
||||||
|
"@kit/emails": "0.1.0",
|
||||||
|
"@kit/mailers": "0.1.0",
|
||||||
|
"@kit/shared": "0.1.0",
|
||||||
"@kit/supabase": "0.1.0",
|
"@kit/supabase": "0.1.0",
|
||||||
"@kit/ui": "0.1.0",
|
"@kit/ui": "0.1.0",
|
||||||
"@kit/shared": "0.1.0",
|
"lucide-react": "^0.363.0"
|
||||||
"@kit/accounts": "0.1.0",
|
|
||||||
"@kit/mailers": "0.1.0",
|
|
||||||
"@kit/emails": "0.1.0",
|
|
||||||
"lucide-react": "^0.360.0"
|
|
||||||
},
|
},
|
||||||
"prettier": "@kit/prettier-config",
|
"prettier": "@kit/prettier-config",
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
@@ -16,18 +16,22 @@
|
|||||||
"./provider": "./src/I18nProvider.tsx"
|
"./provider": "./src/I18nProvider.tsx"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/shared": "^0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"i18next": "^23.10.1",
|
"i18next": "^23.10.1",
|
||||||
"react-i18next": "^14.1.0",
|
|
||||||
"i18next-browser-languagedetector": "7.2.0",
|
"i18next-browser-languagedetector": "7.2.0",
|
||||||
"i18next-resources-to-backend": "^1.2.0",
|
"i18next-resources-to-backend": "^1.2.0",
|
||||||
"next": "^14.1.4",
|
"react-i18next": "^14.1.0"
|
||||||
"@kit/shared": "^0.1.0"
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@kit/shared": "^0.1.0",
|
||||||
|
"i18next": "^23.10.1",
|
||||||
|
"i18next-browser-languagedetector": "7.2.0",
|
||||||
|
"i18next-resources-to-backend": "^1.2.0",
|
||||||
|
"react-i18next": "^14.1.0"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
"nodemailer": "^6.9.13"
|
"nodemailer": "^6.9.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0",
|
"@kit/tsconfig": "0.1.0",
|
||||||
"@types/nodemailer": "6.4.14"
|
"@types/nodemailer": "6.4.14"
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
"pino": "^8.19.0"
|
"pino": "^8.19.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { createContext } from 'react';
|
|
||||||
|
|
||||||
export const CsrfTokenContext = createContext<string | null>(null);
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import { useContext } from 'react';
|
|
||||||
|
|
||||||
import { CsrfTokenContext } from '@kit/contexts/csrf.context';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Retrieves the current CSRF token in the CsrfTokenContext context
|
|
||||||
* If not found, it will return an empty string. If required, the API will throw an error
|
|
||||||
*/
|
|
||||||
function useCsrfToken() {
|
|
||||||
const token = useContext(CsrfTokenContext);
|
|
||||||
|
|
||||||
return token ?? '';
|
|
||||||
}
|
|
||||||
|
|
||||||
export default useCsrfToken;
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { useCallback } from 'react';
|
|
||||||
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name useRefreshRoute
|
|
||||||
* @description Refresh the current page. Useful for when you need to
|
|
||||||
* refresh the data on a page after a mutation. This is a temporary
|
|
||||||
* workaround until Next.js adds mutations
|
|
||||||
*/
|
|
||||||
function useRefreshRoute() {
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
return useCallback(() => {
|
|
||||||
router.refresh();
|
|
||||||
}, [router]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default useRefreshRoute;
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "@kit/stripe",
|
"name": "@kit/stripe",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -17,20 +16,24 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@kit/billing": "0.1.0",
|
"@kit/billing": "0.1.0",
|
||||||
"@kit/ui": "0.1.0",
|
|
||||||
"@kit/shared": "0.1.0",
|
"@kit/shared": "0.1.0",
|
||||||
"@kit/supabase": "0.1.0"
|
"@kit/supabase": "0.1.0",
|
||||||
|
"@kit/ui": "0.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"stripe": "^14.21.0",
|
|
||||||
"@stripe/react-stripe-js": "^2.6.2",
|
"@stripe/react-stripe-js": "^2.6.2",
|
||||||
"@stripe/stripe-js": "^3.0.10"
|
"@stripe/stripe-js": "^3.0.10",
|
||||||
|
"stripe": "^14.21.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@kit/billing": "*",
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
|
"@kit/shared": "*",
|
||||||
|
"@kit/supabase": "*",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@kit/ui": "*"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
CancelSubscriptionParamsSchema,
|
CancelSubscriptionParamsSchema,
|
||||||
CreateBillingCheckoutSchema,
|
CreateBillingCheckoutSchema,
|
||||||
CreateBillingPortalSessionSchema,
|
CreateBillingPortalSessionSchema,
|
||||||
|
ReportBillingUsageSchema,
|
||||||
RetrieveCheckoutSessionSchema,
|
RetrieveCheckoutSessionSchema,
|
||||||
} from '@kit/billing/schema';
|
} from '@kit/billing/schema';
|
||||||
|
|
||||||
@@ -69,6 +70,16 @@ export class StripeBillingStrategyService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async reportUsage(params: z.infer<typeof ReportBillingUsageSchema>) {
|
||||||
|
const stripe = await this.stripeProvider();
|
||||||
|
|
||||||
|
await stripe.subscriptionItems.createUsageRecord(params.subscriptionId, {
|
||||||
|
quantity: params.usage.quantity,
|
||||||
|
});
|
||||||
|
|
||||||
|
return { success: true };
|
||||||
|
}
|
||||||
|
|
||||||
private async stripeProvider(): Promise<Stripe> {
|
private async stripeProvider(): Promise<Stripe> {
|
||||||
return createStripeClient();
|
return createStripeClient();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,16 +23,20 @@
|
|||||||
"./database": "./src/database.types.ts"
|
"./database": "./src/database.types.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@epic-web/invariant": "^1.0.0",
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
|
"@kit/prettier-config": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0"
|
"@kit/tsconfig": "0.1.0",
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@tanstack/react-query": "^5.28.6",
|
|
||||||
"@supabase/ssr": "^0.1.0",
|
"@supabase/ssr": "^0.1.0",
|
||||||
"@supabase/supabase-js": "^2.39.8",
|
"@supabase/supabase-js": "^2.39.8",
|
||||||
"@epic-web/invariant": "^1.0.0"
|
"@tanstack/react-query": "5.28.6"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@epic-web/invariant": "^1.0.0",
|
||||||
|
"@supabase/ssr": "^0.1.0",
|
||||||
|
"@supabase/supabase-js": "^2.39.8",
|
||||||
|
"@tanstack/react-query": "^5.28.6"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
@@ -10,51 +10,60 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-accordion": "1.1.2",
|
"@radix-ui/react-accordion": "1.1.2",
|
||||||
|
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||||
"@radix-ui/react-avatar": "^1.0.4",
|
"@radix-ui/react-avatar": "^1.0.4",
|
||||||
"@radix-ui/react-checkbox": "^1.0.4",
|
"@radix-ui/react-checkbox": "^1.0.4",
|
||||||
"@radix-ui/react-dialog": "^1.0.5",
|
"@radix-ui/react-dialog": "^1.0.5",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||||
"@radix-ui/react-label": "^2.0.2",
|
"@radix-ui/react-label": "^2.0.2",
|
||||||
|
"@radix-ui/react-navigation-menu": "^1.1.4",
|
||||||
"@radix-ui/react-popover": "^1.0.7",
|
"@radix-ui/react-popover": "^1.0.7",
|
||||||
|
"@radix-ui/react-radio-group": "^1.1.3",
|
||||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
"@radix-ui/react-scroll-area": "^1.0.5",
|
||||||
"@radix-ui/react-select": "^2.0.0",
|
"@radix-ui/react-select": "^2.0.0",
|
||||||
|
"@radix-ui/react-separator": "^1.0.3",
|
||||||
"@radix-ui/react-slot": "^1.0.2",
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
"@radix-ui/react-tabs": "^1.0.4",
|
"@radix-ui/react-tabs": "^1.0.4",
|
||||||
"@radix-ui/react-toast": "^1.1.5",
|
"@radix-ui/react-toast": "^1.1.5",
|
||||||
"@radix-ui/react-tooltip": "1.0.7",
|
"@radix-ui/react-tooltip": "1.0.7",
|
||||||
"@radix-ui/react-radio-group": "^1.1.3",
|
|
||||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
|
||||||
"@radix-ui/react-navigation-menu": "^1.1.4",
|
|
||||||
"@radix-ui/react-separator": "^1.0.3",
|
|
||||||
"react-top-loading-bar": "2.3.1",
|
|
||||||
"clsx": "^2.1.0",
|
"clsx": "^2.1.0",
|
||||||
"cmdk": "^0.2.0",
|
"cmdk": "^0.2.0",
|
||||||
|
"react-top-loading-bar": "2.3.1",
|
||||||
"tailwind-merge": "^2.2.0"
|
"tailwind-merge": "^2.2.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tanstack/react-table": "^8.10.7",
|
|
||||||
"react-i18next": "^14.1.0",
|
|
||||||
"@radix-ui/react-icons": "1.3.0",
|
"@radix-ui/react-icons": "1.3.0",
|
||||||
"zod": "^3.22.4",
|
"@tanstack/react-table": "^8.10.7",
|
||||||
"sonner": "^1.4.41",
|
|
||||||
"lucide-react": "0.307.0",
|
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"date-fns": "^3.2.0",
|
"date-fns": "^3.2.0",
|
||||||
"react-hook-form": "^7.49.2"
|
"lucide-react": "^0.363.0",
|
||||||
|
"react-hook-form": "^7.49.2",
|
||||||
|
"react-i18next": "^14.1.0",
|
||||||
|
"sonner": "^1.4.41",
|
||||||
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/eslint-config": "0.2.0",
|
"@kit/eslint-config": "0.2.0",
|
||||||
"@kit/prettier-config": "0.1.0",
|
"@kit/prettier-config": "0.1.0",
|
||||||
"@kit/tailwind-config": "0.1.0",
|
"@kit/tailwind-config": "0.1.0",
|
||||||
"@kit/tsconfig": "0.1.0",
|
"@kit/tsconfig": "0.1.0",
|
||||||
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
|
"@tanstack/react-table": "^8.11.3",
|
||||||
"@types/react": "^18.2.48",
|
"@types/react": "^18.2.48",
|
||||||
"@types/react-dom": "^18.2.18",
|
"@types/react-dom": "^18.2.18",
|
||||||
|
"class-variance-authority": "^0.7.0",
|
||||||
|
"date-fns": "^3.2.0",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
|
"lucide-react": "^0.363.0",
|
||||||
"prettier": "^3.2.4",
|
"prettier": "^3.2.4",
|
||||||
"react-day-picker": "^8.10.0",
|
"react-day-picker": "^8.10.0",
|
||||||
|
"react-hook-form": "^7.51.1",
|
||||||
|
"react-i18next": "^14.1.0",
|
||||||
|
"sonner": "^1.4.41",
|
||||||
"tailwindcss": "3.4.1",
|
"tailwindcss": "3.4.1",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3",
|
||||||
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
920
pnpm-lock.yaml
generated
920
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/eslint-plugin-next": "^14.1.0",
|
"@next/eslint-plugin-next": "^14.1.0",
|
||||||
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||||
"@types/eslint": "^8.56.2",
|
"@types/eslint": "^8.56.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||||
"@typescript-eslint/parser": "^7.3.1",
|
"@typescript-eslint/parser": "^7.3.1",
|
||||||
@@ -24,14 +25,13 @@
|
|||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||||
"eslint-plugin-react": "^7.34.1",
|
"eslint-plugin-react": "^7.34.1",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0"
|
||||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kit/prettier-config": "^0.1.0",
|
"@kit/prettier-config": "^0.1.0",
|
||||||
"@kit/tsconfig": "^0.1.0",
|
"@kit/tsconfig": "^0.1.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.56.0",
|
||||||
"typescript": "^5.4.3"
|
"typescript": "^5.3.3"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user