@cbm-common/cbm-types 0.0.131 → 0.0.133

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.
@@ -1,3 +1,37 @@
1
1
  export declare namespace CbmAuthReactiveModel {
2
2
  type TLocalStorageKey = 'userToken' | 'globalToken' | 'globalInfoToken' | 'consoleToken' | 'consoleInfoToken';
3
+ type TAccessMode = 'public' | 'user';
4
+ interface CbmTokenUserData {
5
+ iss: string;
6
+ sub: string;
7
+ aud: string;
8
+ kid: string;
9
+ jti: string;
10
+ type: string;
11
+ provider: string;
12
+ user: CbmTokenUserData.User;
13
+ country: CbmTokenUserData.Country[];
14
+ user_session_id: string;
15
+ iat: number;
16
+ exp: number;
17
+ }
18
+ namespace CbmTokenUserData {
19
+ interface Country {
20
+ _id: string;
21
+ code: string;
22
+ name: string;
23
+ short_name: string;
24
+ companies: number;
25
+ }
26
+ interface User {
27
+ _id: string;
28
+ full_name: string;
29
+ email: string;
30
+ cellphone: string;
31
+ address: string;
32
+ super_admin: boolean;
33
+ multi_company: boolean;
34
+ photo: string;
35
+ }
36
+ }
3
37
  }
@@ -1,11 +1,18 @@
1
1
  import { Subject } from "rxjs";
2
2
  import { CbmAuthReactiveModel } from "../models/auth-reactive.domain.model";
3
+ type TLocalStorageKey = CbmAuthReactiveModel.TLocalStorageKey;
3
4
  export declare class CbmAuthReactiveService {
4
5
  constructor();
5
6
  setToken: Subject<[CbmAuthReactiveModel.TLocalStorageKey, string | null]>;
6
- private tokens;
7
+ authenticationMode: import("@angular/core").WritableSignal<CbmAuthReactiveModel.TAccessMode>;
8
+ private userTokenData;
9
+ tokens: Record<TLocalStorageKey, string | null>;
10
+ userData: import("@angular/core").Signal<CbmAuthReactiveModel.CbmTokenUserData | null>;
7
11
  init(): Promise<void>;
12
+ destroySession(): void;
8
13
  private subObservers;
9
14
  private refreshTokensFromStorage;
10
15
  private loadTokensFromStorage;
16
+ private decodeToken;
11
17
  }
18
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Router } from "@angular/router";
2
+ import { CbmAuthService } from "../../domain/services/auth/auth.service";
3
+ export declare function authFactory(router: Router): CbmAuthService;
@@ -0,0 +1,4 @@
1
+ import { ApplicationRef } from "@angular/core";
2
+ import { Router } from "@angular/router";
3
+ import { CbmWebSocketService } from "../../domain/services/web-socket/web-socket.service";
4
+ export declare function webSocketFactory(appRef: ApplicationRef, router: Router): CbmWebSocketService;
@@ -0,0 +1,3 @@
1
+ export * from "../domain/services/notification/notification.service";
2
+ export * from "./services/auth.service";
3
+ export * from "./services/web-socket.service";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbm-common/cbm-types",
3
- "version": "0.0.131",
3
+ "version": "0.0.133",
4
4
  "main": "index.js",
5
5
  "types": "public-api.d.ts",
6
6
  "exports": {