@@ -26,6 +26,8 @@ import {
2626 PasswordPolicyAuthConfig ,
2727 PasswordPolicyAuthServerConfig ,
2828 PasswordPolicyConfig ,
29+ EmailPrivacyConfig ,
30+ EmailPrivacyAuthConfig ,
2931} from './auth-config' ;
3032import { deepCopy } from '../utils/deep-copy' ;
3133
@@ -53,6 +55,10 @@ export interface UpdateProjectConfigRequest {
5355 * The password policy configuration to update on the project
5456 */
5557 passwordPolicyConfig ?: PasswordPolicyConfig ;
58+ /**
59+ * The email privacy configuration to update on the project
60+ */
61+ emailPrivacyConfig ?: EmailPrivacyConfig ;
5662}
5763
5864/**
@@ -63,6 +69,7 @@ export interface ProjectConfigServerResponse {
6369 mfa ?: MultiFactorAuthServerConfig ;
6470 recaptchaConfig ?: RecaptchaConfig ;
6571 passwordPolicyConfig ?: PasswordPolicyAuthServerConfig ;
72+ emailPrivacyConfig ?: EmailPrivacyConfig ;
6673}
6774
6875/**
@@ -73,6 +80,7 @@ export interface ProjectConfigClientRequest {
7380 mfa ?: MultiFactorAuthServerConfig ;
7481 recaptchaConfig ?: RecaptchaConfig ;
7582 passwordPolicyConfig ?: PasswordPolicyAuthServerConfig ;
83+ emailPrivacyConfig ?: EmailPrivacyConfig ;
7684}
7785
7886/**
@@ -91,7 +99,12 @@ export class ProjectConfig {
9199 * Supports only phone and TOTP.
92100 */
93101 private readonly multiFactorConfig_ ?: MultiFactorConfig ;
94-
102+ /**
103+ * The multi-factor auth configuration.
104+ */
105+ get multiFactorConfig ( ) : MultiFactorConfig | undefined {
106+ return this . multiFactorConfig_ ;
107+ }
95108 /**
96109 * The reCAPTCHA configuration to update on the project.
97110 * By enabling reCAPTCHA Enterprise integration, you are
@@ -100,16 +113,14 @@ export class ProjectConfig {
100113 */
101114 private readonly recaptchaConfig_ ?: RecaptchaAuthConfig ;
102115
103- /**
104- * The multi-factor auth configuration.
105- */
106- get multiFactorConfig ( ) : MultiFactorConfig | undefined {
107- return this . multiFactorConfig_ ;
108- }
109116 /**
110117 * The password policy configuration for the project
111118 */
112119 public readonly passwordPolicyConfig ?: PasswordPolicyConfig ;
120+ /**
121+ * The email privacy configuration for the project
122+ */
123+ public readonly emailPrivacyConfig ?: EmailPrivacyConfig ;
113124
114125 /**
115126 * Validates a project config options object. Throws an error on failure.
@@ -128,6 +139,7 @@ export class ProjectConfig {
128139 multiFactorConfig : true ,
129140 recaptchaConfig : true ,
130141 passwordPolicyConfig : true ,
142+ emailPrivacyConfig : true ,
131143 }
132144 // Check for unsupported top level attributes.
133145 for ( const key in request ) {
@@ -156,6 +168,11 @@ export class ProjectConfig {
156168 if ( typeof request . passwordPolicyConfig !== 'undefined' ) {
157169 PasswordPolicyAuthConfig . validate ( request . passwordPolicyConfig ) ;
158170 }
171+
172+ // Validate Email Privacy Config if provided.
173+ if ( typeof request . emailPrivacyConfig !== 'undefined' ) {
174+ EmailPrivacyAuthConfig . validate ( request . emailPrivacyConfig ) ;
175+ }
159176 }
160177
161178 /**
@@ -180,6 +197,9 @@ export class ProjectConfig {
180197 if ( typeof configOptions . passwordPolicyConfig !== 'undefined' ) {
181198 request . passwordPolicyConfig = PasswordPolicyAuthConfig . buildServerRequest ( configOptions . passwordPolicyConfig ) ;
182199 }
200+ if ( typeof configOptions . emailPrivacyConfig !== 'undefined' ) {
201+ request . emailPrivacyConfig = configOptions . emailPrivacyConfig ;
202+ }
183203 return request ;
184204 }
185205
@@ -211,6 +231,9 @@ export class ProjectConfig {
211231 if ( typeof response . passwordPolicyConfig !== 'undefined' ) {
212232 this . passwordPolicyConfig = new PasswordPolicyAuthConfig ( response . passwordPolicyConfig ) ;
213233 }
234+ if ( typeof response . emailPrivacyConfig !== 'undefined' ) {
235+ this . emailPrivacyConfig = response . emailPrivacyConfig ;
236+ }
214237 }
215238 /**
216239 * Returns a JSON-serializable representation of this object.
@@ -224,6 +247,7 @@ export class ProjectConfig {
224247 multiFactorConfig : deepCopy ( this . multiFactorConfig ) ,
225248 recaptchaConfig : this . recaptchaConfig_ ?. toJSON ( ) ,
226249 passwordPolicyConfig : deepCopy ( this . passwordPolicyConfig ) ,
250+ emailPrivacyConfig : deepCopy ( this . emailPrivacyConfig ) ,
227251 } ;
228252 if ( typeof json . smsRegionConfig === 'undefined' ) {
229253 delete json . smsRegionConfig ;
@@ -237,6 +261,9 @@ export class ProjectConfig {
237261 if ( typeof json . passwordPolicyConfig === 'undefined' ) {
238262 delete json . passwordPolicyConfig ;
239263 }
264+ if ( typeof json . emailPrivacyConfig === 'undefined' ) {
265+ delete json . emailPrivacyConfig ;
266+ }
240267 return json ;
241268 }
242269}
0 commit comments