1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 07:25:19 +02:00

Merge pull request #154 from simonbukin/remove-billing-and-upgrade-references

Remove billing & upgrade references when STRIPE_API_KEY is missing
This commit is contained in:
Josh Pigford 2024-01-19 07:43:25 -06:00 committed by GitHub
commit 5a62708135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 20 additions and 13 deletions

View file

@ -35,7 +35,7 @@ export default function SettingsPage() {
<Tab.List> <Tab.List>
<Tab>Details</Tab> <Tab>Details</Tab>
<Tab>Security</Tab> <Tab>Security</Tab>
<Tab>Billing</Tab> {process.env.STRIPE_API_KEY && <Tab>Billing</Tab>}
</Tab.List> </Tab.List>
<Tab.Panels> <Tab.Panels>
<Tab.Panel> <Tab.Panel>
@ -46,9 +46,11 @@ export default function SettingsPage() {
<SecurityPreferences /> <SecurityPreferences />
</div> </div>
</Tab.Panel> </Tab.Panel>
{process.env.STRIPE_API_KEY && (
<Tab.Panel> <Tab.Panel>
<BillingPreferences /> <BillingPreferences />
</Tab.Panel> </Tab.Panel>
)}
</Tab.Panels> </Tab.Panels>
</Tab.Group> </Tab.Group>
</section> </section>

View file

@ -33,6 +33,8 @@ const envSchema = z.object({
NX_CDN_PRIVATE_BUCKET: z.string().default('REPLACE_THIS'), NX_CDN_PRIVATE_BUCKET: z.string().default('REPLACE_THIS'),
NX_CDN_PUBLIC_BUCKET: z.string().default('REPLACE_THIS'), NX_CDN_PUBLIC_BUCKET: z.string().default('REPLACE_THIS'),
STRIPE_API_KEY: z.string().optional(),
}) })
const env = envSchema.parse(process.env) const env = envSchema.parse(process.env)

View file

@ -154,11 +154,13 @@ syncInstitutionQueue.add(
*/ */
sendEmailQueue.process('send-email', async (job) => await emailProcessor.send(job.data)) sendEmailQueue.process('send-email', async (job) => await emailProcessor.send(job.data))
sendEmailQueue.add( if (env.STRIPE_API_KEY) {
sendEmailQueue.add(
'send-email', 'send-email',
{ type: 'trial-reminders' }, { type: 'trial-reminders' },
{ repeat: { cron: '0 */12 * * *' } } // Run every 12 hours { repeat: { cron: '0 */12 * * *' } } // Run every 12 hours
) )
}
// Fallback - usually triggered by errors not handled (or thrown) within the Bull event handlers (see above) // Fallback - usually triggered by errors not handled (or thrown) within the Bull event handlers (see above)
process.on( process.on(

View file

@ -313,7 +313,6 @@ function DefaultContent({
email, email,
}: PropsWithChildren<{ onboarding?: ReactNode; name?: string; email?: string }>) { }: PropsWithChildren<{ onboarding?: ReactNode; name?: string; email?: string }>) {
const { addAccount } = useAccountContext() const { addAccount } = useAccountContext()
return ( return (
<> <>
<div className="flex items-center justify-between mb-4"> <div className="flex items-center justify-between mb-4">
@ -338,7 +337,7 @@ function DefaultContent({
{onboarding && onboarding} {onboarding && onboarding}
<UpgradePrompt /> {process.env.STRIPE_API_KEY && <UpgradePrompt />}
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="text-base"> <div className="text-base">

View file

@ -174,7 +174,7 @@ export function MobileLayout({ children, sidebar }: MobileLayoutProps) {
</section> </section>
<div className="pt-6 shrink-0"> <div className="pt-6 shrink-0">
<UpgradePrompt /> {process.env.STRIPE_API_KEY && <UpgradePrompt />}
</div> </div>
</div> </div>
</div> </div>

View file

@ -78,7 +78,9 @@ export function BillingPreferences() {
</div> </div>
)} )}
</div> </div>
{process.env.STRIPE_API_KEY && (
<UpgradeTakeover open={takeoverOpen} onClose={() => setTakeoverOpen(false)} /> <UpgradeTakeover open={takeoverOpen} onClose={() => setTakeoverOpen(false)} />
)}
</> </>
) )
} }