Files
myeasycms-v2/apps/web/next.config.mjs
giancarlo e158ff28d8 Improve and update billing flow
This commit updates various components in the billing flow due to a new schema that supports multiple line items per plan. The added flexibility rendered 'line-items-mapper.ts' redundant, which has been removed. Additionally, webhooks have been created for handling account membership insertions and deletions, as well as handling subscription deletions when an account is deleted. This message also introduces a new service to handle sending out invitation emails. Lastly, the validation of the billing provider has been improved for increased security and stability.
2024-03-30 14:51:16 +08:00

83 lines
1.9 KiB
JavaScript

import withBundleAnalyzer from '@next/bundle-analyzer';
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL;
const INTERNAL_PACKAGES = [
'@kit/ui',
'@kit/auth',
'@kit/accounts',
'@kit/team-accounts',
'@kit/shared',
'@kit/supabase',
'@kit/i18n',
'@kit/mailers',
'@kit/billing',
'@kit/billing-gateway',
'@kit/stripe',
'@kit/email-templates',
'@kit/database-webhooks'
];
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
/** Enables hot reloading for local packages without a build step */
transpilePackages: INTERNAL_PACKAGES,
pageExtensions: ['ts', 'tsx'],
images: {
remotePatterns: getRemotePatterns(),
},
experimental: {
mdxRs: true,
optimizePackageImports: [
'recharts',
'lucide-react',
'@radix-ui/react-icons',
'@radix-ui/react-avatar',
'@radix-ui/react-select',
'date-fns',
...INTERNAL_PACKAGES,
],
},
modularizeImports: {
'lucide-react': {
transform: 'lucide-react/dist/esm/icons/{{ kebabCase member }}',
},
lodash: {
transform: 'lodash/{{member}}',
},
},
/** We already do linting and typechecking as separate tasks in CI */
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
};
export default withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})(config);
function getRemotePatterns() {
/** @type {import('next').NextConfig['remotePatterns']} */
// add here the remote patterns for your images
const remotePatterns = [];
if (SUPABASE_URL) {
const hostname = new URL(SUPABASE_URL).hostname;
remotePatterns.push({
protocol: 'https',
hostname,
});
}
return IS_PRODUCTION
? remotePatterns
: [
{
protocol: 'http',
hostname: '127.0.0.1',
},
];
}