Prepare v0.1.0 release
This commit is contained in:
36
webui/src/features/campaigns/policyUi.ts
Normal file
36
webui/src/features/campaigns/policyUi.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export const INLINE_MAIL_SETTINGS_BLOCKED_MESSAGE = "Inline SMTP/IMAP settings are blocked by the effective mail policy. Select an allowed reusable profile.";
|
||||
|
||||
export type CampaignMailPolicy = {
|
||||
allow_campaign_profiles?: boolean | null;
|
||||
};
|
||||
|
||||
export type CampaignMailSettingsPolicyState = {
|
||||
campaignProfilesAllowed: boolean;
|
||||
usingMailProfile: boolean;
|
||||
inlineMailSettingsBlocked: boolean;
|
||||
inlineOptionDisabled: boolean;
|
||||
canSelectInlineSettings: boolean;
|
||||
inlineBlockedMessage: string;
|
||||
};
|
||||
|
||||
export function campaignMailSettingsPolicyState({
|
||||
effectivePolicy,
|
||||
selectedProfileId,
|
||||
locked = false
|
||||
}: {
|
||||
effectivePolicy: CampaignMailPolicy | null | undefined;
|
||||
selectedProfileId: string | null | undefined;
|
||||
locked?: boolean;
|
||||
}): CampaignMailSettingsPolicyState {
|
||||
const campaignProfilesAllowed = effectivePolicy?.allow_campaign_profiles === true;
|
||||
const usingMailProfile = Boolean(selectedProfileId);
|
||||
const inlineMailSettingsBlocked = !campaignProfilesAllowed && !usingMailProfile;
|
||||
return {
|
||||
campaignProfilesAllowed,
|
||||
usingMailProfile,
|
||||
inlineMailSettingsBlocked,
|
||||
inlineOptionDisabled: !campaignProfilesAllowed,
|
||||
canSelectInlineSettings: !locked && campaignProfilesAllowed,
|
||||
inlineBlockedMessage: INLINE_MAIL_SETTINGS_BLOCKED_MESSAGE
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user