@sanity/sdk-react 3.5.0-next.20260922182803 → 3.5.0-next.20260922191023

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
1
  import { DatasetsResponse, DatasetsResponse as DatasetsResponse$1, SanityProjectMember } from "@sanity/client";
2
- import { AccessResourceType, ActionsResult, Application, ApplicationInclude, ApplicationsOptions, ApplicationsResponse, AuthState, ClientOptions, Comment, CommentThread, CommentsOptions, CreateCommentOptions, CurrentUser, DatasetHandle, DocumentAction, DocumentEvent, DocumentHandle as DocumentHandle$1, DocumentOptions, DocumentPermissionsResult, DocumentPresence, DocumentResource, DocumentTypeHandle as DocumentTypeHandle$1, FavoriteStatusResponse, GetUserOptions, GetUsersOptions, Installation, InstallationInclude, InstallationsOptions, InstallationsResponse, JsonMatch, Organization, OrganizationOptions, Organizations, OrganizationsOptions, PresenceSelection, PreviewValue, Project, ProjectHandle, ProjectOptions, ProjectsOptions, QueryOptions, ReleaseAction, ReleaseDocument, RemoveCommentOptions, ReplyToCommentOptions, ResolveDocument, ResolveProjectionResult, ResolveQueryResult, SanityConfig, SanityInstance, SanityUser, SetCommentStatusOptions, TokenSource, UpdateCommentOptions, UserPresence } from "@sanity/sdk";
2
+ import { AccessResourceType, ActionsResult, Application, ApplicationInclude, ApplicationsOptions, ApplicationsResponse, AuthState, ClientOptions, Comment, CommentThread, CommentsOptions, CreateCommentOptions, CurrentUser, DatasetHandle, DocumentAction, DocumentEvent, DocumentHandle as DocumentHandle$1, DocumentOptions, DocumentPermissionsResult, DocumentPresence, DocumentResource, DocumentTypeHandle as DocumentTypeHandle$1, FavoriteStatusResponse, GetUserOptions, GetUsersOptions, Installation, InstallationInclude, InstallationsOptions, InstallationsResponse, JsonMatch, OAuthTokens, Organization, OrganizationOptions, Organizations, OrganizationsOptions, PresenceSelection, PreviewValue, Project, ProjectHandle, ProjectOptions, ProjectsOptions, QueryOptions, ReleaseAction, ReleaseDocument, RemoveCommentOptions, ReplyToCommentOptions, ResolveDocument, ResolveProjectionResult, ResolveQueryResult, SanityConfig, SanityInstance, SanityUser, SetCommentStatusOptions, TokenSource, UpdateCommentOptions, UserPresence } from "@sanity/sdk";
3
3
  import "@sanity/sdk/_internal";
4
4
  import React$1, { PropsWithChildren, ReactElement, ReactNode } from "react";
5
5
  import { FallbackProps } from "react-error-boundary";
@@ -1095,6 +1095,51 @@ export declare const useCurrentUser: UseCurrentUser;
1095
1095
  * @public
1096
1096
  */
1097
1097
  export declare const useHandleAuthCallback: () => (locationHref?: string | undefined) => Promise<string | false>;
1098
+ /**
1099
+ * A React hook that returns a function for handling the OAuth redirect callback.
1100
+ *
1101
+ * @remarks
1102
+ * This is the OAuth counterpart to `useHandleAuthCallback`. The returned
1103
+ * function invokes core's `handleOAuthCallback`, which validates the `state`
1104
+ * parameter, surfaces `?error=` redirects, exchanges the authorization `code`
1105
+ * for tokens, persists them, and transitions the auth state to `LOGGED_IN` —
1106
+ * all in core. On success it resolves the same-origin location the user was on
1107
+ * when the flow started (so deep links survive login), otherwise the callback
1108
+ * URL cleaned of the OAuth params (`code`, `state`, `error`,
1109
+ * `error_description`). It resolves `false` when there was nothing to handle.
1110
+ * The resolved URL may be a different route, so navigate to it rather than
1111
+ * only calling `history.replaceState`.
1112
+ *
1113
+ * `AuthBoundary` runs this for you when the app lands on the OAuth redirect
1114
+ * URI. Reach for this hook only when building a custom callback component.
1115
+ *
1116
+ * Concurrent calls are single-flight in core, so React StrictMode's double
1117
+ * invocation will not trigger a second code exchange, and a repeated call with
1118
+ * a stale callback URL is ignored once a session is established.
1119
+ *
1120
+ * @example
1121
+ * ```tsx
1122
+ * function OAuthCallback() {
1123
+ * const handleCallback = useHandleOAuthCallback()
1124
+ * const navigate = useNavigate() // your router's navigation
1125
+ *
1126
+ * useEffect(() => {
1127
+ * handleCallback(window.location.href)
1128
+ * .then((nextUrl) => {
1129
+ * // Returns the user to where they started, with OAuth params removed
1130
+ * if (nextUrl) navigate(nextUrl, {replace: true})
1131
+ * })
1132
+ * .catch(console.error)
1133
+ * }, [handleCallback, navigate])
1134
+ *
1135
+ * return <div>Completing sign-in…</div>
1136
+ * }
1137
+ * ```
1138
+ *
1139
+ * @returns A callback handler that processes the OAuth redirect
1140
+ * @public
1141
+ */
1142
+ export declare const useHandleOAuthCallback: () => (locationHref?: string | undefined) => Promise<string | false>;
1098
1143
  /**
1099
1144
  * @internal
1100
1145
  */
@@ -1105,6 +1150,103 @@ export declare function useLoginUrl(): string;
1105
1150
  * @returns A function to log out of the current session
1106
1151
  */
