@sanity/sdk-react 2.18.0 → 3.0.0-rc.1

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.
Files changed (54) hide show
  1. package/dist/index.d.ts +267 -112
  2. package/dist/index.js +131 -89
  3. package/dist/index.js.map +1 -1
  4. package/package.json +11 -9
  5. package/src/_exports/sdk-react.ts +14 -1
  6. package/src/components/auth/AuthBoundary.tsx +10 -5
  7. package/src/context/WorkbenchTokenRefresh.test.tsx +106 -0
  8. package/src/context/WorkbenchTokenRefresh.tsx +61 -0
  9. package/src/context/workbenchToken.ts +63 -0
  10. package/src/hooks/access/useCheckPermissions.test-d.ts +15 -0
  11. package/src/hooks/access/useCheckPermissions.test.tsx +53 -0
  12. package/src/hooks/access/useCheckPermissions.ts +24 -0
  13. package/src/hooks/applications/useApplication.test-d.ts +30 -0
  14. package/src/hooks/applications/useApplication.ts +22 -0
  15. package/src/hooks/applications/useApplications.test-d.ts +31 -0
  16. package/src/hooks/applications/useApplications.ts +25 -0
  17. package/src/hooks/applications/useCreateUserApplication.test-d.ts +14 -0
  18. package/src/hooks/applications/useCreateUserApplication.ts +11 -0
  19. package/src/hooks/applications/useDeleteApplication.test-d.ts +12 -0
  20. package/src/hooks/applications/useDeleteApplication.ts +11 -0
  21. package/src/hooks/applications/useDeleteUserApplication.test-d.ts +14 -0
  22. package/src/hooks/applications/useDeleteUserApplication.ts +11 -0
  23. package/src/hooks/applications/useUpdateApplication.test-d.ts +12 -0
  24. package/src/hooks/applications/useUpdateApplication.ts +11 -0
  25. package/src/hooks/applications/useUpdateUserApplication.test-d.ts +14 -0
  26. package/src/hooks/applications/useUpdateUserApplication.ts +11 -0
  27. package/src/hooks/applications/useUserApplication.test-d.ts +11 -0
  28. package/src/hooks/applications/useUserApplication.ts +14 -0
  29. package/src/hooks/applications/useUserApplications.test-d.ts +11 -0
  30. package/src/hooks/applications/useUserApplications.ts +14 -0
  31. package/src/hooks/helpers/createFetcherHook.test.tsx +180 -0
  32. package/src/hooks/helpers/createFetcherHook.ts +69 -0
  33. package/src/hooks/helpers/createMutationHook.test.tsx +125 -0
  34. package/src/hooks/helpers/createMutationHook.tsx +93 -0
  35. package/src/hooks/installations/useInstallation.test-d.ts +19 -0
  36. package/src/hooks/installations/useInstallation.ts +22 -0
  37. package/src/hooks/installations/useInstallations.test-d.ts +26 -0
  38. package/src/hooks/installations/useInstallations.ts +25 -0
  39. package/src/hooks/organizations/useOrganization.test-d.ts +19 -12
  40. package/src/hooks/organizations/useOrganization.test.ts +50 -52
  41. package/src/hooks/organizations/useOrganization.ts +13 -19
  42. package/src/hooks/organizations/useOrganizations.test-d.ts +26 -13
  43. package/src/hooks/organizations/useOrganizations.test.ts +49 -71
  44. package/src/hooks/organizations/useOrganizations.ts +14 -20
  45. package/src/hooks/projects/useProject.test-d.ts +18 -11
  46. package/src/hooks/projects/useProject.test.tsx +29 -23
  47. package/src/hooks/projects/useProject.ts +12 -16
  48. package/src/hooks/projects/useProjects.test-d.ts +22 -11
  49. package/src/hooks/projects/useProjects.test.ts +45 -98
  50. package/src/hooks/projects/useProjects.ts +16 -17
  51. package/src/hooks/dashboard/useDispatchIntent.test.ts +0 -251
  52. package/src/hooks/dashboard/useDispatchIntent.ts +0 -157
  53. package/src/hooks/dashboard/utils/useResourceIdFromDocumentHandle.test.ts +0 -128
  54. package/src/hooks/dashboard/utils/useResourceIdFromDocumentHandle.ts +0 -42
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AccessResourceType } from "@sanity/sdk";
1
2
  import { ActionsResult } from "@sanity/sdk";
