@levo-so/site-runtime 0.3.24 → 0.3.26

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.
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AnyRouter } from '@tanstack/react-router';
1
2
  import { ILemaCollection } from '@levo-so/core';
2
3
  import { ILevoClient } from '@levo-so/core';
3
4
  import { ILevoInsights } from '@levo-so/insights';
@@ -5,6 +6,7 @@ import { ILevoMembership } from '@levo-so/core';
5
6
  import { IMediaObject } from '@levo-so/core';
6
7
  import { JSX } from 'react/jsx-runtime';
7
8
  import { LevoQuery } from '@levo-so/core';
9
+ import { LinkComponentProps } from '@tanstack/react-router';
8
10
 
9
11
  /**
10
12
  * Build the canonical + hreflang link set for one page.
@@ -55,7 +57,8 @@ export declare const createLevoHead: (site: ISiteJson) => (meta?: IPlatformMetaF
55
57
  * return them keyed by source key — that map is the route's `loaderData`, which
56
58
  * `levoHead`'s dynamic config reads for per-record heads. An empty `dataSources` ({})
57
59
  * resolves to an empty map. Context is typed structurally (just `queryClient`) so the
58
- * scaffold's router types never enter the package.
60
+ * scaffold's router types never enter the package — and WITHOUT `params`, see
61
+ * `ILevoLoaderContext`.
59
62
  *
60
63
  * Takes the raw `site.json` — same single input as `createLevoHead` and
61
64
  * `LevoSiteProvider` — and derives the client config itself.
@@ -72,12 +75,7 @@ export declare const createLevoHead: (site: ISiteJson) => (meta?: IPlatformMetaF
72
75
  * `meta` is optional so sites generated before this shipped keep working unchanged — they
73
76
  * simply prefetch as they always did (and have no gates to protect).
74
77
  */
75
- export declare const createLevoLoader: (site: ISiteJson) => (sources: ILevoDataSources, meta?: IPlatformMetaFile) => ({ context, params, }: {
76
- context: {
77
- queryClient: IQueryClientLike;
78
- };
79
- params?: Record<string, string>;
80
- }) => Promise<Record<string, unknown>>;
78
+ export declare const createLevoLoader: (site: ISiteJson) => (sources: ILevoDataSources, meta?: IPlatformMetaFile) => (ctx: ILevoLoaderContext) => Promise<Record<string, unknown>>;
81
79
 
