@levo-so/core 0.1.105 → 0.1.109

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/dist/index.d.ts CHANGED
@@ -183,7 +183,7 @@ export declare const createLevoClient: (options: ILevoClientOptions) => {
183
183
  signUpWithPassword: <T = import("./types").ILevoMembership.Account>(data: import("./types").ILevoMembership.Request.SignUpWithPassword, options?: WretchOptions) => Promise<T>;
184
184
  };
185
185
  readonly collection: {
186
- getAllCollections: (data?: import("./types").LevoQuery.FindQuery<"name" | "workspace_id" | "created_at" | "id" | "kind" | "description" | "updated_at" | "icon" | "key" | "readonly" | "hidden" | "on_submit" | "on_update" | "module_name" | "allow_public_submit" | "public_submit_set_by" | "sections" | "views" | "title_field" | "email_field" | "mobile_field" | "settings" | "allow_draft" | "allow_public_view" | "public_view_set_by" | "public_view_set_by_account" | "public_submit_set_by_account" | "entry_count">, options?: WretchOptions) => Promise<IResponseMultiple<ILemaCollection>>;
186
+ getAllCollections: (data?: import("./types").LevoQuery.FindQuery<"name" | "workspace_id" | "created_at" | "id" | "kind" | "description" | "updated_at" | "icon" | "key" | "readonly" | "hidden" | "on_submit" | "on_update" | "module_name" | "allow_public_submit" | "public_submit_set_by" | "sections" | "views" | "title_field" | "email_field" | "mobile_field" | "settings" | "allow_draft" | "allow_multiple" | "allow_public_view" | "public_view_set_by" | "public_view_set_by_account" | "public_submit_set_by_account" | "entry_count">, options?: WretchOptions) => Promise<IResponseMultiple<ILemaCollection>>;
187
187
  getCollectionByIDExpanded: <T = ILemaCollection>(id: string, options?: WretchOptions) => Promise<IResponseSingle<T>>;
188
188
  createCollection: (data: ILemaCollection) => Promise<IResponseSingle<ILemaCollection>>;
189
189
  saveCollectionData: ({ collection_id, data, options, }: {
@@ -268,6 +268,8 @@ export declare const FieldInterfaces: Record<"TextWidget" | "CurrencyWidget" | "
268
268
 
269
269
  export declare const FieldInterfacesList: readonly ["TextWidget", "CurrencyWidget", "TextareaWidget", "GeocoderWidget", "MultiGeocoderWidget", "DropdownWidget", "ToggleCheckboxWidget", "RadioWidget", "NumberWidget", "EmailWidget", "PhoneWidget", "URLWidget", "DateWidget", "TimeWidget", "SwitchWidget", "RichTextWidget", "DateTimeWidget", "CheckboxWidget", "ImageUploadWidget", "MultiImageUploadWidget", "FileUploadWidget", "MultiFileUploadWidget", "MultiDropdownWidget", "MultiTextWidget", "CollectionWidget", "ArrayWidget", "RecordWidget", "JSONWidget", "SlugWidget"];
270
270
 
271
+ export declare type FieldKind = (typeof FieldKindList)[number];
272
+
271
273
  export declare const FieldKind: {
272
274
  identifier: "identifier";
273
275
  collection: "collection";
@@ -650,7 +652,7 @@ export declare type IDelayUnit = "minutes" | "hours" | "days";
650
652
  export declare interface IDraftEntry {
651
653
  _id: string;
652
654
  _account: string;
653
- _status: "draft" | "submitted";
655
+ _status: "draft" | "published" | "archived";
654
656
  [x: string]: any;
655
657
  created_at: string;
656
658
  updated_at: string;
@@ -711,35 +713,16 @@ declare interface IFaviconSrcset {
711
713
 
712
714
  /**
713
715
  * Public surface of per-workspace feature flags exposed via the external SDK.
714
- * Only fields renderer/SDK consumers need at runtime belong here. A small,
715
- * runtime-facing subset of `studio_config` (currently `kb_chat` and
716
- * `kb_chat_preview_only`) is included so the published site can gate the
717
- * visitor AI chat widget; the full admin-only studio_config / blogs_config
718
- * shape remains in `@levo/types` `IFeatureFlags` and is not part of the SDK
719
- * contract.
716
+ * Only fields renderer/SDK consumers need at runtime belong here.
717
+ *
718
+ * The visitor AI chat widget is no longer gated by any `studio_config` flag
719
+ * it relies solely on `GET /v1/intelligence/site-agent/get-active` resolving an
720
+ * agent for the request host/surface. The old `kb_chat` / `kb_chat_preview_only`
721
+ * / `kb_chat_variant` flags have been dropped from the SDK contract.
720
722
  */
721
723
  export declare interface IFeatureFlags {
722
724
  /** Controls the "Powered by Levo" badge on rendered workspace sites. */
723
725
  branding?: boolean;
724
- /**
725
- * Only the subset of studio_config the public site renderer needs at
726
- * runtime. The full studio_config shape stays in `@levo/types`.
727
- */
728
- studio_config?: {
729
- /** Visitor-facing AI chat widget on the published site. Default off. */
730
- kb_chat?: boolean;
731
- /**
732
- * When true (default) the KB chat only mounts on preview deployments.
733
- * Flip to false per-workspace to release the widget to production.
734
- */
735
- kb_chat_preview_only?: boolean;
736
- /**
737
- * Launcher shape for the visitor AI chat. `"bar"` (default) renders the
738
- * centered morphing pill at the bottom of the viewport; `"fab"` renders
739
- * the bottom-right floating action button + popover panel.
740
- */
741
- kb_chat_variant?: "bar" | "fab";
742
- };
743
726
  }
744
727
 
745
728
  /**
@@ -815,6 +798,7 @@ export declare interface IForum {
815
798
  listing_page_url?: string;
816
799
  created_at: string;
817
800
  studio_config?: IModuleStudioConfig[];
801
+ icon?: IIcon | null;
818
802
  }
819
803
 
820
804
  export declare interface IForumCategory {
@@ -1035,6 +1019,8 @@ export declare interface ILemaCollection {
1035
1019
  updated_at?: Date | string;
1036
1020
  /** Whether the collection allows draft items. */
1037
1021
  allow_draft?: boolean;
1022
+ /** Whether a user can submit more than one entry. When false, each user is limited to a single submission. */
1023
+ allow_multiple?: boolean;
1038
1024
  /** Structural kind — read-only, derived server-side. Use getCollectionKind() if absent. */
1039
1025
  kind?: ICollectionKind;
1040
1026
  /** Collection-level public view access level. null = private/disabled. */
@@ -1080,6 +1066,7 @@ export declare type ILemaField = Mandatory<Omit<IField, "fields" | "options">, "
1080
1066
  allow_public_view?: boolean;
1081
1067
  /** Whether this field accepts public submissions. */
1082
1068
  allow_public_submit?: boolean;
1069
+ logic?: ILogicRule[];
1083
1070
  };
1084
1071
 
1085
1072
  /**
@@ -1146,6 +1133,7 @@ export declare type ILemaRelationOnDelete = "CASCADE" | "SET_NULL" | "RESTRICT";
1146
1133
  export declare interface ILemaSection extends Omit<ISection, "fields"> {
1147
1134
  /** Fields contained within this section. */
1148
1135
  fields: ILemaField[];
1136
+ logic?: ILogicRule[];
1149
1137
  }
1150
1138
 
1151
1139
  export declare namespace ILevoAudience {
@@ -1417,6 +1405,12 @@ export declare interface ILoggerOptions {
1417
1405
  level?: LogLevel;
1418
1406
  }
1419
1407
 
1408
+ export declare interface ILogicRule {
1409
+ /** Undefined means the rule has been created but no action picked yet — engine treats it as a no-op. */
1410
+ action?: LogicAction;
1411
+ when: LogicWhen;
1412
+ }
1413
+
1420
1414
  export declare interface IMe {
1421
1415
  _id: string;
1422
1416
  public_id: string;
@@ -1866,6 +1860,10 @@ export declare interface IWorkspace {
1866
1860
  twitter?: string;
1867
1861
  linkedin?: string;
1868
1862
  instagram?: string;
1863
+ youtube?: string;
1864
+ tiktok?: string;
1865
+ pinterest?: string;
1866
+ threads?: string;
1869
1867
  };
1870
1868
  /** Whether user has an existing website or is creating new */
1871
1869
  website_status?: "existing" | "new";
@@ -2229,6 +2227,8 @@ export declare const listToColumn: <T extends string>(columns: readonly string[]
2229
2227
 
2230
2228
  export declare const listToRecord: <T extends string>(columns: readonly string[]) => { [K in T]: K; };
2231
2229
 
2230
+ export declare type LogicAction = "show" | "hide";
2231
+
2232
2232
  export declare type LogicalFilter<T extends string = string> = {
2233
2233
  [LogicalOperators.AND]: Filter<T>[];
2234
2234
  [LogicalOperators.OR]?: never;
@@ -2244,6 +2244,34 @@ export declare const LogicalOperators: {
2244
2244
 
2245
2245
  export declare type LogicalOperators = keyof typeof LogicalOperators;
2246
2246
 
2247
+ /** Operator-discriminated leaf — value is always scalar. `is_empty`/`is_not_empty` carry no value. */
2248
+ export declare type LogicCondition = {
2249
+ source: string;
2250
+ operator: "is_empty" | "is_not_empty";
2251
+ } | {
2252
+ source: string;
2253
+ operator: "equals" | "not" | "contains" | "not_contains" | "starts_with" | "not_starts_with" | "ends_with" | "not_ends_with" | "gt" | "gte" | "lt" | "lte";
2254
+ value: LogicValue;
2255
+ };
2256
+
2257
+ export declare interface LogicGroup {
2258
+ combinator: "AND" | "OR";
2259
+ conditions: (LogicCondition | LogicGroup)[];
2260
+ }
2261
+
2262
+ /**
2263
+ * Operator surface is intentionally scalar-only. Multi-value semantics (`in`, `not_in`, `between`)
2264
+ * were removed in favour of composition: a user who wants "show when nominee is Father OR Mother"
2265
+ * writes two conditions in an OR group instead of `in [Father, Mother]`. Same for `between`, which
2266
+ * composes as `gte min AND lte max`. Simplifies the picker UI (every value input is single) and
2267
+ * the engine (one less arity tier).
2268
+ */
2269
+ export declare type LogicOperator = "equals" | "not" | "contains" | "not_contains" | "starts_with" | "not_starts_with" | "ends_with" | "not_ends_with" | "gt" | "gte" | "lt" | "lte" | "is_empty" | "is_not_empty";
2270
+
2271
+ export declare type LogicValue = string | number | boolean | Date | null;
2272
+
2273
+ export declare type LogicWhen = LogicCondition | LogicGroup;
2274
+
2247
2275
  export declare enum LogLevel {
2248
2276
  debug = 0,
2249
2277
  info = 1,
@@ -2261,6 +2289,8 @@ export declare const MediaKindList: readonly ["image", "video", "audio", "docume
2261
2289
  /** Reject types assignable to Error — forces `{ exception }` wrapping at the call site. */
2262
2290
  declare type NotError<T> = T extends Error ? never : T;
2263
2291
 
2292
+ export declare const operatorsByKind: Record<FieldKind, LogicOperator[]>;
2293
+
2264
2294
  export declare type PlanKind = "addon" | "base";
2265
2295
 
2266
2296
  export declare type Prettify<T> = {
package/dist/index.js CHANGED
@@ -588,24 +588,91 @@ var r = /^W[A-Z0-9]{7}$/, i = (e) => {
588
588
  "user.active",
589
589
  "user.idle"
590
590
  ], z = L(R), B = (e) => e.module_name ? "module" : e.allow_public_submit && !e.public_submit_set_by ? "form" : "collection", V = {
591
+ string: [
592
+ "equals",
593
+ "not",
594
+ "contains",
595
+ "not_contains",
596
+ "starts_with",
597
+ "not_starts_with",
598
+ "ends_with",
599
+ "not_ends_with",
600
+ "is_empty",
601
+ "is_not_empty"
602
+ ],
603
+ number: [
604
+ "equals",
605
+ "not",
606
+ "gt",
607
+ "gte",
608
+ "lt",
609
+ "lte",
610
+ "is_empty",
611
+ "is_not_empty"
612
+ ],
613
+ boolean: ["equals", "not"],
614
+ date: [
615
+ "equals",
616
+ "not",
617
+ "gt",
618
+ "gte",
619
+ "lt",
620
+ "lte",
621
+ "is_empty",
622
+ "is_not_empty"
623
+ ],
624
+ "array-string": [
625
+ "contains",
626
+ "not_contains",
627
+ "is_empty",
628
+ "is_not_empty"
629
+ ],
630
+ "array-number": [
631
+ "contains",
632
+ "not_contains",
633
+ "is_empty",
634
+ "is_not_empty"
635
+ ],
636
+ "array-date": ["is_empty", "is_not_empty"],
637
+ "array-boolean": ["is_empty", "is_not_empty"],
638
+ file: ["is_empty", "is_not_empty"],
639
+ "array-file": ["is_empty", "is_not_empty"],
640
+ location: ["is_empty", "is_not_empty"],
641
+ "array-location": ["is_empty", "is_not_empty"],
642
+ richtext: ["is_empty", "is_not_empty"],
643
+ json: ["is_empty", "is_not_empty"],
644
+ "array-json": ["is_empty", "is_not_empty"],
645
+ collection: [
646
+ "equals",
647
+ "not",
648
+ "contains",
649
+ "not_contains",
650
+ "is_empty",
651
+ "is_not_empty"
652
+ ],
653
+ "public-id": ["equals", "not"],
654
+ identifier: ["equals", "not"],
655
+ record: [],
656
+ group: []
657
+ }, H = {
591
658
  published: "published",
592
659
  unpublished: "unpublished",
593
660
  archived: "archived",
594
661
  flagged: "flagged",
595
662
  pending_moderation: "pending_moderation"
596
- }, H = {
663
+ }, U = {
597
664
  post: "post",
598
665
  poll: "poll",
599
666
  gallery: "gallery",
600
667
  link: "link"
601
- }, U = Object.keys(H), W = {
668
+ }, W = Object.keys(U), G = {
602
669
  draft: "draft",
603
670
  published: "published",
604
671
  unpublished: "unpublished",
605
672
  archived: "archived",
606
673
  flagged: "flagged",
607
674
  pending_moderation: "pending_moderation"
608
- }, G = (e) => {
675
+ }, K = (e) => {
609
676
  let t = e.split("/"), n = t[t.length - 1];
610
677
  if (n) {
611
678
  let t = encodeURIComponent(n);
@@ -614,4 +681,4 @@ var r = /^W[A-Z0-9]{7}$/, i = (e) => {
614
681
  return "";
615
682
  };
616
683
  //#endregion
617
- export { z as AnalyticsEvents, R as AnalyticsEventsList, V as COMMENT_STATUS, k as CommonFieldIntefaces, E as CommonFieldInterfacesList, D as ComplexFieldInterfacesList, H as FORUM_POST_KIND, W as FORUM_POST_STATUS, A as FieldInterfaces, O as FieldInterfacesList, M as FieldKind, j as FieldKindList, U as ForumPostKindExpandedList, m as LevoError, x as LevoOAuthProviderList, d as LogLevel, F as MediaKind, P as MediaKindList, C as createLevoClient, p as createLevoLogger, w as defaultByKinds, f as defineLevoLoggerMiddleware, G as formatImagePath, T as formatsByInterface, B as getCollectionKind, g as getLevoError, N as interfaceKinds, I as listToColumn, L as listToRecord, u as remoteLoggerMiddleware };
684
+ export { z as AnalyticsEvents, R as AnalyticsEventsList, H as COMMENT_STATUS, k as CommonFieldIntefaces, E as CommonFieldInterfacesList, D as ComplexFieldInterfacesList, U as FORUM_POST_KIND, G as FORUM_POST_STATUS, A as FieldInterfaces, O as FieldInterfacesList, M as FieldKind, j as FieldKindList, W as ForumPostKindExpandedList, m as LevoError, x as LevoOAuthProviderList, d as LogLevel, F as MediaKind, P as MediaKindList, C as createLevoClient, p as createLevoLogger, w as defaultByKinds, f as defineLevoLoggerMiddleware, K as formatImagePath, T as formatsByInterface, B as getCollectionKind, g as getLevoError, N as interfaceKinds, I as listToColumn, L as listToRecord, V as operatorsByKind, u as remoteLoggerMiddleware };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@levo-so/core",
3
3
  "description": "Levo common utilities",
4
- "version": "0.1.105",
4
+ "version": "0.1.109",
5
5
  "author": "Levo Engineering <devs@theinternetfolks.com>",
6
6
  "dependencies": {
7
7
  "lodash-es": "4.18.1",
@@ -23,6 +23,7 @@
23
23
  "files": [
24
24
  "dist/**",
25
25
  "!dist/**/*.d.ts.map",
26
+ "!dist/**/*.js.map",
26
27
  "package.json"
27
28
  ],
28
29
  "main": "./dist/index.js",