@sanity/sdk-react 3.3.0 → 3.4.0-rc.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.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,98 @@ 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
+ /** The stored OAuth tokens, or `null` when not logged in via OAuth */
1184
+ tokens: OAuthTokens | null;
1185
+ /**
1186
+ * Returns whether the access token has expired, comparing `expiresAt` against
1187
+ * the current time at the moment it is called. Reading the clock does not
1188
+ * trigger a re-render, so call this in an event handler or effect rather than
1189
+ * during render. Returns `false` when there are no tokens.
1190
+ */
1191
+ isExpired: () => boolean;
1192
+ /**
1193
+ * Refresh via the OAuth `refresh_token` grant. When there is no refresh token,
1194
+ * core clears the stored tokens, logs the user out, and this resolves `null`.
1195
+ * Rejects on transient failures (network, 5xx, 408, 429), leaving tokens
1196
+ * unchanged so the call can be retried. Also rejects when the server rejects
1197
+ * the refresh token itself (other 4xx); core clears the tokens and logs out
1198
+ * first, so check `tokens` before retrying.
1199
+ */
1200
+ refresh: () => Promise<OAuthTokens | null>;
1201
+ /** Revoke the tokens at the OAuth server, clear them locally, and log out. */
1202
+ revoke: () => Promise<void>;
1203
+ }
1204
+ /**
1205
+ * A React hook that exposes the stored OAuth token state along with `refresh`
1206
+ * and `revoke` actions.
1207
+ *
1208
+ * @remarks
1209
+ * The token view is a synchronous read over core's token state source, so the
1210
+ * hook re-renders whenever tokens change — including changes made in another
1211
+ * tab, which core propagates via `storage` events.
1212
+ *
1213
+ * @returns The current {@link UseOAuthTokensResult}
1214
+ *
1215
+ * @example
1216
+ * ```tsx
1217
+ * function TokenStatus() {
1218
+ * const {tokens, isExpired, refresh, revoke} = useOAuthTokens()
1219
+ *
1220
+ * if (!tokens) return <div>Not signed in</div>
1221
+ *
1222
+ * const handleRefresh = async () => {
1223
+ * if (!isExpired()) return
1224
+ * try {
1225
+ * await refresh()
1226
+ * } catch {
1227
+ * // Transient failure (tokens unchanged, retry later) or the refresh
1228
+ * // token was rejected (tokens now null, user is logged out).
1229
+ * }
1230
+ * }
1231
+ *
1232
+ * return (
1233
+ * <div>
1234
+ * <p>Expires at {tokens.expiresAt.toLocaleTimeString()}</p>
1235
+ * <button onClick={handleRefresh}>Refresh if expired</button>
1236
+ * <button onClick={() => revoke()}>Revoke tokens</button>
1237
+ * </div>
1238
+ * )
1239
+ * }
1240
+ * ```
1241
+ *
1242
+ * @public
1243
+ */
1244
+ export declare function useOAuthTokens(): UseOAuthTokensResult;
1108
1245
  /**
1109
1246
  * Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
1110
1247
  *
@@ -3505,5 +3642,5 @@ export declare function useUsers(options?: GetUsersOptions): UsersResult;
3505
3642
  * @internal
3506
3643
  */
3507
3644
  export declare const REACT_SDK_VERSION: {};
