@opensourcekd/ng-common-libs 1.2.5 → 1.2.7

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/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Observable, ReplaySubject } from 'rxjs';
2
- import { HttpClient } from '@angular/common/http';
3
2
  import { EventType } from 'mitt';
4
3
 
5
4
  /**
@@ -55,6 +54,27 @@ declare class EventBus {
55
54
  onAll(): Observable<EventPayload>;
56
55
  }
57
56
 
57
+ /**
58
+ * Framework-agnostic Configuration
59
+ * Centralized configuration for all consuming applications
60
+ *
61
+ * This configuration can be used across different frameworks (Angular, React, Vue, etc.)
62
+ * and by various Micro-Frontends (MFEs) and shell applications.
63
+ *
64
+ * Values are statically configured during build time from GitHub repository variables.
65
+ */
66
+ /**
67
+ * Application configuration object
68
+ * Contains all environment-specific variables
69
+ *
70
+ * These values are replaced during build time with actual values from GitHub repository variables.
71
+ */
72
+ declare const APP_CONFIG: {
73
+ auth0Domain: string;
74
+ auth0ClientId: string;
75
+ apiUrl: string;
76
+ };
77
+
58
78
  /**
59
79
  * EventBusService - Angular service for cross-application event communication
60
80
  * Uses mitt library for efficient event handling and RxJS ReplaySubject for observable stream
@@ -173,15 +193,13 @@ interface UserData {
173
193
  * To enable navigation after auth operations, uncomment the marked sections in consuming components.
174
194
  */
175
195
  declare class AuthService {
176
- private http;
177
196
  private eventBus;
178
- id: string;
179
197
  private readonly STANDARD_JWT_CLAIMS;
180
198
  private auth0Client;
181
199
  private initializationPromise;
182
200
  private userSubject;
183
201
  user$: Observable<UserInfo | null>;
184
- constructor(http: HttpClient, eventBus: EventBusService);
202
+ constructor(eventBus: EventBusService);
185
203
  /**
186
204
  * Initialize Auth0 client
187
205
  */
@@ -215,6 +233,13 @@ declare class AuthService {
215
233
  success: boolean;
216
234
  appState?: any;
217
235
  }>;
236
+ /**
237
+ * Decode and log the access token to console
238
+ * NOTE: This logs sensitive token information to console for debugging purposes.
239
+ * In production environments, consider disabling this or filtering console logs.
240
+ * @param token - The JWT access token
241
+ */
242
+ private decodeAndLogToken;
218
243
  /**
219
244
  * Log all user claims for debugging
220
245
  * @param user - User info from Auth0
@@ -332,6 +357,10 @@ declare class AuthService {
332
357
  /**
333
358
  * Auth0 client configuration
334
359
  * Override these values in your consuming application by setting them before importing AuthService
360
+ *
361
+ * Note: redirectUri defaults to window.location.origin (base URL without path).
362
+ * Auth0 will redirect back to this URL after authentication.
363
+ * You can override this to a specific callback URL (e.g., '/auth-callback') using configureAuth0().
335
364
  */
336
365
  declare const AUTH0_CONFIG: {
337
366
  domain: string;
@@ -382,21 +411,33 @@ declare function setStorageItem(key: string, value: string, storageType?: 'local
382
411
  */
383
412
  declare function removeStorageItem(key: string, storageType?: 'localStorage' | 'sessionStorage'): void;
384
413
  /**
385
- * Configure Auth0 settings
386
- * Call this function in your consuming application before using AuthService
414
+ * Configure Auth0 settings (OPTIONAL)
415
+ * Call this function in your consuming application to override default Auth0 configuration.
416
+ * Only the values you provide will be overridden; all other defaults remain unchanged.
417
+ *
418
+ * Note: This function is optional. If not called, default values will be used.
419
+ *
420
+ * @param config - Partial Auth0 configuration object with values to override
387
421
  *
388
422
  * @example
389
423
  * ```typescript
390
424
  * import { configureAuth0 } from '@opensourcekd/ng-common-libs';
391
425
  *
426
+ * // Only override specific values - others keep their defaults
392
427
  * configureAuth0({
393
428
  * domain: 'your-domain.auth0.com',
394
429
  * clientId: 'your-client-id',
395
430
  * audience: 'https://your-api.com'
431
+ * // redirectUri, logoutUri, scope, etc. will use defaults
432
+ * });
433
+ *
434
+ * // Or override just redirectUri to use a specific callback page
435
+ * configureAuth0({
436
+ * redirectUri: window.location.origin + '/auth-callback'
396
437
  * });
397
438
  * ```
398
439
  */
399
440
  declare function configureAuth0(config: Partial<typeof AUTH0_CONFIG>): void;
400
441
 
401
- export { AUTH0_CONFIG, AuthService, EventBus, EventBusService, STORAGE_CONFIG, STORAGE_KEYS, configureAuth0, getStorageItem, removeStorageItem, setStorageItem };
442
+ export { APP_CONFIG, AUTH0_CONFIG, AuthService, EventBus, EventBusService, STORAGE_CONFIG, STORAGE_KEYS, configureAuth0, getStorageItem, removeStorageItem, setStorageItem };
402
443
  export type { EventPayload, UserData, UserInfo };