@tinycloud/web-sdk 3.8.0-beta.8 → 3.8.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.
package/README.md CHANGED
@@ -71,6 +71,7 @@ Duplicate registration throws immediately; enabling replication without
71
71
  registration throws at construction. Replication off requires no plugin, and a
72
72
  refused local replica does not end an otherwise valid network session.
73
73
  Set `replication.syncScope: 'prefixes'` to request sign-in sync only on the declared prefixes.
74
+ Set `replication.contentFetch: 'lazy'` to sync entry names without downloading values; reads of values the replica does not hold go to the network. The default is `'eager'`.
74
75
 
75
76
  Use the same module format for registration and the client: importing both
76
77
  ESM and CJS root bundles in one process creates independent module registries.
@@ -289,6 +290,7 @@ const tc = new TinyCloudWeb({
289
290
  });
290
291
 
291
292
  tc.ui.open();
293
+ tc.ui.setButtonVisible(true); // show or hide the floating button at runtime
292
294
  tc.ui.close();
293
295
  tc.ui.toggle();
294
296
  tc.ui.isOpen; // boolean
@@ -297,6 +299,8 @@ tc.ui.available; // false in iframes, opaque origins, SSR, or when ui is false
297
299
 
298
300
  `open()` also clears the user's hidden flag for the button. The hidden flag is stored per origin and app id under `tinycloud:ui:button-hidden:v1:`. The panel shows sections only for capabilities the client exposes.
299
301
 
302
+ `ui.button` sets the initial state of the floating button, and `tc.ui.setButtonVisible(visible)` changes it at runtime: `true` shows the button now (even under `ui.button: false`) and clears the stored hidden flag, `false` hides it without writing that flag. The SDK does not store this choice; call it on load from your own setting. `open()`, `openPage()` and `toggle()` work whether the button is shown or not. On a phone the panel keeps its header inside the device safe areas, and a downward swipe on the header closes it.
303
+
300
304
  ### Storage section and storage-full toast
301
305
 
302
306
  When the client exposes `storage.status()`, the panel shows a Storage section with the account's usage: "Room left", "Nearly full", "Storage is full", or "No limit", plus a bar and a "Manage storage" link. The link uses the status `manageUrl` only when it is https; otherwise it falls back to `https://account.tinycloud.xyz/storage`. When the storage needs permission, the section shows a neutral note with no numbers.
@@ -1,4 +1,5 @@
1
1
  import { ISessionStorage, PersistedSessionData } from "@tinycloud/sdk-core";
2
+ import type { PortableDelegation } from "@tinycloud/node-sdk/core";
2
3
  export type BrowserSessionLoadStatus = "loaded" | "missing" | "expired" | "corrupt" | "storage-unavailable";
3
4
  export type BrowserSessionLoadResult = {
4
5
  status: "loaded";
@@ -29,6 +30,22 @@ export declare class BrowserSessionStorage implements ISessionStorage {
29
30
  private validateForNetworkRestore;
30
31
  loadWithStatus(address: string): Promise<BrowserSessionLoadResult>;
31
32
  clear(address: string): Promise<void>;
33
+ private grantsKey;
34
+ /**
35
+ * Stores `grants` (runtime delegations to the stored session's key) beside the session record, in the same storage.
36
+ * They are bearer proofs for that key, so they live and die with the session record: `save` of a new session,
37
+ * `clear` and sign-out remove them, and `loadRuntimeGrants` returns none once the session is missing or expired.
38
+ * An empty list removes the entry. A storage that refuses the write (quota, blocked) leaves the grants unsaved:
39
+ * the grant then lasts until the page reloads. Never rejects.
40
+ */
41
+ saveRuntimeGrants(address: string, grants: readonly PortableDelegation[]): Promise<void>;
42
+ private writeRuntimeGrants;
43
+ /**
44
+ * The unexpired, well-formed grants saved for `address` while its session record is valid. Expired or malformed ones
45
+ * are removed. Never rejects: an unreadable storage answers none.
46
+ */
47
+ loadRuntimeGrants(address: string): Promise<PortableDelegation[]>;
48
+ private readRuntimeGrants;
32
49
  exists(address: string): boolean;
33
50
  isAvailable(): boolean;
34
51
  }