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