@interncom/diplomatic 0.0.55 → 0.0.56

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
@@ -1,5 +1,5 @@
1
- import { useClientState, useSyncOnResume } from "./react/useClient";
2
- import { StateManager, opMapApplier } from './state';
1
+ import { useClientState, useClientXferState, useSyncOnResume } from "./react/useClient";
2
+ import { opMapApplier, StateManager } from "./state";
3
3
  import { localStorageStore } from "./localStorageStore";
4
4
  import { idbStore } from "./idbStore";
5
5
  import type { IDiplomaticClientState } from "./types";
@@ -11,5 +11,5 @@ import useStateWatcher from "./react/useStateWatcher";
11
11
  import InitSeedView from "./react/initSeedView";
12
12
  import ClientStatusBar from "./react/statusBar";
13
13
  import * as EntityDB from "./entityDB";
14
- export { useClientState, useSyncOnResume, StateManager, useStateWatcher, opMapApplier, localStorageStore, idbStore, DiplomaticClient, libsodiumCrypto, btoh, htob, Verb, InitSeedView, ClientStatusBar, EntityDB, };
15
- export type { IOp, IUpsertOp, IDiplomaticClientState, };
14
+ export { btoh, ClientStatusBar, DiplomaticClient, EntityDB, htob, idbStore, InitSeedView, libsodiumCrypto, localStorageStore, opMapApplier, StateManager, useClientState, useClientXferState, useStateWatcher, useSyncOnResume, Verb, };
15
+ export type { IDiplomaticClientState, IOp, IUpsertOp };
package/dist/index.mjs CHANGED
@@ -2496,6 +2496,21 @@ function useClientState(client) {
2496
2496
  }, [client]);
2497
2497
  return state;
2498
2498
  }
2499
+ function useClientXferState(client) {
2500
+ const [state, setState] = useState();
2501
+ useEffect(() => {
2502
+ async function updateState() {
2503
+ const state2 = await client.getXferState();
2504
+ setState(state2);
2505
+ }
2506
+ client.xferListener = updateState;
2507
+ updateState();
2508
+ return () => {
2509
+ client.xferListener = void 0;
2510
+ };
2511
+ }, [client]);
2512
+ return state;
2513
+ }
2499
2514
  function useSyncOnResume(client) {
2500
2515
  useEffect(() => {
2501
2516
  async function handleOnline() {
@@ -11829,6 +11844,7 @@ export {
11829
11844
  localStorageStore,
11830
11845
  opMapApplier,
11831
11846
  useClientState,
11847
+ useClientXferState,
11832
11848
  useStateWatcher,
11833
11849
  useSyncOnResume
11834
11850
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer",
6
6
  "main": "dist/index.mjs",