3508
- 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 };
3645
+ 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 };
3509
3646
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqFc,YACd,UACA,UACA,QAAQ,eACL,SACF,iBAAiB;;;;UC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;;;;;;qBCblC,cACX,wCACA,wCAEA,UAAU,gBAAgB,gBAAgB,qBACvC,kBAAkB,QAAQ,gBAAgB;;;;;KC1B1C,gBACH,gCACA,kCACA,sCACE,wBAAwB,aAAa,QAAQ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0D3C,SACd,gCACA,kCACA,oCAEA,SAAS,gBAAgB,QAAQ,UAAU;;EAG3C,MAAM,mBAAmB,WAAW,cAAc;;EAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAgCc,SAAS,OAAO,SAAS,wBAAwB;;EAE/D,MAAM;;EAEN;;;;;;;;;;;;;;;;;;wBCzEc,kBACd,UAAU,wBAAwB,6BACjC;;;;;;;;;;;;;;;;;;;;;;;;;;wBCKa,eACd,UAAU,wBAAwB,6BACjC;;;;UClDO;OACH,QAAQ,gBAAgB,iBAAiB,UAAU,mBAAmB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsExE,wBAAwB;;;;;wBC1BrB,eAAe,oBAAoB;;;;;UC1ClC;;;;EAIf,MAAM;;;;EAIN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAmCc,QAAQ,SAAS,iBAAiB;;;;;UCpCjC;;;;EAIf,MAAM;;;;EAIN;;;;EAKA;;;;EAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Dc,SAAS,UAAU,kBAAkB;;;;;qBCtFxC"}
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/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,iBAAiB;;;;UC3HH,yBAAyB;EACxC,UAAU;EACV,QAAQ,eAAe;EACvB,UAAU;EACV,YAAY,eAAe;;EAE3B;;;;;;;wBAoBc,cACd,UACA,QACA,UACA,+BACG,SACF,mBAAmB;;;;;;;;;;;;UClCL,eACf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;qBCjInB,aAGN,uCAAuC,wCAC5C,UAAU,eAAe,gBAAgB,qBACtC,kBAAkB,QAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBCblC,cACX,wCACA,wCAEA,UAAU,gBAAgB,gBAAgB,qBACvC,kBAAkB,QAAQ,gBAAgB;;;;;KC1B1C,gBACH,gCACA,kCACA,sCACE,wBAAwB,aAAa,QAAQ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0D3C,SACd,gCACA,kCACA,oCAEA,SAAS,gBAAgB,QAAQ,UAAU;;EAG3C,MAAM,mBAAmB,WAAW,cAAc;;EAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAgCc,SAAS,OAAO,SAAS,wBAAwB;;EAE/D,MAAM;;EAEN;;;;;;;;;;;;;;;;;;wBCzEc,kBACd,UAAU,wBAAwB,6BACjC;;;;;;;;;;;;;;;;;;;;;;;;;;wBCKa,eACd,UAAU,wBAAwB,6BACjC;;;;UClDO;OACH,QAAQ,gBAAgB,iBAAiB,UAAU,mBAAmB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsExE,wBAAwB;;;;;wBC1BrB,eAAe,oBAAoB;;;;;UC1ClC;;;;EAIf,MAAM;;;;EAIN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAmCc,QAAQ,SAAS,iBAAiB;;;;;UCpCjC;;;;EAIf,MAAM;;;;EAIN;;;;EAKA;;;;EAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Dc,SAAS,UAAU,kBAAkB;;;;;qBCtFxC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as useWindowConnection, c as useSanityInstance, i as DashboardTokenRefreshProvider, l as SanityInstanceContext, o as useAuthState, r as useOrganizationId, s as createStateSourceHook, t as useStudioWorkspacesByProjectIdDataset } from "./useStudioWorkspacesByProjectIdDataset-B5A5kBH9.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.
@@ -376,7 +400,15 @@ const useHandleAuthCallback = createCallbackHook(handleAuthCallback);
376
400
  /**
377
401
  * Component shown during auth callback processing that handles login completion.
378
402
  * Automatically processes the auth callback when mounted and updates the URL
379
- * to remove callback parameters without triggering a page reload.
403
+ * to remove callback parameters without triggering a page reload. When the
404
+ * callback resolves to a different route (the OAuth flow returns the user to
405
+ * where they started), a real navigation is performed instead so the app's
406
+ * router picks it up.
407
+ *
408
+ * A different route is detected by pathname only, so apps that route in the
409
+ * hash (`#/documents/abc`) will not be navigated to the deep link. Those apps
410
+ * should build a custom callback component with `useHandleOAuthCallback` and
411
+ * their router's `navigate`.
380
412
  *
381
413
  * @alpha
382
414
  */
