@sanity/sdk-react 2.20.0 → 2.20.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 +154 -52
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { StrictMode, Suspense, createContext, use, useCallback, useContext, useE
|
|
|
5
5
|
import { ErrorBoundary, getErrorMessage } from "react-error-boundary";
|
|
6
6
|
import { SDK_CHANNEL_NAME, SDK_NODE_NAME } from "@sanity/message-protocol";
|
|
7
7
|
import { EMPTY, Observable, distinctUntilChanged, filter, firstValueFrom, identity, startWith, switchMap } from "rxjs";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { getCommentsOptionsKey, initTelemetry, isDeepEqual, parseCommentsOptionsKey, pickProperties, trackHookMounted } from "@sanity/sdk/_internal";
|
|
9
10
|
import { createRoot } from "react-dom/client";
|
|
10
11
|
import "groq";
|
|
@@ -159,7 +160,7 @@ const ComlinkTokenRefreshProvider = (t0) => {
|
|
|
159
160
|
let $ = c(2), { children } = t0, instance = useSanityInstance(), isInDashboard = getIsInDashboardState(instance).getCurrent(), isStudio = isStudioConfig(instance.config);
|
|
160
161
|
if (isInDashboard && !isStudio) {
|
|
161
162
|
let t1;
|
|
162
|
-
return $[0] === children ? t1 = $[1] : (t1 =
|
|
163
|
+
return $[0] === children ? t1 = $[1] : (t1 = /* @__PURE__ */ jsx(DashboardTokenRefresh, { children }), $[0] = children, $[1] = t1), t1;
|
|
163
164
|
}
|
|
164
165
|
return children;
|
|
165
166
|
};
|
|
@@ -283,15 +284,45 @@ const styles = {
|
|
|
283
284
|
};
|
|
284
285
|
function Error$1(t0) {
|
|
285
286
|
let $ = c(13), { heading, description, code, cta } = t0, t1;
|
|
286
|
-
$[0] === heading ? t1 = $[1] : (t1 =
|
|
287
|
+
$[0] === heading ? t1 = $[1] : (t1 = /* @__PURE__ */ jsx("h1", {
|
|
288
|
+
style: styles.heading,
|
|
289
|
+
children: heading
|
|
290
|
+
}), $[0] = heading, $[1] = t1);
|
|
287
291
|
let t2;
|
|
288
|
-
$[2] === description ? t2 = $[3] : (t2 = description &&
|
|
292
|
+
$[2] === description ? t2 = $[3] : (t2 = description && /* @__PURE__ */ jsx("p", {
|
|
293
|
+
style: styles.paragraph,
|
|
294
|
+
dangerouslySetInnerHTML: { __html: description }
|
|
295
|
+
}), $[2] = description, $[3] = t2);
|
|
289
296
|
let t3;
|
|
290
|
-
$[4] === code ? t3 = $[5] : (t3 = code &&
|
|
297
|
+
$[4] === code ? t3 = $[5] : (t3 = code && /* @__PURE__ */ jsx("code", {
|
|
298
|
+
style: styles.code,
|
|
299
|
+
children: code
|
|
300
|
+
}), $[4] = code, $[5] = t3);
|
|
291
301
|
let t4;
|
|
292
|
-
$[6] === cta ? t4 = $[7] : (t4 = cta && (cta.href || cta.onClick) &&
|
|
302
|
+
$[6] === cta ? t4 = $[7] : (t4 = cta && (cta.href || cta.onClick) && /* @__PURE__ */ jsx("p", {
|
|
303
|
+
style: styles.paragraph,
|
|
304
|
+
children: cta.href ? /* @__PURE__ */ jsx("a", {
|
|
305
|
+
style: styles.link,
|
|
306
|
+
href: cta.href,
|
|
307
|
+
target: "_blank",
|
|
308
|
+
rel: "noopener noreferrer",
|
|
309
|
+
children: cta.text
|
|
310
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
311
|
+
style: styles.link,
|
|
312
|
+
onClick: cta.onClick,
|
|
313
|
+
children: cta.text
|
|
314
|
+
})
|
|
315
|
+
}), $[6] = cta, $[7] = t4);
|
|
293
316
|
let t5;
|
|
294
|
-
return $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4 ? (t5 =
|
|
317
|
+
return $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxs("div", {
|
|
318
|
+
style: styles.container,
|
|
319
|
+
children: [
|
|
320
|
+
t1,
|
|
321
|
+
t2,
|
|
322
|
+
t3,
|
|
323
|
+
t4
|
|
324
|
+
]
|
|
325
|
+
}), $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
|
|
295
326
|
}
|
|
296
327
|
function reload() {
|
|
297
328
|
try {
|
|
@@ -319,10 +350,14 @@ function ChunkLoadError(_props) {
|
|
|
319
350
|
alreadyAttempted || (setChunkReloadFlag(), reload());
|
|
320
351
|
}, t2 = [alreadyAttempted], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2), !alreadyAttempted) return null;
|
|
321
352
|
let t3;
|
|
322
|
-
return $[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 =
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
353
|
+
return $[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Error$1, {
|
|
354
|
+
heading: "A new version is available",
|
|
355
|
+
description: "The page tried to load an asset that no longer exists. Reload to continue with the latest version.",
|
|
356
|
+
cta: {
|
|
357
|
+
text: "Reload page",
|
|
358
|
+
onClick: _temp$7
|
|
359
|
+
}
|
|
360
|
+
}), $[3] = t3) : t3 = $[3], t3;
|
|
326
361
|
}
|
|
327
362
|
function _temp$7() {
|
|
328
363
|
clearChunkReloadFlag(), reload();
|
|
@@ -334,14 +369,17 @@ function CorsErrorComponent(t0) {
|
|
|
334
369
|
url.searchParams.set("cors", "add"), url.searchParams.set("origin", origin), url.searchParams.set("credentials", "include"), t1 = url.toString(), $[0] = projectId, $[1] = t1;
|
|
335
370
|
} else t1 = $[1];
|
|
336
371
|
let corsUrl = t1, t2;
|
|
337
|
-
return $[2] !== corsUrl || $[3] !== error || $[4] !== projectId ? (t2 =
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
372
|
+
return $[2] !== corsUrl || $[3] !== error || $[4] !== projectId ? (t2 = /* @__PURE__ */ jsx(Error$1, {
|
|
373
|
+
heading: "Before you continue…",
|
|
374
|
+
...projectId ? {
|
|
375
|
+
description: "To access your content, you need to <strong>add the following URL as a CORS origin</strong> to your Sanity project.",
|
|
376
|
+
code: origin,
|
|
377
|
+
cta: {
|
|
378
|
+
text: "Manage CORS configuration",
|
|
379
|
+
href: corsUrl
|
|
380
|
+
}
|
|
381
|
+
} : { description: getErrorMessage(error) }
|
|
382
|
+
}), $[2] = corsUrl, $[3] = error, $[4] = projectId, $[5] = t2) : t2 = $[5], t2;
|
|
345
383
|
}
|
|
346
384
|
function isInIframe() {
|
|
347
385
|
return typeof window < "u" && window.self !== window.top;
|
|
@@ -523,16 +561,23 @@ function LoginError(t0) {
|
|
|
523
561
|
isProjectUserNotFound
|
|
524
562
|
], $[12] = clientError, $[13] = handleRetry, $[14] = isInDashboard, $[15] = isProjectUserNotFound, $[16] = t6, $[17] = t7) : (t6 = $[16], t7 = $[17]), useEffect(t6, t7);
|
|
525
563
|
let t8;
|
|
526
|
-
$[18] === dashboardAccessProjectId ? t8 = $[19] : (t8 = dashboardAccessProjectId &&
|
|
564
|
+
$[18] === dashboardAccessProjectId ? t8 = $[19] : (t8 = dashboardAccessProjectId && /* @__PURE__ */ jsx(Suspense, {
|
|
565
|
+
fallback: null,
|
|
566
|
+
children: /* @__PURE__ */ jsx(DashboardAccessRequest, { projectId: dashboardAccessProjectId })
|
|
567
|
+
}), $[18] = dashboardAccessProjectId, $[19] = t8);
|
|
527
568
|
let t9 = error instanceof ConfigurationError ? "Configuration Error" : "Authentication Error", t10;
|
|
528
569
|
$[20] !== handleRetry || $[21] !== showRetryCta ? (t10 = showRetryCta ? {
|
|
529
570
|
text: "Retry",
|
|
530
571
|
onClick: handleRetry
|
|
531
572
|
} : void 0, $[20] = handleRetry, $[21] = showRetryCta, $[22] = t10) : t10 = $[22];
|
|
532
573
|
let t11;
|
|
533
|
-
$[23] !== authErrorMessage || $[24] !== t10 || $[25] !== t9 ? (t11 =
|
|
574
|
+
$[23] !== authErrorMessage || $[24] !== t10 || $[25] !== t9 ? (t11 = /* @__PURE__ */ jsx(Error$1, {
|
|
575
|
+
heading: t9,
|
|
576
|
+
description: authErrorMessage,
|
|
577
|
+
cta: t10
|
|
578
|
+
}), $[23] = authErrorMessage, $[24] = t10, $[25] = t9, $[26] = t11) : t11 = $[26];
|
|
534
579
|
let t12;
|
|
535
|
-
return $[27] !== t11 || $[28] !== t8 ? (t12 =
|
|
580
|
+
return $[27] !== t11 || $[28] !== t8 ? (t12 = /* @__PURE__ */ jsxs(Fragment, { children: [t8, t11] }), $[27] = t11, $[28] = t8, $[29] = t12) : t12 = $[29], t12;
|
|
536
581
|
}
|
|
537
582
|
if (isInIframe() && !document.querySelector("[data-sanity-core]")) {
|
|
538
583
|
let parsedUrl = new URL(window.location.href), mode = new URLSearchParams(parsedUrl.hash.slice(1)).get("mode"), script = document.createElement("script");
|
|
@@ -564,14 +609,21 @@ function AuthBoundary(t0) {
|
|
|
564
609
|
$[0] === t0 ? (props = $[1], t1 = $[2]) : ({LoginErrorComponent: t1, ...props} = t0, $[0] = t0, $[1] = props, $[2] = t1);
|
|
565
610
|
let LoginErrorComponent = t1 === void 0 ? LoginError : t1, authState = useAuthState(), sessionResetKey = authState.type === AuthStateType.LOGGED_IN ? authState.token : authState.type, t2;
|
|
566
611
|
$[3] === LoginErrorComponent ? t2 = $[4] : (t2 = function LoginComponentWithLayoutProps(fallbackProps) {
|
|
567
|
-
return isImportError(fallbackProps.error) ?
|
|
612
|
+
return isImportError(fallbackProps.error) ? /* @__PURE__ */ jsx(ChunkLoadError, { ...fallbackProps }) : fallbackProps.error instanceof CorsOriginError ? /* @__PURE__ */ jsx(CorsErrorComponent, {
|
|
613
|
+
...fallbackProps,
|
|
614
|
+
projectId: getCorsErrorProjectId(fallbackProps.error)
|
|
615
|
+
}) : /* @__PURE__ */ jsx(LoginErrorComponent, { ...fallbackProps });
|
|
568
616
|
}, $[3] = LoginErrorComponent, $[4] = t2);
|
|
569
617
|
let FallbackComponent = t2, t3;
|
|
570
618
|
$[5] === sessionResetKey ? t3 = $[6] : (t3 = [sessionResetKey], $[5] = sessionResetKey, $[6] = t3);
|
|
571
619
|
let t4;
|
|
572
|
-
$[7] === props ? t4 = $[8] : (t4 =
|
|
620
|
+
$[7] === props ? t4 = $[8] : (t4 = /* @__PURE__ */ jsx(AuthSwitch, { ...props }), $[7] = props, $[8] = t4);
|
|
573
621
|
let t5;
|
|
574
|
-
return $[9] !== FallbackComponent || $[10] !== t3 || $[11] !== t4 ? (t5 =
|
|
622
|
+
return $[9] !== FallbackComponent || $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(ComlinkTokenRefreshProvider, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
623
|
+
FallbackComponent,
|
|
624
|
+
resetKeys: t3,
|
|
625
|
+
children: t4
|
|
626
|
+
}) }), $[9] = FallbackComponent, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
|
|
575
627
|
}
|
|
576
628
|
function AuthSwitch(t0) {
|
|
577
629
|
let $ = c(16), children, projectIds, props, t1, t2;
|
|
@@ -590,7 +642,7 @@ function AuthSwitch(t0) {
|
|
|
590
642
|
case AuthStateType.ERROR: throw new AuthError(authState.error);
|
|
591
643
|
case AuthStateType.LOGGING_IN: {
|
|
592
644
|
let t6;
|
|
593
|
-
return $[13] !== CallbackComponent || $[14] !== props ? (t6 =
|
|
645
|
+
return $[13] !== CallbackComponent || $[14] !== props ? (t6 = /* @__PURE__ */ jsx(CallbackComponent, { ...props }), $[13] = CallbackComponent, $[14] = props, $[15] = t6) : t6 = $[15], t6;
|
|
594
646
|
}
|
|
595
647
|
case AuthStateType.LOGGED_IN: return children;
|
|
596
648
|
case AuthStateType.LOGGED_OUT: return null;
|
|
@@ -722,7 +774,10 @@ function InferredResourcesProvider(t0) {
|
|
|
722
774
|
...explicitResources
|
|
723
775
|
}, $[3] = explicitResources, $[4] = inferred, $[5] = t1) : t1 = $[5];
|
|
724
776
|
let resources = t1, t2;
|
|
725
|
-
return $[6] !== children || $[7] !== resources ? (t2 =
|
|
777
|
+
return $[6] !== children || $[7] !== resources ? (t2 = /* @__PURE__ */ jsx(ResourcesContext.Provider, {
|
|
778
|
+
value: resources,
|
|
779
|
+
children
|
|
780
|
+
}), $[6] = children, $[7] = resources, $[8] = t2) : t2 = $[8], t2;
|
|
726
781
|
}
|
|
727
782
|
/**
|
|
728
783
|
* When `inferMediaLibraryAndCanvas` is set, this component suspends until
|
|
@@ -738,10 +793,18 @@ function OrganizationResourcesProvider(t0) {
|
|
|
738
793
|
let explicitResources = t2, instance = useSanityInstance(), orgId = useDashboardOrganizationId();
|
|
739
794
|
if (!inferMediaLibraryAndCanvas || !orgId) {
|
|
740
795
|
let t3;
|
|
741
|
-
return $[2] !== children || $[3] !== explicitResources ? (t3 =
|
|
796
|
+
return $[2] !== children || $[3] !== explicitResources ? (t3 = /* @__PURE__ */ jsx(ResourcesContext.Provider, {
|
|
797
|
+
value: explicitResources,
|
|
798
|
+
children
|
|
799
|
+
}), $[2] = children, $[3] = explicitResources, $[4] = t3) : t3 = $[4], t3;
|
|
742
800
|
}
|
|
743
801
|
let t3;
|
|
744
|
-
return $[5] !== children || $[6] !== explicitResources || $[7] !== instance || $[8] !== orgId ? (t3 =
|
|
802
|
+
return $[5] !== children || $[6] !== explicitResources || $[7] !== instance || $[8] !== orgId ? (t3 = /* @__PURE__ */ jsx(InferredResourcesProvider, {
|
|
803
|
+
instance,
|
|
804
|
+
orgId,
|
|
805
|
+
explicitResources,
|
|
806
|
+
children
|
|
807
|
+
}), $[5] = children, $[6] = explicitResources, $[7] = instance, $[8] = orgId, $[9] = t3) : t3 = $[9], t3;
|
|
745
808
|
}
|
|
746
809
|
/**
|
|
747
810
|
* Provides the active DocumentResource for a subtree.
|
|
@@ -788,13 +851,17 @@ const ResourceContext = createContext(void 0), PerspectiveContext = createContex
|
|
|
788
851
|
*/
|
|
789
852
|
function SanityInstanceProvider(t0) {
|
|
790
853
|
let $ = c(6), { instance, fallback, children } = t0, t1;
|
|
791
|
-
$[0] !== children || $[1] !== fallback ? (t1 =
|
|
854
|
+
$[0] !== children || $[1] !== fallback ? (t1 = /* @__PURE__ */ jsx(Suspense, {
|
|
855
|
+
fallback,
|
|
856
|
+
children
|
|
857
|
+
}), $[0] = children, $[1] = fallback, $[2] = t1) : t1 = $[2];
|
|
792
858
|
let t2;
|
|
793
|
-
return $[3] !== instance || $[4] !== t1 ? (t2 =
|
|
859
|
+
return $[3] !== instance || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(SanityInstanceContext.Provider, {
|
|
860
|
+
value: instance,
|
|
861
|
+
children: t1
|
|
862
|
+
}), $[3] = instance, $[4] = t1, $[5] = t2) : t2 = $[5], t2;
|
|
794
863
|
}
|
|
795
|
-
const DEFAULT_FALLBACK =
|
|
796
|
-
Warning: No fallback provided. Please supply a fallback prop to ensure proper Suspense handling.
|
|
797
|
-
</>;
|
|
864
|
+
const DEFAULT_FALLBACK = /* @__PURE__ */ jsx(Fragment, { children: "Warning: No fallback provided. Please supply a fallback prop to ensure proper Suspense handling." });
|
|
798
865
|
/**
|
|
799
866
|
* Provides Sanity configuration to child components through React Context.
|
|
800
867
|
*
|
|
@@ -873,13 +940,26 @@ function ResourceProvider(t0) {
|
|
|
873
940
|
};
|
|
874
941
|
}), t8 = [instance, parentInstance], $[18] = instance, $[19] = parentInstance, $[20] = t7, $[21] = t8) : (t7 = $[20], t8 = $[21]), useEffect(t7, t8);
|
|
875
942
|
let t9 = fallback === void 0 ? DEFAULT_FALLBACK : fallback, t10 = perspective ?? parentPerspective, t11;
|
|
876
|
-
$[22] !== children || $[23] !== t10 ? (t11 =
|
|
943
|
+
$[22] !== children || $[23] !== t10 ? (t11 = /* @__PURE__ */ jsx(PerspectiveContext.Provider, {
|
|
944
|
+
value: t10,
|
|
945
|
+
children
|
|
946
|
+
}), $[22] = children, $[23] = t10, $[24] = t11) : t11 = $[24];
|
|
877
947
|
let t12;
|
|
878
|
-
$[25] !== effectiveProjectId || $[26] !== t11 ? (t12 =
|
|
948
|
+
$[25] !== effectiveProjectId || $[26] !== t11 ? (t12 = /* @__PURE__ */ jsx(ProjectContext.Provider, {
|
|
949
|
+
value: effectiveProjectId,
|
|
950
|
+
children: t11
|
|
951
|
+
}), $[25] = effectiveProjectId, $[26] = t11, $[27] = t12) : t12 = $[27];
|
|
879
952
|
let t13;
|
|
880
|
-
$[28] !== effectiveResource || $[29] !== t12 ? (t13 =
|
|
953
|
+
$[28] !== effectiveResource || $[29] !== t12 ? (t13 = /* @__PURE__ */ jsx(ResourceContext.Provider, {
|
|
954
|
+
value: effectiveResource,
|
|
955
|
+
children: t12
|
|
956
|
+
}), $[28] = effectiveResource, $[29] = t12, $[30] = t13) : t13 = $[30];
|
|
881
957
|
let t14;
|
|
882
|
-
return $[31] !== instance || $[32] !== t13 || $[33] !== t9 ? (t14 =
|
|
958
|
+
return $[31] !== instance || $[32] !== t13 || $[33] !== t9 ? (t14 = /* @__PURE__ */ jsx(SanityInstanceProvider, {
|
|
959
|
+
instance,
|
|
960
|
+
fallback: t9,
|
|
961
|
+
children: t13
|
|
962
|
+
}), $[31] = instance, $[32] = t13, $[33] = t9, $[34] = t14) : t14 = $[34], t14;
|
|
883
963
|
}
|
|
884
964
|
/**
|
|
885
965
|
* Clears the chunk-reload flag once children render successfully past the
|
|
@@ -929,13 +1009,29 @@ function SDKProvider(t0) {
|
|
|
929
1009
|
$[19] !== config || $[20] !== t3 ? (t4 = new Set([...t3, ...(Array.isArray(config) ? config : [config]).map(_temp3$1)].filter(_temp4)), $[19] = config, $[20] = t3, $[21] = t4) : t4 = $[21], t2 = Array.from(t4), $[14] = config, $[15] = resourcesValue, $[16] = t2;
|
|
930
1010
|
} else t2 = $[16];
|
|
931
1011
|
let projectIds = t2, t3;
|
|
932
|
-
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t3 =
|
|
1012
|
+
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(ResetChunkReloadFlagOnMount, {}), $[22] = t3) : t3 = $[22];
|
|
933
1013
|
let t4 = resourcesValue[DEFAULT_RESOURCE_NAME], t5;
|
|
934
|
-
$[23] !== children || $[24] !== inferMediaLibraryAndCanvas || $[25] !== resourcesValue ? (t5 =
|
|
1014
|
+
$[23] !== children || $[24] !== inferMediaLibraryAndCanvas || $[25] !== resourcesValue ? (t5 = /* @__PURE__ */ jsx(OrganizationResourcesProvider, {
|
|
1015
|
+
resources: resourcesValue,
|
|
1016
|
+
inferMediaLibraryAndCanvas,
|
|
1017
|
+
children
|
|
1018
|
+
}), $[23] = children, $[24] = inferMediaLibraryAndCanvas, $[25] = resourcesValue, $[26] = t5) : t5 = $[26];
|
|
935
1019
|
let t6;
|
|
936
|
-
$[27] !== projectIds || $[28] !== props || $[29] !== t5 ? (t6 =
|
|
1020
|
+
$[27] !== projectIds || $[28] !== props || $[29] !== t5 ? (t6 = /* @__PURE__ */ jsx(AuthBoundary, {
|
|
1021
|
+
...props,
|
|
1022
|
+
projectIds,
|
|
1023
|
+
children: t5
|
|
1024
|
+
}), $[27] = projectIds, $[28] = props, $[29] = t5, $[30] = t6) : t6 = $[30];
|
|
937
1025
|
let t7;
|
|
938
|
-
return $[31] !== defaultConfig || $[32] !== fallback || $[33] !== t4 || $[34] !== t6 ? (t7 =
|
|
1026
|
+
return $[31] !== defaultConfig || $[32] !== fallback || $[33] !== t4 || $[34] !== t6 ? (t7 = /* @__PURE__ */ jsxs(ErrorBoundary, {
|
|
1027
|
+
FallbackComponent: ChunkAwareFallback,
|
|
1028
|
+
children: [t3, /* @__PURE__ */ jsx(ResourceProvider, {
|
|
1029
|
+
...defaultConfig,
|
|
1030
|
+
resource: t4,
|
|
1031
|
+
fallback,
|
|
1032
|
+
children: t6
|
|
1033
|
+
})]
|
|
1034
|
+
}), $[31] = defaultConfig, $[32] = fallback, $[33] = t4, $[34] = t6, $[35] = t7) : t7 = $[35], t7;
|
|
939
1035
|
}
|
|
940
1036
|
function _temp4(id) {
|
|
941
1037
|
return !!id;
|
|
@@ -950,7 +1046,7 @@ function ChunkAwareFallback(fallbackProps) {
|
|
|
950
1046
|
let $ = c(2);
|
|
951
1047
|
if (isImportError(fallbackProps.error)) {
|
|
952
1048
|
let t0;
|
|
953
|
-
return $[0] === fallbackProps ? t0 = $[1] : (t0 =
|
|
1049
|
+
return $[0] === fallbackProps ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(ChunkLoadError, { ...fallbackProps }), $[0] = fallbackProps, $[1] = t0), t0;
|
|
954
1050
|
}
|
|
955
1051
|
throw fallbackProps.error;
|
|
956
1052
|
}
|
|
@@ -1061,7 +1157,12 @@ function SanityApp(t0) {
|
|
|
1061
1157
|
studioWorkspace
|
|
1062
1158
|
], $[8] = configProp, $[9] = resolvedConfig, $[10] = studioWorkspace, $[11] = t2, $[12] = t3) : (t2 = $[11], t3 = $[12]), useEffect(t2, t3);
|
|
1063
1159
|
let t4;
|
|
1064
|
-
return $[13] !== children || $[14] !== fallback || $[15] !== props || $[16] !== resolvedConfig ? (t4 =
|
|
1160
|
+
return $[13] !== children || $[14] !== fallback || $[15] !== props || $[16] !== resolvedConfig ? (t4 = /* @__PURE__ */ jsx(SDKProvider, {
|
|
1161
|
+
...props,
|
|
1162
|
+
fallback,
|
|
1163
|
+
config: resolvedConfig,
|
|
1164
|
+
children
|
|
1165
|
+
}), $[13] = children, $[14] = fallback, $[15] = props, $[16] = resolvedConfig, $[17] = t4) : t4 = $[17], t4;
|
|
1065
1166
|
}
|
|
1066
1167
|
function _temp$4() {
|
|
1067
1168
|
console.warn("Redirecting to core", REDIRECT_URL), window.location.replace(REDIRECT_URL);
|
|
@@ -1070,14 +1171,15 @@ function _temp$4() {
|
|
|
1070
1171
|
function renderSanityApp(rootElement, namedSources, options, children) {
|
|
1071
1172
|
if (!rootElement) throw Error("Missing root element to mount application into");
|
|
1072
1173
|
let { reactStrictMode = !1 } = options, root = createRoot(rootElement), config = Object.values(namedSources);
|
|
1073
|
-
return root.render(reactStrictMode ?
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1174
|
+
return root.render(reactStrictMode ? /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(SanityApp, {
|
|
1175
|
+
config,
|
|
1176
|
+
fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }),
|
|
1177
|
+
children
|
|
1178
|
+
}) }) : /* @__PURE__ */ jsx(SanityApp, {
|
|
1179
|
+
config,
|
|
1180
|
+
fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }),
|
|
1181
|
+
children
|
|
1182
|
+
})), () => root.unmount();
|
|
1081
1183
|
}
|
|
1082
1184
|
/**
|
|
1083
1185
|
* Pure function that normalizes options by resolving `resourceName` to a `DocumentResource`
|
|
@@ -4361,7 +4463,7 @@ function useUsers(options) {
|
|
|
4361
4463
|
loadMore
|
|
4362
4464
|
}, $[20] = data, $[21] = hasMore, $[22] = isPending, $[23] = loadMore, $[24] = t8) : t8 = $[24], t8;
|
|
4363
4465
|
}
|
|
4364
|
-
var version = "2.20.
|
|
4466
|
+
var version = "2.20.1";
|
|
4365
4467
|
function getEnv(key) {
|
|
4366
4468
|
if (import.meta.env) return import.meta.env[key];
|
|
4367
4469
|
if (typeof process < "u" && process.env) return process.env[key];
|