mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 09:54:51 +10:00
fix: add email disable flag (#2931)
This commit is contained in:
@@ -51,6 +51,13 @@ export const ZClaimFlagsSchema = z.object({
|
||||
allowLegacyEnvelopes: z.boolean().optional(),
|
||||
|
||||
signingReminders: z.boolean().optional(),
|
||||
|
||||
/**
|
||||
* Controls whether an organisation is prevented from sending emails.
|
||||
*
|
||||
* When this is enabled, ALL emails for the organisation are blocked.
|
||||
*/
|
||||
disableEmails: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export type TClaimFlags = z.infer<typeof ZClaimFlagsSchema>;
|
||||
@@ -122,6 +129,10 @@ export const SUBSCRIPTION_CLAIM_FEATURE_FLAGS: Record<
|
||||
key: 'signingReminders',
|
||||
label: 'Signing reminders',
|
||||
},
|
||||
disableEmails: {
|
||||
key: 'disableEmails',
|
||||
label: 'Disable emails',
|
||||
},
|
||||
};
|
||||
|
||||
export enum INTERNAL_CLAIM_ID {
|
||||
@@ -133,20 +144,12 @@ export enum INTERNAL_CLAIM_ID {
|
||||
ENTERPRISE = 'enterprise',
|
||||
}
|
||||
|
||||
export type InternalClaim = Omit<SubscriptionClaim, 'createdAt' | 'updatedAt'>;
|
||||
export type InternalClaim = Pick<SubscriptionClaim, 'id' | 'name'>;
|
||||
|
||||
export type InternalClaims = {
|
||||
[key in INTERNAL_CLAIM_ID]: InternalClaim;
|
||||
};
|
||||
|
||||
/**
|
||||
* TODO: THIS NEEDS A REWORK
|
||||
*
|
||||
* Only the values within "free" claim (flags, etc) are directly used, the rest are taken
|
||||
* from the actual SubscriptionClaim in the database.
|
||||
*
|
||||
* We need to remove all the content besides id/name and fetch free from the database.
|
||||
*/
|
||||
export const internalClaims: InternalClaims = {
|
||||
/**
|
||||
* Free plan has no rates and quotas since this may break self-hosters.
|
||||
@@ -154,135 +157,26 @@ export const internalClaims: InternalClaims = {
|
||||
[INTERNAL_CLAIM_ID.FREE]: {
|
||||
id: INTERNAL_CLAIM_ID.FREE,
|
||||
name: 'Free',
|
||||
teamCount: 1,
|
||||
memberCount: 1,
|
||||
envelopeItemCount: 5,
|
||||
recipientCount: 0,
|
||||
locked: true,
|
||||
flags: {},
|
||||
documentRateLimits: [],
|
||||
documentQuota: null,
|
||||
emailRateLimits: [],
|
||||
emailQuota: null,
|
||||
apiRateLimits: [],
|
||||
apiQuota: null,
|
||||
},
|
||||
[INTERNAL_CLAIM_ID.INDIVIDUAL]: {
|
||||
id: INTERNAL_CLAIM_ID.INDIVIDUAL,
|
||||
name: 'Individual',
|
||||
teamCount: 1,
|
||||
memberCount: 1,
|
||||
envelopeItemCount: 5,
|
||||
recipientCount: 0,
|
||||
locked: true,
|
||||
flags: {
|
||||
unlimitedDocuments: true,
|
||||
signingReminders: true,
|
||||
},
|
||||
documentRateLimits: [],
|
||||
documentQuota: null,
|
||||
emailRateLimits: [],
|
||||
emailQuota: null,
|
||||
apiRateLimits: [],
|
||||
apiQuota: null,
|
||||
},
|
||||
[INTERNAL_CLAIM_ID.TEAM]: {
|
||||
id: INTERNAL_CLAIM_ID.TEAM,
|
||||
name: 'Teams',
|
||||
teamCount: 1,
|
||||
memberCount: 5,
|
||||
envelopeItemCount: 5,
|
||||
recipientCount: 0,
|
||||
locked: true,
|
||||
flags: {
|
||||
unlimitedDocuments: true,
|
||||
allowCustomBranding: true,
|
||||
embedSigning: true,
|
||||
signingReminders: true,
|
||||
},
|
||||
documentRateLimits: [],
|
||||
documentQuota: null,
|
||||
emailRateLimits: [],
|
||||
emailQuota: null,
|
||||
apiRateLimits: [],
|
||||
apiQuota: null,
|
||||
},
|
||||
[INTERNAL_CLAIM_ID.PLATFORM]: {
|
||||
id: INTERNAL_CLAIM_ID.PLATFORM,
|
||||
name: 'Platform',
|
||||
teamCount: 1,
|
||||
memberCount: 0,
|
||||
envelopeItemCount: 10,
|
||||
recipientCount: 0,
|
||||
locked: true,
|
||||
flags: {
|
||||
unlimitedDocuments: true,
|
||||
allowCustomBranding: true,
|
||||
hidePoweredBy: true,
|
||||
emailDomains: false,
|
||||
embedAuthoring: false,
|
||||
embedAuthoringWhiteLabel: true,
|
||||
embedSigning: false,
|
||||
embedSigningWhiteLabel: true,
|
||||
signingReminders: true,
|
||||
},
|
||||
documentRateLimits: [],
|
||||
documentQuota: null,
|
||||
emailRateLimits: [],
|
||||
emailQuota: null,
|
||||
apiRateLimits: [],
|
||||
apiQuota: null,
|
||||
},
|
||||
[INTERNAL_CLAIM_ID.ENTERPRISE]: {
|
||||
id: INTERNAL_CLAIM_ID.ENTERPRISE,
|
||||
name: 'Enterprise',
|
||||
teamCount: 0,
|
||||
memberCount: 0,
|
||||
envelopeItemCount: 10,
|
||||
recipientCount: 0,
|
||||
locked: true,
|
||||
flags: {
|
||||
unlimitedDocuments: true,
|
||||
allowCustomBranding: true,
|
||||
hidePoweredBy: true,
|
||||
emailDomains: true,
|
||||
embedAuthoring: true,
|
||||
embedAuthoringWhiteLabel: true,
|
||||
embedSigning: true,
|
||||
embedSigningWhiteLabel: true,
|
||||
cfr21: true,
|
||||
authenticationPortal: true,
|
||||
signingReminders: true,
|
||||
},
|
||||
documentRateLimits: [],
|
||||
documentQuota: null,
|
||||
emailRateLimits: [],
|
||||
emailQuota: null,
|
||||
apiRateLimits: [],
|
||||
apiQuota: null,
|
||||
},
|
||||
[INTERNAL_CLAIM_ID.EARLY_ADOPTER]: {
|
||||
id: INTERNAL_CLAIM_ID.EARLY_ADOPTER,
|
||||
name: 'Early Adopter',
|
||||
teamCount: 0,
|
||||
memberCount: 0,
|
||||
envelopeItemCount: 5,
|
||||
recipientCount: 0,
|
||||
locked: true,
|
||||
flags: {
|
||||
unlimitedDocuments: true,
|
||||
allowCustomBranding: true,
|
||||
hidePoweredBy: true,
|
||||
embedSigning: true,
|
||||
embedSigningWhiteLabel: true,
|
||||
signingReminders: true,
|
||||
},
|
||||
documentRateLimits: [],
|
||||
documentQuota: null,
|
||||
emailRateLimits: [],
|
||||
emailQuota: null,
|
||||
apiRateLimits: [],
|
||||
apiQuota: null,
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user