@levo-so/studio 0.1.111 → 0.1.113

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,5 +1,5 @@
1
1
  "use client";
2
- import { l as e } from "./dist-bHoi1bCB.js";
2
+ import { l as e } from "./dist-D-y51gmU.js";
3
3
  import { n as t } from "./AuthProvider-C6bvedwF.js";
4
4
  import { t as n } from "./card-D5fPArfa.js";
5
5
  import { t as r } from "./MessageFooter-CHuPnL_D.js";
@@ -3,7 +3,7 @@ import { r as e, t } from "./inlineRteTheme-abXxag3B.js";
3
3
  import { t as ee } from "./RteThemeProvider-LFGzAYi1.js";
4
4
  import { l as te, t as ne, u as re } from "./CollectionField-DrJuHNsg.js";
5
5
  import { i as n } from "./Tooltip-DreKXbTO.js";
6
- import { r, t as ie } from "./Toolbar-D3PnF7Ud.js";
6
+ import { r, t as ie } from "./Toolbar-6IXR9qAh.js";
7
7
  import { c as ae } from "react/compiler-runtime";
8
8
  import { useEffect as i, useState as oe } from "react";
9
9
  import { jsx as a, jsxs as se } from "react/jsx-runtime";
@@ -2,7 +2,7 @@ import { t as e } from "./Button-lUfKisu8.js";
2
2
  import { t } from "./nodeAlignment-BC_Uferw.js";
3
3
  import { l as n } from "./CollectionField-DrJuHNsg.js";
4
4
  import { n as r, r as i, t as a } from "./Tooltip-DreKXbTO.js";
5
- import { a as o, i as s, n as c, o as l, r as u } from "./Popover-DnZY1k6o.js";
5
+ import { a as o, i as s, n as c, o as l, r as u } from "./Popover-C_IQMM8H.js";
6
6
  import { c as d } from "react/compiler-runtime";
7
7
  import { forwardRef as f, useEffect as p, useState as m } from "react";
8
8
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { t as e } from "./Button-DjphTnCg.js";
2
+ import { t as e } from "./Button-Uwxgkriw.js";
3
3
  import { n as t } from "./AuthProvider-C6bvedwF.js";
4
4
  import { n, t as r } from "./StripePaymentModal-BsYNQ4MB.js";
5
- import { BillingStep as i } from "./BillingStep-CY2MHQ-L.js";
5
+ import { BillingStep as i } from "./BillingStep-DjNmSVkY.js";
6
6
  import { cn as a, errorHandler as o, useLevo as s } from "@levo-so/react";
7
7
  import { useEffect as c, useRef as l, useState as u } from "react";
8
8
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
package/collection.js CHANGED
@@ -1,8 +1,8 @@
1
- import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, l as h, n as g, o as _, p as v, r as y, s as b, u as x, v as S, w as C, x as w, y as T } from "./dist-bHoi1bCB.js";
1
+ import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, l as h, n as g, o as _, p as v, r as y, s as b, u as x, v as S, w as C, x as w, y as T } from "./dist-D-y51gmU.js";
2
2
  import { a as E, c as D, d as O, i as k, n as A, o as j, r as M, s as N, t as P, u as F } from "./CollectionField-DrJuHNsg.js";
3
3
  import { t as I } from "./CollectionInput-CG-Pu_51.js";
4
- import { t as L } from "./utils-C_tr8kXV.js";
5
- import { n as R, r as z, t as B } from "./Toolbar-D3PnF7Ud.js";
4
+ import { t as L } from "./utils-NDllPDUz.js";
5
+ import { n as R, r as z, t as B } from "./Toolbar-6IXR9qAh.js";
6
6
  //#region ../../libraries/react-collection/dist/types/formVariant.js
7
7
  var V = [
8
8
  {
@@ -2168,7 +2168,7 @@ var Br = "_156u72w0", Vr = "_156u72w1", Hr = (e) => Array.isArray(e) && e.every(
2168
2168
  leftIcon: n,
2169
2169
  ...e
2170
2170
  }), t[1] = e, t[2] = r), r;