@@ -384,12 +416,13 @@ function LoginCallback() {
384
416
  let $ = c(3), handleAuthCallback = useHandleAuthCallback(), t0, t1;
385
417
  return $[0] === handleAuthCallback ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
386
418
  let url = new URL(location.href);
387
- handleAuthCallback(url.toString()).then(_temp$6);
419
+ handleAuthCallback(url.toString()).then((replacementLocation) => {
420
+ if (!replacementLocation) return;
421
+ let next = new URL(replacementLocation, url);
422
+ next.origin === url.origin && (next.pathname === url.pathname ? history.replaceState(null, "", replacementLocation) : location.replace(replacementLocation));
423
+ });
388
424
  }, t1 = [handleAuthCallback], $[0] = handleAuthCallback, $[1] = t0, $[2] = t1), useEffect(t0, t1), null;
389
425
  }
390
- function _temp$6(replacementLocation) {
391
- replacementLocation && history.replaceState(null, "", replacementLocation);
392
- }
393
426
  /**
394
427
  * Hook to log out of the current session
395
428
  * @internal
@@ -535,23 +568,26 @@ function AuthBoundary(t0) {
535
568
  }) }) }), $[9] = FallbackComponent, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
536
569
  }
537
570
  function AuthSwitch(t0) {
538
- let $ = c(16), children, projectIds, props, t1, t2;
571
+ let $ = c(18), children, projectIds, props, t1, t2;
539
572
  $[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
573
  let CallbackComponent = t1 === void 0 ? LoginCallback : t1, verifyOrganization = t2 === void 0 || t2, authState = useAuthState(), instance = useSanityInstance(), t3;
541
574
  $[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);
575
+ 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;
576
+ if ($[8] !== authorize || $[9] !== isLoggedOut || $[10] !== isOAuth || $[11] !== isStudio || $[12] !== loginUrl ? (t4 = () => {
577
+ isLoggedOut && !isInIframe() && !isStudio && !isDashboardEnvironment() && (isOAuth ? authorize().catch((error) => setAuthorizeError({ error })) : window.location.href = loginUrl);
545
578
  }, t5 = [
546
579
  isLoggedOut,
580
+ isOAuth,
581
+ authorize,
547
582
  loginUrl,
548
583
  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 });
584
+ ], $[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 });
585
+ if (authorizeError) throw new AuthError(authorizeError.error);
550
586
  switch (authState.type) {
551
587
  case AuthStateType.ERROR: throw new AuthError(authState.error);
552
588
  case AuthStateType.LOGGING_IN: {
553
589
  let t6;
554
- return $[13] !== CallbackComponent || $[14] !== props ? (t6 = /* @__PURE__ */ jsx(CallbackComponent, { ...props }), $[13] = CallbackComponent, $[14] = props, $[15] = t6) : t6 = $[15], t6;
590
+ return $[15] !== CallbackComponent || $[16] !== props ? (t6 = /* @__PURE__ */ jsx(CallbackComponent, { ...props }), $[15] = CallbackComponent, $[16] = props, $[17] = t6) : t6 = $[17], t6;
555
591
  }
556
592
  case AuthStateType.LOGGED_IN: return children;
557
593
  case AuthStateType.LOGGED_OUT: return null;
