@@ -26,6 +26,8 @@ import {
26
26
PasswordPolicyAuthConfig ,
27
27
PasswordPolicyAuthServerConfig ,
28
28
PasswordPolicyConfig ,
29
+ EmailPrivacyConfig ,
30
+ EmailPrivacyAuthConfig ,
29
31
} from './auth-config' ;
30
32
import { deepCopy } from '../utils/deep-copy' ;
31
33
@@ -53,6 +55,10 @@ export interface UpdateProjectConfigRequest {
53
55
* The password policy configuration to update on the project
54
56
*/
55
57
passwordPolicyConfig ?: PasswordPolicyConfig ;
58
+ /**
59
+ * The email privacy configuration to update on the project
60
+ */
61
+ emailPrivacyConfig ?: EmailPrivacyConfig ;
56
62
}
57
63
58
64
/**
@@ -63,6 +69,7 @@ export interface ProjectConfigServerResponse {
63
69
mfa ?: MultiFactorAuthServerConfig ;
64
70
recaptchaConfig ?: RecaptchaConfig ;
65
71
passwordPolicyConfig ?: PasswordPolicyAuthServerConfig ;
72
+ emailPrivacyConfig ?: EmailPrivacyConfig ;
66
73
}
67
74
68
75
/**
@@ -73,6 +80,7 @@ export interface ProjectConfigClientRequest {
73
80
mfa ?: MultiFactorAuthServerConfig ;
74
81
recaptchaConfig ?: RecaptchaConfig ;
75
82
passwordPolicyConfig ?: PasswordPolicyAuthServerConfig ;
83
+ emailPrivacyConfig ?: EmailPrivacyConfig ;
76
84
}
77
85
78
86
/**
@@ -91,7 +99,12 @@ export class ProjectConfig {
91
99
* Supports only phone and TOTP.
92
100
*/
93
101
private readonly multiFactorConfig_ ?: MultiFactorConfig ;
94
-
102
+ /**
103
+ * The multi-factor auth configuration.
104
+ */
105
+ get multiFactorConfig ( ) : MultiFactorConfig | undefined {
106
+ return this . multiFactorConfig_ ;
107
+ }
95
108
/**
96
109
* The reCAPTCHA configuration to update on the project.
97
110
* By enabling reCAPTCHA Enterprise integration, you are
@@ -100,16 +113,14 @@ export class ProjectConfig {
100
113
*/
101
114
private readonly recaptchaConfig_ ?: RecaptchaAuthConfig ;
102
115
103
- /**
104
- * The multi-factor auth configuration.
105
- */
106
- get multiFactorConfig ( ) : MultiFactorConfig | undefined {
107
- return this . multiFactorConfig_ ;
108
- }
109
116
/**
110
117
* The password policy configuration for the project
111
118
*/
112
119
public readonly passwordPolicyConfig ?: PasswordPolicyConfig ;
120
+ /**
121
+ * The email privacy configuration for the project
122
+ */
123
+ public readonly emailPrivacyConfig ?: EmailPrivacyConfig ;
113
124
114
125
/**
115
126
* Validates a project config options object. Throws an error on failure.
@@ -128,6 +139,7 @@ export class ProjectConfig {
128
139
multiFactorConfig : true ,
129
140
recaptchaConfig : true ,
130
141
passwordPolicyConfig : true ,
142
+ emailPrivacyConfig : true ,
131
143
}
132
144
// Check for unsupported top level attributes.
133
145
for ( const key in request ) {
@@ -156,6 +168,11 @@ export class ProjectConfig {
156
168
if ( typeof request . passwordPolicyConfig !== 'undefined' ) {
157
169
PasswordPolicyAuthConfig . validate ( request . passwordPolicyConfig ) ;
158
170
}
171
+
172
+ // Validate Email Privacy Config if provided.
173
+ if ( typeof request . emailPrivacyConfig !== 'undefined' ) {
174
+ EmailPrivacyAuthConfig . validate ( request . emailPrivacyConfig ) ;
175
+ }
159
176
}
160
177
161
178
/**
@@ -180,6 +197,9 @@ export class ProjectConfig {
180
197
if ( typeof configOptions . passwordPolicyConfig !== 'undefined' ) {
181
198
request . passwordPolicyConfig = PasswordPolicyAuthConfig . buildServerRequest ( configOptions . passwordPolicyConfig ) ;
182
199
}
200
+ if ( typeof configOptions . emailPrivacyConfig !== 'undefined' ) {
201
+ request . emailPrivacyConfig = configOptions . emailPrivacyConfig ;
202
+ }
183
203
return request ;
184
204
}
185
205
@@ -211,6 +231,9 @@ export class ProjectConfig {
211
231
if ( typeof response . passwordPolicyConfig !== 'undefined' ) {
212
232
this . passwordPolicyConfig = new PasswordPolicyAuthConfig ( response . passwordPolicyConfig ) ;
213
233
}
234
+ if ( typeof response . emailPrivacyConfig !== 'undefined' ) {
235
+ this . emailPrivacyConfig = response . emailPrivacyConfig ;
236
+ }
214
237
}
215
238
/**
216
239
* Returns a JSON-serializable representation of this object.
@@ -224,6 +247,7 @@ export class ProjectConfig {
224
247
multiFactorConfig : deepCopy ( this . multiFactorConfig ) ,
225
248
recaptchaConfig : this . recaptchaConfig_ ?. toJSON ( ) ,
226
249
passwordPolicyConfig : deepCopy ( this . passwordPolicyConfig ) ,
250
+ emailPrivacyConfig : deepCopy ( this . emailPrivacyConfig ) ,
227
251
} ;
228
252
if ( typeof json . smsRegionConfig === 'undefined' ) {
229
253
delete json . smsRegionConfig ;
@@ -237,6 +261,9 @@ export class ProjectConfig {
237
261
if ( typeof json . passwordPolicyConfig === 'undefined' ) {
238
262
delete json . passwordPolicyConfig ;
239
263
}
264
+ if ( typeof json . emailPrivacyConfig === 'undefined' ) {
265
+ delete json . emailPrivacyConfig ;
266
+ }
240
267
return json ;
241
268
}
242
269
}
0 commit comments