1107
1152
  export declare const useLogOut: () => () => Promise<void>;
1153
+ /**
1154
+ * A React hook that returns a function for starting the OAuth authorization-code + PKCE flow.
1155
+ *
1156
+ * @remarks
1157
+ * The returned function invokes core's `startOAuthAuthorization`, which generates
1158
+ * the PKCE `code_verifier`, `code_challenge` and `state`, persists the verifier and
1159
+ * state to `sessionStorage`, and navigates the browser to the authorize endpoint.
1160
+ * `clientId`, `redirectUri` and `organizationId` are read from the instance's
1161
+ * `auth.oauth` config. The returned promise rejects if the instance has no `auth.oauth` config.
1162
+ *
1163
+ * Pair with {@link useHandleOAuthCallback} on the redirect URI to complete the flow.
1164
+ *
1165
+ * @example
1166
+ * ```tsx
1167
+ * function LoginButton() {
1168
+ * const authorize = useOAuthAuthorize()
1169
+ * return <button onClick={() => authorize().catch(console.error)}>Sign in</button>
1170
+ * }
1171
+ * ```
1172
+ *
1173
+ * @returns A function that starts the OAuth flow by navigating to the authorization URL
1174
+ * @public
1175
+ */
1176
+ export declare const useOAuthAuthorize: () => () => Promise<void>;
1177
+ /**
1178
+ * The current OAuth token state, plus actions to refresh and revoke it.
1179
+ *
1180
+ * @public
1181
+ */
1182
+ interface UseOAuthTokensResult {
1183
+ /**
1184
+ * The stored OAuth tokens, or `null` when not logged in via OAuth. The
1185
+ * refresh token is omitted — core retains it internally for `refresh`.
1186
+ */
1187
+ tokens: Omit<OAuthTokens, 'refreshToken'> | null;
1188
+ /**
1189
+ * Returns whether the access token has expired, comparing the latest stored
1190
+ * `expiresAt` against the current time at the moment it is called. Both the
1191
+ * tokens and the clock are read at call time, so a reference captured in an
1192
+ * earlier render stays accurate after a `refresh`. Reading the clock does not
1193
+ * trigger a re-render, so call this in an event handler or effect rather than
1194
+ * during render. Returns `false` when there are no tokens.
1195
+ */
1196
+ isExpired: () => boolean;
1197
+ /**
1198
+ * Refresh via the OAuth `refresh_token` grant. When there is no refresh token,
1199
+ * core clears the stored tokens, logs the user out, and this resolves `null`.
1200
+ * Rejects on transient failures (network, 5xx, 408, 429), leaving tokens
1201
+ * unchanged so the call can be retried. Also rejects when the server rejects
1202
+ * the refresh token itself (other 4xx); core clears the tokens and logs out
1203
+ * first, so check `tokens` before retrying.
1204
+ */
1205
+ refresh: () => Promise<Omit<OAuthTokens, 'refreshToken'> | null>;
1206
+ /** Revoke the tokens at the OAuth server, clear them locally, and log out. */
1207
+ revoke: () => Promise<void>;
1208
+ }
1209
+ /**
1210
+ * A React hook that exposes the stored OAuth token state along with `refresh`
1211
+ * and `revoke` actions.
1212
+ *
1213
+ * @remarks
1214
+ * The token view is a synchronous read over core's token state source, so the
1215
+ * hook re-renders whenever tokens change — including changes made in another
1216
+ * tab, which core propagates via `storage` events.
1217
+ *
1218
+ * @returns The current {@link UseOAuthTokensResult}
1219
+ *
1220
+ * @example
1221
+ * ```tsx
1222
+ * function TokenStatus() {
1223
+ * const {tokens, isExpired, refresh, revoke} = useOAuthTokens()
1224
+ *
1225
+ * if (!tokens) return <div>Not signed in</div>
1226
+ *
1227
+ * const handleRefresh = async () => {
1228
+ * if (!isExpired()) return
1229
+ * try {
1230
+ * await refresh()
1231
+ * } catch {
1232
+ * // Transient failure (tokens unchanged, retry later) or the refresh
1233
+ * // token was rejected (tokens now null, user is logged out).
1234
+ * }
1235
+ * }
1236
+ *
1237
+ * return (
1238
+ * <div>
1239
+ * <p>Expires at {tokens.expiresAt.toLocaleTimeString()}</p>
1240
+ * <button onClick={handleRefresh}>Refresh if expired</button>
1241
+ * <button onClick={() => revoke()}>Revoke tokens</button>
1242
+ * </div>
1243
+ * )
1244
+ * }
1245
+ * ```
1246
+ *
1247
+ * @public
1248
+ */
1249
+ export declare function useOAuthTokens(): UseOAuthTokensResult;
1108
1250
  /**
1109
1251
  * Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
1110
1252
  *
@@ -3522,5 +3664,5 @@ export declare function useUsers(options?: GetUsersOptions): UsersResult;
3522
3664
  * @internal
3523
3665
  */
3524
3666
  export declare const REACT_SDK_VERSION: {};