@@ -1753,7 +1789,89 @@ function createMutationHook(mutation) {
1753
1789
  * @internal
1754
1790
  * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
1755
1791
  */
1756
- const useDeleteApplication = createMutationHook(deleteApplication), useUpdateApplication = createMutationHook(updateApplication), useAuthToken = createStateSourceHook(getTokenState), useCurrentUser = createStateSourceHook(getCurrentUserState), useClient = createStateSourceHook({
1792
+ 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);
1793
+ function isOAuthTokenExpired(tokens) {
1794
+ return tokens ? tokens.expiresAt.getTime() <= Date.now() : !1;
1795
+ }
1796
+ /**
1797
+ * A React hook that exposes the stored OAuth token state along with `refresh`
1798
+ * and `revoke` actions.
1799
+ *
1800
+ * @remarks
1801
+ * The token view is a synchronous read over core's token state source, so the
1802
+ * hook re-renders whenever tokens change — including changes made in another
1803
+ * tab, which core propagates via `storage` events.
1804
+ *
1805
+ * @returns The current {@link UseOAuthTokensResult}
1806
+ *
1807
+ * @example
1808
+ * ```tsx
1809
+ * function TokenStatus() {
1810
+ * const {tokens, isExpired, refresh, revoke} = useOAuthTokens()
1811
+ *
1812
+ * if (!tokens) return <div>Not signed in</div>
1813
+ *
1814
+ * const handleRefresh = async () => {
1815
+ * if (!isExpired()) return
1816
+ * try {
1817
+ * await refresh()
1818
+ * } catch {
1819
+ * // Transient failure (tokens unchanged, retry later) or the refresh
1820
+ * // token was rejected (tokens now null, user is logged out).
1821
+ * }
1822
+ * }
1823
+ *
1824
+ * return (
1825
+ * <div>
1826
+ * <p>Expires at {tokens.expiresAt.toLocaleTimeString()}</p>
1827
+ * <button onClick={handleRefresh}>Refresh if expired</button>
1828
+ * <button onClick={() => revoke()}>Revoke tokens</button>
1829
+ * </div>
1830
+ * )
1831
+ * }
1832
+ * ```
1833
+ *
1834
+ * @public
1835
+ */
1836
+ function useOAuthTokens() {
1837
+ let $ = c(7), tokens = useOAuthTokensState(), t0;
1838
+ $[0] === tokens ? t0 = $[1] : (t0 = () => isOAuthTokenExpired(tokens), $[0] = tokens, $[1] = t0);
1839
+ let t1 = useRefreshOAuthTokens(), t2 = useRevokeOAuthTokens(), t3;
1840
+ return $[2] !== t0 || $[3] !== t1 || $[4] !== t2 || $[5] !== tokens ? (t3 = {
1841
+ tokens,
1842
+ isExpired: t0,
1843
+ refresh: t1,
1844
+ revoke: t2
1845
+ }, $[2] = t0, $[3] = t1, $[4] = t2, $[5] = tokens, $[6] = t3) : t3 = $[6], t3;
1846
+ }
1847
+ /**
1848
+ * A React hook that provides a client that subscribes to changes in your application,
1849
+ *
1850
+ * @remarks
1851
+ * This hook is intended for advanced use cases and special API calls that the React SDK
1852
+ * does not yet provide hooks for. We welcome you to get in touch with us to let us know
1853
+ * your use cases for this!
1854
+ *
1855
+ * @category Platform
1856
+ * @returns A Sanity client
1857
+ *
1858
+ * @example
1859
+ * ```tsx
1860
+ * function MyComponent() {
1861
+ * const client = useClient({apiVersion: '2024-11-12'})
1862
+ * const [document, setDocument] = useState(null)
1863
+ * useEffect(async () => {
1864
+ * const doc = client.fetch('*[_id == "myDocumentId"]')
1865
+ * setDocument(doc)
1866
+ * }, [])
1867
+ * return <div>{JSON.stringify(document) ?? 'Loading...'}</div>
1868
+ * }
1869
+ * ```
1870
+ *
1871
+ * @public
1872
+ * @function
1873
+ */
1874
+ const useClient = createStateSourceHook({
1757
1875
  getState: (instance, options) => {
1758
1876
  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
1877
  return getClientState(instance, options);
@@ -4012,7 +4130,7 @@ function useUsers(options) {
4012
4130
  loadMore
4013
4131
  }, $[20] = data, $[21] = hasMore, $[22] = isPending, $[23] = loadMore, $[24] = t8) : t8 = $[24], t8;
4014
4132
  }
4015
- var version = "3.3.0";
4133
+ var version = "3.4.0-rc.0";
4016
4134
  function getEnv(key) {
4017
4135
  if (import.meta.env) return import.meta.env[key];
4018
4136
  if (typeof process < "u" && process.env) return process.env[key];
@@ -4023,6 +4141,6 @@ function getEnv(key) {
4023
4141
  * @internal
4024
4142
  */
4025
4143
  const REACT_SDK_VERSION = getEnv("PKG_VERSION") || `${version}-development`;
4026
- 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 };
4144
+ 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 };
4027
4145
 
4028
4146
  //# sourceMappingURL=index.js.map