@sevenfold/setto-client 0.2.6 → 0.2.8

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.
@@ -9,6 +9,8 @@ export declare const STALE_BUILDING_MS: number;
9
9
  export declare function isDeploymentStale(row: Pick<DeploymentRow, 'status' | 'started_at' | 'updated_at'>): boolean;
10
10
  /** Latest in-flight deployment for a site, if any (ignores stale rows). */
11
11
  export declare function fetchInProgressDeploymentId(supabase: SupabaseClient, siteId: string): Promise<string | null>;
12
+ /** Wait for a deployment row (e.g. webhook backstop) after trackingDeferred publish. */
13
+ export declare function waitForDeploymentByCommit(supabase: SupabaseClient, siteId: string, commitSha: string, timeoutMs?: number): Promise<string | null>;
12
14
  /** Subscribe to a single deployment row via Supabase Realtime. */
13
15
  export declare function useDeploymentStatus(supabase: SupabaseClient, deploymentId: string | null): {
14
16
  row: DeploymentRow | null;
@@ -21672,6 +21672,15 @@ async function fetchInProgressDeploymentId(supabase, siteId) {
21672
21672
  const fresh = rows.find((r) => !isDeploymentStale(r));
21673
21673
  return fresh?.id ?? null;
21674
21674
  }
21675
+ async function waitForDeploymentByCommit(supabase, siteId, commitSha, timeoutMs = 6e4) {
21676
+ const deadline = Date.now() + timeoutMs;
21677
+ while (Date.now() < deadline) {
21678
+ const { data } = await supabase.from("deployments").select("id").eq("site_id", siteId).eq("commit_sha", commitSha).order("started_at", { ascending: false }).limit(1).maybeSingle();
21679
+ if (data?.id) return data.id;
21680
+ await new Promise((r) => setTimeout(r, 2e3));
21681
+ }
21682
+ return null;
21683
+ }
21675
21684
  function useDeploymentStatus(supabase, deploymentId) {
21676
21685
  const [row, setRow] = useState(null);
21677
21686
  useEffect(() => {
@@ -22118,7 +22127,20 @@ function EditToolbar() {
22118
22127
  const result = await api.publish(config.siteId, files);
22119
22128
  store.commit();
22120
22129
  themeStore?.commit();
22121
- setActiveDeployment(result.deploymentId);
22130
+ let deploymentId = result.deploymentId;
22131
+ if (!deploymentId && result.trackingDeferred) {
22132
+ deploymentId = await waitForDeploymentByCommit(
22133
+ supabase,
22134
+ config.siteId,
22135
+ result.commitSha
22136
+ );
22137
+ }
22138
+ if (deploymentId) {
22139
+ setActiveDeployment(deploymentId);
22140
+ } else {
22141
+ setPublishDialogOpen(false);
22142
+ setPublishedNotice(true);
22143
+ }
22122
22144
  } catch (err) {
22123
22145
  setError(err instanceof Error ? err.message : "unknown error");
22124
22146
  setPublishDialogOpen(false);
@@ -22629,6 +22651,17 @@ function T({ k }) {
22629
22651
  e.preventDefault();
22630
22652
  }
22631
22653
  };
22654
+ const handleKeyDown = (e) => {
22655
+ if (!isLinkContext(e.currentTarget)) return;
22656
+ e.stopPropagation();
22657
+ };
22658
+ const handleKeyUp = (e) => {
22659
+ if (!isLinkContext(e.currentTarget)) return;
22660
+ if (e.key === " " || e.key === "Enter") {
22661
+ e.preventDefault();
22662
+ e.stopPropagation();
22663
+ }
22664
+ };
22632
22665
  const commit = (el) => {
22633
22666
  const text = el.textContent ?? "";
22634
22667
  store?.set(k, i18n.language, text);
@@ -22664,6 +22697,8 @@ function T({ k }) {
22664
22697
  onMouseDown: handleMouseDown,
22665
22698
  onMouseUp: handleMouseUp,
22666
22699
  onClick: handleClick,
22700
+ onKeyDown: handleKeyDown,
22701
+ onKeyUp: handleKeyUp,
22667
22702
  style: {
22668
22703
  cursor: "text",
22669
22704
  color: "inherit",