@zing-protocol/zing-sdk 0.1.7 → 0.1.9

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.
package/dist/index.d.ts CHANGED
@@ -6,7 +6,8 @@ export * from "./mutations/index.js";
6
6
  export * from "./bcs.js";
7
7
  export * from "./_generated/index.js";
8
8
  export * from "./client/index.js";
9
- export * from "./stores/index.js";
9
+ export { uploadActions } from "./stores/uploadStore.js";
10
+ export { zkloginStorage } from "./stores/zkloginStore.js";
10
11
  export type * from "./types.js";
11
12
  export type InfiniteQueryResult<TData> = {
12
13
  pages: TData[];
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ export * from "./mutations/index.js";
6
6
  export * from "./bcs.js";
7
7
  export * from "./_generated/index.js";
8
8
  export * from "./client/index.js";
9
- export * from "./stores/index.js";
9
+ export { uploadActions } from "./stores/uploadStore.js";
10
+ export { zkloginStorage } from "./stores/zkloginStore.js";
package/dist/react.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./components/index.js";
2
2
  export * from "./hooks/index.js";
3
+ export * from "./stores/index.js";
package/dist/react.js CHANGED
@@ -1,3 +1,4 @@
1
1
  // React-dependent exports - requires React to be installed
2
2
  export * from "./components/index.js";
3
3
  export * from "./hooks/index.js";
4
+ export * from "./stores/index.js";
@@ -24,6 +24,13 @@ interface UploadStore {
24
24
  getJob: (id: string) => UploadJob | undefined;
25
25
  getActiveJobs: () => UploadJob[];
26
26
  }
27
- export declare const useUploadStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UploadStore>>;
28
- export declare const uploadActions: UploadStore;
27
+ export declare const useUploadStore: <T>(selector: (state: UploadStore) => T) => T;
28
+ export declare const uploadActions: {
29
+ addJob: (job: Omit<UploadJob, "startedAt">) => void;
30
+ updateJob: (id: string, updates: Partial<UploadJob>) => void;
31
+ removeJob: (id: string) => void;
32
+ clearCompleted: () => void;
33
+ getJob: (id: string) => UploadJob | undefined;
34
+ getActiveJobs: () => UploadJob[];
35
+ };
29
36
  export type { UploadJob, UploadJobStatus, UploadJobType, UploadStore };
@@ -1,6 +1,7 @@
1
- import { create } from "zustand";
2
- // Create the Zustand store using the standard React-compatible `create` function
3
- const useUploadStoreBase = create((set, get) => ({
1
+ import { useStore } from "zustand";
2
+ import { createStore } from "zustand/vanilla";
3
+ // Create the vanilla Zustand store (no React dependency)
4
+ const uploadStoreBase = createStore((set, get) => ({
4
5
  jobs: [],
5
6
  addJob(job) {
6
7
  const newJob = {
@@ -33,7 +34,14 @@ const useUploadStoreBase = create((set, get) => ({
33
34
  return get().jobs.filter((j) => j.status === "uploading");
34
35
  },
35
36
  }));
36
- // Export the hook as the default export (React-compatible)
37
- export const useUploadStore = useUploadStoreBase;
38
- // Export actions for non-React usage (these access the store directly)
39
- export const uploadActions = useUploadStoreBase.getState();
37
+ // React hook wrapper
38
+ export const useUploadStore = (selector) => useStore(uploadStoreBase, selector);
39
+ // Export actions for non-React usage (bound methods)
40
+ export const uploadActions = {
41
+ addJob: uploadStoreBase.getState().addJob,
42
+ updateJob: uploadStoreBase.getState().updateJob,
43
+ removeJob: uploadStoreBase.getState().removeJob,
44
+ clearCompleted: uploadStoreBase.getState().clearCompleted,
45
+ getJob: uploadStoreBase.getState().getJob,
46
+ getActiveJobs: uploadStoreBase.getState().getActiveJobs,
47
+ };
@@ -13,7 +13,7 @@ export interface ZKLoginStorage {
13
13
  setZKProof: (proof: string) => void;
14
14
  reset: () => void;
15
15
  }
16
- export declare const zkloginStorage: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<ZKLoginStorage>, "setState" | "persist"> & {
16
+ export declare const zkloginStorage: Omit<import("zustand/vanilla").StoreApi<ZKLoginStorage>, "setState" | "persist"> & {
17
17
  setState(partial: ZKLoginStorage | Partial<ZKLoginStorage> | ((state: ZKLoginStorage) => ZKLoginStorage | Partial<ZKLoginStorage>), replace?: false | undefined): unknown;
18
18
  setState(state: ZKLoginStorage | ((state: ZKLoginStorage) => ZKLoginStorage), replace: true): unknown;
19
19
  persist: {
@@ -25,4 +25,4 @@ export declare const zkloginStorage: import("zustand").UseBoundStore<Omit<import
25
25
  onFinishHydration: (fn: (state: ZKLoginStorage) => void) => () => void;
26
26
  getOptions: () => Partial<import("zustand/middleware").PersistOptions<ZKLoginStorage, unknown, unknown>>;
27
27
  };
28
- }>;
28
+ };
@@ -1,6 +1,6 @@
1
- import { create } from "zustand";
2
1
  import { persist, createJSONStorage } from "zustand/middleware";
3
- export const zkloginStorage = create()(persist((set) => ({
2
+ import { createStore } from "zustand/vanilla";
3
+ export const zkloginStorage = createStore()(persist((set) => ({
4
4
  jwt: null,
5
5
  suiAddress: null,
6
6
  maxEpoch: null,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@zing-protocol/zing-sdk",
3
3
  "sideEffects": false,
4
4
  "type": "module",
5
- "version": "0.1.7",
5
+ "version": "0.1.9",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
@@ -28,6 +28,14 @@
28
28
  "react": ">=18.0.0",
29
29
  "react-dom": ">=18.0.0"
30
30
  },
31
+ "peerDependenciesMeta": {
32
+ "react": {
33
+ "optional": true
34
+ },
35
+ "react-dom": {
36
+ "optional": true
37
+ }
38
+ },
31
39
  "devDependencies": {
32
40
  "@package/tsconfig": "workspace:*",
33
41
  "type-fest": "^4.41.0",