chore(release): bump version to 0.0.34 and update changelog
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# @warkypublic/zustandsyncstore
|
# @warkypublic/zustandsyncstore
|
||||||
|
|
||||||
|
## 0.0.34
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Better GlobalStateStore
|
||||||
|
|
||||||
## 0.0.33
|
## 0.0.33
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@warkypublic/oranguru",
|
"name": "@warkypublic/oranguru",
|
||||||
"author": "Warky Devs",
|
"author": "Warky Devs",
|
||||||
"version": "0.0.33",
|
"version": "0.0.34",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/lib.d.ts",
|
"types": "./dist/lib.d.ts",
|
||||||
"main": "./dist/lib.cjs.js",
|
"main": "./dist/lib.cjs.js",
|
||||||
|
|||||||
@@ -158,6 +158,12 @@ const createComplexActions = (set: SetState, get: GetState) => ({
|
|||||||
set((state: GlobalState) => ({
|
set((state: GlobalState) => ({
|
||||||
...state,
|
...state,
|
||||||
...result,
|
...result,
|
||||||
|
layout: { ...state.layout, ...result?.layout },
|
||||||
|
navigation: { ...state.navigation, ...result?.navigation },
|
||||||
|
owner: {
|
||||||
|
...state.owner,
|
||||||
|
...result?.owner,
|
||||||
|
},
|
||||||
program: {
|
program: {
|
||||||
...state.program,
|
...state.program,
|
||||||
...result?.program,
|
...result?.program,
|
||||||
@@ -169,6 +175,10 @@ const createComplexActions = (set: SetState, get: GetState) => ({
|
|||||||
connected: true,
|
connected: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
},
|
},
|
||||||
|
user: {
|
||||||
|
...state.user,
|
||||||
|
...result?.user,
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
set((state: GlobalState) => ({
|
set((state: GlobalState) => ({
|
||||||
@@ -329,11 +339,11 @@ const setApiURL = (url: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getApiURL = (): string => {
|
const getApiURL = (): string => {
|
||||||
return GlobalStateStore.getState().session.apiURL;
|
return GlobalStateStore.getState().session.apiURL ?? '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAuthToken = (): string => {
|
const getAuthToken = (): string => {
|
||||||
return GlobalStateStore.getState().session.authToken;
|
return GlobalStateStore.getState().session.authToken ?? '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const isLoggedIn = (): boolean => {
|
const isLoggedIn = (): boolean => {
|
||||||
@@ -346,6 +356,15 @@ const setAuthToken = (token: string) => {
|
|||||||
|
|
||||||
const GetGlobalState = (): GlobalStateStoreType => {
|
const GetGlobalState = (): GlobalStateStoreType => {
|
||||||
return GlobalStateStore.getState();
|
return GlobalStateStore.getState();
|
||||||
}
|
};
|
||||||
|
|
||||||
export { getApiURL, getAuthToken, GetGlobalState, GlobalStateStore, isLoggedIn, setApiURL, setAuthToken, useGlobalStateStore };
|
export {
|
||||||
|
getApiURL,
|
||||||
|
getAuthToken,
|
||||||
|
GetGlobalState,
|
||||||
|
GlobalStateStore,
|
||||||
|
isLoggedIn,
|
||||||
|
setApiURL,
|
||||||
|
setAuthToken,
|
||||||
|
useGlobalStateStore,
|
||||||
|
};
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ interface GlobalStateActions {
|
|||||||
login: (authToken?: string) => Promise<void>;
|
login: (authToken?: string) => Promise<void>;
|
||||||
logout: () => Promise<void>;
|
logout: () => Promise<void>;
|
||||||
// Callbacks for custom logic
|
// Callbacks for custom logic
|
||||||
onFetchSession?: (state: GlobalState) => Promise<Partial<GlobalState>>;
|
onFetchSession?: (state: Partial<GlobalState>) => Promise<Partial<GlobalState>>;
|
||||||
onLogin?: (
|
onLogin?: (
|
||||||
state: GlobalState
|
state: Partial<GlobalState>
|
||||||
) => Promise<Pick<GlobalState, 'owner' | 'program' | 'session' | 'user'> | void>;
|
) => Promise<Partial<Pick<GlobalState, 'owner' | 'program' | 'session' | 'user'>> | void>;
|
||||||
onLogout?: (
|
onLogout?: (
|
||||||
state: GlobalState
|
state: Partial<GlobalState>
|
||||||
) => Promise<Pick<GlobalState, 'owner' | 'program' | 'session' | 'user'> | void>;
|
) => Promise<Partial<Pick<GlobalState, 'owner' | 'program' | 'session' | 'user'>> | void>;
|
||||||
setApiURL: (url: string) => void;
|
setApiURL: (url: string) => void;
|
||||||
|
|
||||||
setAuthToken: (token: string) => void;
|
setAuthToken: (token: string) => void;
|
||||||
@@ -98,7 +98,7 @@ interface NavigationState {
|
|||||||
|
|
||||||
interface OwnerState {
|
interface OwnerState {
|
||||||
guid?: string;
|
guid?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
logo?: string;
|
logo?: string;
|
||||||
name: string;
|
name: string;
|
||||||
settings?: Record<string, any>;
|
settings?: Record<string, any>;
|
||||||
@@ -125,21 +125,21 @@ interface ProgramState {
|
|||||||
logo?: string;
|
logo?: string;
|
||||||
meta?: Record<string, any>;
|
meta?: Record<string, any>;
|
||||||
name: string;
|
name: string;
|
||||||
slug: string;
|
slug?: string;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
version?: string;
|
version?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SessionState {
|
interface SessionState {
|
||||||
apiURL: string;
|
apiURL?: string;
|
||||||
authToken: string;
|
authToken?: string;
|
||||||
connected: boolean;
|
connected?: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
expiryDate?: string;
|
expiryDate?: string;
|
||||||
isSecurity?: boolean;
|
isSecurity?: boolean;
|
||||||
loading: boolean;
|
loading?: boolean;
|
||||||
loggedIn: boolean;
|
loggedIn?: boolean;
|
||||||
meta?: Record<string, any>;
|
meta?: Record<string, any>;
|
||||||
parameters?: Record<string, any>;
|
parameters?: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user