3525
- export type { AuthBoundaryProps, Status as ComlinkStatus, CommentActions, CreateDocumentOverrides, DatasetsResponse, DocumentHandle, DocumentTypeHandle, DocumentsOptions, DocumentsResponse, FetcherHookResult, FrameConnection, FrameMessageHandler as MessageHandler, MutationHookResult, PaginatedDocumentsOptions, PaginatedDocumentsResponse, ResourceHandle, ResourceProviderProps, SDKProviderProps, SanityAppProps, SanityDocument, SanityInstanceProviderProps, SanityProjectMember, SortOrderingItem, StudioWorkspaceHandle, UseCommentThreadsResult, UseCommentsResult, UseFrameConnectionOptions, UsePresenceForDocumentOptions, UseReportPresenceOptions, UseWindowConnectionOptions, UserResult, UsersResult, WindowConnection, WindowMessageHandler, useDocumentPreviewOptions, useDocumentPreviewResults, useDocumentProjectionOptions, useDocumentProjectionResults };
3667
+ export type { AuthBoundaryProps, Status as ComlinkStatus, CommentActions, CreateDocumentOverrides, DatasetsResponse, DocumentHandle, DocumentTypeHandle, DocumentsOptions, DocumentsResponse, FetcherHookResult, FrameConnection, FrameMessageHandler as MessageHandler, MutationHookResult, PaginatedDocumentsOptions, PaginatedDocumentsResponse, ResourceHandle, ResourceProviderProps, SDKProviderProps, SanityAppProps, SanityDocument, SanityInstanceProviderProps, SanityProjectMember, SortOrderingItem, StudioWorkspaceHandle, UseCommentThreadsResult, UseCommentsResult, UseFrameConnectionOptions, UseOAuthTokensResult, UsePresenceForDocumentOptions, UseReportPresenceOptions, UseWindowConnectionOptions, UserResult, UsersResult, WindowConnection, WindowMessageHandler, useDocumentPreviewOptions, useDocumentPreviewResults, useDocumentProjectionOptions, useDocumentProjectionResults };
3526
3668
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/auth/LoginError.tsx","../src/components/auth/AuthBoundary.tsx","../src/components/SanityApp.tsx","../src/components/SDKProvider.tsx","../src/config/handles.ts","../src/context/ComlinkTokenRefresh.tsx","../src/context/renderSanityApp.tsx","../src/context/ResourceProvider.tsx","../src/context/SanityInstanceProvider.tsx","../src/context/SDKStudioContext.ts","../src/hooks/helpers/createFetcherHook.ts","../src/hooks/access/useCheckPermissions.ts","../src/hooks/agent/agentActions.ts","../src/hooks/applications/useApplication.ts","../src/hooks/applications/useApplications.ts","../src/hooks/helpers/createMutationHook.tsx","../src/hooks/applications/useDeleteApplication.ts","../src/hooks/applications/useUpdateApplication.ts","../src/hooks/auth/useAuthState.tsx","../src/hooks/auth/useAuthToken.tsx","../src/hooks/auth/useCurrentUser.tsx","../src/hooks/auth/useHandleAuthCallback.tsx","../src/hooks/auth/useLoginUrl.tsx","../src/hooks/auth/useLogOut.tsx","../src/hooks/auth/useVerifyOrgProjects.tsx","../src/hooks/client/useClient.ts","../../../node_modules/.pnpm/xstate@5.32.6/node_modules/xstate/dist/declarations/src/index.d.ts","../../../node_modules/.pnpm/@sanity+comlink@4.0.3/node_modules/@sanity/comlink/dist/index.d.ts","../src/hooks/comlink/useFrameConnection.ts","../src/hooks/comlink/useWindowConnection.ts","../src/hooks/helpers/useNormalizedResourceOptions.ts","../src/hooks/comments/useCommentActions.ts","../src/hooks/comments/useComments.ts","../src/hooks/comments/useCommentThreads.ts","../src/hooks/context/useResource.ts","../src/hooks/context/useSanityInstance.ts","../src/hooks/dashboard/useFavoriteContext.ts","../src/hooks/dashboard/useFavorite.ts","../src/hooks/dashboard/useRecordDocumentHistoryEvent.ts","../src/hooks/dashboard/useStudioWorkspacesByProjectIdDataset.ts","../src/hooks/dashboard/useUpdateFavorite.ts","../src/hooks/datasets/useDatasets.ts","../src/hooks/document/useApplyDocumentActions.ts","../src/hooks/document/useCreateDocument.ts","../src/hooks/document/useDocument.ts","../src/hooks/document/useDocumentEvent.ts","../src/hooks/document/useDocumentPermissions.ts","../src/hooks/document/useDocumentSyncStatus.ts","../src/hooks/document/useEditDocument.ts","../src/hooks/documents/useDocuments.ts","../src/hooks/installations/useInstallation.ts","../src/hooks/installations/useInstallations.ts","../src/hooks/organizations/useOrganization.ts","../src/hooks/organizations/useOrganizations.ts","../src/hooks/paginatedDocuments/usePaginatedDocuments.ts","../src/hooks/presence/usePresence.ts","../src/hooks/presence/usePresenceForDocument.ts","../src/hooks/presence/useReportPresence.ts","../src/hooks/preview/useDocumentPreview.tsx","../src/hooks/projection/useDocumentProjection.ts","../src/hooks/projects/useProject.ts","../src/hooks/projects/useProjects.ts","../src/hooks/query/useQuery.ts","../src/hooks/releases/useActiveReleases.ts","../src/hooks/releases/useAllReleases.ts","../src/hooks/releases/useApplyReleaseActions.ts","../src/hooks/releases/usePerspective.ts","../src/hooks/users/useUser.ts","../src/hooks/users/useUsers.ts","../src/version.ts"],"x_google_ignoreList":[26,27],"mappings":";;;;;;;;;;;;;KAoBY,kBAAkB;;;;UCkBb;;;;;EAKf,iBAAiB,MAAM;IACrB,SAAS,MAAM;IACf,SAAS,MAAM;;;;;;EAOjB,oBAAoB,MAAM;IACxB,SAAS,MAAM;IACf,SAAS,MAAM;;;;;;;EAQjB,sBAAsB,MAAM,cAAc;;EAG1C,SAAS,MAAM;;;;EAKf;;EAGA,SAAS,MAAM;;EAGf,WAAW,MAAM;;;;;;;;EASjB;;;;;;;;;;;;;;;;;;;;;;;wBAwBc,eACd,wBACG,SACF,oBAAoB,MAAM;;;;;UCpGZ;;;;;;;EAOf,SAAS,eAAe;EACxB,YAAY,eAAe;EAC3B,UAAU,MAAM;EAEhB,UAAU,MAAM;;;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src/components/SanityApp.tsx","../src/components/SDKProvider.tsx","../src/config/handles.ts","../src/context/ComlinkTokenRefresh.tsx","../src/context/renderSanityApp.tsx","../src/context/ResourceProvider.tsx","../src/context/SanityInstanceProvider.tsx","../src/context/SDKStudioContext.ts","../src/hooks/helpers/createFetcherHook.ts","../src/hooks/access/useCheckPermissions.ts","../src/hooks/agent/agentActions.ts","../src/hooks/applications/useApplication.ts","../src/hooks/applications/useApplications.ts","../src/hooks/helpers/createMutationHook.tsx","../src/hooks/applications/useDeleteApplication.ts","../src/hooks/applications/useUpdateApplication.ts","../src/hooks/auth/useAuthState.tsx","../src/hooks/auth/useAuthToken.tsx","../src/hooks/auth/useCurrentUser.tsx","../src/hooks/auth/useHandleAuthCallback.tsx","../src/hooks/auth/useHandleOAuthCallback.tsx","../src/hooks/auth/useLoginUrl.tsx","../src/hooks/auth/useLogOut.tsx","../src/hooks/auth/useOAuthAuthorize.tsx","../src/hooks/auth/useOAuthTokens.tsx","../src/hooks/auth/useVerifyOrgProjects.tsx","../src/hooks/client/useClient.ts","../../../node_modules/.pnpm/xstate@5.32.6/node_modules/xstate/dist/declarations/src/index.d.ts","../../../node_modules/.pnpm/@sanity+comlink@4.0.3/node_modules/@sanity/comlink/dist/index.d.ts","../src/hooks/comlink/useFrameConnection.ts","../src/hooks/comlink/useWindowConnection.ts","../src/hooks/helpers/useNormalizedResourceOptions.ts","../src/hooks/comments/useCommentActions.ts","../src/hooks/comments/useComments.ts","../src/hooks/comments/useCommentThreads.ts","../src/hooks/context/useResource.ts","../src/hooks/context/useSanityInstance.ts","../src/hooks/dashboard/useFavoriteContext.ts","../src/hooks/dashboard/useFavorite.ts","../src/hooks/dashboard/useRecordDocumentHistoryEvent.ts","../src/hooks/dashboard/useStudioWorkspacesByProjectIdDataset.ts","../src/hooks/dashboard/useUpdateFavorite.ts","../src/hooks/datasets/useDatasets.ts","../src/hooks/document/useApplyDocumentActions.ts","../src/hooks/document/useCreateDocument.ts","../src/hooks/document/useDocument.ts","../src/hooks/document/useDocumentEvent.ts","../src/hooks/document/useDocumentPermissions.ts","../src/hooks/document/useDocumentSyncStatus.ts","../src/hooks/document/useEditDocument.ts","../src/hooks/documents/useDocuments.ts","../src/hooks/installations/useInstallation.ts","../src/hooks/installations/useInstallations.ts","../src/hooks/organizations/useOrganization.ts","../src/hooks/organizations/useOrganizations.ts","../src/hooks/paginatedDocuments/usePaginatedDocuments.ts","../src/hooks/presence/usePresence.ts","../src/hooks/presence/usePresenceForDocument.ts","../src/hooks/presence/useReportPresence.ts","../src/hooks/preview/useDocumentPreview.tsx","../src/hooks/projection/useDocumentProjection.ts","../src/hooks/projects/useProject.ts","../src/hooks/projects/useProjects.ts","../src/hooks/query/useQuery.ts","../src/hooks/releases/useActiveReleases.ts","../src/hooks/releases/useAllReleases.ts","../src/hooks/releases/useApplyReleaseActions.ts","../src/hooks/releases/usePerspective.ts","../src/hooks/users/useUser.ts","../src/hooks/users/useUsers.ts","../src/version.ts"],"x_google_ignoreList":[29,30],"mappings":";;;;;;;;;;;;;KAoBY,kBAAkB;;;;UCmBb;;;;;EAKf,iBAAiB,MAAM;IACrB,SAAS,MAAM;IACf,SAAS,MAAM;;;;;;EAOjB,oBAAoB,MAAM;IACxB,SAAS,MAAM;IACf,SAAS,MAAM;;;;;;;EAQjB,sBAAsB,MAAM,cAAc;;EAG1C,SAAS,MAAM;;;;EAKf;;EAGA,SAAS,MAAM;;EAGf,WAAW,MAAM;;;;;;;;EASjB;;;;;;;;;;;;;;;;;;;;;;;wBAwBc,eACd,wBACG,SACF,oBAAoB,MAAM;;;;;UCrGZ;;;;;;;EAOf,SAAS,eAAe;EACxB,YAAY,eAAe;EAC3B,UAAU,MAAM;EAEhB,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqFc,YACd,UACA,UACA,QAAQ,eACL,SACF,iB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BA0Dc,SAAS,UAAU,kBAAkB;;;;;qBCtFxC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as DashboardTokenRefreshProvider, c as createStateSourceHook, i as useOrganizationId, l as useSanityInstance, n as useTopic, o as useWindowConnection, r as useEmit, s as useAuthState, t as useStudioWorkspacesByProjectIdDataset, u as SanityInstanceContext } from "./useStudioWorkspacesByProjectIdDataset-DL6_9jgU.js";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import { ClientError, CorsOriginError } from "@sanity/client";
4
- import { AuthStateType, application, applications, applyDocumentActions, checkPermissions, createComment, createDocument, createSanityInstance, datasets, deleteApplication, editDocument, favorites, getActiveReleasesState, getAllReleasesState, getClientState, getCommentThreadsState, getCommentsState, getCorsErrorProjectId, getCurrentUserState, getDocumentPresence, getDocumentState, getDocumentSyncStatus, getIsInDashboardState, getLoginUrlState, getPermissionsState, getPerspectiveState, getPresence, getProjectionState, getQueryState, getTokenState, getUsersState, handleAuthCallback, installation, installations, isDatasetResource, isImportError, isMediaLibraryResource, loadMoreUsers, logout, observeOrganizationVerificationState, organization, organizations, project, projects, removeComment, replyToComment, reportPresence, resolveCommentThreads, resolveComments, resolveDocument, resolveProjection, resolveQuery, resolveUsers, setAuthToken, setCommentStatus, setFavorite, subscribeDocumentEvents, updateApplication, updateComment } from "@sanity/sdk";
4
+ import { AuthStateType, application, applications, applyDocumentActions, checkPermissions, createComment, createDocument, createSanityInstance, datasets, deleteApplication, editDocument, favorites, getActiveReleasesState, getAllReleasesState, getClientState, getCommentThreadsState, getCommentsState, getCorsErrorProjectId, getCurrentUserState, getDocumentPresence, getDocumentState, getDocumentSyncStatus, getIsInDashboardState, getLoginUrlState, getOAuthTokensState, getPermissionsState, getPerspectiveState, getPresence, getProjectionState, getQueryState, getTokenState, getUsersState, handleAuthCallback, handleOAuthCallback, installation, installations, isDatasetResource, isImportError, isMediaLibraryResource, loadMoreUsers, logout, observeOrganizationVerificationState, organization, organizations, project, projects, refreshOAuthTokens, removeComment, replyToComment, reportPresence, resolveCommentThreads, resolveComments, resolveDocument, resolveProjection, resolveQuery, resolveUsers, revokeOAuthTokens, setAuthToken, setCommentStatus, setFavorite, startOAuthAuthorization, subscribeDocumentEvents, updateApplication, updateComment } from "@sanity/sdk";
5
5
  import { PREVIEW_PROJECTION, createGroqSearchFilter, getClientErrorApiBody, getClientErrorApiDescription, getCommentsOptionsKey, getQueryKey, getUsersKey, initTelemetry, isDashboardEnvironment, isDeepEqual, isProjectUserNotFoundClientError, isStudioConfig, parseCommentsOptionsKey, parseQueryKey, parseUsersKey, pickProperties, randomUuid, trackHookMounted, transformProjectionToPreview } from "@sanity/sdk/_internal";
