@levo-so/site-runtime 0.3.0 → 0.3.7

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 (33) hide show
  1. package/{DateTimeWidget-C1jHOtz7.js → DateTimeWidget-Cctsvcrs.js} +2 -2
  2. package/Dialog-DVB4WpBS.js +130 -0
  3. package/{KBChatWidget-D7F9LRwI.js → KBChatWidget-Cnq0DCOQ.js} +383 -435
  4. package/LevoProvider-nmIbMlsk.js +20 -0
  5. package/{PhoneWidget-_nw97rkI.js → PhoneWidget-J3VTMWJH.js} +2 -2
  6. package/{PopupRenderer-Bncp54gB-DuCULkBK.js → PopupBody-DZVwDLkg-yrot8Uqb.js} +201 -910
  7. package/PopupRenderer-BjW1jg70-Biwj2bIc.js +387 -0
  8. package/{RichTextWidget-D-mGlES0.js → RichTextWidget-BOrVIR2j.js} +10 -9
  9. package/{VerifyButton-BkP98H17.js → VerifyButton-CA1GtEZJ.js} +20 -19
  10. package/{theme.cssm-2YTdd8Yh.js → createThemeExtension-DhGk81nV.js} +2 -2
  11. package/{dist-DBbiX2ST.js → dist-C8gLeklT.js} +601 -598
  12. package/{dist-CJknSbJK.js → dist-Cb6sb7nO.js} +21 -22
  13. package/{inlineCollectionTheme-D2w17LHX.js → generateRadiusScale-54mE9ikx.js} +4 -19
  14. package/index.d.ts +42 -3
  15. package/index.js +724 -694
  16. package/{inlineBaseTheme-DS-AfUHi.js → inlineBaseTheme-B6E9zzyp.js} +2 -2
  17. package/inlineCollectionTheme-DYYMrmcE.js +19 -0
  18. package/{kbChat-AUJxjURc.js → kbChat-DIb4AS7E.js} +31 -26
  19. package/{nodeAlignment-Cn6xNtOP.js → nodeAlignment-D70kOcui.js} +13 -13
  20. package/package.json +9 -9
  21. package/pillChrome-BAu5AfCT.js +30 -0
  22. package/popupState-JmpeKzgM-qhNTV79U.js +229 -0
  23. package/popups.js +1 -1
  24. package/react-6kO0cqgr.js +74 -0
  25. package/rteTheme.cssm-xg0gJ28J.js +4 -0
  26. package/styles.css +1 -1
  27. package/theme.cssm-mkQwezuj.js +4 -0
  28. package/usePopupRedirect-BThP_YPW-DoixMAB9.js +80 -0
  29. package/Dialog-CzVhHLEY.js +0 -145
  30. package/pillChrome-AhXOWXIb.js +0 -20
  31. /package/{CollectionField-CzS-34zx.js → CollectionField-C59pmeQw.js} +0 -0
  32. /package/{Popover-q5dL7y0W.js → Popover-C7zZHBIc.js} +0 -0
  33. /package/{es-iCqKQf1c.js → es-CztjLuNy.js} +0 -0
@@ -1,11 +1,10 @@
1
1
  import { t as e } from "./rolldown-runtime-CAFD8bLK.js";
2
- import { d as t } from "./Dialog-CzVhHLEY.js";
3
- import { a as n, c as r, g as i, h as a, l as o, n as s, r as c, t as l } from "./PopupRenderer-Bncp54gB-DuCULkBK.js";
2
+ import { t } from "./LevoProvider-nmIbMlsk.js";
3
+ import { a as n, c as r, i, l as a, o, t as s, u as c } from "./popupState-JmpeKzgM-qhNTV79U.js";
4
+ import { t as l } from "./react-6kO0cqgr.js";
4
5
  import { Suspense as u, lazy as d, useEffect as f, useRef as p, useState as m } from "react";
5
6
  import { jsx as h } from "react/jsx-runtime";
6
7
  import { c as g } from "react/compiler-runtime";
7
- import "clsx";
8
- import "@tabler/icons-react";
9
8
  import { $isIdentityContextReady as _ } from "@levo-so/insights/stores";
10
9
  //#region ../../libraries/popups/dist/index.js
