shogun-button-react 1.10.3 → 1.11.0

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,28 +1,44 @@
1
1
  import React from "react";
2
- import { IGunInstance, ShogunCore } from "shogun-core";
2
+ import { ShogunCore } from "shogun-core";
3
3
  import { Observable } from "rxjs";
4
+ import { GunAdvancedPlugin } from "../plugins/GunAdvancedPlugin";
4
5
  import "../styles/index.css";
5
6
  type ShogunContextType = {
6
7
  core: ShogunCore | null;
7
8
  options: any;
8
9
  isLoggedIn: boolean;
9
- isConnected: boolean;
10
10
  userPub: string | null;
11
11
  username: string | null;
12
12
  login: (method: string, ...args: any[]) => Promise<any>;
13
13
  signUp: (method: string, ...args: any[]) => Promise<any>;
14
14
  logout: () => void;
15
15
  observe: <T>(path: string) => Observable<T>;
16
+ setProvider: (provider: any) => boolean;
16
17
  hasPlugin: (name: string) => boolean;
17
18
  getPlugin: <T>(name: string) => T | undefined;
18
19
  exportGunPair: (password?: string) => Promise<string>;
19
20
  importGunPair: (pairData: string, password?: string) => Promise<boolean>;
21
+ gunPlugin: GunAdvancedPlugin | null;
22
+ useGunState: <T>(path: string, defaultValue?: T) => any;
23
+ useGunCollection: <T>(path: string, options?: any) => any;
24
+ useGunConnection: (path: string) => {
25
+ isConnected: boolean;
26
+ lastSeen: Date | null;
27
+ error: string | null;
28
+ };
29
+ useGunDebug: (path: string, enabled?: boolean) => void;
30
+ useGunRealtime: <T>(path: string, callback?: (data: T, key: string) => void) => {
31
+ data: T | null;
32
+ key: string | null;
33
+ };
34
+ put: (path: string, data: any) => Promise<void>;
35
+ get: (path: string) => any;
36
+ remove: (path: string) => Promise<void>;
20
37
  };
21
38
  export declare const useShogun: () => ShogunContextType;
22
39
  type ShogunButtonProviderProps = {
23
40
  children: React.ReactNode;
24
41
  core: ShogunCore;
25
- gun: IGunInstance<any>;
26
42
  options: any;
27
43
  onLoginSuccess?: (data: {
28
44
  userPub: string;
@@ -37,9 +53,8 @@ type ShogunButtonProviderProps = {
37
53
  authMethod?: "password" | "web3" | "webauthn" | "nostr" | "oauth";
38
54
  }) => void;
39
55
  onError?: (error: string) => void;
40
- onLogout?: () => void;
41
56
  };
42
- export declare function ShogunButtonProvider({ children, core, gun, options, onLoginSuccess, onSignupSuccess, onError, onLogout, }: ShogunButtonProviderProps): React.JSX.Element;
57
+ export declare function ShogunButtonProvider({ children, core, options, onLoginSuccess, onSignupSuccess, onError, }: ShogunButtonProviderProps): React.JSX.Element;
43
58
  type ShogunButtonComponent = React.FC & {
44
59
  Provider: typeof ShogunButtonProvider;
45
60
  useShogun: typeof useShogun;