MCPcopy Index your code
hub / github.com/simstudioai/sim / sendFreeTierEmail

Function sendFreeTierEmail

apps/sim/lib/billing/core/usage.ts:917–942  ·  view source on GitHub ↗
(email: string, name?: string)

Source from the content-addressed store, hash-verified

915 if (crosses80 && isFreeUser && !crosses100) {
916 const upgradeLink = upgradeCreditsLink
917 const sendFreeTierEmail = async (email: string, name?: string) => {
918 const prefs = await getEmailPreferences(email)
919 if (prefs?.unsubscribeAll || prefs?.unsubscribeNotifications) return
920
921 const html = await renderFreeTierUpgradeEmail({
922 userName: name,
923 percentUsed: Math.min(100, Math.round(params.percentAfter)),
924 currentUsage: params.currentUsageAfter,
925 limit: params.limit,
926 upgradeLink,
927 })
928
929 await sendEmail({
930 to: email,
931 subject: getEmailSubject('free-tier-upgrade'),
932 html,
933 emailType: 'notifications',
934 })
935
936 logger.info('Free tier upgrade email sent', {
937 email,
938 percentUsed: Math.round(params.percentAfter),
939 currentUsage: params.currentUsageAfter,
940 limit: params.limit,
941 })
942 }
943
944 // Free users are always individual scope (not organization)
945 if (params.scope === 'user' && params.userId && params.userEmail) {

Callers 1

Calls 5

getEmailPreferencesFunction · 0.90
sendEmailFunction · 0.90
getEmailSubjectFunction · 0.90
infoMethod · 0.80

Tested by

no test coverage detected