Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Support legacy no trial plans

Blue Mouse6752da79d661
diff --git a/backend/apps/cloud/src/auth/auth.service.ts b/backend/apps/cloud/src/auth/auth.service.ts
index c3c39d464..72e22c6cb 100644
--- a/backend/apps/cloud/src/auth/auth.service.ts
+++ b/backend/apps/cloud/src/auth/auth.service.ts
@@ -571,10 +571,6 @@ export class AuthService {
async registerUserGoogle(sub: string, email: string) {
const query: UserGoogleDTO = {
googleId: sub,
- trialEndDate: dayjs
- .utc()
- .add(TRIAL_DURATION, 'day')
- .format('YYYY-MM-DD HH:mm:ss'),
registeredWithGoogle: true,
isActive: true,
emailRequests: 0,
@@ -975,10 +971,6 @@ export class AuthService {
async registerUserGithub(id: number, email: string) {
const query: UserGithubDTO = {
githubId: id,
- trialEndDate: dayjs
- .utc()
- .add(TRIAL_DURATION, 'day')
- .format('YYYY-MM-DD HH:mm:ss'),
registeredWithGithub: true,
isActive: true,
emailRequests: 0,
diff --git a/backend/apps/cloud/src/user/dto/user-github.dto.ts b/backend/apps/cloud/src/user/dto/user-github.dto.ts
index 9a205397a..0e28c44f1 100644
--- a/backend/apps/cloud/src/user/dto/user-github.dto.ts
+++ b/backend/apps/cloud/src/user/dto/user-github.dto.ts
@@ -10,10 +10,6 @@ export class UserGithubDTO {
@IsBoolean()
registeredWithGithub: boolean
- @ApiProperty({ example: '2023-01-01 23:12:55', required: true })
- @IsString()
- trialEndDate: string
-
@ApiProperty({ example: '[email protected]', required: false })
@IsEmail()
email?: string
diff --git a/backend/apps/cloud/src/user/dto/user-google.dto.ts b/backend/apps/cloud/src/user/dto/user-google.dto.ts
index 025fb1e0b..7a6a8ebf3 100644
--- a/backend/apps/cloud/src/user/dto/user-google.dto.ts
+++ b/backend/apps/cloud/src/user/dto/user-google.dto.ts
@@ -10,10 +10,6 @@ export class UserGoogleDTO {
@IsBoolean()
registeredWithGoogle: boolean
- @ApiProperty({ example: '2023-01-01 23:12:55', required: true })
- @IsString()
- trialEndDate: string
-
@ApiProperty({ example: '[email protected]', required: false })
@IsEmail()
email?: string
diff --git a/backend/apps/cloud/src/user/entities/user.entity.ts b/backend/apps/cloud/src/user/entities/user.entity.ts
index dc7c7e7f7..4af25a192 100644
--- a/backend/apps/cloud/src/user/entities/user.entity.ts
+++ b/backend/apps/cloud/src/user/entities/user.entity.ts
@@ -41,9 +41,11 @@ interface PlanSignature {
id: PlanCode
monthlyUsageLimit: number
maxAlerts: number
- legacy: boolean
+ legacy?: boolean
pid?: string
ypid?: string
+ legacyPids?: string[]
+ legacyYpids?: string[]
}
export const ACCOUNT_PLANS = {
@@ -71,85 +73,109 @@ export const ACCOUNT_PLANS = {
[PlanCode.hobby]: {
id: PlanCode.hobby,
monthlyUsageLimit: 10000,
- pid: '813694', // Plan ID
- ypid: '813695', // Plan ID - Yearly billing
+ pid: '813694',
+ ypid: '813695',
+ legacyPids: [],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode['50k']]: {
id: PlanCode['50k'],
monthlyUsageLimit: 50000,
- pid: '918109', // Plan ID
- ypid: '918110', // Plan ID - Yearly billing
+ pid: '918109',
+ ypid: '918110',
+ legacyPids: [],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode.freelancer]: {
id: PlanCode.freelancer,
monthlyUsageLimit: 100000,
- pid: '752316', // Plan ID
- ypid: '776469', // Plan ID - Yearly billing
+ pid: '752316',
+ ypid: '776469',
+ legacyPids: [],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode['100k']]: {
id: PlanCode['100k'],
monthlyUsageLimit: 100000,
- pid: '916455', // Plan ID
- ypid: '916456', // Plan ID - Yearly billing
+ pid: '922473',
+ ypid: '922474',
+ legacyPids: ['916455'],
+ legacyYpids: ['916456'],
maxAlerts: 50,
},
[PlanCode['200k']]: {
id: PlanCode['200k'],
monthlyUsageLimit: 200000,
- pid: '854654', // Plan ID
- ypid: '854655', // Plan ID - Yearly billing
+ pid: '922471',
+ ypid: '922472',
+ legacyPids: ['854654'],
+ legacyYpids: ['854655'],
maxAlerts: 50,
},
[PlanCode['500k']]: {
id: PlanCode['500k'],
monthlyUsageLimit: 500000,
- pid: '854656', // Plan ID
- ypid: '854657', // Plan ID - Yearly billing
+ pid: '922470',
+ ypid: '854657',
+ legacyPids: ['854656'],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode.startup]: {
id: PlanCode.startup,
monthlyUsageLimit: 1000000,
- pid: '752317',
+ pid: '922469',
ypid: '776470',
+ legacyPids: ['752317'],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode['2m']]: {
id: PlanCode['2m'],
monthlyUsageLimit: 2000000,
- pid: '854663', // Plan ID
- ypid: '854664', // Plan ID - Yearly billing
+ pid: '854663',
+ ypid: '854664',
+ legacyPids: [],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode.enterprise]: {
id: PlanCode.enterprise,
monthlyUsageLimit: 5000000,
- pid: '752318',
+ pid: '922468',
ypid: '776471',
+ legacyPids: ['752318'],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode['10m']]: {
id: PlanCode['10m'],
monthlyUsageLimit: 10000000,
- pid: '854665', // Plan ID
- ypid: '854666', // Plan ID - Yearly billing
+ pid: '854665',
+ ypid: '922467',
+ legacyPids: [],
+ legacyYpids: ['854666'],
maxAlerts: 50,
},
[PlanCode['15m']]: {
id: PlanCode['15m'],
monthlyUsageLimit: 15000000,
- pid: '916451', // Plan ID
- ypid: '916452', // Plan ID - Yearly billing
+ pid: '916451',
+ ypid: '916452',
+ legacyPids: [],
+ legacyYpids: [],
maxAlerts: 50,
},
[PlanCode['20m']]: {
id: PlanCode['20m'],
monthlyUsageLimit: 20000000,
- pid: '916453', // Plan ID
- ypid: '916454', // Plan ID - Yearly billing
+ pid: '916453',
+ ypid: '916454',
+ legacyPids: [],
+ legacyYpids: [],
maxAlerts: 50,
},
}
diff --git a/backend/apps/cloud/src/user/user.service.ts b/backend/apps/cloud/src/user/user.service.ts
index 52e020c09..50c93d69e 100644
--- a/backend/apps/cloud/src/user/user.service.ts
+++ b/backend/apps/cloud/src/user/user.service.ts
@@ -223,10 +223,6 @@ export class UserService {
return this.usersRepository.save({
...user,
isActive: true,
- trialEndDate: dayjs
- .utc()
- .add(TRIAL_DURATION, 'day')
- .format('YYYY-MM-DD HH:mm:ss'),
})
}
@@ -345,17 +341,26 @@ export class UserService {
// @ts-ignore
tier.pid === stringifiedPlanId ||
// @ts-ignore
- tier.ypid === stringifiedPlanId,
+ tier.ypid === stringifiedPlanId ||
+ // @ts-ignore
+ tier.legacyPids?.includes(stringifiedPlanId) ||
+ // @ts-ignore
+ tier.legacyYpids?.includes(stringifiedPlanId),
)
// @ts-ignore
if (plan && plan.pid) {
const planCode = plan.id
- const billingFrequency =
+ // @ts-ignore
+ const isMonthly =
// @ts-ignore
- Number(plan?.pid) === planId
- ? BillingFrequency.Monthly
- : BillingFrequency.Yearly
+ plan.pid === stringifiedPlanId ||
+ // @ts-ignore
+ plan.legacyPids?.includes(stringifiedPlanId)
+
+ const billingFrequency = isMonthly
+ ? BillingFrequency.Monthly
+ : BillingFrequency.Yearly
return {
planCode,
diff --git a/backend/apps/cloud/src/webhook/webhook.controller.ts b/backend/apps/cloud/src/webhook/webhook.controller.ts
index 27928352d..52244748f 100644
--- a/backend/apps/cloud/src/webhook/webhook.controller.ts
+++ b/backend/apps/cloud/src/webhook/webhook.controller.ts
@@ -113,11 +113,23 @@ export class WebhookController {
let monthlyBilling = true
let plan = _find(ACCOUNT_PLANS, ({ pid }) => pid === subscriptionPlanId)
+ if (!plan) {
+ plan = _find(ACCOUNT_PLANS, (tier) =>
+ (tier as any).legacyPids?.includes(subscriptionPlanId),
+ )
+ }
+
if (!plan) {
monthlyBilling = false
plan = _find(ACCOUNT_PLANS, ({ ypid }) => ypid === subscriptionPlanId)
}
+ if (!plan) {
+ plan = _find(ACCOUNT_PLANS, (tier) =>
+ (tier as any).legacyYpids?.includes(subscriptionPlanId),
+ )
+ }
+
if (!plan) {
throw new NotFoundException(
`The selected account plan (${subscriptionPlanId}) is not available`,
diff --git a/web/app/components/pricing/BillingPricing.tsx b/web/app/components/pricing/BillingPricing.tsx
index 8a1d54845..5298948a2 100644
--- a/web/app/components/pricing/BillingPricing.tsx
+++ b/web/app/components/pricing/BillingPricing.tsx
@@ -208,7 +208,7 @@ const BillingPricing = ({
const opened = openCheckout({
product:
billingFrequency === BillingFrequency.monthly ? tier.pid : tier.ypid,
- trialDays: 0,
+ ...(user.trialEndDate ? { trialDays: 0 } : {}),
email: user.email,
passthrough: JSON.stringify({ uid: user.id }),
locale: paddleLanguageMapping[language] || language,
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index 572b27fb3..3dd931904 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -639,8 +639,10 @@ export const PLAN_LIMITS = {
yearly: 40,
},
},
- pid: 813694, // Plan ID
- ypid: 813695, // Plan ID - Yearly billing
+ pid: 813694, // plan ID
+ ypid: 813695, // yearly plan ID
+ legacyPids: [] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
'50k': {
@@ -662,8 +664,10 @@ export const PLAN_LIMITS = {
yearly: 100,
},
},
- pid: 918109, // Plan ID
- ypid: 918110, // Plan ID - Yearly billing
+ pid: 918109,
+ ypid: 918110,
+ legacyPids: [] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
freelancer: {
@@ -685,8 +689,10 @@ export const PLAN_LIMITS = {
yearly: 140,
},
},
- pid: 752316, // Plan ID
- ypid: 776469, // Plan ID - Yearly billing
+ pid: 752316,
+ ypid: 776469,
+ legacyPids: [] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
'100k': {
@@ -708,8 +714,10 @@ export const PLAN_LIMITS = {
yearly: 150,
},
},
- pid: 916455, // Plan ID
- ypid: 916456, // Plan ID - Yearly billing
+ pid: 922473,
+ ypid: 922474,
+ legacyPids: [916455] as number[],
+ legacyYpids: [916456] as number[],
maxAlerts: 50,
},
'200k': {
@@ -731,8 +739,10 @@ export const PLAN_LIMITS = {
yearly: 230,
},
},
- pid: 854654, // Plan ID
- ypid: 854655, // Plan ID - Yearly billing
+ pid: 922471,
+ ypid: 922472,
+ legacyPids: [854654] as number[],
+ legacyYpids: [854655] as number[],
maxAlerts: 50,
},
'500k': {
@@ -754,8 +764,10 @@ export const PLAN_LIMITS = {
yearly: 390,
},
},
- pid: 854656, // Plan ID
- ypid: 854657, // Plan ID - Yearly billing
+ pid: 922470,
+ ypid: 854657,
+ legacyPids: [854656] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
startup: {
@@ -777,8 +789,10 @@ export const PLAN_LIMITS = {
yearly: 590,
},
},
- pid: 752317,
+ pid: 922469,
ypid: 776470,
+ legacyPids: [752317] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
'2m': {
@@ -802,6 +816,8 @@ export const PLAN_LIMITS = {
},
pid: 854663,
ypid: 854664,
+ legacyPids: [] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
enterprise: {
@@ -823,8 +839,10 @@ export const PLAN_LIMITS = {
yearly: 1390,
},
},
- pid: 752318,
+ pid: 922468,
ypid: 776471,
+ legacyPids: [752318] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
'10m': {
@@ -847,7 +865,9 @@ export const PLAN_LIMITS = {
},
},
pid: 854665,
- ypid: 854666,
+ ypid: 922467,
+ legacyPids: [] as number[],
+ legacyYpids: [854666] as number[],
maxAlerts: 50,
},
'15m': {
@@ -871,6 +891,8 @@ export const PLAN_LIMITS = {
},
pid: 916451,
ypid: 916452,
+ legacyPids: [] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
'20m': {
@@ -894,6 +916,8 @@ export const PLAN_LIMITS = {
},
pid: 916453,
ypid: 916454,
+ legacyPids: [] as number[],
+ legacyYpids: [] as number[],
maxAlerts: 50,
},
}
diff --git a/web/app/pages/Subscribe/Subscribe.tsx b/web/app/pages/Subscribe/Subscribe.tsx
index c1129fb4e..37b31a6ca 100644
--- a/web/app/pages/Subscribe/Subscribe.tsx
+++ b/web/app/pages/Subscribe/Subscribe.tsx
@@ -136,6 +136,7 @@ const Subscribe = () => {
const opened = openCheckout({
product,
+ ...(user?.trialEndDate ? { trialDays: 0 } : {}),
email: user?.email,
passthrough: JSON.stringify({ uid: user?.id }),
locale: paddleLanguageMapping[i18n.language] || i18n.language,