2171
- }, Gr = L(() => import("./DateTimeWidget-BVHZh4EV.js")), Kr = L(() => import("./PhoneWidget-BaDSMSW5.js")), qr = L(() => import("./RichTextWidget-yaDCZwIo.js")), Jr = {
2171
+ }, Gr = L(() => import("./DateTimeWidget-CzBq92zC.js")), Kr = L(() => import("./PhoneWidget-DdX8_-2v.js")), qr = L(() => import("./RichTextWidget-BfZ3sCcx.js")), Jr = {
2172
2172
  TextWidget: $((e) => /* @__PURE__ */ G(ur, { ...e })),
2173
2173
  NumberWidget: $((e) => /* @__PURE__ */ G(ur, {
2174
2174
  type: "number",
@@ -0,0 +1,13 @@
1
+ //#region ../../libraries/ai-chat/src/helpers.ts
2
+ var e = (e, t = {
3
+ hour: "numeric",
4
+ minute: "2-digit"
5
+ }) => {
6
+ if (!e) return "";
7
+ let n = e instanceof Date ? e : new Date(e);
8
+ return Number.isNaN(n.getTime()) ? "" : n.toLocaleTimeString([], t);
9
+ }, t = (e, t) => t ? `levo.site_chat.${e}.${t}` : null, n = (e, t) => {
10
+ e.style.height = "auto", e.style.height = t === void 0 ? `${e.scrollHeight}px` : `${Math.min(e.scrollHeight, t)}px`;
11
+ }, r = "linear-gradient(to right, color-mix(in oklch, var(--ai-chat-thinking-1, oklch(0.65 0.15 253.81)) 40%, transparent), color-mix(in oklch, var(--ai-chat-thinking-2, oklch(0.65 0.15 17.5826)) 40%, transparent))", i = "linear-gradient(to right, var(--ai-chat-thinking-1, oklch(0.65 0.15 253.81)), var(--ai-chat-thinking-2, oklch(0.65 0.15 17.5826)))";
12
+ //#endregion
13
+ export { t as a, e as i, i as n, n as r, r as t };
package/index.d.ts CHANGED
@@ -220,13 +220,14 @@ declare type BaseImageProps = ImageProps & HTMLImageProps;
220
220
  /**
221
221
  * Published-site language switcher, modeled as a studio element (like `UserMenu`).
222
222
  *
223
- * Reads the page's sibling language variants from context (via `useLocalizedPages`)
223
+ * Reads the page's sibling language variants from context (via `useLanguageVariants`)
224
224
  * — no data wiring needed — and navigates to the selected language's localized URL
225
225
  * on a full reload. Dynamic-page placeholder slugs are resolved from the current
226
226
  * path before navigating.
227
227
  *
228
- * Renders nothing when the page has at most one language. Hide it deliberately by
229
- * setting `config.enabled = false` on its element `withBlockProps` gates on that.
228
+ * Hidden by default (like `UserMenu`): renders only when `config.enabled` is
229
+ * explicitly turned on for its element. Even when enabled, renders nothing if the
230
+ * page has at most one language.
230
231
  */
231
232
  export declare const BaseLanguageSwitcher: React_2.FC<BaseLanguageSwitcherProps>;
232
233
 
@@ -306,8 +307,7 @@ declare type BlockProviderInput = {
306
307
  renderMode: IRenderMode;
307
308
  workspace_id: string;
308
309
  pageSource: IPage["source"];
309
- localizedPages?: IPage["localized_pages"];
310
- language?: IPage["language"];
310
+ languageVariants?: IPage["language_variants"];
311
311
  };
312
312
 
313
313
  export declare const BlockSourceModuleList: readonly ["collection", "event", "blog", "community", "context", "form", "blog_author", "blog_category", "blog_tag"];
@@ -400,8 +400,8 @@ export declare const Box: WithBlockPropsComponent<BaseBoxProps & default_2.RefAt
400
400
  * (no current template, unparseable URL, or mismatched segment counts).
401
401
  */
402
402
  export declare const buildLocalizedHref: ({ current, target, currentPathname, }: {
403
- current?: ILocalizedPage;
404
- target: ILocalizedPage;
403
+ current?: ILanguageVariant;
404
+ target: ILanguageVariant;
405
405
  currentPathname: string;
406
406
  }) => string;
407
407
 
@@ -446,6 +446,12 @@ declare interface CarouselProps extends BaseElementProps {
446
446
  */
447
447
  export declare const CategoryFilter: React.FC<ICategoryFilterProps>;
448
448
 
449
+ /**
450
+ * Invalidate every cached entry whose key contains `match` (typically a source
451
+ * identifier). Called after a content edit so the page refetches fresh data.
452
+ */
453
+ export declare const clearContentCache: (match: string) => Promise<void>;
454
+
449
455
  export declare const colorOptions: {
450
456
  readonly brand: {
451
457
  readonly label: "Brand";
@@ -702,7 +708,7 @@ export declare const fetchCollectionSchema: ({ levoClient, source, cookies, draf
702
708
  };
703
709
  }>;
704
710
 
705
- export declare const fetchSource: ({ levoClient, source, workspace_id, slugs, params, cookies, draft, }: SourceFetchOptions) => Promise<IResponseMultiple | IResponseSingle | null>;
711
+ export declare const fetchSource: ({ levoClient, source, workspace_id, slugs, params, cookies, draft, language, }: SourceFetchOptions) => Promise<IResponseMultiple | IResponseSingle | null>;
706
712
 
707
713
  /**
708
714
  * Recursively searches content_schema for a field with matching key
@@ -921,12 +927,13 @@ export declare const getPageData: ({ levoClient, workspace, url, draft, visitorP
921
927
  cookies?: string;
922
928
  }) => Promise<IPageFromPath | null>;
923
929
 
924
- export declare const getPageSource: ({ levoClient, pageData, slugs, cookies, draft, }: {
930
+ export declare const getPageSource: ({ levoClient, pageData, slugs, cookies, draft, language, }: {
925
931
  levoClient: ILevoClient;
926
932
  pageData: IPageExpanded;
927
933
  slugs: Record<string, string>;
928
934
  cookies?: string;
929
935
  draft?: boolean;
936
+ language?: string;
930
937
  }) => Promise<{
931
938
  pageContext: IPageContext;
932
939
  pageMeta: TPageMeta;
@@ -1091,7 +1098,7 @@ export declare interface IBlockInstance {
1091
1098
  created_at: string;
1092
1099
  updated_at: string;
1093
1100
  deleted_at: any;
1094
- site_version: "v1" | "v2";
1101
+ site_version: "v1" | "v2" | "v3";
1095
1102
  }
1096
1103
 
1097
1104
  export declare interface IBlockLayouts {
@@ -1300,8 +1307,8 @@ export declare interface IFieldConfig {
1300
1307
  selected_fields?: string[];
1301
1308
  };
1302
1309
  action?: {
1303
- type: "page" | "external_link" | "email" | "phone" | "login" | "popup" | "none";
1304
- /** For type "popup", holds the popup id to open. */
1310
+ type: "page" | "page_section" | "external_link" | "email" | "phone" | "login" | "popup" | "none";
1311
+ /** For type "popup", holds the popup id to open. For "page_section", holds the target block id (rendered as a `#<blockId>` in-page anchor). */
1305
1312
  value: string;
1306
1313
  alt?: string;
1307
1314
  options: {
@@ -1451,6 +1458,31 @@ declare interface IJsonEditorProps {
1451
1458
  onChange: (value: Record<string, any>) => void;
1452
1459
  }
1453
1460
 
1461
+ export declare interface IKBChatProps {
1462
+ workspace: IWorkspace;
1463
+ site: ISite;
1464
+ }
1465
+
1466
+ /**
1467
+ * A sibling language variant as returned by the studio runtime
1468
+ * (`get-page-from-path` → `data.language_variants`). Drives the published-site
1469
+ * language switcher. Distinct from {@link ILocalizedPage} (the editor field).
1470
+ */
1471
+ export declare interface ILanguageVariant {
1472
+ id: string;
1473
+ language: string;
1474
+ /** Human-readable language label, e.g. "French (France)". */
1475
+ language_label?: string;
1476
+ /**
1477
+ * Fully-localized URL for this variant. Default language is unprefixed, others
1478
+ * are language-prefixed. Dynamic pages keep `{placeholder}` slugs to substitute
1479
+ * client-side before navigating.
1480
+ */
1481
+ live_url?: string;
1482
+ /** True for the page currently being served; always the first entry. */
1483
+ is_current?: boolean;
1484
+ }
1485
+
1454
1486
  declare interface ILazyMotionProviderProps {
1455
1487
  children: ReactNode;
1456
1488
  /** Enforce m component usage - throws if motion component is used */
@@ -1542,7 +1574,7 @@ declare interface ILevoFormContext {
1542
1574
  preview?: boolean;
1543
1575
  }
1544
1576
 
1545
- export declare type ILevoPageData = Pick<IPageExpanded, "id" | "workspace_id" | "blocks" | "source" | "title" | "description" | "access" | "style_config" | "settings" | "language" | "localized_pages">;
1577
+ export declare type ILevoPageData = Pick<IPageExpanded, "id" | "workspace_id" | "blocks" | "source" | "title" | "description" | "access" | "style_config" | "settings" | "language_variants">;
1546
1578
 
1547
1579
  export declare interface ILevoPageProps {
1548
1580
  pageData: ILevoPageData;
@@ -1557,30 +1589,18 @@ export declare interface ILevoPageProps {
1557
1589
  }
1558
1590
 
1559
1591
  /**
1560
- * A sibling language variant of a page.
1592
+ * A sibling language variant of a page as seen by the **dashboard editor**.
1593
+ * Populated by the editor's page-data response — `title`, `status`, `countries`,
1594
+ * `url` — and drives the locale/country pickers.
1561
1595
  *
1562
- * Two backends populate this shape:
1563
- * - The studio runtime (`get-page-from-path`) sets `language_label`, `live_url`,
1564
- * and `is_current` used by the published-site language switcher.
1565
- * - The dashboard editor's page-data response sets `title`, `status`, `countries`,
1566
- * `url` — used by the locale/country pickers.
1567
- *
1568
- * Only `id` and `language` are guaranteed on both; the rest are source-specific.
1596
+ * The published-site language switcher uses {@link ILanguageVariant} instead: a
1597
+ * separate runtime field (`data.language_variants`) carrying navigation data, not
1598
+ * editor metadata. The backend keeps the two apart deliberately so they can't be
1599
+ * confused two different things, two different names.
1569
1600
  */
1570
1601
  export declare interface ILocalizedPage {
1571
1602
  id: string;
1572
1603
  language: string;
1573
- /** Human-readable language label, e.g. "French (France)". Runtime response only. */
1574
- language_label?: string;
1575
- /**
1576
- * Fully-localized URL for this sibling. Default language is unprefixed, others
1577
- * are language-prefixed. Dynamic pages keep `{placeholder}` slugs to substitute
1578
- * client-side. Runtime response only.
1579
- */
1580
- live_url?: string;
1581
- /** True for the page currently being served; always the first entry. Runtime response only. */
1582
- is_current?: boolean;
1583
- /** Editor response only — guaranteed there; absent on runtime entries (not read by the runtime). */
1584
1604
  title: string;
1585
1605
  status?: "published" | "draft";
1586
1606
  countries?: string[];
@@ -1628,7 +1648,7 @@ export declare interface IPage {
1628
1648
  id: string;
1629
1649
  workspace_id: string;
1630
1650
  site_id: string;
1631
- site_version?: "v1" | "v2";
1651
+ site_version?: "v1" | "v2" | "v3";
1632
1652
  title: string;
1633
1653
  description: string;
1634
1654
  key: string;
@@ -1645,7 +1665,10 @@ export declare interface IPage {
1645
1665
  language?: string;
1646
1666
  is_generating?: boolean;
1647
1667
  generation_cancelled?: boolean;
1668
+ /** Editor-only sibling languages (titles/statuses/countries). See {@link ILocalizedPage}. */
1648
1669
  localized_pages?: ILocalizedPage[];
1670
+ /** Runtime sibling languages for the published-site switcher. See {@link ILanguageVariant}. */
1671
+ language_variants?: ILanguageVariant[];
1649
1672
  style_config?: ISiteStyleConfig | null;
1650
1673
  countries?: string[];
1651
1674
  theme: {
@@ -1953,7 +1976,7 @@ export declare interface ISite {
1953
1976
  object: string;
1954
1977
  id: string;
1955
1978
  workspace_id: string;
1956
- site_version: "v1" | "v2";
1979
+ site_version: "v1" | "v2" | "v3";
1957
1980
  name: string;
1958
1981
  slug: string;
1959
1982
  timezone: string;
@@ -2067,6 +2090,8 @@ export declare type IStudioSource = {
2067
2090
  module: (typeof BlockSourceModuleList)[number];
2068
2091
  identifier: string;
2069
2092
  field_key: string;
2093
+ /** Owning workspace, sent with system-defined sources at create-single so the backend scopes the source record. */
2094
+ workspace_id?: string;
2070
2095
  params?: Record<string, any>;
2071
2096
  options?: {
2072
2097
  sub_module?: "latest_posts" | "popular_posts" | "related_posts" | "author_posts" | "category_posts" | "tag_posts";
@@ -2384,6 +2409,14 @@ export declare const JoinRequestForm: default_2.FC<IJoinRequestFormProps>;
2384
2409
 
2385
2410
  export declare const JsonEditor: React.FC<IJsonEditorProps>;
2386
2411
 
2412
+ /**
2413
+ * Studio's site AI chat widget, derived from `workspace`/`site` the same way
2414
+ * `LevoPage` mounts it automatically. Exported standalone for callers that
2415
+ * render outside `LevoPage` (custom layouts, non-block pages) and still want
2416
+ * the chat widget wired up without re-deriving its props by hand.
2417
+ */
2418
+ export declare const KBChat: React.FC<IKBChatProps>;
2419
+
2387
2420
  export declare function Kbd({ className, ...props }: React.ComponentProps<"kbd">): JSX.Element;
2388
2421
 
2389
2422
  export declare function KbdGroup({ className, ...props }: React.ComponentProps<"div">): JSX.Element;
@@ -2400,7 +2433,7 @@ export declare const LanguageSwitcher: WithBlockPropsComponent<BaseLanguageSwitc
2400
2433
  */
2401
2434
  export declare const LazyMotionProvider: React.FC<ILazyMotionProviderProps>;
2402
2435
 
2403
- export declare const LevoBlock: default_2.MemoExoticComponent<({ html_id, renderMode, blocks, parsedBlockData, blockData, pageContext, pageMeta, blockContext, workspace_id, pageSource, localizedPages, language, }: LevoBlockProps) => JSX.Element>;
2436
+ export declare const LevoBlock: default_2.MemoExoticComponent<({ html_id, renderMode, blocks, parsedBlockData, blockData, pageContext, pageMeta, blockContext, workspace_id, pageSource, languageVariants, }: LevoBlockProps) => JSX.Element>;
2404
2437
 
2405
2438
  declare interface LevoBlockProps {
2406
2439
  html_id?: string;
@@ -2413,8 +2446,7 @@ declare interface LevoBlockProps {
2413
2446
  pageMeta?: TPageMeta;
2414
2447
  blockContext?: IPageDataContext["blocks"][number];
2415
2448
  pageSource?: IPage["source"];
2416
- localizedPages?: IPage["localized_pages"];
2417
- language?: IPage["language"];
2449
+ languageVariants?: IPage["language_variants"];
2418
2450
  }
2419
2451
 
2420
2452
  export declare const LevoPage: default_2.FC<ILevoPageProps>;
@@ -2572,7 +2604,7 @@ declare type ParseResult = {
2572
2604
  prefix: string;
2573
2605
  };
2574
2606
 
2575
- export declare const parseVariablesFromResolvedSource: ({ levoClient, block, resolvedSources, pageContext, siteData, cookies, draft, workspace_id, }: {
2607
+ export declare const parseVariablesFromResolvedSource: ({ levoClient, block, resolvedSources, pageContext, siteData, cookies, draft, workspace_id, language, }: {
2576
2608
  levoClient: ILevoClient;
2577
2609
  block: IBlockInstance;
2578
2610
  resolvedSources: IBlockInstance["source"];
@@ -2581,6 +2613,7 @@ export declare const parseVariablesFromResolvedSource: ({ levoClient, block, res
2581
2613
  siteData?: Record<string, any>;
2582
2614
  cookies?: string;
2583
2615
  draft?: boolean;
2616
+ language?: string;
2584
2617
  }) => Promise<[IBlockInstance, Record<string, IResponseMultiple<Record<string, unknown>>>]>;
2585
2618
 
2586
2619
  /** Parse the inner expression of a `{...}` token into a path + transforms. */
@@ -2791,6 +2824,14 @@ export declare const RegisterModal: ({ eventID, title, external, buttonText, }:
2791
2824
  buttonText?: string;
2792
2825
  }) => JSX.Element;
2793
2826
 
2827
+ /**
2828
+ * Drop the cached DB connection so the next cache access re-opens and re-wipes
2829
+ * the store. Call when leaving studio: client-side navigation keeps this module
2830
+ * alive, so without this the reused connection would skip the open-time wipe and
2831
+ * serve the previous session's data when studio is reopened without a reload.
2832
+ */
2833
+ export declare const resetContentCache: () => void;
2834
+
2794
2835
  export declare const resolveStyles: ({ skeleton, blockFetchedContent, blockSources, currentPath, }: {
2795
2836
  skeleton: any;
2796
2837
  blockFetchedContent: Record<string, any>;
@@ -2851,6 +2892,12 @@ export declare const sanitizeBackgroundEffectConfig: (config: BackgroundEffectCo
2851
2892
  */
2852
2893
  export declare const sanitizeElementKey: (elementKey: string) => string;
2853
2894
 
2895
+ /** Cache for collection schema responses, keyed by request url. */
2896
+ export declare const schemaCache: {
2897
+ get: (key: string) => Promise<unknown>;
2898
+ set: (key: string, value: unknown) => Promise<void>;
2899
+ };
2900
+
2854
2901
  /**
2855
2902
  * Converts an IBlock schema definition into a mock IBlockInstance
2856
2903
  * that LevoBlock can render. Uses layout defaults for content/styles/config.
@@ -2921,6 +2968,12 @@ export declare function Skeleton({ className, ...props }: React.ComponentProps<"
2921
2968
  */
2922
2969
  export declare const snapDateStyle: (style: TDateStyle, available: readonly TDateStyle[]) => TDateStyle;
2923
2970
 
2971
+ /** Cache for content-engine source query responses, keyed by request url. */
2972
+ export declare const sourceCache: {
2973
+ get: (key: string) => Promise<unknown>;
2974
+ set: (key: string, value: unknown) => Promise<void>;
2975
+ };
2976
+
2924
2977
  export declare interface SourceFetchOptions {
2925
2978
  levoClient: ILevoClient;
2926
2979
  source: IStudioSource;
@@ -2929,6 +2982,7 @@ export declare interface SourceFetchOptions {
2929
2982
  params?: Record<string, unknown>;
2930
2983
  cookies?: string;
2931
2984
  draft?: boolean;
2985
+ language?: string;
2932
2986
  }
2933
2987
 
2934
2988
  export declare interface SourceURL {
@@ -3120,9 +3174,8 @@ export declare const useForumContext: () => IForumContext;
3120
3174
  */
3121
3175
  export declare const useGeneratedClassName: (elementKey: string, blockId: string, configValue: IFieldConfig | undefined) => string;
3122
3176
 
3123
- export declare const useLocalizedPages: () => {
3124
- localizedPages: ILocalizedPage[];
3125
- currentLanguage: string | undefined;
3177
+ export declare const useLanguageVariants: () => {
3178
+ languageVariants: ILanguageVariant[];
3126
3179
  };
3127
3180
 
3128
3181
  /**