ingeniuscliq-core 0.4.0 → 0.4.2

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,15 +1,13 @@
1
1
  import { CoreAuthStore, CoreUser } from '../types';
2
2
  import { CoreAuthBaseService } from '../services';
3
3
  export declare class CoreAuthBuilder<T extends CoreUser> {
4
- protected authService: CoreAuthBaseService;
5
- protected initialState: Pick<CoreAuthStore<T>, "user" | "token" | "refreshToken" | "isAuthenticated" | "loading" | "error">;
6
- constructor(authService?: CoreAuthBaseService, initialState?: Partial<CoreAuthStore<T>>);
4
+ protected authService: CoreAuthBaseService<T>;
5
+ protected initialState: Pick<CoreAuthStore<T>, "user" | "isAuthenticated" | "loading" | "error">;
6
+ constructor(authService?: CoreAuthBaseService<T>, initialState?: Partial<CoreAuthStore<T>>);
7
7
  build(): import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<CoreAuthStore<T>>, "persist"> & {
8
8
  persist: {
9
9
  setOptions: (options: Partial<import('zustand/middleware').PersistOptions<CoreAuthStore<T>, {
10
10
  user: T | null;
11
- token: string | null;
12
- refreshToken: string | null;
13
11
  isAuthenticated: boolean;
14
12
  }>>) => void;
15
13
  clearStorage: () => void;
@@ -19,8 +17,6 @@ export declare class CoreAuthBuilder<T extends CoreUser> {
19
17
  onFinishHydration: (fn: (state: CoreAuthStore<T>) => void) => () => void;
20
18
  getOptions: () => Partial<import('zustand/middleware').PersistOptions<CoreAuthStore<T>, {
21
19
  user: T | null;
22
- token: string | null;
23
- refreshToken: string | null;
24
20
  isAuthenticated: boolean;
25
21
  }>>;
26
22
  };
@@ -1,18 +1,16 @@
1
1
  export declare function useAuth(): {
2
2
  user: import('../types').CoreUser | null;
3
- token: string | null;
4
- refreshToken: string | null;
5
3
  isAuthenticated: boolean;
6
4
  loading: boolean;
7
5
  error: string | null;
8
- getUser: () => Promise<import('../types').CoreUser>;
6
+ getUser: () => Promise<import('../../..').BaseApiResponse<import('../types').CoreGetUserResponse<import('../types').CoreUser>>>;
9
7
  login: <K extends import('../types').CoreLoginCredentials>(credentials: K) => Promise<import('../../..').BaseApiResponse<import('../types').CoreAuthLoginResponse<import('../types').CoreUser>>>;
10
8
  register: <K extends import('../types').CoreRegisterCredentials>(credentials: K) => Promise<import('../../..').BaseApiResponse<import('../types').CoreAuthRegisterResponse<import('../types').CoreUser>>>;
11
9
  logout: () => void;
12
10
  refreshUserToken: () => Promise<any>;
11
+ updateUser: (userId: Pick<import('../types').CoreUser, "id">, updateUserData: Partial<import('../types').CoreUser>, actions?: import('../../..').CoreActions) => void;
12
+ deleteUser: (userId: Pick<import('../types').CoreUser, "id">, actions?: import('../../..').CoreActions) => void;
13
13
  setUser: (user: import('../types').CoreUser | null) => void;
14
- setToken: (token: string | null) => void;
15
- setRefreshToken: (token: string | null) => void;
16
14
  setLoading: (loading: boolean) => void;
17
15
  setError: (error: string | null) => void;
18
16
  reset: () => void;
@@ -1,5 +1,7 @@
1
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
- import { CoreLoginCredentials, CoreRegisterCredentials } from '../types/CoreAuth';
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import { CoreGetUserResponse, CoreLoginCredentials, CoreRegisterCredentials, CoreUser } from '../types/CoreAuth';
3
+ import { BaseApiResponse } from '../../../types';
4
+ import { BaseService } from '../../../services';
3
5
  interface CoreAuthRoutes {
4
6
  login: string;
5
7
  register: string;
@@ -10,14 +12,15 @@ interface CoreAuthRoutes {
10
12
  /**
11
13
  * Base class that can be extended by concrete services
12
14
  */
13
- export declare class CoreAuthBaseService {
14
- private readonly api;
15
+ export declare class CoreAuthBaseService<T extends CoreUser> extends BaseService {
15
16
  private readonly routes;
16
17
  constructor(routes?: CoreAuthRoutes, api?: AxiosInstance);
17
- getUser(): Promise<import('axios').AxiosResponse<any, any>>;
18
- login<T extends CoreLoginCredentials>(credentials: T): Promise<import('axios').AxiosResponse<any, any>>;
19
- register<T extends CoreRegisterCredentials>(credentials: T): Promise<import('axios').AxiosResponse<any, any>>;
20
- logout(config?: AxiosRequestConfig): Promise<import('axios').AxiosResponse<any, any>>;
21
- refreshToken(config?: AxiosRequestConfig): Promise<import('axios').AxiosResponse<any, any>>;
18
+ getUser(): Promise<AxiosResponse<BaseApiResponse<CoreGetUserResponse<T>>, any>>;
19
+ login<T extends CoreLoginCredentials>(credentials: T): Promise<AxiosResponse<any, any>>;
20
+ register<T extends CoreRegisterCredentials>(credentials: T): Promise<AxiosResponse<any, any>>;
21
+ logout(config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
22
+ refreshToken(config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
23
+ updateUser(userId: Pick<T, "id">, updateUserData: Partial<T>): Promise<AxiosResponse<BaseApiResponse<T>, any>>;
24
+ deleteUser: (userId: Pick<T, "id">) => Promise<AxiosResponse<BaseApiResponse<null>, any>>;
22
25
  }
23
26
  export {};
@@ -3,8 +3,6 @@ export declare const useAuthStore: import('zustand').UseBoundStore<Omit<import('
3
3
  persist: {
4
4
  setOptions: (options: Partial<import('zustand/middleware').PersistOptions<import('../types').CoreAuthStore<CoreUser>, {
5
5
  user: CoreUser | null;
6
- token: string | null;
7
- refreshToken: string | null;
8
6
  isAuthenticated: boolean;
9
7
  }>>) => void;
10
8
  clearStorage: () => void;
@@ -14,8 +12,6 @@ export declare const useAuthStore: import('zustand').UseBoundStore<Omit<import('
14
12
  onFinishHydration: (fn: (state: import('../types').CoreAuthStore<CoreUser>) => void) => () => void;
15
13
  getOptions: () => Partial<import('zustand/middleware').PersistOptions<import('../types').CoreAuthStore<CoreUser>, {
16
14
  user: CoreUser | null;
17
- token: string | null;
18
- refreshToken: string | null;
19
15
  isAuthenticated: boolean;
20
16
  }>>;
21
17
  };
@@ -1,4 +1,4 @@
1
- import { BaseApiResponse } from '../../../types';
1
+ import { BaseApiResponse, CoreActions } from '../../../types';
2
2
  import { BaseStore } from '../../../types/BaseStore';
3
3
  import { BaseType } from '../../../types/BaseType';
4
4
  export interface CoreUser extends BaseType {
@@ -17,21 +17,21 @@ export interface CoreRegisterCredentials extends CoreLoginCredentials {
17
17
  }
18
18
  export interface CoreAuthStore<T extends CoreUser> extends BaseStore {
19
19
  user: T | null;
20
- token: string | null;
21
- refreshToken: string | null;
22
20
  isAuthenticated: boolean;
23
- getUser: () => Promise<T>;
21
+ getUser: () => Promise<BaseApiResponse<CoreGetUserResponse<T>>>;
24
22
  login: <K extends CoreLoginCredentials>(credentials: K) => Promise<BaseApiResponse<CoreAuthLoginResponse<T>>>;
25
23
  register: <K extends CoreRegisterCredentials>(credentials: K) => Promise<BaseApiResponse<CoreAuthRegisterResponse<T>>>;
26
24
  logout: () => void;
27
25
  refreshUserToken: () => Promise<any>;
28
26
  setUser: (user: T | null) => void;
29
- setToken: (token: string | null) => void;
30
- setRefreshToken: (token: string | null) => void;
27
+ updateUser: (userId: Pick<T, "id">, updateUserData: Partial<T>, actions?: CoreActions) => void;
28
+ deleteUser: (userId: Pick<T, "id">, actions?: CoreActions) => void;
31
29
  }
32
30
  export interface CoreAuthLoginResponse<T extends CoreUser> {
33
31
  user: T;
34
- token: string;
35
32
  }
36
33
  export interface CoreAuthRegisterResponse<T extends CoreUser> extends CoreAuthLoginResponse<T> {
37
34
  }
35
+ export interface CoreGetUserResponse<T extends CoreUser> {
36
+ user: T;
37
+ }
@@ -19,6 +19,9 @@ export interface CoreDesignTemplateSettings {
19
19
  store_map_iframe: string;
20
20
  available_coins: CoreDesignTemplateCoin[];
21
21
  base_coin: CoreDesignTemplateCoin;
22
+ store_about_us: string;
23
+ store_email: string;
24
+ store_phone: string;
22
25
  }
23
26
  export interface CoreDesignTemplateCoin {
24
27
  short_name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingeniuscliq-core",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "IngeniusCliq Core UI y lógica compartida",
5
5
  "license": "MIT",
6
6
  "type": "module",