@cbm-common/cbm-types 0.0.130 → 0.0.132

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
  }
@@ -3,9 +3,14 @@ import { CbmAuthReactiveModel } from "../models/auth-reactive.domain.model";
3
3
  export declare class CbmAuthReactiveService {
4
4
  constructor();
5
5
  setToken: Subject<[CbmAuthReactiveModel.TLocalStorageKey, string | null]>;
6
+ authenticationMode: import("@angular/core").WritableSignal<CbmAuthReactiveModel.TAccessMode>;
7
+ private userTokenData;
6
8
  private tokens;
9
+ userData: import("@angular/core").Signal<CbmAuthReactiveModel.CbmTokenUserData | null>;
7
10
  init(): Promise<void>;
11
+ destroySession(): void;
8
12
  private subObservers;
9
13
  private refreshTokensFromStorage;
10
14
  private loadTokensFromStorage;
15
+ private decodeToken;
11
16
  }
@@ -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.130",
3
+ "version": "0.0.132",
4
4
  "main": "index.js",
5
5
  "types": "public-api.d.ts",
6
6
  "exports": {
package/public-api.d.ts CHANGED
@@ -475,4 +475,8 @@ export * from './lib/domain/services/global-state.domain.service';
475
475
  export * from './lib/components/pms-add-charge/pms-add-charge';
476
476
 
477
477
  //#region client card component
478
- export * from './lib/components/client-card/client-card.component';
478
+ export * from './lib/components/client-card/client-card.component';
479
+
480
+ //#region auth reactive service
481
+ export * from './lib/domain/services/auth-reactive.domain.service';
482
+ export * from './lib/domain/models/auth-reactive.domain.model';
@@ -1,15 +0,0 @@
1
- import { DestroyRef } from "@angular/core";
2
- import { FormControl } from "@angular/forms";
3
- import { CbmItemModel } from "@cbm-common/cbm-types";
4
- import { CbmItemDomainRepository } from "../../repositories/item.domain.repository";
5
- import { CbmNotificationService } from "../notification/notification.service";
6
- export declare class FindItemCodeService {
7
- private readonly destroyRef;
8
- private readonly itemRepository;
9
- private readonly notificationService;
10
- private readonly codeControl;
11
- private readonly itemControl;
12
- constructor(destroyRef: DestroyRef, itemRepository: CbmItemDomainRepository, notificationService: CbmNotificationService, codeControl: FormControl<string>, itemControl: FormControl<Partial<CbmItemModel.ListResponse.Item> | null>);
13
- loading: import("@angular/core").WritableSignal<boolean>;
14
- findCode(code?: string): Promise<void>;
15
- }
@@ -1,12 +0,0 @@
1
- import { DestroyRef } from "@angular/core";
2
- import { FormControl } from "@angular/forms";
3
- import { IGetPriceTypeParams, IPriceTypeExec } from "../../../types/price-type.fn";
4
- import { CbmSalePriceModel } from "../../models/sale-price.domain.model";
5
- export declare class FindPriceTypeService {
6
- private readonly destroyRef;
7
- private readonly controlPriceType;
8
- private readonly controls;
9
- private readonly params;
10
- constructor(destroyRef: DestroyRef, controlPriceType: FormControl<Partial<CbmSalePriceModel.GetResponse.Data> | null>, controls: Omit<IPriceTypeExec, 'controlPriceType'>, params: IGetPriceTypeParams);
11
- subObserver(): void;
12
- }