Skip to content

Commit 45a6fe3

Browse files
committed
fix(billing): eligible-only trial copy, log a failed plan-ended email, stronger search-gate assertion
1 parent a372f5d commit 45a6fe3

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎apps/sim/components/emails/billing/credits-exhausted-email.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function CreditsExhaustedEmail({
3131
<ProFeaturesBox />
3232

3333
<Text style={baseStyles.paragraph}>
34-
If you haven't had a Sim trial, Pro starts with a {PRO_TRIAL_DAYS}-day free trial.
34+
Eligible new Pro subscribers start with a {PRO_TRIAL_DAYS}-day free trial.
3535
</Text>
3636

3737
<EmailButton href={upgradeLink}>Upgrade to Pro</EmailButton>

‎apps/sim/components/emails/billing/free-tier-upgrade-email.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function FreeTierUpgradeEmail({
3535
<ProFeaturesBox />
3636

3737
<Text style={baseStyles.paragraph}>
38-
If you haven't had a Sim trial, Pro starts with a {PRO_TRIAL_DAYS}-day free trial.
38+
Eligible new Pro subscribers start with a {PRO_TRIAL_DAYS}-day free trial.
3939
</Text>
4040

4141
<EmailButton href={upgradeLink}>Upgrade to Pro</EmailButton>

‎apps/sim/lib/billing/free-plan.integration.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ describe('web search', () => {
182182

183183
const response = await search(userId, workspaceId)
184184

185-
expect(response.status).not.toBe(402)
185+
// Past the plan gate, the request reaches the provider step, which has no key under test.
186+
expect(response.status).toBe(503)
187+
expect((await response.json()).error).toBe('Search service not configured')
186188
})
187189
})
188190

‎apps/sim/lib/billing/webhooks/plan-notices.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,16 @@ export async function sendPlanEndedEmail(ended: {
162162
userName: recipient.name || undefined,
163163
upgradeLink: `${getBaseUrl()}/account/settings/billing`,
164164
})
165-
await sendEmail({
165+
const result = await sendEmail({
166166
to: recipient.email,
167167
subject: getPlanEndedSubject(planName),
168168
html,
169169
emailType: 'transactional',
170170
})
171+
// A notice must not fail the deletion it follows; the error log is the alert.
172+
if (!result.success) {
173+
logger.error('Plan ended email failed to send', { referenceId: ended.referenceId })
174+
}
171175
} catch (error) {
172176
logger.error('Failed to send plan ended email', { referenceId: ended.referenceId, error })
173177
}

0 commit comments

Comments
 (0)