6
6
  import { StrictMode, Suspense, createContext, use, useCallback, useContext, useEffect, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
7
7
  import { ErrorBoundary, getErrorMessage } from "react-error-boundary";
@@ -37,7 +37,7 @@ function DashboardTokenRefresh(t0) {
37
37
  if (clearRefreshTimeout(), res.token) {
38
38
  setAuthToken(instance, res.token);
39
39
  let errorContainer = document.getElementById("__sanityError");
40
- errorContainer && Array.from(errorContainer.getElementsByTagName("div")).some(_temp$8) && errorContainer.remove();
40
+ errorContainer && Array.from(errorContainer.getElementsByTagName("div")).some(_temp$7) && errorContainer.remove();
41
41
  }
42
42
  isTokenRefreshInProgress.current = !1;
43
43
  } catch {
@@ -62,7 +62,7 @@ function DashboardTokenRefresh(t0) {
62
62
  * It is used to automatically request a new token on 401 error if enabled.
63
63
  * @public
64
64
  */
65
- function _temp$8(div) {
65
+ function _temp$7(div) {
66
66
  return div.textContent?.includes("Uncaught error: Unauthorized - A valid session is required for this endpoint");
67
67
  }
68
68
  const ComlinkTokenRefreshProvider = (t0) => {
@@ -82,6 +82,37 @@ function useLoginUrl() {
82
82
  let { subscribe, getCurrent } = t0;
83
83
  return useSyncExternalStore(subscribe, getCurrent);
84
84
  }
85
+ function createCallbackHook(callback) {
86
+ function useHook() {
87
+ let $ = c(2), instance = useSanityInstance(), t0;
88
+ return $[0] === instance ? t0 = $[1] : (t0 = (...t1) => callback(instance, ...t1), $[0] = instance, $[1] = t0), t0;
89
+ }
90
+ return useHook;
91
+ }
92
+ /**
93
+ * A React hook that returns a function for starting the OAuth authorization-code + PKCE flow.
94
+ *
95
+ * @remarks
96
+ * The returned function invokes core's `startOAuthAuthorization`, which generates
97
+ * the PKCE `code_verifier`, `code_challenge` and `state`, persists the verifier and
98
+ * state to `sessionStorage`, and navigates the browser to the authorize endpoint.
99
+ * `clientId`, `redirectUri` and `organizationId` are read from the instance's
100
+ * `auth.oauth` config. The returned promise rejects if the instance has no `auth.oauth` config.
101
+ *
102
+ * Pair with {@link useHandleOAuthCallback} on the redirect URI to complete the flow.
103
+ *
104
+ * @example
105
+ * ```tsx
106
+ * function LoginButton() {
107
+ * const authorize = useOAuthAuthorize()
108
+ * return <button onClick={() => authorize().catch(console.error)}>Sign in</button>
109
+ * }
110
+ * ```
111
+ *
112
+ * @returns A function that starts the OAuth flow by navigating to the authorization URL
113
+ * @public
114
+ */
115
+ const useOAuthAuthorize = createCallbackHook(startOAuthAuthorization);
85
116
  /**
86
117
  * Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
87
118
  *
@@ -264,11 +295,11 @@ function ChunkLoadError(_props) {
264
295
  description: "The page tried to load an asset that no longer exists. Reload to continue with the latest version.",
265
296
  cta: {
266
297
  text: "Reload page",
267
- onClick: _temp$7
298
+ onClick: _temp$6
268
299
  }
269
300
  }), $[3] = t3) : t3 = $[3], t3;
270
301
  }
271
- function _temp$7() {
302
+ function _temp$6() {
272
303
  clearChunkReloadFlag(), reload();
273
304
  }
274
305
  function CorsErrorComponent(t0) {
@@ -325,13 +356,6 @@ var AuthError = class extends Error {
325
356
  typeof error == "object" && error && "message" in error && typeof error.message == "string" ? super(error.message) : super(), this.cause = error;
326
357
  }
327
358
  };
328
- function createCallbackHook(callback) {
329
- function useHook() {
330
- let $ = c(2), instance = useSanityInstance(), t0;
331
- return $[0] === instance ? t0 = $[1] : (t0 = (...t1) => callback(instance, ...t1), $[0] = instance, $[1] = t0), t0;
332
- }
333
- return useHook;
334
- }
335
359
  /**
336
360
  * @internal
337
361
  * A React hook that returns a function for handling authentication callbacks.
@@ -373,10 +397,25 @@ function createCallbackHook(callback) {
373
397
  * @public
374
398
  */
375
399
  const useHandleAuthCallback = createCallbackHook(handleAuthCallback);
400
+ /** Every `key=value` in `subset` is present with the same value in `superset`. */
401
+ function isSubset(subset, superset) {
402
+ return [...subset].every(([key, value]) => superset.get(key) === value);
403
+ }
404
+ /**
405
+ * Whether `next` is `current` with callback params removed and nothing added.
406
+ * Core returns such a URL when there is nowhere else to go; anything additive
407
+ * (a path, query or hash the current URL lacks) is a destination to navigate to.
408
+ */
409
+ function onlyStripsParams(next, current) {
410
+ return next.pathname === current.pathname && isSubset(next.searchParams, current.searchParams) && isSubset(new URLSearchParams(next.hash.slice(1)), new URLSearchParams(current.hash.slice(1)));
411
+ }
376
412
  /**
377
413
  * Component shown during auth callback processing that handles login completion.
378
414
  * Automatically processes the auth callback when mounted and updates the URL
379
- * to remove callback parameters without triggering a page reload.
415
+ * to remove callback parameters without triggering a page reload. When the
416
+ * callback resolves to a different location (the OAuth flow returns the user
417
+ * to where they started), a real navigation is performed instead so the app's
418
+ * router picks it up.
380
419
  *
381
420
  * @alpha
382
421
  */
@@ -384,12 +423,13 @@ function LoginCallback() {
384
423
  let $ = c(3), handleAuthCallback = useHandleAuthCallback(), t0, t1;
385
424
  return $[0] === handleAuthCallback ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
386
425
  let url = new URL(location.href);
387
- handleAuthCallback(url.toString()).then(_temp$6);
426
+ handleAuthCallback(url.toString()).then((replacementLocation) => {
427
+ if (!replacementLocation) return;
428
+ let next = new URL(replacementLocation, url);
429
+ next.origin === url.origin && (onlyStripsParams(next, url) ? history.replaceState(null, "", replacementLocation) : location.replace(replacementLocation));
430
+ });
388
431
  }, t1 = [handleAuthCallback], $[0] = handleAuthCallback, $[1] = t0, $[2] = t1), useEffect(t0, t1), null;
389
432
  }
390
- function _temp$6(replacementLocation) {
391
- replacementLocation && history.replaceState(null, "", replacementLocation);
392
- }
393
433
  /**
394
434
  * Hook to log out of the current session
395
435
  * @internal
@@ -535,23 +575,26 @@ function AuthBoundary(t0) {
535
575
  }) }) }), $[9] = FallbackComponent, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
536
576
  }
537
577
  function AuthSwitch(t0) {
538
- let $ = c(16), children, projectIds, props, t1, t2;
578
+ let $ = c(18), children, projectIds, props, t1, t2;
539
579
  $[0] === t0 ? (children = $[1], projectIds = $[2], props = $[3], t1 = $[4], t2 = $[5]) : ({CallbackComponent: t1, children, verifyOrganization: t2, projectIds, ...props} = t0, $[0] = t0, $[1] = children, $[2] = projectIds, $[3] = props, $[4] = t1, $[5] = t2);
540
580
  let CallbackComponent = t1 === void 0 ? LoginCallback : t1, verifyOrganization = t2 === void 0 || t2, authState = useAuthState(), instance = useSanityInstance(), t3;
541
581
  $[6] === instance.config ? t3 = $[7] : (t3 = isStudioConfig(instance.config), $[6] = instance.config, $[7] = t3);
542
- let isStudio = t3, orgError = useVerifyOrgProjects(!verifyOrganization || isStudio || authState.type !== AuthStateType.LOGGED_IN, projectIds), isLoggedOut = authState.type === AuthStateType.LOGGED_OUT && !authState.isDestroyingSession, loginUrl = useLoginUrl(), t4, t5;
543
- if ($[8] !== isLoggedOut || $[9] !== isStudio || $[10] !== loginUrl ? (t4 = () => {
544
- isLoggedOut && !isInIframe() && !isStudio && !isDashboardEnvironment() && (window.location.href = loginUrl);
582
+ let isStudio = t3, orgError = useVerifyOrgProjects(!verifyOrganization || isStudio || authState.type !== AuthStateType.LOGGED_IN, projectIds), isLoggedOut = authState.type === AuthStateType.LOGGED_OUT && !authState.isDestroyingSession, isOAuth = !!instance.config.auth?.oauth, loginUrl = useLoginUrl(), authorize = useOAuthAuthorize(), [authorizeError, setAuthorizeError] = useState(null), t4, t5;
583
+ if ($[8] !== authorize || $[9] !== isLoggedOut || $[10] !== isOAuth || $[11] !== isStudio || $[12] !== loginUrl ? (t4 = () => {
584
+ isLoggedOut && !isInIframe() && !isStudio && !isDashboardEnvironment() && (isOAuth ? authorize().catch((error) => setAuthorizeError({ error })) : window.location.href = loginUrl);
545
585
  }, t5 = [
546
586
  isLoggedOut,
587
+ isOAuth,
588
+ authorize,
547
589
  loginUrl,
548
590
  isStudio
549
- ], $[8] = isLoggedOut, $[9] = isStudio, $[10] = loginUrl, $[11] = t4, $[12] = t5) : (t4 = $[11], t5 = $[12]), useEffect(t4, t5), verifyOrganization && orgError) throw new ConfigurationError({ message: orgError });
591
+ ], $[8] = authorize, $[9] = isLoggedOut, $[10] = isOAuth, $[11] = isStudio, $[12] = loginUrl, $[13] = t4, $[14] = t5) : (t4 = $[13], t5 = $[14]), useEffect(t4, t5), verifyOrganization && orgError) throw new ConfigurationError({ message: orgError });
592
+ if (authorizeError) throw new AuthError(authorizeError.error);
550
593
  switch (authState.type) {
551
594
  case AuthStateType.ERROR: throw new AuthError(authState.error);
552
595
  case AuthStateType.LOGGING_IN: {
553
596
  let t6;
554
- return $[13] !== CallbackComponent || $[14] !== props ? (t6 = /* @__PURE__ */ jsx(CallbackComponent, { ...props }), $[13] = CallbackComponent, $[14] = props, $[15] = t6) : t6 = $[15], t6;
597
+ return $[15] !== CallbackComponent || $[16] !== props ? (t6 = /* @__PURE__ */ jsx(CallbackComponent, { ...props }), $[15] = CallbackComponent, $[16] = props, $[17] = t6) : t6 = $[17], t6;
555
598
  }
556
599
  case AuthStateType.LOGGED_IN: return children;
557
600
  case AuthStateType.LOGGED_OUT: return null;
@@ -1753,7 +1796,87 @@ function createMutationHook(mutation) {
1753
1796
  * @internal
1754
1797
  * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
1755
1798
  */
1756
- const useDeleteApplication = createMutationHook(deleteApplication), useUpdateApplication = createMutationHook(updateApplication), useAuthToken = createStateSourceHook(getTokenState), useCurrentUser = createStateSourceHook(getCurrentUserState), useClient = createStateSourceHook({
1799
+ const useDeleteApplication = createMutationHook(deleteApplication), useUpdateApplication = createMutationHook(updateApplication), useAuthToken = createStateSourceHook(getTokenState), useCurrentUser = createStateSourceHook(getCurrentUserState), useHandleOAuthCallback = createCallbackHook(handleOAuthCallback), useOAuthTokensState = createStateSourceHook(getOAuthTokensState), useRefreshOAuthTokens = createCallbackHook(refreshOAuthTokens), useRevokeOAuthTokens = createCallbackHook(revokeOAuthTokens), useIsOAuthTokenExpired = createCallbackHook((instance) => {
1800
+ let tokens = getOAuthTokensState(instance).getCurrent();
1801
+ return tokens ? tokens.expiresAt.getTime() <= Date.now() : !1;
1802
+ });
1803
+ /**
1804
+ * A React hook that exposes the stored OAuth token state along with `refresh`
1805
+ * and `revoke` actions.
1806
+ *
1807
+ * @remarks
1808
+ * The token view is a synchronous read over core's token state source, so the
1809
+ * hook re-renders whenever tokens change — including changes made in another
1810
+ * tab, which core propagates via `storage` events.
1811
+ *
1812
+ * @returns The current {@link UseOAuthTokensResult}
1813
+ *
1814
+ * @example
1815
+ * ```tsx
1816
+ * function TokenStatus() {
1817
+ * const {tokens, isExpired, refresh, revoke} = useOAuthTokens()
1818
+ *
1819
+ * if (!tokens) return <div>Not signed in</div>
1820
+ *
1821
+ * const handleRefresh = async () => {
1822
+ * if (!isExpired()) return
1823
+ * try {
1824
+ * await refresh()
1825
+ * } catch {
1826
+ * // Transient failure (tokens unchanged, retry later) or the refresh
1827
+ * // token was rejected (tokens now null, user is logged out).
1828
+ * }
1829
+ * }
1830
+ *
1831
+ * return (
1832
+ * <div>
1833
+ * <p>Expires at {tokens.expiresAt.toLocaleTimeString()}</p>
1834
+ * <button onClick={handleRefresh}>Refresh if expired</button>
1835
+ * <button onClick={() => revoke()}>Revoke tokens</button>
1836
+ * </div>
1837
+ * )
1838
+ * }
1839
+ * ```
1840
+ *
1841
+ * @public
1842
+ */
1843
+ function useOAuthTokens() {
1844
+ let $ = c(5), t0 = useOAuthTokensState(), t1 = useIsOAuthTokenExpired(), t2 = useRefreshOAuthTokens(), t3 = useRevokeOAuthTokens(), t4;
1845
+ return $[0] !== t0 || $[1] !== t1 || $[2] !== t2 || $[3] !== t3 ? (t4 = {
1846
+ tokens: t0,
1847
+ isExpired: t1,
1848
+ refresh: t2,
1849
+ revoke: t3
1850
+ }, $[0] = t0, $[1] = t1, $[2] = t2, $[3] = t3, $[4] = t4) : t4 = $[4], t4;
1851
+ }
1852
+ /**
1853
+ * A React hook that provides a client that subscribes to changes in your application,
1854
+ *
1855
+ * @remarks
1856
+ * This hook is intended for advanced use cases and special API calls that the React SDK
1857
+ * does not yet provide hooks for. We welcome you to get in touch with us to let us know
1858
+ * your use cases for this!
1859
+ *
1860
+ * @category Platform
1861
+ * @returns A Sanity client
1862
+ *
1863
+ * @example
1864
+ * ```tsx
1865
+ * function MyComponent() {
1866
+ * const client = useClient({apiVersion: '2024-11-12'})
1867
+ * const [document, setDocument] = useState(null)
1868
+ * useEffect(async () => {
1869
+ * const doc = client.fetch('*[_id == "myDocumentId"]')
1870
+ * setDocument(doc)
1871
+ * }, [])
1872
+ * return <div>{JSON.stringify(document) ?? 'Loading...'}</div>
1873
+ * }
1874
+ * ```
1875
+ *
1876
+ * @public
1877
+ * @function
1878
+ */
1879
+ const useClient = createStateSourceHook({
1757
1880
  getState: (instance, options) => {
1758
1881
  if (!options || typeof options != "object") throw Error("useClient() requires a configuration object with at least an \"apiVersion\" property. Example: useClient({ apiVersion: \"2024-11-12\" })");
1759
1882
  return getClientState(instance, options);
@@ -4049,7 +4172,7 @@ function useUsers(options) {
4049
4172
  loadMore
4050
4173
  }, $[20] = data, $[21] = hasMore, $[22] = isPending, $[23] = loadMore, $[24] = t8) : t8 = $[24], t8;
4051
4174
  }
4052
- var version = "3.5.0-next.20260922182803";
4175
+ var version = "3.5.0-next.20260922191023";
4053
4176
  function getEnv(key) {
4054
4177
  if (import.meta.env) return import.meta.env[key];
4055
4178
  if (typeof process < "u" && process.env) return process.env[key];
@@ -4060,6 +4183,6 @@ function getEnv(key) {
4060
4183
  * @internal
4061
4184
  */
4062
4185
  const REACT_SDK_VERSION = getEnv("PKG_VERSION") || `${version}-development`;
4063
- export { AuthBoundary, ComlinkTokenRefreshProvider, REACT_SDK_VERSION, ResourceProvider, SDKProvider, SDKStudioContext, SanityApp, SanityInstanceProvider, renderSanityApp, useActiveReleases, useAgentGenerate, useAgentPatch, useAgentPrompt, useAgentTransform, useAgentTranslate, useAllReleases, useApplication, useApplications, useApplyDocumentActions, useApplyReleaseActions, useAuthState, useAuthToken, useCheckPermissions, useClient, useCommentActions, useCommentThreads, useComments, useCreateDocument, useCurrentUser, useDatasets, useDeleteApplication, useDocument, useDocumentEvent, useDocumentPermissions, useDocumentPreview, useDocumentProjection, useDocumentSyncStatus, useDocuments, useEditDocument, useFavorite, useFrameConnection, useHandleAuthCallback, useInstallation, useInstallations, useLogOut, useLoginUrl, useOrganization, useOrganizations, usePaginatedDocuments, usePerspective, usePresence, usePresenceForDocument, useProject, useProjects, useQuery, useRecordDocumentHistoryEvent, useReportPresence, useResource, useSanityInstance, useStudioWorkspacesByProjectIdDataset, useUpdateApplication, useUpdateFavorite, useUser, useUsers, useVerifyOrgProjects, useWindowConnection };
4186
+ export { AuthBoundary, ComlinkTokenRefreshProvider, REACT_SDK_VERSION, ResourceProvider, SDKProvider, SDKStudioContext, SanityApp, SanityInstanceProvider, renderSanityApp, useActiveReleases, useAgentGenerate, useAgentPatch, useAgentPrompt, useAgentTransform, useAgentTranslate, useAllReleases, useApplication, useApplications, useApplyDocumentActions, useApplyReleaseActions, useAuthState, useAuthToken, useCheckPermissions, useClient, useCommentActions, useCommentThreads, useComments, useCreateDocument, useCurrentUser, useDatasets, useDeleteApplication, useDocument, useDocumentEvent, useDocumentPermissions, useDocumentPreview, useDocumentProjection, useDocumentSyncStatus, useDocuments, useEditDocument, useFavorite, useFrameConnection, useHandleAuthCallback, useHandleOAuthCallback, useInstallation, useInstallations, useLogOut, useLoginUrl, useOAuthAuthorize, useOAuthTokens, useOrganization, useOrganizations, usePaginatedDocuments, usePerspective, usePresence, usePresenceForDocument, useProject, useProjects, useQuery, useRecordDocumentHistoryEvent, useReportPresence, useResource, useSanityInstance, useStudioWorkspacesByProjectIdDataset, useUpdateApplication, useUpdateFavorite, useUser, useUsers, useVerifyOrgProjects, useWindowConnection };
4064
4187
 
4065
4188
  //# sourceMappingURL=index.js.map