witspry-auth-ng-client 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "witspry-auth-ng-client",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Witspry auth angular library for secure authentication with configurable providers",
5
5
  "keywords": [
6
6
  "angular",
@@ -58,6 +58,9 @@ export interface OAuth2Config {
58
58
 
59
59
  /** To specify well known OAuth Provider */
60
60
  oAuthProvider?: 'google' | 'witsauth';
61
+
62
+ /** UI Theme preference (optional) */
63
+ theme?: 'light' | 'dark' | 'system' | (() => 'light' | 'dark' | 'system' | string);
61
64
  }
62
65
 
63
66
  /**
@@ -20,6 +20,7 @@ export interface AuthorizationRequest {
20
20
  code_challenge_method: string;
21
21
  code_challenge: string;
22
22
  state?: string;
23
+ theme?: string;
23
24
  }
24
25
 
25
26
  /**
@@ -226,6 +226,12 @@ export class OAuth2Service implements OnDestroy {
226
226
  this.storageService.setItem(OAUTH2_STORAGE_KEYS.STATE, state);
227
227
  this.storageService.setItem(OAUTH2_STORAGE_KEYS.NONCE, nonce);
228
228
 
229
+ // Evaluate theme if configured
230
+ let themeVal: string | undefined;
231
+ if (this.config.theme) {
232
+ themeVal = typeof this.config.theme === 'function' ? this.config.theme() : this.config.theme;
233
+ }
234
+
229
235
  // Build authorization request
230
236
  const authRequest: AuthorizationRequest = {
231
237
  client_id: this.config.clientId,
@@ -236,7 +242,8 @@ export class OAuth2Service implements OnDestroy {
236
242
  scope: this.config.scope,
237
243
  code_challenge_method: pkceChallenge.codeChallengeMethod,
238
244
  code_challenge: pkceChallenge.codeChallenge,
239
- state
245
+ state,
246
+ theme: themeVal
240
247
  };
241
248
 
242
249
  // Build authorization URL