sanity 6.1.0-next.37 → 6.1.0-next.38

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.
@@ -1,4 +1,4 @@
1
- var version = "6.1.0-next.37+a9372805fd";
1
+ var version = "6.1.0-next.38+467aa574d6";
2
2
  let buildVersion;
3
3
  try {
4
4
  buildVersion = process.env.PKG_BUILD_VERSION;
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "6.1.0-next.37+a9372805fd";
10
+ "6.1.0-next.38+467aa574d6";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -85319,12 +85319,12 @@ function DocumentLimitsUpsellPanel() {
85319
85319
  }
85320
85320
  const isDocumentLimitError = (error) => error instanceof ClientError ? error.response.body.error.type === "documentLimitExceededError" : !1, StudioAuthReadyMeasured = defineEvent({
85321
85321
  name: "Studio Auth Ready Measured",
85322
- version: 1,
85323
- description: "Time from browser navigation start to the moment Studio resolves the auth state (logged-in, logged-out, or unauthorized)."
85322
+ version: 2,
85323
+ description: "Time from browser navigation start to the moment Studio resolves the auth state (logged-in, logged-out, or unauthorized), with page-visibility context to distinguish foreground loads from backgrounded ones."
85324
85324
  }), StudioReadyMeasured = defineEvent({
85325
85325
  name: "Studio Ready Measured",
85326
- version: 1,
85327
- description: "Time from browser navigation start to the moment the active tool has first rendered and the Studio layout is interactive."
85326
+ version: 2,
85327
+ description: "Time from browser navigation start to the moment the active tool has first rendered and the Studio layout is interactive, with page-visibility context to distinguish foreground loads from backgrounded ones."
85328
85328
  }), checkPath = "/ping", checkRequestTag = "protocol-check";
85329
85329
  function isUsingLegacyHttp(client) {
85330
85330
  return getProtocolForApi(client).pipe(map((protocol) => {
@@ -86822,6 +86822,21 @@ function StudioErrorBoundary(props2) {
86822
86822
  let t3;
86823
86823
  return $[16] !== caughtError.error || $[17] !== caughtError.eventId || $[18] !== heading ? (t3 = /* @__PURE__ */ jsx(FallbackErrorScreen, { heading, error: caughtError.error, eventId: caughtError.eventId, onReset: handleResetError }), $[16] = caughtError.error, $[17] = caughtError.eventId, $[18] = heading, $[19] = t3) : t3 = $[19], t3;
86824
86824
  }
86825
+ const isBrowser = typeof document < "u";
86826
+ let firstHiddenTime = isBrowser && document.visibilityState === "hidden" ? 0 : Number.POSITIVE_INFINITY;
86827
+ function handleVisibilityChange() {
86828
+ document.visibilityState === "hidden" && firstHiddenTime === Number.POSITIVE_INFINITY && (firstHiddenTime = performance.now());
86829
+ }
86830
+ isBrowser && document.addEventListener("visibilitychange", handleVisibilityChange, {
86831
+ capture: !0
86832
+ });
86833
+ function getPageVisibilitySnapshot(measuredAt = isBrowser ? performance.now() : 0) {
86834
+ return {
86835
+ wasHidden: firstHiddenTime < measuredAt,
86836
+ visibilityState: isBrowser ? document.visibilityState : "visible",
86837
+ firstHiddenTime: firstHiddenTime === Number.POSITIVE_INFINITY ? null : Math.round(firstHiddenTime)
86838
+ };
86839
+ }
86825
86840
  const StudioToolMountTimeMeasured = defineEvent({
86826
86841
  name: "Studio Tool Mount Time Measured",
86827
86842
  version: 1,
@@ -86897,11 +86912,16 @@ function StudioLayoutComponent() {
86897
86912
  }, t6 = [documentTitle, toolControlsDocumentTitle], $[13] = documentTitle, $[14] = toolControlsDocumentTitle, $[15] = t5, $[16] = t6) : (t5 = $[15], t6 = $[16]), useEffect(t5, t6);
86898
86913
  let t7, t8;
86899
86914
  $[17] !== activeTool || $[18] !== telemetry || $[19] !== tools.length ? (t7 = () => {
86900
- studioReadyFired || activeTool && (studioReadyFired = !0, telemetry.log(StudioReadyMeasured, {
86901
- durationMs: performance.now(),
86915
+ if (studioReadyFired || !activeTool)
86916
+ return;
86917
+ studioReadyFired = !0;
86918
+ const durationMs = performance.now();
86919
+ telemetry.log(StudioReadyMeasured, {
86920
+ durationMs,
86902
86921
  toolsCount: tools.length,
86903
- activeToolName: activeTool.name
86904
- }));
86922
+ activeToolName: activeTool.name,
86923
+ ...getPageVisibilitySnapshot(durationMs)
86924
+ });
86905
86925
  }, t8 = [activeTool, telemetry, tools.length], $[17] = activeTool, $[18] = telemetry, $[19] = tools.length, $[20] = t7, $[21] = t8) : (t7 = $[20], t8 = $[21]), useEffect(t7, t8);
86906
86926
  let t9;
86907
86927
  $[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = (open) => {
@@ -90976,10 +90996,15 @@ function AuthBoundary(t0) {
90976
90996
  }, t5 = [loggedIn, telemetry, mountTime], $[0] = loggedIn, $[1] = mountTime, $[2] = telemetry, $[3] = t4, $[4] = t5) : (t4 = $[3], t5 = $[4]), useEffect(t4, t5);
90977
90997
  let t6, t7;
90978
90998
  $[5] !== loggedIn || $[6] !== telemetry ? (t6 = () => {
90979
- authReadyFired || loggedIn !== "loading" && (authReadyFired = !0, telemetry.log(StudioAuthReadyMeasured, {
90980
- durationMs: performance.now(),
90981
- authState: loggedIn
90982
- }));
90999
+ if (authReadyFired || loggedIn === "loading")
91000
+ return;
91001
+ authReadyFired = !0;
91002
+ const durationMs = performance.now();
91003
+ telemetry.log(StudioAuthReadyMeasured, {
91004
+ durationMs,
91005
+ authState: loggedIn,
91006
+ ...getPageVisibilitySnapshot(durationMs)
91007
+ });
90983
91008
  }, t7 = [loggedIn, telemetry], $[5] = loggedIn, $[6] = telemetry, $[7] = t6, $[8] = t7) : (t6 = $[7], t7 = $[8]), useEffect(t6, t7);
90984
91009
  let t8, t9;
90985
91010
  $[9] !== activeWorkspace.auth || $[10] !== telemetry ? (t8 = () => {