11
10
  var v = /* @__PURE__ */ e({
@@ -15,15 +14,15 @@ var v = /* @__PURE__ */ e({
15
14
  }), y = async (e, t) => {
16
15
  let n = {};
17
16
  return t?.site_id && (n.site_id = t.site_id), t?.locale && (n.locale = t.locale), t?.country && (n.country = t.country), (await e.url("/v1/studio/popup/list-active").query(n).get().json())?.content?.data ?? [];
18
- }, b = d(() => import("./PopupRenderer-Bncp54gB-DuCULkBK.js").then((e) => e.o).then((e) => e.t).then((e) => ({ default: e.PopupRenderer }))), x = (e) => {
19
- let n = g(9), { siteId: r, pageId: i } = e, { fetch: a, logger: o } = t(), [c, l] = m(null), d = p(!1), v, x;
20
- if (n[0] !== a || n[1] !== o || n[2] !== r ? (v = () => {
17
+ }, b = d(() => import("./PopupRenderer-BjW1jg70-Biwj2bIc.js").then((e) => e.t).then((e) => ({ default: e.PopupRenderer }))), x = (e) => {
18
+ let n = g(9), { siteId: r, pageId: i } = e, { fetch: a, logger: s } = t(), [c, l] = m(null), d = p(!1), v, x;
19
+ if (n[0] !== a || n[1] !== s || n[2] !== r ? (v = () => {
21
20
  if (d.current) return;
22
21
  let e = () => {
23
22
  d.current || (d.current = !0, y(a, r ? { site_id: r } : void 0).then((e) => {
24
- s(e), l(e);
23
+ o(e), l(e);
25
24
  }).catch((e) => {
26
- o?.error("Failed to fetch popups", { exception: e }), s([]), l([]);
25
+ s?.error("Failed to fetch popups", { exception: e }), o([]), l([]);
27
26
  }).finally(S));
28
27
  };
29
28
  if (_.get()) {
@@ -36,9 +35,9 @@ var v = /* @__PURE__ */ e({
36
35
  return () => t();
37
36
  }, x = [
38
37
  a,
39
- o,
38
+ s,
40
39
  r
41
- ], n[0] = a, n[1] = o, n[2] = r, n[3] = v, n[4] = x) : (v = n[3], x = n[4]), f(v, x), !c || c.length === 0) return null;
40
+ ], n[0] = a, n[1] = s, n[2] = r, n[3] = v, n[4] = x) : (v = n[3], x = n[4]), f(v, x), !c || c.length === 0) return null;
42
41
  let C;
43
42
  n[5] === Symbol.for("react.memo_cache_sentinel") ? (C = {
44
43
  position: "relative",
@@ -54,27 +53,27 @@ var v = /* @__PURE__ */ e({
54
53
  }), n[6] = i, n[7] = c, n[8] = w) : w = n[8], w;
55
54
  };
56
55
  function S() {
57
- return c(!1);
56
+ return a(!1);
58
57
  }
59
58
  var C = () => {
60
- let e = g(3), t = i(r), n = i(o), a = w, s = T, c;
61
- return e[0] !== n || e[1] !== t ? (c = {
59
+ let e = g(3), t = l(n), r = l(c), i = w, a = T, o;
60
+ return e[0] !== r || e[1] !== t ? (o = {
62
61
  popups: t,
63
- isLoading: n,
64
- openPopup: a,
65
- closePopup: s
66
- }, e[0] = n, e[1] = t, e[2] = c) : c = e[2], c;
62
+ isLoading: r,
63
+ openPopup: i,
64
+ closePopup: a
65
+ }, e[0] = r, e[1] = t, e[2] = o) : o = e[2], o;
67
66
  };
68
67
  function w(e) {
69
- let t = r.get().find((t) => t.id === e);
70
- t && n(t, {
68
+ let t = n.get().find((t) => t.id === e);
69
+ t && s(t, {
71
70
  force: !0,
72
71
  trigger_type: "manual"
73
72
  });
74
73
  }
75
74
  function T() {
76
- let e = a.get().active_popup_id;
77
- e && l(e);
75
+ let e = i.get().active_popup_id;
76
+ e && r(e);
78
77
  }
79
78
  //#endregion
80
79
  export { v as n, C as t };
@@ -1,6 +1,5 @@
1
- import { n as e } from "./theme.cssm-2YTdd8Yh.js";
2
1
  //#region ../../libraries/levocn/dist/styles/theme/themeVars.cssm.js
3
- var t = {
2
+ var e = {
4
3
  colors: {
5
4
  background: "var(--_1i5egzy0)",
6
5
  foreground: "var(--_1i5egzy1)",
@@ -53,7 +52,7 @@ var t = {
53
52
  xl: "var(--_1i5egzy16)",
54
53
  inner: "var(--_1i5egzy17)"
55
54
  }
56
- }, n = (e) => ({
55
+ }, t = (e) => ({
57
56
  sm: `calc(${e} * 0.5)`,
58
57
  base: e,
59
58
  md: `calc(${e} * 1.5)`,
@@ -67,20 +66,6 @@ var t = {
67
66
  "7xl": `calc(${e} * 20)`,
68
67
  "8xl": `calc(${e} * 24)`,
69
68
  full: "100%"
70
- }), r = {
71
- form: {
72
- maxWidth: "var(--_1092q7b0)",
73
- gap: "var(--_1092q7b1)",
74
- borderRadius: "var(--_1092q7b2)",
75
- labelFontSize: "var(--_1092q7b3)",
76
- helpFontSize: "var(--_1092q7b4)"
77
- },
78
- input: {
79
- fontSize: "var(--_1092q7b5)",
80
- height: "var(--_1092q7b6)",
81
- borderRadius: "var(--_1092q7b7)"
82
- },
83
- checkbox: { labelFontSize: "var(--_1092q7b8)" }
84
- }, i = e(r);
69
+ });
85
70
  //#endregion
86
- export { t as i, r as n, n as r, i as t };
71
+ export { e as n, t };
package/index.d.ts CHANGED
@@ -194,6 +194,21 @@ export declare interface ILayersNode {
194
194
  export declare interface ILevoChatProps {
195
195
  /** The site's root `site.json` — all chat props are derived from it. */
196
196
  site: ISiteJson;
197
+ /**
198
+ * The visitor's current URL path, sourced from TanStack Router in
199
+ * `LevoSiteProvider` (`useRouterState` → `state.location.pathname`). Forwarded
200
+ * to the widget's boot call so a multi-agent v3 site resolves the agent bound
201
+ * to this path, and RE-resolves it when the path changes on client navigation
202
+ * — the launcher mounts once at `__root` and never remounts across route
203
+ * changes, so this prop is the only signal that the URL moved. A v3 site is
204
+ * code-routed (no `[visitor]/[workspace]` rewrite), so the router pathname is
205
+ * already the visitor-facing URL. Omitted → the BE treats the path as "/" and
206
+ * the whole-site catch-all agent answers.
207
+ *
208
+ * Example: land on /pricing → path="/pricing" → Sales. Client-navigate to
209
+ * /help → path="/help" → Support. One mount, agent swapped.
210
+ */
211
+ path?: string;
197
212
  }
198
213
 
199
214
  /** The shape a page exports so its route loader can prefetch every binding it renders. */
@@ -297,6 +312,12 @@ export declare interface ILevoPopupsProps {
297
312
  * workspace-wide active popups are returned.
298
313
  */
299
314
  siteId?: string;
315
+ /**
316
+ * The current page's platform id, read from the head by `LevoSiteProvider` (see
317
+ * `../pageId`). Feeds page-bound targeting rules ("show on the pricing page", "show on
318
+ * all blog posts"). Absent → those rules never match; URL-path rules still do.
319
+ */
320
+ pageId?: string;
300
321
  }
301
322
 
302
323
  /** A single-record binding — one collection record / blog post / event by `slug` (a detail page). */
@@ -437,6 +458,13 @@ export declare interface IPatchedHistoryFn {
437
458
 
438
459
  /** The full `meta/<route>.json` shape: page identity (platform-owned) + the SEO object. */
439
460
  export declare interface IPlatformMetaFile {
461
+ /**
462
+ * The platform's page id. Stamped by the platform (never by the AI) and used for
463
+ * analytics `page_id` + popup page-bound targeting — see `./pageId`. Ships empty on
464
+ * sites provisioned before the platform started stamping it; empty = simply absent,
465
+ * every consumer degrades to URL-based behavior.
466
+ */
467
+ id?: string;
440
468
  title?: string;
441
469
  description?: string;
442
470
  meta?: IPlatformPageMeta;
@@ -741,9 +769,10 @@ export declare const LevoForm: React.FC<ILevoFormProps>;
741
769
  * everything else: it fetches active popups, evaluates page/referrer targeting against the
742
770
  * current URL, lazy-loads the renderer only when popups exist, and self-hides otherwise.
743
771
  *
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.
772
+ * `pageId` comes from the matched route's `meta/<route>.json` (the provider reads it off the
773
+ * head — see `../pageId`), which is what makes page-bound rules work on a code-routed site.
774
+ * Sites whose meta files carry no id still get site-wide and URL-path targeting (the
775
+ * `is_all_pages` / `contains` / `begins_with` matchers).
747
776
  */
748
777
  export declare const LevoPopups: React.FC<ILevoPopupsProps>;
749
778
 
@@ -764,6 +793,9 @@ export declare const LevoSiteProvider: React.FC<{
764
793
  children: React.ReactNode;
765
794
  }>;
766
795
 
796
+ /** `name` of the head tag carrying the page id. Written by `levoHead`, read by `readPageId`. */
797
+ export declare const PAGE_ID_META = "levo:page-id";
798
+
767
799
  /**
768
800
  * Renders a page's metadata as document tags. Pages include it anywhere in their JSX —
769
801
  * React 19 hoists <title>/<meta>/<link> into <head> (SSR too); scripts render in place
@@ -818,6 +850,13 @@ export declare const prefetchLevoSources: ({ queryClient, config, sources, param
818
850
  params?: Record<string, string>;
819
851
  }) => Promise<Record<string, unknown>>;
820
852
 
853
+ /**
854
+ * The id the currently matched route stamped into the head, or null when the site's
855
+ * platform hasn't stamped ids into its meta files yet (the field ships empty). Client-only —
856
+ * returns null during SSR, so callers must read it in an effect.
857
+ */
858
+ export declare const readPageId: () => string | null;
859
+
821
860
  /** What `system` resolves to — the class actually on `<html>`. */
822
861
  export declare type ResolvedColorMode = "dark" | "light";
823
862