@sanity/sdk-react 0.0.0-alpha.15 → 0.0.0-alpha.16
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/_chunks-es/useLogOut.js +1 -1
- package/dist/_chunks-es/useLogOut.js.map +1 -1
- package/dist/components.d.ts +37 -9
- package/dist/components.js +7 -8
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +390 -141
- package/dist/hooks.js +160 -75
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/_exports/hooks.ts +14 -5
- package/src/_exports/index.ts +1 -10
- package/src/components/SDKProvider.test.tsx +3 -3
- package/src/components/SDKProvider.tsx +18 -7
- package/src/components/SanityApp.test.tsx +5 -5
- package/src/components/SanityApp.tsx +36 -9
- package/src/hooks/_synchronous-groq-js.mjs +4 -0
- package/src/hooks/client/useClient.ts +4 -1
- package/src/hooks/context/useSanityInstance.ts +1 -1
- package/src/hooks/datasets/useDatasets.ts +26 -1
- package/src/hooks/document/useDocument.ts +3 -3
- package/src/hooks/document/useDocumentEvent.ts +2 -0
- package/src/hooks/document/useDocumentSyncStatus.ts +2 -1
- package/src/hooks/document/useEditDocument.ts +2 -1
- package/src/hooks/helpers/createStateSourceHook.tsx +4 -4
- package/src/hooks/infiniteList/useInfiniteList.test.tsx +152 -0
- package/src/hooks/infiniteList/useInfiniteList.ts +163 -0
- package/src/hooks/paginatedList/usePaginatedList.test.tsx +259 -0
- package/src/hooks/paginatedList/usePaginatedList.ts +278 -0
- package/src/hooks/projects/useProject.ts +25 -1
- package/src/hooks/projects/useProjects.ts +33 -11
- package/src/hooks/query/useQuery.test.tsx +188 -0
- package/src/hooks/query/useQuery.ts +112 -0
- package/src/hooks/users/useUsers.ts +2 -2
- package/src/utils/getEnv.ts +21 -0
- package/src/version.ts +8 -0
- package/src/hooks/documentCollection/types.ts +0 -19
- package/src/hooks/documentCollection/useDocuments.test.ts +0 -130
- package/src/hooks/documentCollection/useDocuments.ts +0 -126
- package/src/hooks/documentCollection/useSearch.test.ts +0 -100
- package/src/hooks/documentCollection/useSearch.ts +0 -75
|
@@ -22,7 +22,7 @@ function createStateSourceHook(options) {
|
|
|
22
22
|
let resourceId;
|
|
23
23
|
getResourceId && (resourceId = getResourceId(...params));
|
|
24
24
|
const instance = useSanityInstance(resourceId);
|
|
25
|
-
if (suspense?.shouldSuspend(instance, ...params))
|
|
25
|
+
if (suspense?.suspender && suspense?.shouldSuspend?.(instance, ...params))
|
|
26
26
|
throw suspense.suspender(instance, ...params);
|
|
27
27
|
const state = useMemo(
|
|
28
28
|
() => getState(instance, ...params),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogOut.js","sources":["../../src/hooks/context/useSanityInstance.ts","../../src/hooks/helpers/createStateSourceHook.tsx","../../src/hooks/auth/useAuthState.tsx","../../src/hooks/helpers/createCallbackHook.tsx","../../src/hooks/auth/useHandleCallback.tsx","../../src/hooks/auth/useLoginUrls.tsx","../../src/hooks/auth/useLogOut.tsx"],"sourcesContent":["import {type SanityInstance} from '@sanity/sdk'\nimport {useContext} from 'react'\n\nimport {SanityInstanceContext} from '../../context/SanityProvider'\n\n/**\n * `useSanityInstance` returns the current Sanity instance from the application context.\n * This must be called from within a `SanityProvider` component.\n * @internal\n *\n * @param resourceId - The resourceId of the Sanity instance to return (optional)\n * @returns The current Sanity instance\n * @example\n * ```tsx\n * const instance = useSanityInstance('abc123
|
|
1
|
+
{"version":3,"file":"useLogOut.js","sources":["../../src/hooks/context/useSanityInstance.ts","../../src/hooks/helpers/createStateSourceHook.tsx","../../src/hooks/auth/useAuthState.tsx","../../src/hooks/helpers/createCallbackHook.tsx","../../src/hooks/auth/useHandleCallback.tsx","../../src/hooks/auth/useLoginUrls.tsx","../../src/hooks/auth/useLogOut.tsx"],"sourcesContent":["import {type SanityInstance} from '@sanity/sdk'\nimport {useContext} from 'react'\n\nimport {SanityInstanceContext} from '../../context/SanityProvider'\n\n/**\n * `useSanityInstance` returns the current Sanity instance from the application context.\n * This must be called from within a `SanityProvider` component.\n * @internal\n *\n * @param resourceId - The resourceId of the Sanity instance to return (optional)\n * @returns The current Sanity instance\n * @example\n * ```tsx\n * const instance = useSanityInstance('abc123.production')\n * ```\n */\nexport const useSanityInstance = (resourceId?: string): SanityInstance => {\n const sanityInstance = useContext(SanityInstanceContext)\n if (!sanityInstance) {\n throw new Error('useSanityInstance must be called from within the SanityProvider')\n }\n if (sanityInstance.length === 0) {\n throw new Error('No Sanity instances found')\n }\n if (sanityInstance.length === 1 || !resourceId) {\n return sanityInstance[0]\n }\n\n if (!resourceId) {\n throw new Error('resourceId is required when there are multiple Sanity instances')\n }\n\n const instance = sanityInstance.find((inst) => inst.identity.resourceId === resourceId)\n if (!instance) {\n throw new Error(`Sanity instance with resourceId ${resourceId} not found`)\n }\n return instance\n}\n","import {type ResourceId, type SanityInstance, type StateSource} from '@sanity/sdk'\nimport {useMemo, useSyncExternalStore} from 'react'\n\nimport {useSanityInstance} from '../context/useSanityInstance'\n\ntype StateSourceFactory<TParams extends unknown[], TState> = (\n instance: SanityInstance,\n ...params: TParams\n) => StateSource<TState>\n\ninterface CreateStateSourceHookOptions<TParams extends unknown[], TState> {\n getState: StateSourceFactory<TParams, TState>\n shouldSuspend?: (instance: SanityInstance, ...params: TParams) => boolean\n suspender?: (instance: SanityInstance, ...params: TParams) => Promise<unknown>\n getResourceId?: (...params: TParams) => ResourceId | undefined\n}\n\nexport function createStateSourceHook<TParams extends unknown[], TState>(\n options: StateSourceFactory<TParams, TState> | CreateStateSourceHookOptions<TParams, TState>,\n): (...params: TParams) => TState {\n const getState = typeof options === 'function' ? options : options.getState\n const getResourceId = 'getResourceId' in options ? options.getResourceId : undefined\n const suspense = 'shouldSuspend' in options && 'suspender' in options ? options : undefined\n\n function useHook(...params: TParams) {\n let resourceId: ResourceId | undefined\n if (getResourceId) {\n resourceId = getResourceId(...params)\n }\n const instance = useSanityInstance(resourceId)\n if (suspense?.suspender && suspense?.shouldSuspend?.(instance, ...params)) {\n throw suspense.suspender(instance, ...params)\n }\n\n const state = useMemo(\n () => getState(instance, ...params),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [instance, ...params],\n )\n return useSyncExternalStore(state.subscribe, state.getCurrent)\n }\n\n return useHook\n}\n","import {type AuthState, getAuthState} from '@sanity/sdk'\n\nimport {createStateSourceHook} from '../helpers/createStateSourceHook'\n\n/**\n * @internal\n * A React hook that subscribes to authentication state changes.\n *\n * This hook provides access to the current authentication state type from the Sanity auth store.\n * It automatically re-renders when the authentication state changes.\n *\n * @remarks\n * The hook uses `useSyncExternalStore` to safely subscribe to auth state changes\n * and ensure consistency between server and client rendering.\n *\n * @returns The current authentication state type\n *\n * @example\n * ```tsx\n * function AuthStatus() {\n * const authState = useAuthState()\n * return <div>Current auth state: {authState}</div>\n * }\n * ```\n */\nexport const useAuthState: () => AuthState = createStateSourceHook(getAuthState)\n","import {type SanityInstance} from '@sanity/sdk'\nimport {useCallback} from 'react'\n\nimport {useSanityInstance} from '../context/useSanityInstance'\n\nexport function createCallbackHook<TParams extends unknown[], TReturn>(\n callback: (instance: SanityInstance, ...params: TParams) => TReturn,\n): () => (...params: TParams) => TReturn {\n function useHook() {\n const instance = useSanityInstance()\n return useCallback((...params: TParams) => callback(instance, ...params), [instance])\n }\n\n return useHook\n}\n","import {handleCallback} from '@sanity/sdk'\n\nimport {createCallbackHook} from '../helpers/createCallbackHook'\n\n/**\n * @internal\n * A React hook that returns a function for handling authentication callbacks.\n *\n * @remarks\n * This hook provides access to the authentication store's callback handler,\n * which processes auth redirects by extracting the session ID and fetching the\n * authentication token. If fetching the long-lived token is successful,\n * `handleCallback` will return a Promise that resolves a new location that\n * removes the short-lived token from the URL. Use this in combination with\n * `history.replaceState` or your own router's `replace` function to update the\n * current location without triggering a reload.\n *\n * @example\n * ```tsx\n * function AuthCallback() {\n * const handleCallback = useHandleCallback()\n * const router = useRouter() // Example router\n *\n * useEffect(() => {\n * async function processCallback() {\n * // Handle the callback and get the cleaned URL\n * const newUrl = await handleCallback(window.location.href)\n *\n * if (newUrl) {\n * // Replace URL without triggering navigation\n * router.replace(newUrl, {shallow: true})\n * }\n * }\n *\n * processCallback().catch(console.error)\n * }, [handleCallback, router])\n *\n * return <div>Completing login...</div>\n * }\n * ```\n *\n * @returns A callback handler function that processes OAuth redirects\n * @public\n */\nexport const useHandleCallback = createCallbackHook(handleCallback)\n","import {type AuthProvider, fetchLoginUrls, getLoginUrlsState} from '@sanity/sdk'\nimport {useMemo, useSyncExternalStore} from 'react'\n\nimport {useSanityInstance} from '../context/useSanityInstance'\n\n/**\n * @internal\n * A React hook that retrieves the available authentication provider URLs for login.\n *\n * @remarks\n * This hook fetches the login URLs from the Sanity auth store when the component mounts.\n * Each provider object contains information about an authentication method, including its URL.\n * The hook will suspend if the login URLs have not yet loaded.\n *\n * @example\n * ```tsx\n * // LoginProviders component that uses the hook\n * function LoginProviders() {\n * const providers = useLoginUrls()\n *\n * return (\n * <div>\n * {providers.map((provider) => (\n * <a key={provider.name} href={provider.url}>\n * Login with {provider.title}\n * </a>\n * ))}\n * </div>\n * )\n * }\n *\n * // Parent component with Suspense boundary\n * function LoginPage() {\n * return (\n * <Suspense fallback={<div>Loading authentication providers...</div>}>\n * <LoginProviders />\n * </Suspense>\n * )\n * }\n * ```\n *\n * @returns An array of {@link AuthProvider} objects containing login URLs and provider information\n * @public\n */\nexport function useLoginUrls(): AuthProvider[] {\n const instance = useSanityInstance()\n const {subscribe, getCurrent} = useMemo(() => getLoginUrlsState(instance), [instance])\n\n if (!getCurrent()) throw fetchLoginUrls(instance)\n\n return useSyncExternalStore(subscribe, getCurrent as () => AuthProvider[])\n}\n","import {logout} from '@sanity/sdk'\n\nimport {createCallbackHook} from '../helpers/createCallbackHook'\n\n/**\n * Hook to log out of the current session\n * @internal\n * @returns A function to log out of the current session\n */\nexport const useLogOut = createCallback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AAA;AACT;AC8Ba,MAAA,oBAAoB,mBAAmB,cAAc;ACA3D,SAAS,eAA+B;AAC7C,QAAM,WAAW,qBACX,EAAC,WAAW,WAAU,IAAI,QAAQ,MAAM,kBAAkB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAErF,MAAI,CAAC,WAAA,EAAc,OAAM,eAAe,QAAQ;AAEzC,SAAA,qBAAqB,WAAW,UAAkC;AAC3E;AC1Ca,MAAA,YAAY,mBAAmB,MAAM;"}
|
package/dist/components.d.ts
CHANGED
|
@@ -79,26 +79,48 @@ declare interface LoginLayoutProps {
|
|
|
79
79
|
* @returns Your Sanity application, integrated with your Sanity configuration and application context
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
|
-
* ```
|
|
83
|
-
* import { SanityApp } from '@sanity/sdk-react
|
|
82
|
+
* ```tsx
|
|
83
|
+
* import { SanityApp } from '@sanity/sdk-react'
|
|
84
84
|
*
|
|
85
85
|
* import MyAppRoot from './Root'
|
|
86
86
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
87
|
+
* // Single project configuration
|
|
88
|
+
* const mySanityConfigs = [
|
|
89
|
+
* {
|
|
90
|
+
* projectId: 'my-project-id',
|
|
91
|
+
* dataset: 'production',
|
|
92
|
+
* },
|
|
93
|
+
* ]
|
|
94
|
+
*
|
|
95
|
+
* // Or multiple project configurations
|
|
96
|
+
* const multipleConfigs = [
|
|
97
|
+
* // Configuration for your main project. This will be used as the default project for all hooks if no resource ID override is provided.
|
|
98
|
+
* {
|
|
99
|
+
* projectId: 'marketing-website-project',
|
|
100
|
+
* dataset: 'production',
|
|
101
|
+
* },
|
|
102
|
+
* // Configuration for a separate blog project
|
|
103
|
+
* {
|
|
104
|
+
* projectId: 'blog-project',
|
|
105
|
+
* dataset: 'production',
|
|
106
|
+
* },
|
|
107
|
+
* // Configuration for a separate ecommerce project
|
|
108
|
+
* {
|
|
109
|
+
* projectId: 'ecommerce-project',
|
|
110
|
+
* dataset: 'production',
|
|
111
|
+
* }
|
|
112
|
+
* ]
|
|
91
113
|
*
|
|
92
114
|
* export default function MyApp() {
|
|
93
115
|
* return (
|
|
94
|
-
* <SanityApp
|
|
116
|
+
* <SanityApp sanityConfigs={mySanityConfigs}>
|
|
95
117
|
* <MyAppRoot />
|
|
96
118
|
* </SanityApp>
|
|
97
119
|
* )
|
|
98
120
|
* }
|
|
99
121
|
* ```
|
|
100
122
|
*/
|
|
101
|
-
export declare function SanityApp({sanityConfigs, children}: SanityAppProps): ReactElement
|
|
123
|
+
export declare function SanityApp({sanityConfigs, children, fallback}: SanityAppProps): ReactElement
|
|
102
124
|
|
|
103
125
|
/**
|
|
104
126
|
* @public
|
|
@@ -106,6 +128,7 @@ export declare function SanityApp({sanityConfigs, children}: SanityAppProps): Re
|
|
|
106
128
|
export declare interface SanityAppProps {
|
|
107
129
|
sanityConfigs: SanityConfig[]
|
|
108
130
|
children: React.ReactNode
|
|
131
|
+
fallback: React.ReactNode
|
|
109
132
|
}
|
|
110
133
|
|
|
111
134
|
/**
|
|
@@ -113,7 +136,11 @@ export declare interface SanityAppProps {
|
|
|
113
136
|
*
|
|
114
137
|
* Top-level context provider that provides access to the Sanity SDK.
|
|
115
138
|
*/
|
|
116
|
-
export declare function SDKProvider({
|
|
139
|
+
export declare function SDKProvider({
|
|
140
|
+
children,
|
|
141
|
+
sanityConfigs,
|
|
142
|
+
fallback,
|
|
143
|
+
}: SDKProviderProps): ReactElement
|
|
117
144
|
|
|
118
145
|
/**
|
|
119
146
|
* @internal
|
|
@@ -121,6 +148,7 @@ export declare function SDKProvider({children, sanityConfigs}: SDKProviderProps)
|
|
|
121
148
|
export declare interface SDKProviderProps {
|
|
122
149
|
children: ReactNode
|
|
123
150
|
sanityConfigs: SanityConfig[]
|
|
151
|
+
fallback: ReactNode
|
|
124
152
|
}
|
|
125
153
|
|
|
126
154
|
export {}
|
package/dist/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { AuthStateType, createSanityInstance } from "@sanity/sdk";
|
|
3
3
|
import { Fragment, Suspense, useEffect, useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { ErrorBoundary } from "react-error-boundary";
|
|
@@ -129,14 +129,13 @@ function AuthSwitch({
|
|
|
129
129
|
return /* @__PURE__ */ jsx(LoginComponent, { ...props });
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
);
|
|
136
|
-
return /* @__PURE__ */ jsx(SanityProvider, { sanityInstances, children: /* @__PURE__ */ jsx(AuthBoundary, { children }) });
|
|
132
|
+
const DEFAULT_FALLBACK = /* @__PURE__ */ jsx(Fragment$1, { children: "Warning: No fallback provided. Please supply a fallback prop to ensure proper Suspense handling." });
|
|
133
|
+
function SDKProvider({ children, sanityConfigs, fallback }) {
|
|
134
|
+
const sanityInstances = useMemo(() => sanityConfigs.map((sanityConfig) => createSanityInstance(sanityConfig)), [sanityConfigs]);
|
|
135
|
+
return /* @__PURE__ */ jsx(SanityProvider, { sanityInstances, children: /* @__PURE__ */ jsx(Suspense, { fallback: fallback ?? DEFAULT_FALLBACK, children: /* @__PURE__ */ jsx(AuthBoundary, { children }) }) });
|
|
137
136
|
}
|
|
138
137
|
const CORE_URL = "https://core.sanity.io";
|
|
139
|
-
function SanityApp({ sanityConfigs, children }) {
|
|
138
|
+
function SanityApp({ sanityConfigs, children, fallback }) {
|
|
140
139
|
const [_sanityConfigs, setSanityConfigs] = useState(sanityConfigs);
|
|
141
140
|
return useEffect(() => {
|
|
142
141
|
let timeout;
|
|
@@ -151,7 +150,7 @@ function SanityApp({ sanityConfigs, children }) {
|
|
|
151
150
|
) : isLocalUrl(window) || (timeout = setTimeout(() => {
|
|
152
151
|
console.warn("Redirecting to core", CORE_URL), window.location.replace(CORE_URL);
|
|
153
152
|
}, 1e3)), () => clearTimeout(timeout);
|
|
154
|
-
}, [sanityConfigs]), /* @__PURE__ */ jsx(SDKProvider, { sanityConfigs: _sanityConfigs, children });
|
|
153
|
+
}, [sanityConfigs]), /* @__PURE__ */ jsx(SDKProvider, { sanityConfigs: _sanityConfigs, fallback, children });
|
|
155
154
|
}
|
|
156
155
|
export {
|
|
157
156
|
AuthBoundary,
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":["../src/components/utils.ts","../src/components/auth/AuthError.ts","../src/components/auth/LoginFooter.tsx","../src/components/auth/LoginLayout.tsx","../src/components/auth/Login.tsx","../src/components/auth/LoginCallback.tsx","../src/components/auth/LoginError.tsx","../src/components/auth/AuthBoundary.tsx","../src/components/SDKProvider.tsx","../src/components/SanityApp.tsx"],"sourcesContent":["export function isInIframe(): boolean {\n return typeof window !== 'undefined' && window.self !== window.top\n}\n\n/**\n * @internal\n *\n * Checks if the current URL is a local URL.\n *\n * @param window - The window object\n * @returns True if the current URL is a local URL, false otherwise\n */\nexport function isLocalUrl(window: Window): boolean {\n const url = typeof window !== 'undefined' ? window.location.href : ''\n\n return (\n url.startsWith('http://localhost') ||\n url.startsWith('https://localhost') ||\n url.startsWith('http://127.0.0.1') ||\n url.startsWith('https://127.0.0.1')\n )\n}\n","/**\n * Error class for authentication-related errors. Wraps errors thrown during the\n * authentication flow.\n *\n * @remarks\n * This class provides a consistent error type for authentication failures while\n * preserving the original error as the cause. If the original error has a\n * message property, it will be used as the error message.\n *\n * @alpha\n */\nexport class AuthError extends Error {\n constructor(error: unknown) {\n if (\n typeof error === 'object' &&\n !!error &&\n 'message' in error &&\n typeof error.message === 'string'\n ) {\n super(error.message)\n } else {\n super()\n }\n\n this.cause = error\n }\n}\n","import {SanityLogo} from '@sanity/logos'\nimport {Fragment} from 'react'\n\nconst LINKS = [\n {\n url: 'https://slack.sanity.io/',\n i18nKey: 'workspaces.community-title',\n title: 'Community',\n },\n {\n url: 'https://www.sanity.io/docs',\n i18nKey: 'workspaces.docs-title',\n title: 'Docs',\n },\n {\n url: 'https://www.sanity.io/legal/privacy',\n i18nKey: 'workspaces.privacy-title',\n title: 'Privacy',\n },\n {\n url: 'https://www.sanity.io',\n i18nKey: 'workspaces.sanity-io-title',\n title: 'sanity.io',\n },\n]\n\n/**\n * Default footer component for login screens showing Sanity branding and legal\n * links.\n *\n * @alpha\n */\nexport function LoginFooter(): React.ReactNode {\n return (\n <div className=\"sc-login-footer\">\n <SanityLogo className=\"sc-login-footer__logo\" />\n\n <ul className=\"sc-login-footer__links\">\n {LINKS.map((link) => (\n <Fragment key={link.title}>\n <li className=\"sc-login-footer__link\">\n <a href={link.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {link.title}\n </a>\n </li>\n </Fragment>\n ))}\n </ul>\n </div>\n )\n}\n","import {LoginFooter} from './LoginFooter'\n\n/**\n * @alpha\n */\nexport interface LoginLayoutProps {\n /** Optional header content rendered at top of card */\n header?: React.ReactNode\n\n /** Optional footer content rendered below card. Defaults to an internal login footer */\n footer?: React.ReactNode\n\n /** Main content rendered in card body */\n children?: React.ReactNode\n}\n\n/**\n * Layout component for login-related screens providing consistent styling and structure.\n * Renders content in a centered card with optional header and footer sections.\n *\n * Can be used to build custom login screens for the AuthBoundary component, including:\n * - Login provider selection (LoginComponent)\n * - OAuth callback handling (CallbackComponent)\n * - Error states (LoginErrorComponent)\n *\n * @example\n * ```tsx\n * // Custom login screen using the layout\n * function CustomLogin({header, footer}: LoginLayoutProps) {\n * return (\n * <LoginLayout\n * header={header}\n * footer={footer}\n * >\n * <CustomLoginContent />\n * </LoginLayout>\n * )\n * }\n *\n * // Use with AuthBoundary\n * <AuthBoundary\n * LoginComponent={CustomLogin}\n * header={<Logo />}\n * >\n * <ProtectedContent />\n * </AuthBoundary>\n * ```\n *\n * @alpha\n */\nexport function LoginLayout({\n children,\n footer = <LoginFooter />,\n header,\n}: LoginLayoutProps): React.ReactNode {\n return (\n <div className=\"sc-login-layout\">\n <div className=\"sc-login-layout__container\">\n <div className=\"sc-login-layout__card\">\n {header && <div className=\"sc-login-layout__card-header\">{header}</div>}\n\n {children && <div className=\"sc-login-layout__card-body\">{children}</div>}\n </div>\n\n {footer}\n </div>\n </div>\n )\n}\n","import {type JSX, Suspense} from 'react'\n\nimport {useLoginUrls} from '../../hooks/auth/useLoginUrls'\nimport {LoginLayout, type LoginLayoutProps} from './LoginLayout'\n\n/**\n * Login component that displays available authentication providers.\n * Renders a list of login options with a loading fallback while providers load.\n *\n * @alpha\n * @internal\n */\nexport function Login({header, footer}: LoginLayoutProps): JSX.Element {\n return (\n <LoginLayout header={header} footer={footer}>\n <div className=\"sc-login\">\n <h1 className=\"sc-login__title\">Choose login provider</h1>\n\n <Suspense fallback={<div className=\"sc-login__loading\">Loading…</div>}>\n <Providers />\n </Suspense>\n </div>\n </LoginLayout>\n )\n}\n\nfunction Providers() {\n const loginUrls = useLoginUrls()\n\n return (\n <div className=\"sc-login-providers\">\n {loginUrls.map(({title, url}) => (\n <a key={url} href={url}>\n {title}\n </a>\n ))}\n </div>\n )\n}\n","import {useEffect} from 'react'\n\nimport {useHandleCallback} from '../../hooks/auth/useHandleCallback'\nimport {LoginLayout, type LoginLayoutProps} from './LoginLayout'\n\n/**\n/**\n * Component shown during auth callback processing that handles login completion.\n * Automatically processes the auth callback when mounted and updates the URL\n * to remove callback parameters without triggering a page reload.\n *\n * @alpha\n */\nexport function LoginCallback({header, footer}: LoginLayoutProps): React.ReactNode {\n const handleCallback = useHandleCallback()\n\n useEffect(() => {\n const url = new URL(location.href)\n handleCallback(url.toString()).then((replacementLocation) => {\n if (replacementLocation) {\n // history API with `replaceState` is used to prevent a reload but still\n // remove the short-lived token from the URL\n history.replaceState(null, '', replacementLocation)\n }\n })\n }, [handleCallback])\n\n return (\n <LoginLayout header={header} footer={footer}>\n <div className=\"sc-login-callback\">\n <h1 className=\"sc-login-callback__title\">Logging you in…</h1>\n <div className=\"sc-login-callback__loading\">Loading…</div>\n </div>\n </LoginLayout>\n )\n}\n","import {useCallback} from 'react'\nimport {type FallbackProps} from 'react-error-boundary'\n\nimport {useLogOut} from '../../hooks/auth/useLogOut'\nimport {AuthError} from './AuthError'\nimport {LoginLayout, type LoginLayoutProps} from './LoginLayout'\n\n/**\n * @alpha\n */\nexport type LoginErrorProps = FallbackProps & LoginLayoutProps\n\n/**\n * Displays authentication error details and provides retry functionality.\n * Only handles {@link AuthError} instances - rethrows other error types.\n *\n * @alpha\n */\nexport function LoginError({\n error,\n resetErrorBoundary,\n header,\n footer,\n}: LoginErrorProps): React.ReactNode {\n if (!(error instanceof AuthError)) throw error\n const logout = useLogOut()\n\n const handleRetry = useCallback(async () => {\n await logout()\n resetErrorBoundary()\n }, [logout, resetErrorBoundary])\n\n return (\n <LoginLayout header={header} footer={footer}>\n <div className=\"sc-login-error\">\n <div className=\"sc-login-error__content\">\n <h2 className=\"sc-login-error__title\">Authentication Error</h2>\n <p className=\"sc-login-error__description\">\n Please try again or contact support if the problem persists.\n </p>\n </div>\n\n <button className=\"sc-login-error__button\" onClick={handleRetry}>\n Retry\n </button>\n </div>\n </LoginLayout>\n )\n}\n","import {AuthStateType} from '@sanity/sdk'\nimport {useMemo} from 'react'\nimport {ErrorBoundary, type FallbackProps} from 'react-error-boundary'\n\nimport {useAuthState} from '../../hooks/auth/useAuthState'\nimport {isInIframe} from '../utils'\nimport {AuthError} from './AuthError'\nimport {Login} from './Login'\nimport {LoginCallback} from './LoginCallback'\nimport {LoginError, type LoginErrorProps} from './LoginError'\nimport {type LoginLayoutProps} from './LoginLayout'\n\n// Only import bridge if we're in an iframe. This assumes that the app is\n// running within SanityOS if it is in an iframe.\nif (isInIframe()) {\n const parsedUrl = new URL(window.location.href)\n const mode = new URLSearchParams(parsedUrl.hash.slice(1)).get('mode')\n const script = document.createElement('script')\n script.src =\n mode === 'core-ui--staging'\n ? 'https://core.sanity-cdn.work/bridge.js'\n : 'https://core.sanity-cdn.com/bridge.js'\n script.type = 'module'\n script.async = true\n document.head.appendChild(script)\n}\n\n/**\n * @internal\n */\ninterface AuthBoundaryProps extends LoginLayoutProps {\n /**\n * Custom component to render the login screen.\n * Receives all login layout props. Defaults to {@link Login}.\n */\n LoginComponent?: React.ComponentType<LoginLayoutProps>\n\n /**\n * Custom component to render during OAuth callback processing.\n * Receives all login layout props. Defaults to {@link LoginCallback}.\n */\n CallbackComponent?: React.ComponentType<LoginLayoutProps>\n\n /**\n * Custom component to render when authentication errors occur.\n * Receives login layout props and error boundary props. Defaults to\n * {@link LoginError}\n */\n LoginErrorComponent?: React.ComponentType<LoginErrorProps>\n}\n\n/**\n * A component that handles authentication flow and error boundaries for a\n * protected section of the application.\n *\n * @remarks\n * This component manages different authentication states and renders the\n * appropriate components based on that state.\n *\n * @example\n * ```tsx\n * function App() {\n * return (\n * <AuthBoundary header={<MyLogo />}>\n * <ProtectedContent />\n * </AuthBoundary>\n * )\n * }\n * ```\n *\n * @internal\n */\nexport function AuthBoundary({\n LoginErrorComponent = LoginError,\n ...props\n}: AuthBoundaryProps): React.ReactNode {\n const {header, footer} = props\n const FallbackComponent = useMemo(() => {\n return function LoginComponentWithLayoutProps(fallbackProps: FallbackProps) {\n return <LoginErrorComponent {...fallbackProps} header={header} footer={footer} />\n }\n }, [header, footer, LoginErrorComponent])\n\n return (\n <ErrorBoundary FallbackComponent={FallbackComponent}>\n <AuthSwitch {...props} />\n </ErrorBoundary>\n )\n}\n\ninterface AuthSwitchProps extends LoginLayoutProps {\n LoginComponent?: React.ComponentType<LoginLayoutProps>\n CallbackComponent?: React.ComponentType<LoginLayoutProps>\n}\n\nfunction AuthSwitch({\n LoginComponent = Login,\n CallbackComponent = LoginCallback,\n children,\n ...props\n}: AuthSwitchProps) {\n const authState = useAuthState()\n\n switch (authState.type) {\n case AuthStateType.ERROR: {\n throw new AuthError(authState.error)\n }\n case AuthStateType.LOGGING_IN: {\n return <CallbackComponent {...props} />\n }\n case AuthStateType.LOGGED_IN: {\n return children\n }\n default: {\n return <LoginComponent {...props} />\n }\n }\n}\n","import {createSanityInstance, type SanityConfig} from '@sanity/sdk'\nimport {type ReactElement, type ReactNode} from 'react'\n\nimport {SanityProvider} from '../context/SanityProvider'\nimport {AuthBoundary} from './auth/AuthBoundary'\n\n/**\n * @internal\n */\nexport interface SDKProviderProps {\n children: ReactNode\n sanityConfigs: SanityConfig[]\n}\n\n// Marking this as internal since this should not be used directly by consumers\n/**\n * @internal\n *\n * Top-level context provider that provides access to the Sanity SDK.\n */\nexport function SDKProvider({children, sanityConfigs}: SDKProviderProps): ReactElement {\n const sanityInstances = sanityConfigs.map((sanityConfig: SanityConfig) =>\n createSanityInstance(sanityConfig),\n )\n\n return (\n <SanityProvider sanityInstances={sanityInstances}>\n <AuthBoundary>{children}</AuthBoundary>\n </SanityProvider>\n )\n}\n","import {type SanityConfig} from '@sanity/sdk'\nimport {type ReactElement, useEffect, useState} from 'react'\n\nimport {SDKProvider} from './SDKProvider'\nimport {isInIframe, isLocalUrl} from './utils'\n\n/**\n * @public\n */\nexport interface SanityAppProps {\n sanityConfigs: SanityConfig[]\n children: React.ReactNode\n}\n\nconst CORE_URL = 'https://core.sanity.io'\n\n/**\n * @public\n *\n * The SanityApp component provides your Sanity application with access to your Sanity configuration,\n * as well as application context and state which is used by the Sanity React hooks. Your application\n * must be wrapped with the SanityApp component to function properly.\n *\n * @param props - Your Sanity configuration and the React children to render\n * @returns Your Sanity application, integrated with your Sanity configuration and application context\n *\n * @example\n * ```\n * import { SanityApp } from '@sanity/sdk-react\n *\n * import MyAppRoot from './Root'\n *\n * const mySanityConfig = {\n * procectId: 'my-project-id',\n * dataset: 'production',\n * }\n *\n * export default function MyApp() {\n * return (\n * <SanityApp sanityConfig={mySanityConfig}>\n * <MyAppRoot />\n * </SanityApp>\n * )\n * }\n * ```\n */\nexport function SanityApp({sanityConfigs, children}: SanityAppProps): ReactElement {\n const [_sanityConfigs, setSanityConfigs] = useState<SanityConfig[]>(sanityConfigs)\n\n useEffect(() => {\n let timeout: NodeJS.Timeout | undefined\n\n if (isInIframe()) {\n // When running in an iframe Content OS, we don't want to store tokens\n setSanityConfigs(\n sanityConfigs.map((sanityConfig) => ({\n ...sanityConfig,\n auth: {\n ...sanityConfig.auth,\n storageArea: undefined,\n },\n })),\n )\n } else if (!isLocalUrl(window)) {\n // If the app is not running in an iframe and is not a local url, redirect to core.\n timeout = setTimeout(() => {\n // eslint-disable-next-line no-console\n console.warn('Redirecting to core', CORE_URL)\n window.location.replace(CORE_URL)\n }, 1000)\n }\n return () => clearTimeout(timeout)\n }, [sanityConfigs])\n\n return <SDKProvider sanityConfigs={_sanityConfigs}>{children}</SDKProvider>\n}\n"],"names":["window"],"mappings":";;;;;;;AAAO,SAAS,aAAsB;AACpC,SAAO,OAAO,SAAW,OAAe,OAAO,SAAS,OAAO;AACjE;AAUO,SAAS,WAAWA,SAAyB;AAClD,QAAM,MAAM,OAAOA,UAAW,MAAcA,QAAO,SAAS,OAAO;AAEnE,SACE,IAAI,WAAW,kBAAkB,KACjC,IAAI,WAAW,mBAAmB,KAClC,IAAI,WAAW,kBAAkB,KACjC,IAAI,WAAW,mBAAmB;AAEtC;ACVO,MAAM,kBAAkB,MAAM;AAAA,EACnC,YAAY,OAAgB;AAExB,WAAO,SAAU,YACf,SACF,aAAa,SACb,OAAO,MAAM,WAAY,WAEzB,MAAM,MAAM,OAAO,IAEnB,MAAM,GAGR,KAAK,QAAQ;AAAA,EAAA;AAEjB;ACvBA,MAAM,QAAQ;AAAA,EACZ;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EAAA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AEA,6BACG,gBAAe,EAAA,iBACd,UAAC,oBAAA,cAAA,EAAc,SAAS,CAAA,GAC1B;AAEJ;AChBA,MAAM,WAAW;AAgCV,SAAS,UAAU,EAAC,eAAe,YAAyC;AACjF,QAAM,CAAC,gBAAgB,gBAAgB,IAAI,SAAyB,aAAa;AAEjF,SAAA,UAAU,MAAM;AACV,QAAA;AAEJ,WAAI,WAEF,IAAA;AAAA,MACE,cAAc,IAAI,CAAC,kBAAkB;AAAA,QACnC,GAAG;AAAA,QACH,MAAM;AAAA,UACJ,GAAG,aAAa;AAAA,UAChB,aAAa;AAAA,QAAA;AAAA,MACf,EACA;AAAA,QAEM,WAAW,MAAM,MAE3B,UAAU,WAAW,MAAM;AAEzB,cAAQ,KAAK,uBAAuB,QAAQ,GAC5C,OAAO,SAAS,QAAQ,QAAQ;AAAA,IAC/B,GAAA,GAAI,IAEF,MAAM,aAAa,OAAO;AAAA,EAAA,GAChC,CAAC,aAAa,CAAC,GAEV,oBAAA,aAAA,EAAY,eAAe,gBAAiB,UAAS;AAC/D;"}
|
|
1
|
+
{"version":3,"file":"components.js","sources":["../src/components/utils.ts","../src/components/auth/AuthError.ts","../src/components/auth/LoginFooter.tsx","../src/components/auth/LoginLayout.tsx","../src/components/auth/Login.tsx","../src/components/auth/LoginCallback.tsx","../src/components/auth/LoginError.tsx","../src/components/auth/AuthBoundary.tsx","../src/components/SDKProvider.tsx","../src/components/SanityApp.tsx"],"sourcesContent":["export function isInIframe(): boolean {\n return typeof window !== 'undefined' && window.self !== window.top\n}\n\n/**\n * @internal\n *\n * Checks if the current URL is a local URL.\n *\n * @param window - The window object\n * @returns True if the current URL is a local URL, false otherwise\n */\nexport function isLocalUrl(window: Window): boolean {\n const url = typeof window !== 'undefined' ? window.location.href : ''\n\n return (\n url.startsWith('http://localhost') ||\n url.startsWith('https://localhost') ||\n url.startsWith('http://127.0.0.1') ||\n url.startsWith('https://127.0.0.1')\n )\n}\n","/**\n * Error class for authentication-related errors. Wraps errors thrown during the\n * authentication flow.\n *\n * @remarks\n * This class provides a consistent error type for authentication failures while\n * preserving the original error as the cause. If the original error has a\n * message property, it will be used as the error message.\n *\n * @alpha\n */\nexport class AuthError extends Error {\n constructor(error: unknown) {\n if (\n typeof error === 'object' &&\n !!error &&\n 'message' in error &&\n typeof error.message === 'string'\n ) {\n super(error.message)\n } else {\n super()\n }\n\n this.cause = error\n }\n}\n","import {SanityLogo} from '@sanity/logos'\nimport {Fragment} from 'react'\n\nconst LINKS = [\n {\n url: 'https://slack.sanity.io/',\n i18nKey: 'workspaces.community-title',\n title: 'Community',\n },\n {\n url: 'https://www.sanity.io/docs',\n i18nKey: 'workspaces.docs-title',\n title: 'Docs',\n },\n {\n url: 'https://www.sanity.io/legal/privacy',\n i18nKey: 'workspaces.privacy-title',\n title: 'Privacy',\n },\n {\n url: 'https://www.sanity.io',\n i18nKey: 'workspaces.sanity-io-title',\n title: 'sanity.io',\n },\n]\n\n/**\n * Default footer component for login screens showing Sanity branding and legal\n * links.\n *\n * @alpha\n */\nexport function LoginFooter(): React.ReactNode {\n return (\n <div className=\"sc-login-footer\">\n <SanityLogo className=\"sc-login-footer__logo\" />\n\n <ul className=\"sc-login-footer__links\">\n {LINKS.map((link) => (\n <Fragment key={link.title}>\n <li className=\"sc-login-footer__link\">\n <a href={link.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {link.title}\n </a>\n </li>\n </Fragment>\n ))}\n </ul>\n </div>\n )\n}\n","import {LoginFooter} from './LoginFooter'\n\n/**\n * @alpha\n */\nexport interface LoginLayoutProps {\n /** Optional header content rendered at top of card */\n header?: React.ReactNode\n\n /** Optional footer content rendered below card. Defaults to an internal login footer */\n footer?: React.ReactNode\n\n /** Main content rendered in card body */\n children?: React.ReactNode\n}\n\n/**\n * Layout component for login-related screens providing consistent styling and structure.\n * Renders content in a centered card with optional header and footer sections.\n *\n * Can be used to build custom login screens for the AuthBoundary component, including:\n * - Login provider selection (LoginComponent)\n * - OAuth callback handling (CallbackComponent)\n * - Error states (LoginErrorComponent)\n *\n * @example\n * ```tsx\n * // Custom login screen using the layout\n * function CustomLogin({header, footer}: LoginLayoutProps) {\n * return (\n * <LoginLayout\n * header={header}\n * footer={footer}\n * >\n * <CustomLoginContent />\n * </LoginLayout>\n * )\n * }\n *\n * // Use with AuthBoundary\n * <AuthBoundary\n * LoginComponent={CustomLogin}\n * header={<Logo />}\n * >\n * <ProtectedContent />\n * </AuthBoundary>\n * ```\n *\n * @alpha\n */\nexport function LoginLayout({\n children,\n footer = <LoginFooter />,\n header,\n}: LoginLayoutProps): React.ReactNode {\n return (\n <div className=\"sc-login-layout\">\n <div className=\"sc-login-layout__container\">\n <div className=\"sc-login-layout__card\">\n {header && <div className=\"sc-login-layout__card-header\">{header}</div>}\n\n {children && <div className=\"sc-login-layout__card-body\">{children}</div>}\n </div>\n\n {footer}\n </div>\n </div>\n )\n}\n","import {type JSX, Suspense} from 'react'\n\nimport {useLoginUrls} from '../../hooks/auth/useLoginUrls'\nimport {LoginLayout, type LoginLayoutProps} from './LoginLayout'\n\n/**\n * Login component that displays available authentication providers.\n * Renders a list of login options with a loading fallback while providers load.\n *\n * @alpha\n * @internal\n */\nexport function Login({header, footer}: LoginLayoutProps): JSX.Element {\n return (\n <LoginLayout header={header} footer={footer}>\n <div className=\"sc-login\">\n <h1 className=\"sc-login__title\">Choose login provider</h1>\n\n <Suspense fallback={<div className=\"sc-login__loading\">Loading…</div>}>\n <Providers />\n </Suspense>\n </div>\n </LoginLayout>\n )\n}\n\nfunction Providers() {\n const loginUrls = useLoginUrls()\n\n return (\n <div className=\"sc-login-providers\">\n {loginUrls.map(({title, url}) => (\n <a key={url} href={url}>\n {title}\n </a>\n ))}\n </div>\n )\n}\n","import {useEffect} from 'react'\n\nimport {useHandleCallback} from '../../hooks/auth/useHandleCallback'\nimport {LoginLayout, type LoginLayoutProps} from './LoginLayout'\n\n/**\n/**\n * Component shown during auth callback processing that handles login completion.\n * Automatically processes the auth callback when mounted and updates the URL\n * to remove callback parameters without triggering a page reload.\n *\n * @alpha\n */\nexport function LoginCallback({header, footer}: LoginLayoutProps): React.ReactNode {\n const handleCallback = useHandleCallback()\n\n useEffect(() => {\n const url = new URL(location.href)\n handleCallback(url.toString()).then((replacementLocation) => {\n if (replacementLocation) {\n // history API with `replaceState` is used to prevent a reload but still\n // remove the short-lived token from the URL\n history.replaceState(null, '', replacementLocation)\n }\n })\n }, [handleCallback])\n\n return (\n <LoginLayout header={header} footer={footer}>\n <div className=\"sc-login-callback\">\n <h1 className=\"sc-login-callback__title\">Logging you in…</h1>\n <div className=\"sc-login-callback__loading\">Loading…</div>\n </div>\n </LoginLayout>\n )\n}\n","import {useCallback} from 'react'\nimport {type FallbackProps} from 'react-error-boundary'\n\nimport {useLogOut} from '../../hooks/auth/useLogOut'\nimport {AuthError} from './AuthError'\nimport {LoginLayout, type LoginLayoutProps} from './LoginLayout'\n\n/**\n * @alpha\n */\nexport type LoginErrorProps = FallbackProps & LoginLayoutProps\n\n/**\n * Displays authentication error details and provides retry functionality.\n * Only handles {@link AuthError} instances - rethrows other error types.\n *\n * @alpha\n */\nexport function LoginError({\n error,\n resetErrorBoundary,\n header,\n footer,\n}: LoginErrorProps): React.ReactNode {\n if (!(error instanceof AuthError)) throw error\n const logout = useLogOut()\n\n const handleRetry = useCallback(async () => {\n await logout()\n resetErrorBoundary()\n }, [logout, resetErrorBoundary])\n\n return (\n <LoginLayout header={header} footer={footer}>\n <div className=\"sc-login-error\">\n <div className=\"sc-login-error__content\">\n <h2 className=\"sc-login-error__title\">Authentication Error</h2>\n <p className=\"sc-login-error__description\">\n Please try again or contact support if the problem persists.\n </p>\n </div>\n\n <button className=\"sc-login-error__button\" onClick={handleRetry}>\n Retry\n </button>\n </div>\n </LoginLayout>\n )\n}\n","import {AuthStateType} from '@sanity/sdk'\nimport {useMemo} from 'react'\nimport {ErrorBoundary, type FallbackProps} from 'react-error-boundary'\n\nimport {useAuthState} from '../../hooks/auth/useAuthState'\nimport {isInIframe} from '../utils'\nimport {AuthError} from './AuthError'\nimport {Login} from './Login'\nimport {LoginCallback} from './LoginCallback'\nimport {LoginError, type LoginErrorProps} from './LoginError'\nimport {type LoginLayoutProps} from './LoginLayout'\n\n// Only import bridge if we're in an iframe. This assumes that the app is\n// running within SanityOS if it is in an iframe.\nif (isInIframe()) {\n const parsedUrl = new URL(window.location.href)\n const mode = new URLSearchParams(parsedUrl.hash.slice(1)).get('mode')\n const script = document.createElement('script')\n script.src =\n mode === 'core-ui--staging'\n ? 'https://core.sanity-cdn.work/bridge.js'\n : 'https://core.sanity-cdn.com/bridge.js'\n script.type = 'module'\n script.async = true\n document.head.appendChild(script)\n}\n\n/**\n * @internal\n */\ninterface AuthBoundaryProps extends LoginLayoutProps {\n /**\n * Custom component to render the login screen.\n * Receives all login layout props. Defaults to {@link Login}.\n */\n LoginComponent?: React.ComponentType<LoginLayoutProps>\n\n /**\n * Custom component to render during OAuth callback processing.\n * Receives all login layout props. Defaults to {@link LoginCallback}.\n */\n CallbackComponent?: React.ComponentType<LoginLayoutProps>\n\n /**\n * Custom component to render when authentication errors occur.\n * Receives login layout props and error boundary props. Defaults to\n * {@link LoginError}\n */\n LoginErrorComponent?: React.ComponentType<LoginErrorProps>\n}\n\n/**\n * A component that handles authentication flow and error boundaries for a\n * protected section of the application.\n *\n * @remarks\n * This component manages different authentication states and renders the\n * appropriate components based on that state.\n *\n * @example\n * ```tsx\n * function App() {\n * return (\n * <AuthBoundary header={<MyLogo />}>\n * <ProtectedContent />\n * </AuthBoundary>\n * )\n * }\n * ```\n *\n * @internal\n */\nexport function AuthBoundary({\n LoginErrorComponent = LoginError,\n ...props\n}: AuthBoundaryProps): React.ReactNode {\n const {header, footer} = props\n const FallbackComponent = useMemo(() => {\n return function LoginComponentWithLayoutProps(fallbackProps: FallbackProps) {\n return <LoginErrorComponent {...fallbackProps} header={header} footer={footer} />\n }\n }, [header, footer, LoginErrorComponent])\n\n return (\n <ErrorBoundary FallbackComponent={FallbackComponent}>\n <AuthSwitch {...props} />\n </ErrorBoundary>\n )\n}\n\ninterface AuthSwitchProps extends LoginLayoutProps {\n LoginComponent?: React.ComponentType<LoginLayoutProps>\n CallbackComponent?: React.ComponentType<LoginLayoutProps>\n}\n\nfunction AuthSwitch({\n LoginComponent = Login,\n CallbackComponent = LoginCallback,\n children,\n ...props\n}: AuthSwitchProps) {\n const authState = useAuthState()\n\n switch (authState.type) {\n case AuthStateType.ERROR: {\n throw new AuthError(authState.error)\n }\n case AuthStateType.LOGGING_IN: {\n return <CallbackComponent {...props} />\n }\n case AuthStateType.LOGGED_IN: {\n return children\n }\n default: {\n return <LoginComponent {...props} />\n }\n }\n}\n","import {createSanityInstance, type SanityConfig} from '@sanity/sdk'\nimport {type ReactElement, type ReactNode, Suspense, useMemo} from 'react'\n\nimport {SanityProvider} from '../context/SanityProvider'\nimport {AuthBoundary} from './auth/AuthBoundary'\n\nconst DEFAULT_FALLBACK = (\n <>\n Warning: No fallback provided. Please supply a fallback prop to ensure proper Suspense handling.\n </>\n)\n\n/**\n * @internal\n */\nexport interface SDKProviderProps {\n children: ReactNode\n sanityConfigs: SanityConfig[]\n fallback: ReactNode\n}\n\n/**\n * @internal\n *\n * Top-level context provider that provides access to the Sanity SDK.\n */\nexport function SDKProvider({children, sanityConfigs, fallback}: SDKProviderProps): ReactElement {\n const sanityInstances = useMemo(() => {\n return sanityConfigs.map((sanityConfig: SanityConfig) => createSanityInstance(sanityConfig))\n }, [sanityConfigs])\n\n return (\n <SanityProvider sanityInstances={sanityInstances}>\n {/* This Suspense boundary is necessary because some hooks may suspend.\n It ensures that the Sanity instance state created above remains stable\n before rendering the AuthBoundary and its children. */}\n <Suspense fallback={fallback ?? DEFAULT_FALLBACK}>\n <AuthBoundary>{children}</AuthBoundary>\n </Suspense>\n </SanityProvider>\n )\n}\n","import {type SanityConfig} from '@sanity/sdk'\nimport {type ReactElement, useEffect, useState} from 'react'\n\nimport {SDKProvider} from './SDKProvider'\nimport {isInIframe, isLocalUrl} from './utils'\n\n/**\n * @public\n */\nexport interface SanityAppProps {\n sanityConfigs: SanityConfig[]\n children: React.ReactNode\n fallback: React.ReactNode\n}\n\nconst CORE_URL = 'https://core.sanity.io'\n\n/**\n * @public\n *\n * The SanityApp component provides your Sanity application with access to your Sanity configuration,\n * as well as application context and state which is used by the Sanity React hooks. Your application\n * must be wrapped with the SanityApp component to function properly.\n *\n * @param props - Your Sanity configuration and the React children to render\n * @returns Your Sanity application, integrated with your Sanity configuration and application context\n *\n * @example\n * ```tsx\n * import { SanityApp } from '@sanity/sdk-react'\n *\n * import MyAppRoot from './Root'\n *\n * // Single project configuration\n * const mySanityConfigs = [\n * {\n * projectId: 'my-project-id',\n * dataset: 'production',\n * },\n * ]\n *\n * // Or multiple project configurations\n * const multipleConfigs = [\n * // Configuration for your main project. This will be used as the default project for all hooks if no resource ID override is provided.\n * {\n * projectId: 'marketing-website-project',\n * dataset: 'production',\n * },\n * // Configuration for a separate blog project\n * {\n * projectId: 'blog-project',\n * dataset: 'production',\n * },\n * // Configuration for a separate ecommerce project\n * {\n * projectId: 'ecommerce-project',\n * dataset: 'production',\n * }\n * ]\n *\n * export default function MyApp() {\n * return (\n * <SanityApp sanityConfigs={mySanityConfigs}>\n * <MyAppRoot />\n * </SanityApp>\n * )\n * }\n * ```\n */\nexport function SanityApp({sanityConfigs, children, fallback}: SanityAppProps): ReactElement {\n const [_sanityConfigs, setSanityConfigs] = useState<SanityConfig[]>(sanityConfigs)\n\n useEffect(() => {\n let timeout: NodeJS.Timeout | undefined\n\n if (isInIframe()) {\n // When running in an iframe Content OS, we don't want to store tokens\n setSanityConfigs(\n sanityConfigs.map((sanityConfig) => ({\n ...sanityConfig,\n auth: {\n ...sanityConfig.auth,\n storageArea: undefined,\n },\n })),\n )\n } else if (!isLocalUrl(window)) {\n // If the app is not running in an iframe and is not a local url, redirect to core.\n timeout = setTimeout(() => {\n // eslint-disable-next-line no-console\n console.warn('Redirecting to core', CORE_URL)\n window.location.replace(CORE_URL)\n }, 1000)\n }\n return () => clearTimeout(timeout)\n }, [sanityConfigs])\n\n return (\n <SDKProvider sanityConfigs={_sanityConfigs} fallback={fallback}>\n {children}\n </SDKProvider>\n )\n}\n"],"names":["window"],"mappings":";;;;;;;AAAO,SAAS,aAAsB;AACpC,SAAO,OAAO,SAAW,OAAe,OAAO,SAAS,OAAO;AACjE;AAUO,SAAS,WAAWA,SAAyB;AAClD,QAAM,MAAM,OAAOA,UAAW,MAAcA,QAAO,SAAS,OAAO;AAEnE,SACE,IAAI,WAAW,kBAAkB,KACjC,IAAI,WAAW,mBAAmB,KAClC,IAAI,WAAW,kBAAkB,KACjC,IAAI,WAAW,mBAAmB;AAEtC;ACVO,MAAM,kBAAkB,MAAM;AAAA,EACnC,YAAY,OAAgB;AAExB,WAAO,SAAU,YACf,SACF,aAAa,SACb,OAAO,MAAM,WAAY,WAEzB,MAAM,MAAM,OAAO,IAEnB,MAAM,GAGR,KAAK,QAAQ;AAAA,EAAA;AAEjB;ACvBA,MAAM,QAAQ;AAAA,EACZ;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAEX;AAQO,SAAS,cAA+B;AAE3C,SAAA,qBAAC,OAAI,EAAA,WAAU,mBACb,UAAA;AAAA,IAAC,oBAAA,YAAA,EAAW,WAAU,wBAAwB,CAAA;AAAA,IAE7C,oBAAA,MAAA,EAAG,WAAU,0BACX,UAAM,MAAA,IAAI,CAAC,SACT,oBAAA,UAAA,EACC,UAAC,oBAAA,MAAA,EAAG,WAAU,yBACZ,UAAA,oBAAC,KAAE,EAAA,MAAM,KAAK,KAAK,QAAO,UAA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