@levo-so/core 0.1.82 → 0.1.108

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 (3) hide show
  1. package/dist/index.d.ts +374 -79
  2. package/dist/index.js +683 -699
  3. package/package.json +21 -21
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" | "key" | "readonly" | "hidden" | "icon" | "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">, 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_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, }: {
@@ -201,14 +201,21 @@ export declare const createLevoClient: (options: ILevoClientOptions) => {
201
201
  getFilters: (collectionId: string, options?: WretchOptions) => Promise<IResponseMultiple<ILemaCollection["sections"][number]["fields"][number]>>;
202
202
  };
203
203
  readonly media: {
204
- mediaBulkUpload: (formData: FormData, options?: WretchOptions) => Promise<IResponseMultiple<IMedia>>;
204
+ mediaBulkUpload: (formData: FormData, options?: WretchOptions, context?: IMediaUploadContext) => Promise<IResponseMultiple<IMedia>>;
205
205
  getAllMedia: (data?: import("./types").LevoQuery.FindQuery) => Promise<IResponseMultiple<IMedia>>;
206
206
  };
207
207
  readonly logger: {
208
208
  debug: (...args: any[]) => void;
209
209
  info: (...args: any[]) => void;
210
210
  warn: (...args: any[]) => void;
211
- error: (...args: any[]) => void;
211
+ error: {
212
+ (message: string): void;
213
+ <T extends {
214
+ exception?: unknown;
215
+ [key: string]: any;
216
+ }>(message: string, props: T extends Error ? never : T): void;
217
+ };
218
+ attachMiddleware: (mw: ILevoLoggerMiddleware) => (() => void);
212
219
  };
213
220
  readonly fetch: QueryStringAddon & Wretch<QueryStringAddon, unknown, undefined>;
214
221
  readonly APP_MODE: string;
@@ -218,18 +225,51 @@ export declare const createLevoClient: (options: ILevoClientOptions) => {
218
225
  updateWorkspace: (workspace: string | null) => void;
219
226
  };
220
227
 
228
+ /**
229
+ * @description base factory that includes levo workspace details, analytics tools & fetch client
230
+ */
231
+ declare const createLevoControl: (options: ICoreOptions) => {
232
+ workspace: WorkspaceID | null;
233
+ readonly appName: string | undefined;
234
+ readonly apiUrl: string;
235
+ readonly NODE_ENV: string;
236
+ readonly APP_MODE: string;
237
+ };
238
+
239
+ export declare const createLevoLogger: (core: ILevoControl, options?: ILoggerOptions) => {
240
+ debug: (...args: any[]) => void;
241
+ info: (...args: any[]) => void;
242
+ warn: (...args: any[]) => void;
243
+ error: {
244
+ (message: string): void;
245
+ <T extends {
246
+ exception?: unknown;
247
+ [key: string]: any;
248
+ }>(message: string, props: NotError<T>): void;
249
+ };
250
+ attachMiddleware: (mw: ILevoLoggerMiddleware) => (() => void);
251
+ };
252
+
221
253
  export declare type DeepPartial<T> = {
222
254
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
223
255
  };
224
256
 
225
257
  export declare const defaultByKinds: Record<(typeof FieldKindList)[number], any>;
226
258
 
259
+ /**
260
+ * Define a named logger middleware. Name is used for dedup — attaching
261
+ * a middleware with the same name replaces the previous one.
262
+ */
263
+ export declare const defineLevoLoggerMiddleware: (name: string, callback: (core: ILevoControl, level: LogLevel, args: any[]) => void) => ILevoLoggerMiddleware;
264
+
227
265
  export declare type FieldFilter<T extends string = string> = Partial<Record<T, ComparableFilter<T> | FieldType>>;
228
266
 
229
267
  export declare const FieldInterfaces: Record<"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", "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">;
230
268
 
231
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"];
232
270
 
