@tinycloud/web-sdk 3.16.0 → 3.18.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/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/modals.cjs +1 -2
- package/dist/modals.mjs +1 -2
- package/dist/modules/tcw.d.ts +55 -0
- package/dist/notifications/permissionExpansion.d.ts +6 -0
- package/dist/notifications/permissionExpansionBridge.d.ts +2 -0
- package/dist/notifications/types.schema.d.ts +2 -2
- package/dist/panel.cjs +1 -1
- package/dist/panel.mjs +1 -1
- package/dist/ui/panel-toasts.d.ts +1 -1
- package/dist/ui/strings.d.ts +2 -0
- package/dist/ui/toast-store.d.ts +8 -0
- package/package.json +3 -3
- package/dist/modals.cjs.LICENSE.txt +0 -23
- package/dist/modals.mjs.LICENSE.txt +0 -23
package/dist/modules/tcw.d.ts
CHANGED
|
@@ -53,6 +53,14 @@ export interface Config extends ClientConfig {
|
|
|
53
53
|
* `expiryChangeable: true` asks OpenKey to let the user change the session expiry in the approval. The SDK then
|
|
54
54
|
* accepts the changed expiry and builds the session with the SIGNED value. It is a pass-through: `@openkey/sdk`
|
|
55
55
|
* >= 0.13.0 (beta: 0.13.0-beta.0) forwards it; it is inert on 0.12.x, so the expiry stays as requested.
|
|
56
|
+
*
|
|
57
|
+
* On a third-party site, an owner with no registry record is refused before OpenKey is asked to approve anything, or,
|
|
58
|
+
* for an app that asks only for its own `applications` space, after the approval when the default node does not host
|
|
59
|
+
* that space (the hosted-owner proof). With `@openkey/sdk` >= 0.13.0-beta.5 (`setupAccount`) and a managed OpenKey key,
|
|
60
|
+
* `signIn()` then opens OpenKey's account setup, and once the owner has set the account up it signs in again, which
|
|
61
|
+
* OpenKey asks the owner to approve. In popup mode, if the browser blocks that popup, it asks in OpenKey's frame
|
|
62
|
+
* instead. When the owner cancels or setup fails, for wallet keys and older clients, and for any other refusal after
|
|
63
|
+
* the approval, `signIn()` rejects with the `AccountSetupRequiredError` as before.
|
|
56
64
|
*/
|
|
57
65
|
openkey?: {
|
|
58
66
|
client: OpenKeyAuthorizeTinyCloud;
|
|
@@ -189,6 +197,20 @@ export interface RequestPermissionsResult {
|
|
|
189
197
|
session?: ClientSession;
|
|
190
198
|
delegations?: readonly PortableDelegation[];
|
|
191
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* `account.setup.pending`: the owner signed in, but has no account record yet (TC-4344). Their own space is hosted, so
|
|
202
|
+
* nothing is blocked; OpenKey can set the account up in one step.
|
|
203
|
+
*/
|
|
204
|
+
export interface AccountSetupPendingEvent {
|
|
205
|
+
/** The signed-in owner's address. */
|
|
206
|
+
readonly address: string;
|
|
207
|
+
/**
|
|
208
|
+
* Opens OpenKey's account setup for the signing key. Call it from a click: it opens a window. Resolves true once
|
|
209
|
+
* OpenKey reports the account set up; false when the owner closed it, or the owner signed out or changed since.
|
|
210
|
+
* Never rejects. The current session keeps working either way.
|
|
211
|
+
*/
|
|
212
|
+
finishSetup(): Promise<boolean>;
|
|
213
|
+
}
|
|
192
214
|
export type SessionRestoreStatus = "idle" | "disabled" | "restoring" | "restored" | "missing" | "expired" | "corrupt" | "storage-unavailable" | "restore-failed" | "stale" | "logging-in";
|
|
193
215
|
export interface SessionRestoreResult {
|
|
194
216
|
status: Exclude<SessionRestoreStatus, "idle" | "restoring" | "logging-in">;
|
|
@@ -261,6 +283,9 @@ export declare class TinyCloudWeb {
|
|
|
261
283
|
private _shareReceiverService?;
|
|
262
284
|
private readonly storageFullHandlers;
|
|
263
285
|
private readonly purgeFailedHandlers;
|
|
286
|
+
private readonly accountSetupHandlers;
|
|
287
|
+
/** The setup the account-setup toast's button runs: the latest sign-in's offer, which refuses once that session ends. */
|
|
288
|
+
private latestAccountSetupOffer?;
|
|
264
289
|
/** Promise that resolves when WASM + node are ready */
|
|
265
290
|
private _initPromise;
|
|
266
291
|
/** User config */
|
|
@@ -337,6 +362,13 @@ export declare class TinyCloudWeb {
|
|
|
337
362
|
* retries now. Safe to call before initialization finishes. Returns the unsubscribe function.
|
|
338
363
|
*/
|
|
339
364
|
on(event: "replica.purge.failed", handler: (event: LocalCopyPurgeFailedEvent) => void): () => void;
|
|
365
|
+
/**
|
|
366
|
+
* Subscribe to `account.setup.pending`. It fires at the end of a `signIn()` that succeeded for an owner with no
|
|
367
|
+
* account record whose OpenKey key can be set up from here, so the app can offer "finish setup" in its own UI; call
|
|
368
|
+
* the event's `finishSetup` from the owner's click. While any handler is subscribed, the SDK shows no setup toast
|
|
369
|
+
* of its own. Safe to call before initialization finishes. Returns the unsubscribe function.
|
|
370
|
+
*/
|
|
371
|
+
on(event: "account.setup.pending", handler: (event: AccountSetupPendingEvent) => void): () => void;
|
|
340
372
|
/** The owner's TinyCloud storage; `storage.status()` reads usage and plan from the node. */
|
|
341
373
|
get storage(): IStorageService;
|
|
342
374
|
/** Browser UI API: `open`, `close`, `toggle`, `isOpen`, and `available`. Inert when `ui: false` or the page cannot render UI. */
|
|
@@ -449,6 +481,29 @@ export declare class TinyCloudWeb {
|
|
|
449
481
|
* `maxExpiresAt` is forwarded only with it.
|
|
450
482
|
*/
|
|
451
483
|
private openKeySignInOptions;
|
|
484
|
+
/**
|
|
485
|
+
* The OpenKey key to set up after a refusal setup is offered for, or undefined when OpenKey can't set it up from here:
|
|
486
|
+
* the client has no `setupAccount` (`@openkey/sdk` before 0.13.0-beta.5), or the key is not a managed OpenKey key
|
|
487
|
+
* of the account signing in. A wallet key is set up in TinyCloud One; with no keyId, OpenKey would set up the
|
|
488
|
+
* account's primary key, which may be another account.
|
|
489
|
+
*/
|
|
490
|
+
private openKeyAccountSetupKey;
|
|
491
|
+
/**
|
|
492
|
+
* Opens OpenKey's account setup for `keyId` and waits for it. True when OpenKey reports the account set up; false
|
|
493
|
+
* when the owner cancelled or setup did not finish, so the caller keeps its `AccountSetupRequiredError`.
|
|
494
|
+
*/
|
|
495
|
+
private setUpOpenKeyAccount;
|
|
496
|
+
/**
|
|
497
|
+
* After a sign-in that succeeded for an owner with no account record (the hosted-owner proof, TC-4344): the
|
|
498
|
+
* `account.setup.pending` event, or with no handler subscribed, a toast whose button opens OpenKey's setup. It never
|
|
499
|
+
* opens anything by itself and never blocks the sign-in. Only a managed OpenKey key of the signed-in owner is offered.
|
|
500
|
+
*/
|
|
501
|
+
private offerAccountSetup;
|
|
502
|
+
/**
|
|
503
|
+
* The sign-in again once OpenKey set the account up; its preparation reads the registry afresh. The owner's clicks
|
|
504
|
+
* went to OpenKey's window, so this one may no longer open a popup: a blocked popup asks in OpenKey's frame instead.
|
|
505
|
+
*/
|
|
506
|
+
private signInWithOpenKeyAfterAccountSetup;
|
|
452
507
|
signIn: (options?: SignInOptions) => Promise<ClientSignInResult>;
|
|
453
508
|
private performSignIn;
|
|
454
509
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sdk-core's permission expansion, for the prompt's derived line. In the built prompt chunk this module is replaced by
|
|
3
|
+
* permissionExpansionBridge.ts, which takes the root bundle's own copy, so the chunk carries none of sdk-core (TC-4294).
|
|
4
|
+
*/
|
|
5
|
+
export { expandPermissionEntries } from "@tinycloud/sdk-core";
|
|
6
|
+
//# sourceMappingURL=permissionExpansion.d.ts.map
|
|
@@ -43,11 +43,11 @@ export declare const SpaceCreationResultSchema: z.ZodObject<{
|
|
|
43
43
|
/** Whether the modal was dismissed without creating */
|
|
44
44
|
dismissed: z.ZodBoolean;
|
|
45
45
|
}, "strip", z.ZodTypeAny, {
|
|
46
|
-
dismissed?: boolean;
|
|
47
46
|
success?: boolean;
|
|
48
|
-
}, {
|
|
49
47
|
dismissed?: boolean;
|
|
48
|
+
}, {
|
|
50
49
|
success?: boolean;
|
|
50
|
+
dismissed?: boolean;
|
|
51
51
|
}>;
|
|
52
52
|
export type SpaceCreationResult = z.infer<typeof SpaceCreationResultSchema>;
|
|
53
53
|
/**
|