@sanity/sdk-react 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -142,7 +142,9 @@ const ComlinkTokenRefreshProvider = (t0) => {
|
|
|
142
142
|
children
|
|
143
143
|
} = t0, instance = useSanityInstance();
|
|
144
144
|
let t1;
|
|
145
|
-
|
|
145
|
+
t1 = getIsInDashboardState(instance).getCurrent();
|
|
146
|
+
const isInDashboard = t1, studioModeEnabled = !!instance.config.studioMode?.enabled;
|
|
147
|
+
if (isInDashboard && !studioModeEnabled) {
|
|
146
148
|
let t2;
|
|
147
149
|
return $[0] !== children ? (t2 = /* @__PURE__ */ jsx(DashboardTokenRefresh, { children }), $[0] = children, $[1] = t2) : t2 = $[1], t2;
|
|
148
150
|
}
|
|
@@ -353,7 +355,7 @@ function AuthBoundary(t0) {
|
|
|
353
355
|
return $[7] !== FallbackComponent || $[8] !== t4 ? (t5 = /* @__PURE__ */ jsx(ComlinkTokenRefreshProvider, { children: /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent, children: t4 }) }), $[7] = FallbackComponent, $[8] = t4, $[9] = t5) : t5 = $[9], t5;
|
|
354
356
|
}
|
|
355
357
|
function AuthSwitch(t0) {
|
|
356
|
-
const $ = c(
|
|
358
|
+
const $ = c(14);
|
|
357
359
|
let children, projectIds, props, t1, t2;
|
|
358
360
|
$[0] !== t0 ? ({
|
|
359
361
|
CallbackComponent: t1,
|
|
@@ -362,11 +364,11 @@ function AuthSwitch(t0) {
|
|
|
362
364
|
projectIds,
|
|
363
365
|
...props
|
|
364
366
|
} = t0, $[0] = t0, $[1] = children, $[2] = projectIds, $[3] = props, $[4] = t1, $[5] = t2) : (children = $[1], projectIds = $[2], props = $[3], t1 = $[4], t2 = $[5]);
|
|
365
|
-
const CallbackComponent = t1 === void 0 ? LoginCallback : t1, verifyOrganization = t2 === void 0 ? !0 : t2, authState = useAuthState(),
|
|
367
|
+
const CallbackComponent = t1 === void 0 ? LoginCallback : t1, verifyOrganization = t2 === void 0 ? !0 : t2, authState = useAuthState(), studioModeEnabled = useSanityInstance().config.studioMode?.enabled, disableVerifyOrg = !verifyOrganization || studioModeEnabled || authState.type !== AuthStateType.LOGGED_IN, orgError = useVerifyOrgProjects(disableVerifyOrg, projectIds), isLoggedOut = authState.type === AuthStateType.LOGGED_OUT && !authState.isDestroyingSession, loginUrl = useLoginUrl();
|
|
366
368
|
let t3, t4;
|
|
367
|
-
if ($[6] !== isLoggedOut || $[7] !== loginUrl ? (t3 = () => {
|
|
368
|
-
isLoggedOut && !isInIframe() && (window.location.href = loginUrl);
|
|
369
|
-
}, t4 = [isLoggedOut, loginUrl], $[6] = isLoggedOut, $[7] = loginUrl, $[8] =
|
|
369
|
+
if ($[6] !== isLoggedOut || $[7] !== loginUrl || $[8] !== studioModeEnabled ? (t3 = () => {
|
|
370
|
+
isLoggedOut && !isInIframe() && !studioModeEnabled && (window.location.href = loginUrl);
|
|
371
|
+
}, t4 = [isLoggedOut, loginUrl, studioModeEnabled], $[6] = isLoggedOut, $[7] = loginUrl, $[8] = studioModeEnabled, $[9] = t3, $[10] = t4) : (t3 = $[9], t4 = $[10]), useEffect(t3, t4), verifyOrganization && orgError)
|
|
370
372
|
throw new ConfigurationError({
|
|
371
373
|
message: orgError
|
|
372
374
|
});
|
|
@@ -375,7 +377,7 @@ function AuthSwitch(t0) {
|
|
|
375
377
|
throw new AuthError(authState.error);
|
|
376
378
|
case AuthStateType.LOGGING_IN: {
|
|
377
379
|
let t5;
|
|
378
|
-
return $[
|
|
380
|
+
return $[11] !== CallbackComponent || $[12] !== props ? (t5 = /* @__PURE__ */ jsx(CallbackComponent, { ...props }), $[11] = CallbackComponent, $[12] = props, $[13] = t5) : t5 = $[13], t5;
|
|
379
381
|
}
|
|
380
382
|
case AuthStateType.LOGGED_IN:
|
|
381
383
|
return children;
|
|
@@ -1231,7 +1233,7 @@ function useUsers(options) {
|
|
|
1231
1233
|
loadMore
|
|
1232
1234
|
};
|
|
1233
1235
|
}
|
|
1234
|
-
var version = "2.3.
|
|
1236
|
+
var version = "2.3.1";
|
|
1235
1237
|
function getEnv(key) {
|
|
1236
1238
|
if (typeof import.meta < "u" && import.meta.env)
|
|
1237
1239
|
return import.meta.env[key];
|