82
80
  /**
83
81
  * Build a route-existence matcher from a generated `routeTree`.
@@ -622,6 +620,23 @@ export declare interface ILevoDynamicHead {
622
620
  image?: string;
623
621
  }
624
622
 
623
+ export declare interface ILevoEditFormProps {
624
+ /** The collection binding — same `dataSources` entry (`mode: "form"`) a `<LevoForm>` takes. */
625
+ source: ILevoFormConfig;
626
+ /** Values the form opens with — the entry being edited. Read once, when the form mounts. */
627
+ initialValues?: Record<string, unknown>;
628
+ /** Receives only the visible fields' values; hidden ones never reach the save. */
629
+ onSubmit: (values: Record<string, unknown>) => void;
630
+ /** Disables the submit button and shows "Saving" — pass the save's pending state. */
631
+ isLoading?: boolean;
632
+ /** Fields to hide, by key or id. */
633
+ hiddenFields?: string[];
634
+ submitLabel?: string;
635
+ /** Per-form color/radius overrides. Rarely needed — the form already follows the site theme. */
636
+ theme?: ILevoFormTheme;
637
+ className?: string;
638
+ }
639
+
625
640
  export declare interface ILevoEntryFormProps {
626
641
  /** The gated collection's key — take it from the blocking rule's `options.collection`. */
627
642
  collection: string;
@@ -648,6 +663,11 @@ declare interface ILevoEventRegisterProps {
648
663
  endsAt?: string | Date | null;
649
664
  /** Joining link (`url`), attached to the calendar entry so it is one tap away at start time. */
650
665
  eventUrl?: string | null;
666
+ /**
667
+ * Lets one order hold several tickets: a quantity stepper per ticket type, then one set of
668
+ * attendee details per ticket, paid for together. Off by default — one ticket, one attendee.
669
+ */
670
+ enableMultipleTicketBooking?: boolean;
651
671
  }
652
672
 
653
673
  /**
@@ -769,6 +789,41 @@ export declare interface ILevoFormTheme {
769
789
  /** How the form lays its fields out. */
770
790
  export declare type ILevoFormVariant = "default" | "single-field" | "steps" | "steps-2";
771
791
 
792
+ /**
793
+ * `Link`'s props with `to` widened to any site path.
794
+ *
795
+ * `params` is dropped: a neutral path carries none, and a shared component that links to a
796
+ * dynamic page composes the string (`` `/accelerators/${slug}` ``).
797
+ */
798
+ export declare interface ILevoLinkProps extends Omit<LinkComponentProps<"a", AnyRouter, string, string, string, string>, "to" | "params"> {
799
+ /** A site path — the neutral `/about-us` in shared chrome. Not checked against the routes. */
800
+ to: string;
801
+ }
802
+
803
+ /**
804
+ * The slice of the router's loader context the loader reads. Structural on purpose (like
805
+ * `IHeadCtx`) so the scaffold's router types never enter the package.
806
+ *
807
+ * `params` is deliberately NOT declared here, and must not be re-added in any form. TanStack
808
+ * infers a route's param type from the loader it is handed: `createFileRoute(path)({ loader })`
809
+ * carries a `TParams` type parameter whose DEFAULT is the params parsed from the path, and the
810
+ * loader argument's `params` property is an inference site for it. Any annotation on that
811
+ * property — `params?: Record<string, string>`, `params?: unknown`, a generic bound — becomes
812
+ * the inferred `TParams` and beats the default, so `Route.useParams()` on `$slug.tsx` read
813
+ * `{ [x: string]: string } | undefined` and `slug` failed the publish type check (#4696).
814
+ * Left undeclared, the loader contributes no candidate and the route keeps the params its
815
+ * path (or its `params.parse`) gives it. `loaderParams` reads them at runtime.
816
+ *
817
+ * Exported (and re-exported from the package root) because a route file's `Route` type
818
+ * carries its loader's type: a site that emits declarations (`Register { router }` makes the
819
+ * router an exported type) would otherwise fail with TS4023 "cannot be named".
820
+ */
821
+ export declare interface ILevoLoaderContext {
822
+ context: {
823
+ queryClient: IQueryClientLike;
824
+ };
825
+ }
826
+
772
827
  export declare interface ILevoLoginActions {
773
828
  /**
774
829
  * Send a verification code. `identifier` is the email address (medium `"email"`) or the
@@ -1753,6 +1808,16 @@ export declare const LEVO_PRIMARY_AUTH_METHODS: readonly ["otp", "magiclink", "w
1753
1808
  */
1754
1809
  export declare const LevoChat: React.FC<ILevoChatProps>;
1755
1810
 
1811
+ /**
1812
+ * A collection's fields as an edit form, with no API calls of its own — the v3 counterpart of
1813
+ * v2's studio `EditForm`. The page loads the entry (`initialValues`) and saves it in
1814
+ * `onSubmit`, e.g. an "edit my profile" page over `getDraftEntry` + `editDraftEntry`.
1815
+ * For new submissions use `<LevoForm>`; for the membership account, `<LevoProfileForm>`.
1816
+ *
1817
+ * Mount it once the entry has loaded: `initialValues` is read on mount only.
1818
+ */
1819
+ export declare const LevoEditForm: React.FC<ILevoEditFormProps>;
1820
+
1756
1821
  /**
1757
1822
  * The "request access" form for a `gating` rule — the collection's own fields, submitted as
1758
1823
  * an entry owned by the signed-in visitor.
@@ -1780,9 +1845,11 @@ export declare const LevoEntryForm: React.FC<ILevoEntryFormProps>;
1780
1845
  * auto-stamps the workspace on every request, so no auth/workspace wiring is needed.
1781
1846
  * `external` turns it into a plain link out to a third-party ticketing URL.
1782
1847
  *
1848
+ * `enableMultipleTicketBooking` swaps in the cart flow (`CartRegister`): several tickets, one attendee each.
1849
+ *
1783
1850
  * `?register=1` on the page URL opens the sheet on load, for campaign links and second CTAs.
1784
1851
  */
1785
- export declare const LevoEventRegister: ({ eventID, title, external, buttonText, startsAt, endsAt, eventUrl, }: ILevoEventRegisterProps) => JSX.Element;
1852
+ export declare const LevoEventRegister: (props: ILevoEventRegisterProps) => JSX.Element;
1786
1853
 
1787
1854
  /**
1788
1855
  * A collection-backed form for generated Studio v3 sites — renders the collection's fields
@@ -1802,6 +1869,19 @@ export declare const LevoEventRegister: ({ eventID, title, external, buttonText,
1802
1869
  */
1803
1870
  export declare const LevoForm: React.FC<ILevoFormProps>;
1804
1871
 
1872
+ /**
1873
+ * `<Link>` whose `to` accepts any site path.
1874
+ *
1875
+ * Use it in shared chrome for the language-neutral path: `<LevoLink to="/about-us">`. Inside a
1876
+ * variant folder (`src/routes/fr-FR/pricing.tsx`) keep `<Link to="/fr-FR/about">`: the variant
1877
+ * is fixed there, and `Link` keeps that path checked against the routes, which this cannot.
1878
+ * Everything else — `className`, `activeProps`, `preload`, `ref`, the render-function
1879
+ * `children` — is `Link`'s own.
1880
+ *
1881
+ * @since 0.3.25
1882
+ */
1883
+ export declare const LevoLink: React.FC<ILevoLinkProps>;
1884
+
1805
1885
  export declare const levoParams: <TSegment extends string, TPattern extends string, TSiblings extends string = never>(key: TSegment, pattern: TPattern, _siblings?: readonly TSiblings[]) => ILevoParams<TSegment, TPattern, TSiblings>;
1806
1886
 
1807
1887
  /**