applesauce-react 0.0.0-next-20250128171228 → 0.0.0-next-20250128182541

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,6 +1,6 @@
1
1
  export * from "./use-account-manager.js";
2
2
  export * from "./use-accounts.js";
3
- export * from "./use-active-accounts.js";
3
+ export * from "./use-active-account.js";
4
4
  export * from "./use-event-factory.js";
5
5
  export * from "./use-observable.js";
6
6
  export * from "./use-query-store.js";
@@ -1,6 +1,6 @@
1
1
  export * from "./use-account-manager.js";
2
2
  export * from "./use-accounts.js";
3
- export * from "./use-active-accounts.js";
3
+ export * from "./use-active-account.js";
4
4
  export * from "./use-event-factory.js";
5
5
  export * from "./use-observable.js";
6
6
  export * from "./use-query-store.js";
@@ -1 +1,4 @@
1
- export declare function useAccountManager(): import("applesauce-accounts").AccountManager<any> | undefined;
1
+ import { AccountManager } from "applesauce-accounts";
2
+ export declare function useAccountManager(): AccountManager;
3
+ export declare function useAccountManager(require: false): AccountManager | undefined;
4
+ export declare function useAccountManager(require: true): AccountManager;
@@ -1,5 +1,8 @@
1
1
  import { useContext } from "react";
2
2
  import { AccountsContext } from "../providers/accounts-provider.js";
3
- export function useAccountManager() {
4
- return useContext(AccountsContext);
3
+ export function useAccountManager(require = true) {
4
+ const manager = useContext(AccountsContext);
5
+ if (!manager && require)
6
+ throw new Error("Missing AccountsProvider");
7
+ return manager;
5
8
  }
@@ -1 +1,2 @@
1
- export declare function useAccounts(): import("applesauce-accounts").IAccount<any, any, any>[];
1
+ import { IAccount } from "applesauce-accounts";
2
+ export declare function useAccounts(): IAccount[];
@@ -2,5 +2,5 @@ import { useObservable } from "./use-observable.js";
2
2
  import { useAccountManager } from "./use-account-manager.js";
3
3
  export function useAccounts() {
4
4
  const manager = useAccountManager();
5
- return useObservable(manager?.accounts$);
5
+ return useObservable(manager.accounts$);
6
6
  }
@@ -0,0 +1,2 @@
1
+ import { IAccount } from "applesauce-accounts";
2
+ export declare function useActiveAccount(): IAccount | null;
@@ -2,5 +2,5 @@ import { useObservable } from "./use-observable.js";
2
2
  import { useAccountManager } from "./use-account-manager.js";
3
3
  export function useActiveAccount() {
4
4
  const manager = useAccountManager();
5
- return useObservable(manager?.active$);
5
+ return useObservable(manager.active$);
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-react",
3
- "version": "0.0.0-next-20250128171228",
3
+ "version": "0.0.0-next-20250128182541",
4
4
  "description": "React hooks for applesauce",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,10 +48,10 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "applesauce-accounts": "0.0.0-next-20250128171228",
52
- "applesauce-content": "0.0.0-next-20250128171228",
53
- "applesauce-core": "0.0.0-next-20250128171228",
54
- "applesauce-factory": "0.0.0-next-20250128171228",
51
+ "applesauce-accounts": "0.0.0-next-20250128182541",
52
+ "applesauce-content": "0.0.0-next-20250128182541",
53
+ "applesauce-core": "0.0.0-next-20250128182541",
54
+ "applesauce-factory": "0.0.0-next-20250128182541",
55
55
  "nostr-tools": "^2.10.3",
56
56
  "react": "^18.3.1",
57
57
  "rxjs": "^7.8.1"
@@ -1 +0,0 @@
1
- export declare function useActiveAccount(): import("applesauce-accounts").IAccount<any, any, any> | null;