@levo-so/site-runtime 0.3.0 → 0.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.
Files changed (4) hide show
  1. package/index.d.ts +27 -3
  2. package/index.js +716 -691
  3. package/package.json +1 -1
  4. package/styles.css +1 -1
package/index.d.ts CHANGED
@@ -297,6 +297,12 @@ export declare interface ILevoPopupsProps {
297
297
  * workspace-wide active popups are returned.
298
298
  */
299
299
  siteId?: string;
300
+ /**
301
+ * The current page's platform id, read from the head by `LevoSiteProvider` (see
302
+ * `../pageId`). Feeds page-bound targeting rules ("show on the pricing page", "show on
303
+ * all blog posts"). Absent → those rules never match; URL-path rules still do.
304
+ */
305
+ pageId?: string;
300
306
  }
301
307
 
302
308
  /** A single-record binding — one collection record / blog post / event by `slug` (a detail page). */
@@ -437,6 +443,13 @@ export declare interface IPatchedHistoryFn {
437
443
 
438
444
  /** The full `meta/<route>.json` shape: page identity (platform-owned) + the SEO object. */
439
445
  export declare interface IPlatformMetaFile {
446
+ /**
447
+ * The platform's page id. Stamped by the platform (never by the AI) and used for
448
+ * analytics `page_id` + popup page-bound targeting — see `./pageId`. Ships empty on
449
+ * sites provisioned before the platform started stamping it; empty = simply absent,
450
+ * every consumer degrades to URL-based behavior.
451
+ */
452
+ id?: string;
440
453
  title?: string;
441
454
  description?: string;
442
455
  meta?: IPlatformPageMeta;
@@ -741,9 +754,10 @@ export declare const LevoForm: React.FC<ILevoFormProps>;
741
754
  * everything else: it fetches active popups, evaluates page/referrer targeting against the
742
755
  * current URL, lazy-loads the renderer only when popups exist, and self-hides otherwise.
743
756
  *
744
- * No `pageId` is threaded: that is a studio DB page id with no equivalent in a code-routed
745
- * site, so page-bound rules don't apply here — site-wide and URL-path targeting (the
746
- * `is_all_pages` / `contains` / `begins_with` matchers) do.
757
+ * `pageId` comes from the matched route's `meta/<route>.json` (the provider reads it off the
758
+ * head — see `../pageId`), which is what makes page-bound rules work on a code-routed site.
759
+ * Sites whose meta files carry no id still get site-wide and URL-path targeting (the
760
+ * `is_all_pages` / `contains` / `begins_with` matchers).
747
761
  */
748
762
  export declare const LevoPopups: React.FC<ILevoPopupsProps>;
749
763
 
@@ -764,6 +778,9 @@ export declare const LevoSiteProvider: React.FC<{
764
778
  children: React.ReactNode;
765
779
  }>;
766
780
 
781
+ /** `name` of the head tag carrying the page id. Written by `levoHead`, read by `readPageId`. */
782
+ export declare const PAGE_ID_META = "levo:page-id";
783
+
767
784
  /**
768
785
  * Renders a page's metadata as document tags. Pages include it anywhere in their JSX —
769
786
  * React 19 hoists <title>/<meta>/<link> into <head> (SSR too); scripts render in place
@@ -818,6 +835,13 @@ export declare const prefetchLevoSources: ({ queryClient, config, sources, param
818
835
  params?: Record<string, string>;
819
836
  }) => Promise<Record<string, unknown>>;
820
837
 
838
+ /**
839
+ * The id the currently matched route stamped into the head, or null when the site's
840
+ * platform hasn't stamped ids into its meta files yet (the field ships empty). Client-only —
841
+ * returns null during SSR, so callers must read it in an effect.
842
+ */
843
+ export declare const readPageId: () => string | null;
844
+
821
845
  /** What `system` resolves to — the class actually on `<html>`. */
822
846
  export declare type ResolvedColorMode = "dark" | "light";
823
847