The billing schema has been revamped to allow more flexible billing setups, supporting multiple line items per plan. Changes extend to related app and UI components for a seamless experience. As a result, the previously used 'line-items-mapper.ts' is no longer needed and has been removed.
56 lines
1.1 KiB
TypeScript
56 lines
1.1 KiB
TypeScript
import type { Provider } from '@supabase/gotrue-js';
|
|
|
|
import { z } from 'zod';
|
|
|
|
const providers: z.ZodType<Provider> = getProviders();
|
|
|
|
const AuthConfigSchema = z.object({
|
|
providers: z.object({
|
|
password: z.boolean({
|
|
description: 'Enable password authentication.',
|
|
}),
|
|
magicLink: z.boolean({
|
|
description: 'Enable magic link authentication.',
|
|
}),
|
|
oAuth: providers.array(),
|
|
}),
|
|
});
|
|
|
|
const authConfig = AuthConfigSchema.parse({
|
|
// NB: Enable the providers below in the Supabase Console
|
|
// in your production project
|
|
providers: {
|
|
password: process.env.NEXT_PUBLIC_AUTH_PASSWORD === 'true',
|
|
magicLink: process.env.NEXT_PUBLIC_AUTH_MAGIC_LINK === 'true',
|
|
oAuth: ['google'],
|
|
},
|
|
} satisfies z.infer<typeof AuthConfigSchema>);
|
|
|
|
export default authConfig;
|
|
|
|
function getProviders() {
|
|
return z.enum([
|
|
'apple',
|
|
'azure',
|
|
'bitbucket',
|
|
'discord',
|
|
'facebook',
|
|
'figma',
|
|
'github',
|
|
'gitlab',
|
|
'google',
|
|
'kakao',
|
|
'keycloak',
|
|
'linkedin',
|
|
'linkedin_oidc',
|
|
'notion',
|
|
'slack',
|
|
'spotify',
|
|
'twitch',
|
|
'twitter',
|
|
'workos',
|
|
'zoom',
|
|
'fly',
|
|
]);
|
|
}
|