271
+ export declare type FieldKind = (typeof FieldKindList)[number];
272
+
233
273
  export declare const FieldKind: {
234
274
  identifier: "identifier";
235
275
  collection: "collection";
@@ -335,10 +375,6 @@ export declare interface IAuthor {
335
375
  active_at: Date;
336
376
  }
337
377
 
338
- declare interface IBatchOptions {
339
- logApiUrl?: string;
340
- }
341
-
342
378
  export declare interface IBlog {
343
379
  _id: string;
344
380
  slug: string;
@@ -355,6 +391,13 @@ export declare interface IBlog {
355
391
  created_by: string;
356
392
  updated_by: string;
357
393
  studio_config: IModuleStudioConfig[];
394
+ icon?: IIcon | null;
395
+ /**
396
+ * Default brief applied to every post in this blog. Merges per-field with
397
+ * `post.brief`; per-post values win. Setting `documents: ["DC_BRAND_GUIDE"]`
398
+ * here means every post is audited against that guide unless overridden.
399
+ */
400
+ brief_defaults?: IBrief | null;
358
401
  }
359
402
 
360
403
  export declare interface IBlogCategory {
@@ -417,6 +460,65 @@ export declare interface IBooking {
417
460
  attendees?: IAttendee[];
418
461
  }
419
462
 
463
+ export declare interface IBrief {
464
+ /** PR... persona id. Falls back to `post.target_persona` when null. */
465
+ persona_id?: string | null;
466
+ /** Reserved — server accepts but doesn't yet route on it. */
467
+ writer_id?: string | null;
468
+ /** DC... ai_document ids (brand guide, compliance, research). */
469
+ documents?: string[] | null;
470
+ intent?: IBriefIntent | null;
471
+ focus_keyword?: string | null;
472
+ /** Semantic anchor; falls back to focus_keyword for drift checks. */
473
+ core_topic?: string | null;
474
+ funnel_stage?: IBriefFunnelStage | null;
475
+ brand_placement?: IBriefBrandPlacement | null;
476
+ word_limit?: IBriefWordLimit | null;
477
+ topic_drift?: IBriefTopicDrift | null;
478
+ cta_targets?: IBriefCtaTargets | null;
479
+ }
480
+
481
+ export declare type IBriefBrandPlacement = "soft" | "standard" | "strong";
482
+
483
+ export declare interface IBriefCtaTargets {
484
+ top?: boolean;
485
+ mid?: boolean;
486
+ bottom?: boolean;
487
+ }
488
+
489
+ export declare type IBriefFunnelStage = "tofu" | "mofu" | "bofu";
490
+
491
+ export declare type IBriefIntent = "educate" | "persuade" | "compare" | "convert";
492
+
493
+ /**
494
+ * Snapshot of the merged brief at audit-run time, returned on the audit doc.
495
+ * `null` when both `post.brief` and `blog.brief_defaults` are empty.
496
+ */
497
+ export declare interface IBriefSnapshot {
498
+ brief: IBrief;
499
+ documents: IBriefSnapshotDocument[];
500
+ }
501
+
502
+ /**
503
+ * Document fingerprint embedded in the audit response. The body itself is not
504
+ * inlined — only sha256 + length, used for drift detection on the audit cache key.
505
+ */
506
+ export declare interface IBriefSnapshotDocument {
507
+ id: string;
508
+ title: string;
509
+ tags: string[];
510
+ body_sha256: string;
511
+ length: number;
512
+ }
513
+
514
+ export declare type IBriefTopicDrift = "tight" | "normal" | "loose";
515
+
516
+ export declare interface IBriefWordLimit {
517
+ target: number;
518
+ /** Default 0.2 (±20%) when omitted on the wire. */
519
+ tolerance?: number;
520
+ }
521
+
420
522
  /** Structural kind of a collection object. Read-only, derived server-side. */
421
523
  export declare type ICollectionKind = "collection" | "form" | "module";
422
524
 
@@ -545,17 +647,7 @@ declare interface ICoreOptions {
545
647
  APP_MODE: string;
546
648
  }
547
649
 
548
- export declare interface IDefaultPermissionsObject {
549
- status?: "enabled" | "disabled" | "hidden";
550
- create?: boolean;
551
- modify?: boolean;
552
- delete?: boolean;
553
- archive?: boolean;
554
- duplicate?: boolean;
555
- export?: boolean;
556
- upload?: boolean;
557
- list_actions?: boolean;
558
- }
650
+ export declare type IDelayUnit = "minutes" | "hours" | "days";
559
651
 
560
652
  export declare interface IDraftEntry {
561
653
  _id: string;
@@ -585,6 +677,9 @@ export declare interface IErrorContent {
585
677
  description: string;
586
678
  type?: string;
587
679
  errors?: IFieldError[];
680
+ url?: string;
681
+ /** Raw response body from the server, preserved for debugging/error tracking. */
682
+ responseData?: unknown;
588
683
  }
589
684
 
590
685
  export declare type IErrorParams = {
@@ -616,8 +711,37 @@ declare interface IFaviconSrcset {
616
711
  "192": string;
617
712
  }
618
713
 
619
- export declare interface IFeatureFlags extends Partial<IModuleAccessControl> {
714
+ /**
715
+ * Public surface of per-workspace feature flags exposed via the external SDK.
716
+ * Only fields renderer/SDK consumers need at runtime belong here. A small,
717
+ * runtime-facing subset of `studio_config` (currently `kb_chat` and
718
+ * `kb_chat_preview_only`) is included so the published site can gate the
719
+ * visitor AI chat widget; the full admin-only studio_config / blogs_config
720
+ * shape remains in `@levo/types` `IFeatureFlags` and is not part of the SDK
721
+ * contract.
722
+ */
723
+ export declare interface IFeatureFlags {
724
+ /** Controls the "Powered by Levo" badge on rendered workspace sites. */
620
725
  branding?: boolean;
726
+ /**
727
+ * Only the subset of studio_config the public site renderer needs at
728
+ * runtime. The full studio_config shape stays in `@levo/types`.
729
+ */
730
+ studio_config?: {
731
+ /** Visitor-facing AI chat widget on the published site. Default off. */
732
+ kb_chat?: boolean;
733
+ /**
734
+ * When true (default) the KB chat only mounts on preview deployments.
735
+ * Flip to false per-workspace to release the widget to production.
736
+ */
737
+ kb_chat_preview_only?: boolean;
738
+ /**
739
+ * Launcher shape for the visitor AI chat. `"bar"` (default) renders the
740
+ * centered morphing pill at the bottom of the viewport; `"fab"` renders
741
+ * the bottom-right floating action button + popover panel.
742
+ */
743
+ kb_chat_variant?: "bar" | "fab";
744
+ };
621
745
  }
622
746
 
623
747
  /**
@@ -868,11 +992,9 @@ export declare interface IIconData {
868
992
  /**
869
993
  * Defines the schema structure for a Levo Collection.
870
994
  *
871
- * A Levo Collection is a feature of the Levo platform that enables dynamic form rendering using the `@levo-so/react-collection` library.
995
+ * A Levo Collection is a feature of the Levo platform that enables dynamic form rendering using the `@levo.libraries/react-collection` library.
872
996
  * This interface describes the schema used to generate forms, including sections, fields, and configuration options.
873
997
  * The schema is referenced anywhere a Levo Collection is required in the Levo ecosystem.
874
- *
875
- * For more details, see the documentation in external/react-collection/docs/readme.md.
876
998
  */
877
999
  export declare interface ILemaCollection {
878
1000
  /** Unique identifier for the collection schema. */
@@ -929,6 +1051,8 @@ export declare interface ILemaCollection {
929
1051
  public_view_set_by_account?: ILemaCollectionAccount | null;
930
1052
  /** Expanded account details for who set public submit. */
931
1053
  public_submit_set_by_account?: ILemaCollectionAccount | null;
1054
+ /** Number of entries in the collection. Returned by listing API. */
1055
+ entry_count?: number;
932
1056
  }
933
1057
 
934
1058
  /** Account details embedded in collection responses for _set_by fields. */
@@ -958,6 +1082,7 @@ export declare type ILemaField = Mandatory<Omit<IField, "fields" | "options">, "
958
1082
  allow_public_view?: boolean;
959
1083
  /** Whether this field accepts public submissions. */
960
1084
  allow_public_submit?: boolean;
1085
+ logic?: ILogicRule[];
961
1086
  };
962
1087
 
963
1088
  /**
@@ -1001,6 +1126,10 @@ export declare interface ILemaFieldOptions {
1001
1126
  validationsPresets?: string[];
1002
1127
  /** Whether to verify email/phone values or not */
1003
1128
  verification?: boolean;
1129
+ /** Restrict upload widget to specific media types (e.g. ["image", "document"]). All types allowed when absent. */
1130
+ allowed_upload_types?: string[];
1131
+ /** Restrict upload widget to specific file extensions (e.g. ["pdf", "docx"]). All extensions for the allowed types when absent. */
1132
+ allowed_extensions?: string[];
1004
1133
  }
1005
1134
 
1006
1135
  export declare type ILemaRelation = {
@@ -1020,6 +1149,7 @@ export declare type ILemaRelationOnDelete = "CASCADE" | "SET_NULL" | "RESTRICT";
1020
1149
  export declare interface ILemaSection extends Omit<ISection, "fields"> {
1021
1150
  /** Fields contained within this section. */
1022
1151
  fields: ILemaField[];
1152
+ logic?: ILogicRule[];
1023
1153
  }
1024
1154
 
1025
1155
  export declare namespace ILevoAudience {
@@ -1098,20 +1228,12 @@ export declare interface ILevoClientOptions extends ICoreOptions {
1098
1228
  loggerOptions?: ILoggerOptions;
1099
1229
  }
1100
1230
 
1101
- export declare type ILevoIntegrationInstance = {
1102
- id: string;
1103
- name: string;
1104
- publisher: string;
1105
- description: string;
1106
- url: string | null;
1107
- logo: string | null;
1108
- dashboard_url: string | null;
1109
- sidebar_icon: string | null;
1110
- show_on_sidebar: boolean;
1111
- key: string;
1112
- };
1231
+ declare type ILevoControl = ReturnType<typeof createLevoControl>;
1113
1232
 
1114
- export declare type ILevoIntegrationList = (typeof LEVO_INTEGRATIONS)[keyof typeof LEVO_INTEGRATIONS][];
1233
+ export declare interface ILevoLoggerMiddleware {
1234
+ name: string;
1235
+ callback: (core: ILevoControl, level: LogLevel, args: any[]) => void;
1236
+ }
1115
1237
 
1116
1238
  export declare namespace ILevoMembership {
1117
1239
  export interface sub_account_oauth_credentials {
@@ -1290,15 +1412,19 @@ export declare namespace ILevoMembership {
1290
1412
  password: string;
1291
1413
  };
1292
1414
  }
1293
- {};
1415
+ export {};
1294
1416
  }
1295
1417
 
1296
1418
  export declare type ILevoOAuthProvider = (typeof LevoOAuthProviderList)[number];
1297
1419
 
1298
- declare interface ILoggerOptions extends IBatchOptions {
1420
+ export declare interface ILoggerOptions {
1299
1421
  level?: LogLevel;
1300
- enableRemote?: boolean;
1301
- context?: Record<string, any>;
1422
+ }
1423
+
1424
+ export declare interface ILogicRule {
1425
+ /** Undefined means the rule has been created but no action picked yet — engine treats it as a no-op. */
1426
+ action?: LogicAction;
1427
+ when: LogicWhen;
1302
1428
  }
1303
1429
 
1304
1430
  export declare interface IMe {
@@ -1356,34 +1482,23 @@ export declare type IMediaObject = Pick<IMedia, "id" | "location" | "srcset" | "
1356
1482
  mimetype?: IMedia["metadata"]["mimetype"];
1357
1483
  };
1358
1484
 
1485
+ /** Source context attached to a media upload so the backend can record where the file originated. */
1486
+ export declare interface IMediaUploadContext {
1487
+ /** The product module the upload belongs to (e.g. "community", "blog"). */
1488
+ module: "community" | "collection" | "blog" | "event" | "membership" | "beacon" | "studio" | "ai";
1489
+ /** Module-specific resource key (e.g. blog slug, collection key, event slug). */
1490
+ identifier: string;
1491
+ /** Schema field key within the module (e.g. "cover_image", "attachment"). */
1492
+ field_key?: string;
1493
+ /** Human-readable field label (e.g. "Cover Image", "Attachment"). */
1494
+ field_label?: string;
1495
+ }
1496
+
1359
1497
  export declare interface IMeta {
1360
1498
  total: number;
1361
1499
  pages: number;
1362
1500
  }
1363
1501
 
1364
- export declare type IModuleAccessControl = {
1365
- dashboard_config: IDefaultPermissionsObject;
1366
- studio_config: IDefaultPermissionsObject & {
1367
- addBlocks: boolean;
1368
- version: string;
1369
- preview_url: string | null;
1370
- modules: {
1371
- my_blocks: IDefaultPermissionsObject;
1372
- };
1373
- };
1374
- collections_config: IDefaultPermissionsObject & {
1375
- modules: {
1376
- records: IDefaultPermissionsObject;
1377
- };
1378
- };
1379
- media_config: IDefaultPermissionsObject;
1380
- events_config: IDefaultPermissionsObject;
1381
- blogs_config: IDefaultPermissionsObject;
1382
- memberships_config: IDefaultPermissionsObject;
1383
- insights_config: IDefaultPermissionsObject;
1384
- settings_config: IDefaultPermissionsObject;
1385
- };
1386
-
1387
1502
  export declare interface IModuleStudioConfig {
1388
1503
  page_id: string;
1389
1504
  preview_url: string;
@@ -1406,6 +1521,8 @@ export declare interface INotificationData {
1406
1521
  reply_to?: string;
1407
1522
  cc_email?: string[];
1408
1523
  bcc_email?: string[];
1524
+ delay_value?: number;
1525
+ delay_unit?: IDelayUnit;
1409
1526
  info: {
1410
1527
  title?: string;
1411
1528
  show_download_button?: boolean;
@@ -1523,6 +1640,10 @@ export declare interface IPost {
1523
1640
  location: string;
1524
1641
  };
1525
1642
  }[];
1643
+ /** Staff account who created the post. Immutable. `null` for legacy/unbackfilled posts. */
1644
+ created_by?: IPostStaffAccount | null;
1645
+ /** Staff account who last edited the post. Re-stamped on every save. `null` for legacy/unbackfilled posts. */
1646
+ updated_by?: IPostStaffAccount | null;
1526
1647
  settings: Record<string, any>;
1527
1648
  in_review_at?: Date;
1528
1649
  approved_at?: Date;
@@ -1540,6 +1661,75 @@ export declare interface IPost {
1540
1661
  name: string;
1541
1662
  slug: string;
1542
1663
  }[];
1664
+ /** Latest completed audit for this post. `null` when never audited. Platform list only. */
1665
+ audit?: IPostAuditSummary | null;
1666
+ /** True while a pending/running audit exists for this post. Independent of `audit`. */
1667
+ is_auditing?: boolean;
1668
+ /**
1669
+ * Per-post writing/audit brief. All fields optional; absent fields fall
1670
+ * through to the parent blog's `brief_defaults`.
1671
+ */
1672
+ brief?: IBrief | null;
1673
+ }
1674
+
1675
+ export declare interface IPostAuditDimensionGrade {
1676
+ key: string;
1677
+ name: string;
1678
+ grade: IPostAuditGrade;
1679
+ }
1680
+
1681
+ /**
1682
+ * Counts of recommended fixes by severity. `total` includes any unknown
1683
+ * severities so the headline number stays honest if the BE enum grows.
1684
+ */
1685
+ export declare interface IPostAuditFixesCount {
1686
+ high: number;
1687
+ medium: number;
1688
+ low: number;
1689
+ total: number;
1690
+ }
1691
+
1692
+ export declare type IPostAuditGrade = "A+" | "A" | "B" | "C" | "D" | "F";
1693
+
1694
+ export declare type IPostAuditMode = "quick" | "full";
1695
+
1696
+ /**
1697
+ * Lightweight audit summary attached to each post in the platform list response.
1698
+ * Full body (signals, fixes, execution) lives on `GET /v1/agents/audit/:id`.
1699
+ */
1700
+ export declare interface IPostAuditSummary {
1701
+ id: string;
1702
+ mode: IPostAuditMode;
1703
+ overall_grade: IPostAuditGrade;
1704
+ overall_score: number;
1705
+ dimensions: IPostAuditDimensionGrade[];
1706
+ fixes_count: IPostAuditFixesCount;
1707
+ completed_at: string;
1708
+ /** True when post.updated_at > audit.completed_at — any post edit flags it. */
1709
+ is_stale: boolean;
1710
+ }
1711
+
1712
+ /**
1713
+ * Staff account audit shape returned for `created_by` / `updated_by` on blog posts.
1714
+ * Distinct from the editorial `authors` byline — this is the internal CMS audit trail.
1715
+ */
1716
+ export declare interface IPostStaffAccount {
1717
+ _id: string;
1718
+ first_name: string;
1719
+ last_name: string;
1720
+ username?: string;
1721
+ slug?: string;
1722
+ profile_picture?: {
1723
+ location: string;
1724
+ } | null;
1725
+ last_access_at?: string | null;
1726
+ }
1727
+
1728
+ export declare interface IRemoteLoggerMiddlewareOptions {
1729
+ /** URL of the log ingestion API */
1730
+ logApiUrl: string;
1731
+ /** Extra static context merged into every log payload */
1732
+ context?: Record<string, any>;
1543
1733
  }
1544
1734
 
1545
1735
  export declare interface IResponseError {
@@ -1661,7 +1851,6 @@ export declare interface IWorkspace {
1661
1851
  created_at: string;
1662
1852
  updated_at: string;
1663
1853
  deleted_at?: null;
1664
- integrations?: ILevoIntegrationList | ILevoIntegrationInstance[];
1665
1854
  description: any;
1666
1855
  icon: IMediaObject | null;
1667
1856
  workspace_id: string;
@@ -1718,18 +1907,6 @@ declare type JSONContent = {
1718
1907
  [key: string]: any;
1719
1908
  };
1720
1909
 
1721
- export declare const LEVO_INTEGRATIONS: {
1722
- readonly beacon: "so.levo.beacon";
1723
- readonly blog: "so.levo.blog";
1724
- readonly event: "so.levo.event";
1725
- readonly membership: "so.levo.membership";
1726
- readonly payment: "so.levo.payment";
1727
- readonly community: "so.levo.community";
1728
- readonly search_console: "com.google.search_console";
1729
- };
1730
-
1731
- export declare const LEVO_INTEGRATIONS_LIST: ("so.levo.beacon" | "so.levo.blog" | "so.levo.event" | "so.levo.membership" | "so.levo.payment" | "so.levo.community" | "com.google.search_console")[];
1732
-
1733
1910
  /**
1734
1911
  * Enhanced error class that matches backend response structure
1735
1912
  */
@@ -1739,6 +1916,9 @@ export declare class LevoError extends Error {
1739
1916
  status: number;
1740
1917
  type?: string;
1741
1918
  errors?: IFieldError[];
1919
+ url?: string;
1920
+ /** Raw response body from the server, preserved for debugging/error tracking. */
1921
+ responseData?: unknown;
1742
1922
  constructor(data: IErrorContent);
1743
1923
  /**
1744
1924
  * Get validation errors for form fields
@@ -1770,6 +1950,7 @@ export declare namespace LevoEvent {
1770
1950
  slug: string;
1771
1951
  status: "draft" | "canceled" | "published";
1772
1952
  accept_registration: boolean;
1953
+ one_attendee_per_account: boolean;
1773
1954
  max_capacity: number;
1774
1955
  banners: IMediaObject[];
1775
1956
  created_at: Date;
@@ -1810,6 +1991,7 @@ export declare namespace LevoEvent {
1810
1991
  hidden: boolean;
1811
1992
  allow_to_upgrade: boolean;
1812
1993
  include_in_upgrade: boolean;
1994
+ one_attendee_per_account: boolean;
1813
1995
  enforce_max_quantity: boolean;
1814
1996
  status: string;
1815
1997
  offerings: string[];
@@ -1842,6 +2024,11 @@ export declare namespace LevoEvent {
1842
2024
  expires_at: Date | null;
1843
2025
  max_redemptions: number | null;
1844
2026
  minimum_amount: number | null;
2027
+ /** Minimum transaction amount required to use this coupon */
2028
+ min_trnx_amount: number | null;
2029
+ /** Maximum discount amount cap (for percent coupons) */
2030
+ max_amount_off: number | null;
2031
+ redeem_count: number;
1845
2032
  is_public: boolean;
1846
2033
  created_at: Date;
1847
2034
  created_by: string;
@@ -1884,19 +2071,41 @@ export declare namespace LevoEvent {
1884
2071
  export namespace Attendee {
1885
2072
  export interface Root {
1886
2073
  _id: string;
2074
+ slug: string;
1887
2075
  public_id: string;
1888
2076
  name: string;
1889
2077
  email: string;
1890
2078
  mobile: string | null;
1891
2079
  event: string;
2080
+ organization: string;
2081
+ designation: string;
2082
+ details: Record<string, any>;
1892
2083
  booking: Booking.Root;
1893
2084
  ticket: Pick<LevoEvent.Ticket.Root, "_id" | "title" | "currency" | "quantity" | "status" | "unit_amount">;
1894
2085
  price: string;
1895
- account: string | null;
2086
+ /** Raw string ID, or populated account object when `include.account` is used */
2087
+ account: string | IAttendeeAccount | null;
1896
2088
  status: string;
2089
+ info: Record<string, any>;
2090
+ qr_image: IMediaObject & {
2091
+ width: number;
2092
+ height: number;
2093
+ };
2094
+ checkin_at: Date | null;
1897
2095
  created_at: Date;
1898
2096
  updated_at: Date;
1899
2097
  }
2098
+ /** Populated account shape returned when `include.account` is used in the query */
2099
+ export interface IAttendeeAccount {
2100
+ _id: string;
2101
+ reducted_email?: string;
2102
+ reducted_mobile?: string;
2103
+ slug?: string;
2104
+ username?: string;
2105
+ profile_picture?: {
2106
+ location: string;
2107
+ };
2108
+ }
1900
2109
  }
1901
2110
  export namespace Booking {
1902
2111
  export interface Root {
@@ -1915,13 +2124,17 @@ export declare namespace LevoEvent {
1915
2124
  code: string | null;
1916
2125
  status: string;
1917
2126
  paid: boolean;
2127
+ tax_inclusive: boolean;
2128
+ is_business_purchase: boolean;
2129
+ billing_details: IBillingDetails | null;
1918
2130
  info: Record<string, any>;
1919
2131
  taxes?: Array<{
1920
2132
  id: string;
1921
2133
  label: string;
1922
- percentage: number;
2134
+ percentage?: number;
1923
2135
  amount: number;
1924
- }>;
2136
+ }> | Record<string, never>;
2137
+ payment_details: IPaymentDetail[];
1925
2138
  qr_image: IMediaObject & {
1926
2139
  width: number;
1927
2140
  height: number;
@@ -1931,10 +2144,49 @@ export declare namespace LevoEvent {
1931
2144
  width: number;
1932
2145
  height: number;
1933
2146
  }) | null;
2147
+ /** How this booking was created: public (website), manual (dashboard), csv (import) */
2148
+ source: "public" | "manual" | "csv";
2149
+ /** Visit ID or null — populated when `include._visit` is used */
2150
+ _visit: string | null;
2151
+ _page: IBookingPage | null;
2152
+ upgraded_at: Date | null;
1934
2153
  created_at: Date;
1935
2154
  updated_at: Date;
1936
2155
  attendees: LevoEvent.Attendee.Root[];
1937
2156
  }
2157
+ export interface IBillingDetails {
2158
+ name: string;
2159
+ tax_id?: string;
2160
+ address?: {
2161
+ line1: string;
2162
+ line2?: string;
2163
+ city: string;
2164
+ state: string;
2165
+ postal_code: string;
2166
+ country_code: string;
2167
+ };
2168
+ }
2169
+ export interface IPaymentDetail {
2170
+ order_id: string;
2171
+ link_id: string;
2172
+ payment_kind: string;
2173
+ payment_id: string;
2174
+ provider: string;
2175
+ kind: string;
2176
+ identifier: string;
2177
+ amount: number;
2178
+ currency: string;
2179
+ status: string;
2180
+ info: Record<string, any>;
2181
+ created_at: string;
2182
+ }
2183
+ export interface IBookingPage {
2184
+ url: string;
2185
+ hostname: string;
2186
+ pathname: string;
2187
+ id: string;
2188
+ title: string;
2189
+ }
1938
2190
  export type Create = Omit<Pick<Root, "event" | "coupon">, "attendees"> & {
1939
2191
  attendees: Mandatory<LevoEvent.Attendee.Root, "name" | "ticket" | "email">;
1940
2192
  };
@@ -1946,6 +2198,7 @@ export declare namespace LevoEvent {
1946
2198
  name: string;
1947
2199
  description: string;
1948
2200
  cover_image: string | null;
2201
+ icon?: IIcon | null;
1949
2202
  status: "published" | string;
1950
2203
  created_at: string;
1951
2204
  updated_at: string;
@@ -1957,6 +2210,7 @@ export declare namespace LevoEvent {
1957
2210
  }
1958
2211
  export interface Update {
1959
2212
  name: string;
2213
+ icon?: IIcon | null;
1960
2214
  }
1961
2215
  }
1962
2216
  }
@@ -1985,6 +2239,8 @@ export declare const listToColumn: <T extends string>(columns: readonly string[]
1985
2239
 
1986
2240
  export declare const listToRecord: <T extends string>(columns: readonly string[]) => { [K in T]: K; };
1987
2241
 
2242
+ export declare type LogicAction = "show" | "hide";
2243
+
1988
2244
  export declare type LogicalFilter<T extends string = string> = {
1989
2245
  [LogicalOperators.AND]: Filter<T>[];
1990
2246
  [LogicalOperators.OR]?: never;
@@ -2000,7 +2256,35 @@ export declare const LogicalOperators: {
2000
2256
 
2001
2257
  export declare type LogicalOperators = keyof typeof LogicalOperators;
2002
2258
 
2003
- declare enum LogLevel {
2259
+ /** Operator-discriminated leaf — value is always scalar. `is_empty`/`is_not_empty` carry no value. */
2260
+ export declare type LogicCondition = {
2261
+ source: string;
2262
+ operator: "is_empty" | "is_not_empty";
2263
+ } | {
2264
+ source: string;
2265
+ operator: "equals" | "not" | "contains" | "not_contains" | "starts_with" | "not_starts_with" | "ends_with" | "not_ends_with" | "gt" | "gte" | "lt" | "lte";
2266
+ value: LogicValue;
2267
+ };
2268
+
2269
+ export declare interface LogicGroup {
2270
+ combinator: "AND" | "OR";
2271
+ conditions: (LogicCondition | LogicGroup)[];
2272
+ }
2273
+
2274
+ /**
2275
+ * Operator surface is intentionally scalar-only. Multi-value semantics (`in`, `not_in`, `between`)
2276
+ * were removed in favour of composition: a user who wants "show when nominee is Father OR Mother"
2277
+ * writes two conditions in an OR group instead of `in [Father, Mother]`. Same for `between`, which
2278
+ * composes as `gte min AND lte max`. Simplifies the picker UI (every value input is single) and
2279
+ * the engine (one less arity tier).
2280
+ */
2281
+ 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";
2282
+
2283
+ export declare type LogicValue = string | number | boolean | Date | null;
2284
+
2285
+ export declare type LogicWhen = LogicCondition | LogicGroup;
2286
+
2287
+ export declare enum LogLevel {
2004
2288
  debug = 0,
2005
2289
  info = 1,
2006
2290
  warn = 2,
@@ -2014,12 +2298,23 @@ export declare const MediaKind: Record<"image" | "video" | "audio" | "document",
2014
2298
 
2015
2299
  export declare const MediaKindList: readonly ["image", "video", "audio", "document"];
2016
2300
 
2301
+ /** Reject types assignable to Error — forces `{ exception }` wrapping at the call site. */
2302
+ declare type NotError<T> = T extends Error ? never : T;
2303
+
2304
+ export declare const operatorsByKind: Record<FieldKind, LogicOperator[]>;
2305
+
2017
2306
  export declare type PlanKind = "addon" | "base";
2018
2307
 
2019
2308
  export declare type Prettify<T> = {
2020
2309
  [K in keyof T]: T[K];
2021
2310
  };
2022
2311
 
2312
+ /**
2313
+ * Middleware that batches error logs and sends them to a remote API.
2314
+ * Only forwards `LogLevel.error` — lower levels are ignored.
2315
+ */
2316
+ export declare const remoteLoggerMiddleware: (options: IRemoteLoggerMiddlewareOptions) => ILevoLoggerMiddleware;
2317
+
2023
2318
  export declare type WithinFilterType = {
2024
2319
  latitude: number;
2025
2320
  longitude: number;