2
3
  import { AgentGenerateOptions } from "@sanity/sdk";
3
4
  import { AgentPatchOptions } from "@sanity/sdk";
@@ -6,13 +7,22 @@ import { AgentPromptOptions } from "@sanity/sdk";
6
7
  import { AgentPromptResult } from "@sanity/sdk";
7
8
  import { AgentTransformOptions } from "@sanity/sdk";
8
9
  import { AgentTranslateOptions } from "@sanity/sdk";
10
+ import { Application } from "@sanity/sdk";
11
+ import { ApplicationBase } from "@sanity/sdk";
12
+ import { ApplicationInclude } from "@sanity/sdk";
13
+ import { ApplicationsOptions } from "@sanity/sdk";
14
+ import { ApplicationsResponse } from "@sanity/sdk";
9
15
  import { AuthState } from "@sanity/sdk";
10
16
  import { CanvasResource } from "@sanity/message-protocol";
11
17
  import { ClientOptions } from "@sanity/sdk";
12
18
  import { Context } from "react";
19
+ import { CreateUserApplicationInput } from "@sanity/sdk";
13
20
  import { CurrentUser } from "@sanity/sdk";
14
21
  import { DatasetHandle } from "@sanity/sdk";
15
22
  import { DatasetsResponse } from "@sanity/client";
23
+ import { DeleteApplicationInput } from "@sanity/sdk";
24
+ import { DeletedResult } from "@sanity/sdk";
25
+ import { DeleteUserApplicationInput } from "@sanity/sdk";
16
26
  import { DocumentAction } from "@sanity/sdk";
17
27
  import { DocumentEvent } from "@sanity/sdk";
18
28
  import { DocumentHandle as DocumentHandle_2 } from "@sanity/sdk";
@@ -25,6 +35,10 @@ import { FavoriteStatusResponse } from "@sanity/sdk";
25
35
  import { FrameMessage } from "@sanity/sdk";
26
36
  import { GetUserOptions } from "@sanity/sdk";
27
37
  import { GetUsersOptions } from "@sanity/sdk";
38
+ import { Installation } from "@sanity/sdk";
39
+ import { InstallationInclude } from "@sanity/sdk";
40
+ import { InstallationsOptions } from "@sanity/sdk";
41
+ import { InstallationsResponse } from "@sanity/sdk";
28
42
  import { JsonMatch } from "@sanity/sdk";
29
43
  import { MediaResource } from "@sanity/message-protocol";
30
44
  import { Organization } from "@sanity/sdk";
@@ -56,6 +70,10 @@ import { SanityUser } from "@sanity/sdk";
56
70
  import { SortOrderingItem } from "@sanity/types";
57
71
  import { StudioResource } from "@sanity/message-protocol";
58
72
  import { TokenSource } from "@sanity/sdk";
73
+ import { UpdateApplicationInput } from "@sanity/sdk";
74
+ import { UpdateUserApplicationInput } from "@sanity/sdk";
75
+ import { UserApplication } from "@sanity/sdk";
76
+ import { UserApplicationsOptions } from "@sanity/sdk";
59
77
  import { UserPresence } from "@sanity/sdk";
60
78
  import { WindowMessage } from "@sanity/sdk";
61
79
 
