hyperframes 0.7.29 → 0.7.31

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>HyperFrames Studio</title>
8
- <script type="module" crossorigin src="/assets/index-mz4av-V1.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DeqMZHQ4.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DmkOvZns.css">
10
10
  </head>
11
11
  <body>
@@ -1602,27 +1602,28 @@ async function flushEvents() {
1602
1602
  clearTimeout(timeout);
1603
1603
  }
1604
1604
  }
1605
+ function flushViaBeacon() {
1606
+ if (flushTimer) {
1607
+ clearInterval(flushTimer);
1608
+ flushTimer = null;
1609
+ }
1610
+ if (queue.length === 0) return;
1611
+ const batch = queue.map((e) => ({
1612
+ event: e.event,
1613
+ properties: { ...e.properties, $ip: null },
1614
+ distinct_id: getDistinctId(),
1615
+ timestamp: e.timestamp
1616
+ }));
1617
+ queue = [];
1618
+ const body = JSON.stringify({ api_key: POSTHOG_API_KEY, batch });
1619
+ try {
1620
+ navigator.sendBeacon(`${POSTHOG_HOST}/batch/`, body);
1621
+ } catch {
1622
+ }
1623
+ }
1605
1624
  if (typeof window !== "undefined") {
1606
1625
  window.addEventListener("visibilitychange", () => {
1607
- if (document.visibilityState === "hidden") {
1608
- if (flushTimer) {
1609
- clearInterval(flushTimer);
1610
- flushTimer = null;
1611
- }
1612
- if (queue.length === 0) return;
1613
- const batch = queue.map((e) => ({
1614
- event: e.event,
1615
- properties: { ...e.properties, $ip: null },
1616
- distinct_id: getDistinctId(),
1617
- timestamp: e.timestamp
1618
- }));
1619
- queue = [];
1620
- const body = JSON.stringify({ api_key: POSTHOG_API_KEY, batch });
1621
- try {
1622
- navigator.sendBeacon(`${POSTHOG_HOST}/batch/`, body);
1623
- } catch {
1624
- }
1625
- }
1626
+ if (document.visibilityState === "hidden") flushViaBeacon();
1626
1627
  });
1627
1628
  }
1628
1629
 
@@ -22467,6 +22468,42 @@ function sdkResolverShadowCheck(session, hfId, ops, sourceContent) {
22467
22468
  if (inverse.length > 0) session.applyPatches(inverse);
22468
22469
  }
22469
22470
  }
22471
+ var attemptCounts = {};
22472
+ function recordAttempt(opLabel) {
22473
+ attemptCounts[opLabel] = (attemptCounts[opLabel] ?? 0) + 1;
22474
+ ensureAttemptFlushScheduled();
22475
+ }
22476
+ function flushAttemptCounts() {
22477
+ const keys = Object.keys(attemptCounts);
22478
+ if (keys.length === 0) return null;
22479
+ const snapshot = {};
22480
+ for (const key of keys) {
22481
+ snapshot[key] = attemptCounts[key];
22482
+ delete attemptCounts[key];
22483
+ }
22484
+ return snapshot;
22485
+ }
22486
+ var ATTEMPT_FLUSH_INTERVAL_MS = 5 * 6e4;
22487
+ var attemptFlushTimer = null;
22488
+ var attemptVisibilityHandler = null;
22489
+ function flushAndEmitAttempts() {
22490
+ const counts = flushAttemptCounts();
22491
+ if (counts === null) return;
22492
+ trackStudioEvent("sdk_resolver_shadow_attempt", { counts: JSON.stringify(counts) });
22493
+ }
22494
+ function ensureAttemptFlushScheduled() {
22495
+ if (!attemptFlushTimer) {
22496
+ attemptFlushTimer = setInterval(flushAndEmitAttempts, ATTEMPT_FLUSH_INTERVAL_MS);
22497
+ }
22498
+ if (!attemptVisibilityHandler && typeof document !== "undefined") {
22499
+ attemptVisibilityHandler = () => {
22500
+ if (document.visibilityState !== "hidden") return;
22501
+ flushAndEmitAttempts();
22502
+ flushViaBeacon();
22503
+ };
22504
+ document.addEventListener("visibilitychange", attemptVisibilityHandler);
22505
+ }
22506
+ }
22470
22507
  function redactValue(value) {
22471
22508
  if (value == null) return value;
22472
22509
  return `[redacted len=${value.length}]`;
@@ -22482,6 +22519,7 @@ function runResolverShadow(session, hfId, ops, sourceContent) {
22482
22519
  if (!STUDIO_SDK_RESOLVER_SHADOW_ENABLED) return;
22483
22520
  if (!hfId) return;
22484
22521
  try {
22522
+ recordAttempt("dom-edit");
22485
22523
  const mismatches = sdkResolverShadowCheck(session, hfId, ops, sourceContent);
22486
22524
  if (mismatches.length === 0) return;
22487
22525
  const isElementNotFound = mismatches.some((m) => m.kind === "element_not_found");
@@ -22511,6 +22549,7 @@ async function recordResolverParity(session, hfId, opLabel, readSource) {
22511
22549
  if (!STUDIO_SDK_RESOLVER_SHADOW_ENABLED) return;
22512
22550
  if (!session || !hfId) return;
22513
22551
  try {
22552
+ recordAttempt(opLabel);
22514
22553
  if (resolveSnapshot(session, hfId)) return;
22515
22554
  const sessionElementCount = session.getElements().length;
22516
22555
  let source;
@@ -22550,6 +22589,7 @@ function recordAnimationResolverParity(session, animationId, opLabel) {
22550
22589
  if (!STUDIO_SDK_RESOLVER_SHADOW_ENABLED) return;
22551
22590
  if (!session || !animationId) return;
22552
22591
  try {
22592
+ recordAttempt(opLabel);
22553
22593
  const elements = session.getElements();
22554
22594
  const resolves = elements.some((el) => el.animationIds.includes(animationId));
22555
22595
  if (resolves) return;