@@ -153,10 +171,7 @@ export declare interface AuthBoundaryProps {
153
171
  * @public
154
172
  */
155
173
  export declare type ComlinkStatus =
156
- | "idle"
157
- | "handshaking"
158
- | "connected"
159
- | "disconnected";
174
+ "idle" | "handshaking" | "connected" | "disconnected";
160
175
 
161
176
  /**
162
177
  * This provider is used to provide the Comlink token refresh feature.
@@ -191,14 +206,6 @@ declare interface DashboardResource {
191
206
 
192
207
  export { DatasetsResponse };
193
208
 
194
- /**
195
- * Return type for the useDispatchIntent hook
196
- * @beta
197
- */
198
- declare interface DispatchIntent {
199
- dispatchIntent: () => void;
200
- }
201
-
202
209
  /**
203
210
  * React SDK document handle. Adds `resourceName` to the core `DocumentHandle`.
204
211
  *
@@ -301,6 +308,23 @@ export declare interface DocumentTypeHandle<
301
308
  resourceName?: string;
302
309
  }
303
310
 
311
+ /**
312
+ * The value returned by a fetcher-backed hook. The hook suspends until the
313
+ * first fetch succeeds, so `data` is always present once your component renders.
314
+ *
315
+ * @public
316
+ */
317
+ export declare interface FetcherHookResult<TData> {
318
+ /** The resolved data. Guaranteed present — the hook suspends until the first fetch succeeds. */
319
+ data: TData;
320
+ /** A fetch for this entry is in flight (background revalidation or a `refetch()`). */
321
+ isFetching: boolean;
322
+ /** The most recent background-fetch failure while data still renders; cleared by the next success. */
323
+ error: unknown;
324
+ /** Imperatively refetch, bypassing staleness. Resolves with the refreshed data. */
325
+ refetch: () => Promise<TData>;
326
+ }
327
+
304
328
  /**
305
329
  * @internal
306
330
  */
@@ -327,11 +351,7 @@ export declare interface FrameConnection<TFrameMessage extends FrameMessage> {
327
351
  }
328
352
 
329
353
  declare type IgnoredKey =
330
- | "_id"
331
- | "_type"
332
- | "_rev"
333
- | "_createdAt"
334
- | "_updatedAt";
354
+ "_id" | "_type" | "_rev" | "_createdAt" | "_updatedAt";
335
355
 
336
356
  /**
337
357
  * @alpha
@@ -356,6 +376,31 @@ export declare type MessageHandler<TWindowMessage extends WindowMessage> = (
356
376
  event: TWindowMessage["data"],
357
377
  ) => TWindowMessage["response"] | Promise<TWindowMessage["response"]>;
358
378
 
379
+ /**
380
+ * The value returned by a mutation-backed hook. The write-side counterpart to
381
+ * {@link FetcherHookResult}: local `{mutate, isPending, error, data, reset}`
382
+ * state around a core mutation action.
383
+ *
384
+ * @public
385
+ */
386
+ export declare interface MutationHookResult<TInput, TResult> {
387
+ /**
388
+ * Runs the mutation. Resolves with the server response; rejects on failure
389
+ * (the failure is also captured in {@link MutationHookResult.error}, so a
390
+ * fire-and-forget caller should read `error` and an `await`ing caller should
391
+ * `try`/`catch`).
392
+ */
393
+ mutate: (input: TInput) => Promise<TResult>;
394
+ /** A mutation is currently in flight. */
395
+ isPending: boolean;
396
+ /** The most recent failure; cleared by the next `mutate` or `reset`. */
397
+ error: unknown;
398
+ /** The last successful server response, or `undefined` before the first success. */
399
+ data: TResult | undefined;
400
+ /** Clears state back to idle and abandons any in-flight result. */
401
+ reset: () => void;
402
+ }
403
+
359
404
  /** In-flight CLI PR is using named sources since it's aspirational.
360
405
  * We can transform the shape in this function until it's finalized.
361
406
  */
@@ -1454,6 +1499,44 @@ export declare function useAllReleases(
1454
1499
  options?: WithResourceNameSupport<SanityConfig> | undefined,
1455
1500
  ): ReleaseDocument[];
1456
1501
 
1502
+ /**
1503
+ * Returns a single application by id.
1504
+ *
1505
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
1506
+ * The `include` tokens you pass shape `data`: each requested token adds its
1507
+ * field, and omitted ones are absent from the type.
1508
+ *
1509
+ * @public
1510
+ * @param applicationId - The application id.
1511
+ * @param options - Optional `include` list to expand related resources.
1512
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
1513
+ */
1514
+ export declare const useApplication: <
1515
+ Include extends ApplicationInclude = never,
1516
+ >(
1517
+ applicationId: string,
1518
+ options?: {
1519
+ include?: Include[];
1520
+ },
1521
+ ) => FetcherHookResult<Application<Include>>;
1522
+
1523
+ /**
1524
+ * Returns the applications matching the given options.
1525
+ *
1526
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
1527
+ * The `include` tokens you pass shape `data.data`: each requested token adds its
1528
+ * field, and omitted ones are absent from the type.
1529
+ *
1530
+ * @public
1531
+ * @param options - Filter and include options for the applications list.
1532
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
1533
+ */
1534
+ export declare const useApplications: <
1535
+ Include extends ApplicationInclude = never,
1536
+ >(
1537
+ options: ApplicationsOptions<Include>,
1538
+ ) => FetcherHookResult<ApplicationsResponse<Include>>;
1539
+
1457
1540
  /**
1458
1541
  * @public
1459
1542
  */
@@ -1766,6 +1849,25 @@ export declare const useAuthState: () => AuthState;
1766
1849
  */
1767
1850
  export declare const useAuthToken: () => string | null;
1768
1851
 
1852
+ /**
1853
+ * Checks whether the current user holds the given permissions on a resource.
1854
+ *
1855
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
1856
+ * `data` maps each requested permission to whether the user has it — keyed by
1857
+ * exactly the permission strings you passed.
1858
+ *
1859
+ * @public
1860
+ * @param resourceType - The type of resource (e.g. `'project'`, `'organization'`).
1861
+ * @param resourceId - The resource id.
1862
+ * @param permissions - The permission names to check.
1863
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
1864
+ */
1865
+ export declare const useCheckPermissions: <Permission extends string>(
1866
+ resourceType: AccessResourceType,
1867
+ resourceId: string,
1868
+ permissions: Permission[],
1869
+ ) => FetcherHookResult<Record<Permission, boolean>>;
1870
+
1769
1871
  /**
1770
1872
  * A React hook that provides a client that subscribes to changes in your application,
1771
1873
  *
@@ -1836,6 +1938,17 @@ export declare function useCreateDocument<
1836
1938
  overrides?: CreateDocumentOverrides,
1837
1939
  ) => Promise<DocumentHandle>;
1838
1940
 
1941
+ /**
1942
+ * Creates a user application.
1943
+ *
1944
+ * @internal
1945
+ * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
1946
+ */
1947
+ export declare const useCreateUserApplication: () => MutationHookResult<
1948
+ CreateUserApplicationInput,
1949
+ UserApplication
1950
+ >;
1951
+
1839
1952
  declare type UseCurrentUser = {
1840
1953
  /**
1841
1954
  * @public
@@ -1975,70 +2088,26 @@ declare type UseDatasets = {
1975
2088
  export declare const useDatasets: UseDatasets;
1976
2089
 
1977
2090
  /**
1978
- * @beta
2091
+ * Soft-deletes an application.
1979
2092
  *
1980
- * A hook for dispatching intent messages to the Dashboard with a document handle.
1981
- * This allows applications to signal their intent to pass the referenced document to other applications that have registered the ability to perform specific actions on that document.
1982
- *
1983
- * @param params - Object containing:
1984
- * - `action` - Action to perform (currently only 'edit' is supported). Will prompt a picker if multiple handlers are available.
1985
- * - `intentId` - Specific ID of the intent to dispatch. Either `action` or `intentId` is required.
1986
- * - `documentHandle` - The document handle containing document ID, type, and either:
1987
- * - `projectId` and `dataset` for traditional dataset resources, like `{documentId: '123', documentType: 'book', projectId: 'abc123', dataset: 'production'}`
1988
- * - `resource` for media library, canvas, or dataset resources, like `{documentId: '123', documentType: 'sanity.asset', resource: mediaLibrarySource('ml123')}` or `{documentId: '123', documentType: 'sanity.canvas.document', resource: canvasSource('canvas123')}`
1989
- * - `paremeters` - Optional parameters to include in the dispatch; will be passed to the resolved intent handler
1990
- * @returns An object containing:
1991
- * - `dispatchIntent` - Function to dispatch the intent message
1992
- *
1993
- * @example
1994
- * ```tsx
1995
- * import {useDispatchIntent} from '@sanity/sdk-react'
1996
- * import {Button} from '@sanity/ui'
1997
- * import {Suspense} from 'react'
1998
- *
1999
- * function DispatchIntentButton({documentId, documentType, projectId, dataset}) {
2000
- * const {dispatchIntent} = useDispatchIntent({
2001
- * action: 'edit',
2002
- * documentHandle: {documentId, documentType, projectId, dataset},
2003
- * })
2004
- *
2005
- * return (
2006
- * <Button
2007
- * onClick={() => dispatchIntent()}
2008
- * text="Dispatch Intent"
2009
- * />
2010
- * )
2011
- * }
2012
- *
2013
- * // Wrap the component with Suspense since the hook may suspend
2014
- * function MyDocumentAction({documentId, documentType, projectId, dataset}) {
2015
- * return (
2016
- * <Suspense fallback={<Button text="Loading..." disabled />}>
2017
- * <DispatchIntentButton
2018
- * documentId={documentId}
2019
- * documentType={documentType}
2020
- * projectId={projectId}
2021
- * dataset={dataset}
2022
- * />
2023
- * </Suspense>
2024
- * )
2025
- * }
2026
- * ```
2093
+ * @internal
2094
+ * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
2027
2095
  */
2028
- export declare function useDispatchIntent(
2029
- params: UseDispatchIntentParams,
2030
- ): DispatchIntent;
2096
+ export declare const useDeleteApplication: () => MutationHookResult<
2097
+ DeleteApplicationInput,
2098
+ DeletedResult
2099
+ >;
2031
2100
 
2032
2101
  /**
2033
- * Parameters for the useDispatchIntent hook
2034
- * @beta
2102
+ * Deletes a user application.
2103
+ *
2104
+ * @internal
2105
+ * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
2035
2106
  */
2036
- declare interface UseDispatchIntentParams {
2037
- action?: "edit";
2038
- intentId?: string;
2039
- documentHandle: DocumentHandle;
2040
- parameters?: Record<string, unknown>;
2041
- }
2107
+ export declare const useDeleteUserApplication: () => MutationHookResult<
2108
+ DeleteUserApplicationInput,
2109
+ DeletedResult
2110
+ >;
2042
2111
 
2043
2112
  declare interface UseDocument {
2044
2113
  /** @internal */
@@ -2996,6 +3065,44 @@ export declare const useHandleAuthCallback: () => (
2996
3065
  locationHref?: string | undefined,
2997
3066
  ) => Promise<string | false>;
2998
3067
 
3068
+ /**
3069
+ * Returns a single installation by id.
3070
+ *
3071
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
3072
+ * The `include` tokens you pass shape `data`: each requested token adds its
3073
+ * field, and omitted ones are absent from the type.
3074
+ *
3075
+ * @public
3076
+ * @param installationId - The installation id.
3077
+ * @param options - Optional `include` list to expand related resources.
3078
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
3079
+ */
3080
+ export declare const useInstallation: <
3081
+ Include extends InstallationInclude = never,
3082
+ >(
3083
+ installationId: string,
3084
+ options?: {
3085
+ include?: Include[];
3086
+ },
3087
+ ) => FetcherHookResult<Installation<Include>>;
3088
+
3089
+ /**
3090
+ * Returns the installations matching the given options.
3091
+ *
3092
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
3093
+ * The `include` tokens you pass shape `data.data`: each requested token adds its
3094
+ * field, and omitted ones are absent from the type.
3095
+ *
3096
+ * @public
3097
+ * @param options - Filter and include options for the installations list.
3098
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
3099
+ */
3100
+ export declare const useInstallations: <
3101
+ Include extends InstallationInclude = never,
3102
+ >(
3103
+ options: InstallationsOptions<Include>,
3104
+ ) => FetcherHookResult<InstallationsResponse<Include>>;
3105
+
2999
3106
  /**
3000
3107
  * @internal
3001
3108
  */
@@ -3066,9 +3173,7 @@ export declare function useManageFavorite({
3066
3173
  declare interface UseManageFavoriteProps extends DocumentHandle_2 {
3067
3174
  resourceId?: string;
3068
3175
  resourceType:
3069
- | StudioResource["type"]
3070
- | MediaResource["type"]
3071
- | CanvasResource["type"];
3176
+ StudioResource["type"] | MediaResource["type"] | CanvasResource["type"];
3072
3177
  /**
3073
3178
  * The name of the schema collection this document belongs to.
3074
3179
  * Typically is the name of the workspace when used in the context of a studio.
@@ -3130,20 +3235,21 @@ export declare function useNavigateToStudioDocument(
3130
3235
  *
3131
3236
  * @category Organizations
3132
3237
  * @param options - Configuration options
3133
- * @returns The metadata for the organisation. `members` is included only when
3134
- * `includeMembers: true`; `features` is included only when `includeFeatures: true`.
3238
+ * @returns A {@link FetcherHookResult} whose `data` is the metadata for the
3239
+ * organisation. `members` is included only when `includeMembers: true`;
3240
+ * `features` is included only when `includeFeatures: true`.
3135
3241
  * @example
3136
3242
  * ```tsx
3137
3243
  * function OrganizationName({organizationId}: {organizationId: string}) {
3138
- * const organization = useOrganization({organizationId})
3244
+ * const {data: organization} = useOrganization({organizationId})
3139
3245
  *
3140
3246
  * return <h1>{organization.name}</h1>
3141
3247
  * }
3142
3248
  * ```
3143
3249
  * @example
3144
3250
  * ```tsx
3145
- * const organizationWithMembers = useOrganization({organizationId, includeMembers: true})
3146
- * const organizationWithFeatures = useOrganization({organizationId, includeFeatures: true})
3251
+ * const {data: organizationWithMembers} = useOrganization({organizationId, includeMembers: true})
3252
+ * const {data: organizationWithFeatures} = useOrganization({organizationId, includeFeatures: true})
3147
3253
  * ```
3148
3254
  * @public
3149
3255
  * @function
@@ -3153,18 +3259,19 @@ export declare const useOrganization: <
3153
3259
  IncludeFeatures extends boolean = false,
3154
3260
  >(
3155
3261
  options: OrganizationOptions<IncludeMembers, IncludeFeatures>,
3156
- ) => Organization<IncludeMembers, IncludeFeatures>;
3262
+ ) => FetcherHookResult<Organization<IncludeMembers, IncludeFeatures>>;
3157
3263
 
3158
3264
  /**
3159
3265
  * Returns metadata for each organisation the current user has access to.
3160
3266
  *
3161
3267
  * @category Organizations
3162
3268
  * @param options - Configuration options
3163
- * @returns An array of organisation metadata. `members` is included only when
3164
- * `includeMembers: true`; `features` is included only when `includeFeatures: true`.
3269
+ * @returns A {@link FetcherHookResult} whose `data` is an array of organisation
3270
+ * metadata. `members` is included only when `includeMembers: true`; `features`
3271
+ * is included only when `includeFeatures: true`.
3165
3272
  * @example
3166
3273
  * ```tsx
3167
- * const organizations = useOrganizations()
3274
+ * const {data: organizations} = useOrganizations()
3168
3275
  *
3169
3276
  * return (
3170
3277
  * <select>
@@ -3176,9 +3283,9 @@ export declare const useOrganization: <
3176
3283
  * ```
3177
3284
  * @example
3178
3285
  * ```tsx
3179
- * const organizationsWithMembers = useOrganizations({includeMembers: true})
3180
- * const organizationsWithFeatures = useOrganizations({includeFeatures: true})
3181
- * const organizationsIncludingImplicit = useOrganizations({includeImplicitMemberships: true})
3286
+ * const {data: organizationsWithMembers} = useOrganizations({includeMembers: true})
3287
+ * const {data: organizationsWithFeatures} = useOrganizations({includeFeatures: true})
3288
+ * const {data: organizationsIncludingImplicit} = useOrganizations({includeImplicitMemberships: true})
3182
3289
  * ```
3183
3290
  * @public
3184
3291
  * @function
@@ -3188,7 +3295,7 @@ export declare const useOrganizations: <
3188
3295
  IncludeFeatures extends boolean = false,
3189
3296
  >(
3190
3297
  options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>,
3191
- ) => Organizations<IncludeMembers, IncludeFeatures>;
3298
+ ) => FetcherHookResult<Organizations<IncludeMembers, IncludeFeatures>>;
3192
3299
 
3193
3300
  /**
3194
3301
  * Retrieves pages of {@link DocumentHandle}s, narrowed by optional filters, text searches, and custom ordering,
@@ -3324,12 +3431,13 @@ export declare function usePresence(options?: ResourceHandle): {
3324
3431
  *
3325
3432
  * @category Projects
3326
3433
  * @param options - Configuration options
3327
- * @returns The metadata for the project. `members` is included only when
3328
- * `includeMembers: true`; `features` is included unless `includeFeatures: false`.
3434
+ * @returns A {@link FetcherHookResult} whose `data` is the metadata for the
3435
+ * project. `members` is included only when `includeMembers: true`; `features`
3436
+ * is included unless `includeFeatures: false`.
3329
3437
  * @example
3330
3438
  * ```tsx
3331
3439
  * function ProjectMetadata({projectId}: {projectId: string}) {
3332
- * const project = useProject({projectId})
3440
+ * const {data: project} = useProject({projectId})
3333
3441
  *
3334
3442
  * return (
3335
3443
  * <figure style={{backgroundColor: project.metadata.color || 'lavender'}}>
@@ -3340,10 +3448,10 @@ export declare function usePresence(options?: ResourceHandle): {
3340
3448
  * ```
3341
3449
  * @example
3342
3450
  * ```tsx
3343
- * const projectWithMembersAndFeatures = useProject({projectId})
3344
- * const projectWithMembers = useProject({projectId, includeMembers: true})
3345
- * const projectWithoutMembers = useProject({projectId, includeMembers: false})
3346
- * const projectWithoutFeatures = useProject({projectId, includeFeatures: false})
3451
+ * const {data: projectWithMembersAndFeatures} = useProject({projectId})
3452
+ * const {data: projectWithMembers} = useProject({projectId, includeMembers: true})
3453
+ * const {data: projectWithoutMembers} = useProject({projectId, includeMembers: false})
3454
+ * const {data: projectWithoutFeatures} = useProject({projectId, includeFeatures: false})
3347
3455
  * ```
3348
3456
  * @remarks
3349
3457
  * The `projectId` is resolved in order from:
@@ -3359,18 +3467,19 @@ export declare const useProject: <
3359
3467
  IncludeFeatures extends boolean = true,
3360
3468
  >(
3361
3469
  options?: ProjectOptions<IncludeMembers, IncludeFeatures>,
3362
- ) => Project<IncludeMembers, IncludeFeatures>;
3470
+ ) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>>;
3363
3471
 
3364
3472
  /**
3365
3473
  * Returns metadata for each project you have access to.
3366
3474
  *
3367
3475
  * @category Projects
3368
3476
  * @param options - Configuration options
3369
- * @returns An array of project metadata. `members` is included only when
3370
- * `includeMembers: true`; `features` is included unless `includeFeatures: false`.
3477
+ * @returns A {@link FetcherHookResult} whose `data` is an array of project
3478
+ * metadata. `members` is included only when `includeMembers: true`; `features`
3479
+ * is included unless `includeFeatures: false`.
3371
3480
  * @example
3372
3481
  * ```tsx
3373
- * const projects = useProjects()
3482
+ * const {data: projects} = useProjects()
3374
3483
  *
3375
3484
  * return (
3376
3485
  * <select>
@@ -3382,11 +3491,11 @@ export declare const useProject: <
3382
3491
  * ```
3383
3492
  * @example
3384
3493
  * ```tsx
3385
- * const projects = useProjects()
3386
- * const projectsWithFeatures = useProjects()
3387
- * const projectsWithMembers = useProjects({includeMembers: true})
3388
- * const projectsWithoutMembers = useProjects({includeMembers: false})
3389
- * const projectsWithoutFeatures = useProjects({includeFeatures: false})
3494
+ * const {data: projects} = useProjects()
3495
+ * const {data: projectsWithFeatures} = useProjects()
3496
+ * const {data: projectsWithMembers} = useProjects({includeMembers: true})
3497
+ * const {data: projectsWithoutMembers} = useProjects({includeMembers: false})
3498
+ * const {data: projectsWithoutFeatures} = useProjects({includeFeatures: false})
3390
3499
  * ```
3391
3500
  * @public
3392
3501
  * @function
@@ -3396,7 +3505,7 @@ export declare const useProjects: <
3396
3505
  IncludeFeatures extends boolean = true,
3397
3506
  >(
3398
3507
  options?: ProjectsOptions<IncludeMembers, IncludeFeatures>,
3399
- ) => Project<IncludeMembers, IncludeFeatures>[];
3508
+ ) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>[]>;
3400
3509
 
3401
3510
  /**
3402
3511
  * @public
@@ -3567,9 +3676,7 @@ export declare function useRecordDocumentHistoryEvent({
3567
3676
  */
3568
3677
  declare interface UseRecordDocumentHistoryEventProps extends DocumentHandle_2 {
3569
3678
  resourceType:
3570
- | StudioResource["type"]
3571
- | MediaResource["type"]
3572
- | CanvasResource["type"];
3679
+ StudioResource["type"] | MediaResource["type"] | CanvasResource["type"];
3573
3680
  resourceId?: string;
3574
3681
  /**
3575
3682
  * The name of the schema collection this document belongs to.
@@ -3700,6 +3807,28 @@ export declare const useSanityInstance: (
3700
3807
  */
3701
3808
  export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult;
3702
3809
 
3810
+ /**
3811
+ * Updates an application's mutable properties (title, icon, visibility).
3812
+ *
3813
+ * @internal
3814
+ * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
3815
+ */
3816
+ export declare const useUpdateApplication: () => MutationHookResult<
3817
+ UpdateApplicationInput,
3818
+ ApplicationBase
3819
+ >;
3820
+
3821
+ /**
3822
+ * Updates a user application.
3823
+ *
3824
+ * @internal
3825
+ * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
3826
+ */
3827
+ export declare const useUpdateUserApplication: () => MutationHookResult<
3828
+ UpdateUserApplicationInput,
3829
+ UserApplication
3830
+ >;
3831
+
3703
3832
  /**
3704
3833
  *
3705
3834
  * @public
@@ -3734,6 +3863,32 @@ export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspace
3734
3863
  */
3735
3864
  export declare function useUser(options: GetUserOptions): UserResult;
3736
3865
 
3866
+ /**
3867
+ * Returns a single user application by id.
3868
+ *
3869
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
3870
+ *
3871
+ * @public
3872
+ * @param userApplicationId - The user application id.
3873
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
3874
+ */
3875
+ export declare const useUserApplication: (
3876
+ userApplicationId: string,
3877
+ ) => FetcherHookResult<UserApplication>;
3878
+
3879
+ /**
3880
+ * Returns the current user's applications for the given organisation.
3881
+ *
3882
+ * The hook suspends until the first fetch succeeds, so `data` is always present.
3883
+ *
3884
+ * @public
3885
+ * @param options - Options identifying the organisation.
3886
+ * @returns The result envelope `{data, isFetching, error, refetch}`.
3887
+ */
3888
+ export declare const useUserApplications: (
3889
+ options: UserApplicationsOptions,
3890
+ ) => FetcherHookResult<UserApplication[]>;
3891
+
3737
3892
  /**
3738
3893
  *
3739
3894
  * @public