@levo-so/core 0.1.82 → 0.1.105

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 +332 -79
  2. package/dist/index.js +616 -699
  3. package/package.json +20 -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,12 +225,43 @@ 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">;
@@ -335,10 +373,6 @@ export declare interface IAuthor {
335
373
  active_at: Date;
336
374
  }
337
375
 
338
- declare interface IBatchOptions {
339
- logApiUrl?: string;
340
- }
341
-
342
376
  export declare interface IBlog {
343
377
  _id: string;
344
378
  slug: string;
@@ -355,6 +389,13 @@ export declare interface IBlog {
355
389
  created_by: string;
356
390
  updated_by: string;
357
391
  studio_config: IModuleStudioConfig[];
392
+ icon?: IIcon | null;
393
+ /**
394
+ * Default brief applied to every post in this blog. Merges per-field with
395
+ * `post.brief`; per-post values win. Setting `documents: ["DC_BRAND_GUIDE"]`
396
+ * here means every post is audited against that guide unless overridden.
397
+ */
398
+ brief_defaults?: IBrief | null;
358
399
  }
359
400
 
360
401
  export declare interface IBlogCategory {
@@ -417,6 +458,65 @@ export declare interface IBooking {
417
458
  attendees?: IAttendee[];
418
459
  }
419
460
 
461
+ export declare interface IBrief {
462
+ /** PR... persona id. Falls back to `post.target_persona` when null. */
463
+ persona_id?: string | null;
464
+ /** Reserved — server accepts but doesn't yet route on it. */
465
+ writer_id?: string | null;
466
+ /** DC... ai_document ids (brand guide, compliance, research). */
467
+ documents?: string[] | null;
468
+ intent?: IBriefIntent | null;
469
+ focus_keyword?: string | null;
470
+ /** Semantic anchor; falls back to focus_keyword for drift checks. */
471
+ core_topic?: string | null;
472
+ funnel_stage?: IBriefFunnelStage | null;
473
+ brand_placement?: IBriefBrandPlacement | null;
474
+ word_limit?: IBriefWordLimit | null;
475
+ topic_drift?: IBriefTopicDrift | null;
476
+ cta_targets?: IBriefCtaTargets | null;
477
+ }
478
+
479
+ export declare type IBriefBrandPlacement = "soft" | "standard" | "strong";
480
+
481
+ export declare interface IBriefCtaTargets {
482
+ top?: boolean;
483
+ mid?: boolean;
484
+ bottom?: boolean;
485
+ }
486
+
487
+ export declare type IBriefFunnelStage = "tofu" | "mofu" | "bofu";
488
+
489
+ export declare type IBriefIntent = "educate" | "persuade" | "compare" | "convert";
490
+
491
+ /**
492
+ * Snapshot of the merged brief at audit-run time, returned on the audit doc.
493
+ * `null` when both `post.brief` and `blog.brief_defaults` are empty.
494
+ */
495
+ export declare interface IBriefSnapshot {
496
+ brief: IBrief;
497
+ documents: IBriefSnapshotDocument[];
498
+ }
499
+
500
+ /**
501
+ * Document fingerprint embedded in the audit response. The body itself is not
502
+ * inlined — only sha256 + length, used for drift detection on the audit cache key.
503
+ */
504
+ export declare interface IBriefSnapshotDocument {
505
+ id: string;
506
+ title: string;
507
+ tags: string[];
508
+ body_sha256: string;
509
+ length: number;
510
+ }
511
+
512
+ export declare type IBriefTopicDrift = "tight" | "normal" | "loose";
513
+
514
+ export declare interface IBriefWordLimit {
515
+ target: number;
516
+ /** Default 0.2 (±20%) when omitted on the wire. */
517
+ tolerance?: number;
518
+ }
519
+
420
520
  /** Structural kind of a collection object. Read-only, derived server-side. */
421
521
  export declare type ICollectionKind = "collection" | "form" | "module";
422
522
 
@@ -545,17 +645,7 @@ declare interface ICoreOptions {
545
645
  APP_MODE: string;
546
646
  }
547
647
 
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
- }
648
+ export declare type IDelayUnit = "minutes" | "hours" | "days";
559
649
 
560
650
  export declare interface IDraftEntry {
561
651
  _id: string;
@@ -585,6 +675,9 @@ export declare interface IErrorContent {
585
675
  description: string;
586
676
  type?: string;
587
677
  errors?: IFieldError[];
678
+ url?: string;
679
+ /** Raw response body from the server, preserved for debugging/error tracking. */
680
+ responseData?: unknown;
588
681
  }
589
682
 
590
683
  export declare type IErrorParams = {
@@ -616,8 +709,37 @@ declare interface IFaviconSrcset {
616
709
  "192": string;
617
710
  }
618
711
 
619
- export declare interface IFeatureFlags extends Partial<IModuleAccessControl> {
712
+ /**
713
+ * 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.
720
+ */
721
+ export declare interface IFeatureFlags {
722
+ /** Controls the "Powered by Levo" badge on rendered workspace sites. */
620
723
  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
+ };
621
743
  }
622
744
 
623
745
  /**
@@ -868,11 +990,9 @@ export declare interface IIconData {
868
990
  /**
869
991
  * Defines the schema structure for a Levo Collection.
870
992
  *
871
- * A Levo Collection is a feature of the Levo platform that enables dynamic form rendering using the `@levo-so/react-collection` library.
993
+ * A Levo Collection is a feature of the Levo platform that enables dynamic form rendering using the `@levo.libraries/react-collection` library.
872
994
  * This interface describes the schema used to generate forms, including sections, fields, and configuration options.
873
995
  * 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
996
  */
877
997
  export declare interface ILemaCollection {
878
998
  /** Unique identifier for the collection schema. */
@@ -929,6 +1049,8 @@ export declare interface ILemaCollection {
929
1049
  public_view_set_by_account?: ILemaCollectionAccount | null;
930
1050
  /** Expanded account details for who set public submit. */
931
1051
  public_submit_set_by_account?: ILemaCollectionAccount | null;
1052
+ /** Number of entries in the collection. Returned by listing API. */
1053
+ entry_count?: number;
932
1054
  }
933
1055
 
934
1056
  /** Account details embedded in collection responses for _set_by fields. */
@@ -1001,6 +1123,10 @@ export declare interface ILemaFieldOptions {
1001
1123
  validationsPresets?: string[];
1002
1124
  /** Whether to verify email/phone values or not */
1003
1125
  verification?: boolean;
1126
+ /** Restrict upload widget to specific media types (e.g. ["image", "document"]). All types allowed when absent. */
1127
+ allowed_upload_types?: string[];
1128
+ /** Restrict upload widget to specific file extensions (e.g. ["pdf", "docx"]). All extensions for the allowed types when absent. */
1129
+ allowed_extensions?: string[];
1004
1130
  }
1005
1131
 
1006
1132
  export declare type ILemaRelation = {
@@ -1098,20 +1224,12 @@ export declare interface ILevoClientOptions extends ICoreOptions {
1098
1224
  loggerOptions?: ILoggerOptions;
1099
1225
  }
1100
1226
 
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
- };
1227
+ declare type ILevoControl = ReturnType<typeof createLevoControl>;
1113
1228
 
1114
- export declare type ILevoIntegrationList = (typeof LEVO_INTEGRATIONS)[keyof typeof LEVO_INTEGRATIONS][];
1229
+ export declare interface ILevoLoggerMiddleware {
1230
+ name: string;
1231
+ callback: (core: ILevoControl, level: LogLevel, args: any[]) => void;
1232
+ }
1115
1233
 
1116
1234
  export declare namespace ILevoMembership {
1117
1235
  export interface sub_account_oauth_credentials {
@@ -1290,15 +1408,13 @@ export declare namespace ILevoMembership {
1290
1408
  password: string;
1291
1409
  };
1292
1410
  }
1293
- {};
1411
+ export {};
1294
1412
  }
1295
1413
 
1296
1414
  export declare type ILevoOAuthProvider = (typeof LevoOAuthProviderList)[number];
1297
1415
 
1298
- declare interface ILoggerOptions extends IBatchOptions {
1416
+ export declare interface ILoggerOptions {
1299
1417
  level?: LogLevel;
1300
- enableRemote?: boolean;
1301
- context?: Record<string, any>;
1302
1418
  }
1303
1419
 
1304
1420
  export declare interface IMe {
@@ -1356,34 +1472,23 @@ export declare type IMediaObject = Pick<IMedia, "id" | "location" | "srcset" | "
1356
1472
  mimetype?: IMedia["metadata"]["mimetype"];
1357
1473
  };
1358
1474
 
1475
+ /** Source context attached to a media upload so the backend can record where the file originated. */
1476
+ export declare interface IMediaUploadContext {
1477
+ /** The product module the upload belongs to (e.g. "community", "blog"). */
1478
+ module: "community" | "collection" | "blog" | "event" | "membership" | "beacon" | "studio" | "ai";
1479
+ /** Module-specific resource key (e.g. blog slug, collection key, event slug). */
1480
+ identifier: string;
1481
+ /** Schema field key within the module (e.g. "cover_image", "attachment"). */
1482
+ field_key?: string;
1483
+ /** Human-readable field label (e.g. "Cover Image", "Attachment"). */
1484
+ field_label?: string;
1485
+ }
1486
+
1359
1487
  export declare interface IMeta {
1360
1488
  total: number;
1361
1489
  pages: number;
1362
1490
  }
1363
1491
 
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
1492
  export declare interface IModuleStudioConfig {
1388
1493
  page_id: string;
1389
1494
  preview_url: string;
@@ -1406,6 +1511,8 @@ export declare interface INotificationData {
1406
1511
  reply_to?: string;
1407
1512
  cc_email?: string[];
1408
1513
  bcc_email?: string[];
1514
+ delay_value?: number;
1515
+ delay_unit?: IDelayUnit;
1409
1516
  info: {
1410
1517
  title?: string;
1411
1518
  show_download_button?: boolean;
@@ -1523,6 +1630,10 @@ export declare interface IPost {
1523
1630
  location: string;
1524
1631
  };
1525
1632
  }[];
1633
+ /** Staff account who created the post. Immutable. `null` for legacy/unbackfilled posts. */
1634
+ created_by?: IPostStaffAccount | null;
1635
+ /** Staff account who last edited the post. Re-stamped on every save. `null` for legacy/unbackfilled posts. */
1636
+ updated_by?: IPostStaffAccount | null;
1526
1637
  settings: Record<string, any>;
1527
1638
  in_review_at?: Date;
1528
1639
  approved_at?: Date;
@@ -1540,6 +1651,75 @@ export declare interface IPost {
1540
1651
  name: string;
1541
1652
  slug: string;
1542
1653
  }[];
1654
+ /** Latest completed audit for this post. `null` when never audited. Platform list only. */
1655
+ audit?: IPostAuditSummary | null;
1656
+ /** True while a pending/running audit exists for this post. Independent of `audit`. */
1657
+ is_auditing?: boolean;
1658
+ /**
1659
+ * Per-post writing/audit brief. All fields optional; absent fields fall
1660
+ * through to the parent blog's `brief_defaults`.
1661
+ */
1662
+ brief?: IBrief | null;
1663
+ }
1664
+
1665
+ export declare interface IPostAuditDimensionGrade {
1666
+ key: string;
1667
+ name: string;
1668
+ grade: IPostAuditGrade;
1669
+ }
1670
+
1671
+ /**
1672
+ * Counts of recommended fixes by severity. `total` includes any unknown
1673
+ * severities so the headline number stays honest if the BE enum grows.
1674
+ */
1675
+ export declare interface IPostAuditFixesCount {
1676
+ high: number;
1677
+ medium: number;
1678
+ low: number;
1679
+ total: number;
1680
+ }
1681
+
1682
+ export declare type IPostAuditGrade = "A+" | "A" | "B" | "C" | "D" | "F";
1683
+
1684
+ export declare type IPostAuditMode = "quick" | "full";
1685
+
1686
+ /**
1687
+ * Lightweight audit summary attached to each post in the platform list response.
1688
+ * Full body (signals, fixes, execution) lives on `GET /v1/agents/audit/:id`.
1689
+ */
1690
+ export declare interface IPostAuditSummary {
1691
+ id: string;
1692
+ mode: IPostAuditMode;
1693
+ overall_grade: IPostAuditGrade;
1694
+ overall_score: number;
1695
+ dimensions: IPostAuditDimensionGrade[];
1696
+ fixes_count: IPostAuditFixesCount;
1697
+ completed_at: string;
1698
+ /** True when post.updated_at > audit.completed_at — any post edit flags it. */
1699
+ is_stale: boolean;
1700
+ }
1701
+
1702
+ /**
1703
+ * Staff account audit shape returned for `created_by` / `updated_by` on blog posts.
1704
+ * Distinct from the editorial `authors` byline — this is the internal CMS audit trail.
1705
+ */
1706
+ export declare interface IPostStaffAccount {
1707
+ _id: string;
1708
+ first_name: string;
1709
+ last_name: string;
1710
+ username?: string;
1711
+ slug?: string;
1712
+ profile_picture?: {
1713
+ location: string;
1714
+ } | null;
1715
+ last_access_at?: string | null;
1716
+ }
1717
+
1718
+ export declare interface IRemoteLoggerMiddlewareOptions {
1719
+ /** URL of the log ingestion API */
1720
+ logApiUrl: string;
1721
+ /** Extra static context merged into every log payload */
1722
+ context?: Record<string, any>;
1543
1723
  }
1544
1724
 
1545
1725
  export declare interface IResponseError {
@@ -1661,7 +1841,6 @@ export declare interface IWorkspace {
1661
1841
  created_at: string;
1662
1842
  updated_at: string;
1663
1843
  deleted_at?: null;
1664
- integrations?: ILevoIntegrationList | ILevoIntegrationInstance[];
1665
1844
  description: any;
1666
1845
  icon: IMediaObject | null;
1667
1846
  workspace_id: string;
@@ -1718,18 +1897,6 @@ declare type JSONContent = {
1718
1897
  [key: string]: any;
1719
1898
  };
1720
1899
 
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
1900
  /**
1734
1901
  * Enhanced error class that matches backend response structure
1735
1902
  */
@@ -1739,6 +1906,9 @@ export declare class LevoError extends Error {
1739
1906
  status: number;
1740
1907
  type?: string;
1741
1908
  errors?: IFieldError[];
1909
+ url?: string;
1910
+ /** Raw response body from the server, preserved for debugging/error tracking. */
1911
+ responseData?: unknown;
1742
1912
  constructor(data: IErrorContent);
1743
1913
  /**
1744
1914
  * Get validation errors for form fields
@@ -1770,6 +1940,7 @@ export declare namespace LevoEvent {
1770
1940
  slug: string;
1771
1941
  status: "draft" | "canceled" | "published";
1772
1942
  accept_registration: boolean;
1943
+ one_attendee_per_account: boolean;
1773
1944
  max_capacity: number;
1774
1945
  banners: IMediaObject[];
1775
1946
  created_at: Date;
@@ -1810,6 +1981,7 @@ export declare namespace LevoEvent {
1810
1981
  hidden: boolean;
1811
1982
  allow_to_upgrade: boolean;
1812
1983
  include_in_upgrade: boolean;
1984
+ one_attendee_per_account: boolean;
1813
1985
  enforce_max_quantity: boolean;
1814
1986
  status: string;
1815
1987
  offerings: string[];
@@ -1842,6 +2014,11 @@ export declare namespace LevoEvent {
1842
2014
  expires_at: Date | null;
1843
2015
  max_redemptions: number | null;
1844
2016
  minimum_amount: number | null;
2017
+ /** Minimum transaction amount required to use this coupon */
2018
+ min_trnx_amount: number | null;
2019
+ /** Maximum discount amount cap (for percent coupons) */
2020
+ max_amount_off: number | null;
2021
+ redeem_count: number;
1845
2022
  is_public: boolean;
1846
2023
  created_at: Date;
1847
2024
  created_by: string;
@@ -1884,19 +2061,41 @@ export declare namespace LevoEvent {
1884
2061
  export namespace Attendee {
1885
2062
  export interface Root {
1886
2063
  _id: string;
2064
+ slug: string;
1887
2065
  public_id: string;
1888
2066
  name: string;
1889
2067
  email: string;
1890
2068
  mobile: string | null;
1891
2069
  event: string;
2070
+ organization: string;
2071
+ designation: string;
2072
+ details: Record<string, any>;
1892
2073
  booking: Booking.Root;
1893
2074
  ticket: Pick<LevoEvent.Ticket.Root, "_id" | "title" | "currency" | "quantity" | "status" | "unit_amount">;
1894
2075
  price: string;
1895
- account: string | null;
2076
+ /** Raw string ID, or populated account object when `include.account` is used */
2077
+ account: string | IAttendeeAccount | null;
1896
2078
  status: string;
2079
+ info: Record<string, any>;
2080
+ qr_image: IMediaObject & {
2081
+ width: number;
2082
+ height: number;
2083
+ };
2084
+ checkin_at: Date | null;
1897
2085
  created_at: Date;
1898
2086
  updated_at: Date;
1899
2087
  }
2088
+ /** Populated account shape returned when `include.account` is used in the query */
2089
+ export interface IAttendeeAccount {
2090
+ _id: string;
2091
+ reducted_email?: string;
2092
+ reducted_mobile?: string;
2093
+ slug?: string;
2094
+ username?: string;
2095
+ profile_picture?: {
2096
+ location: string;
2097
+ };
2098
+ }
1900
2099
  }
1901
2100
  export namespace Booking {
1902
2101
  export interface Root {
@@ -1915,13 +2114,17 @@ export declare namespace LevoEvent {
1915
2114
  code: string | null;
1916
2115
  status: string;
1917
2116
  paid: boolean;
2117
+ tax_inclusive: boolean;
2118
+ is_business_purchase: boolean;
2119
+ billing_details: IBillingDetails | null;
1918
2120
  info: Record<string, any>;
1919
2121
  taxes?: Array<{
1920
2122
  id: string;
1921
2123
  label: string;
1922
- percentage: number;
2124
+ percentage?: number;
1923
2125
  amount: number;
1924
- }>;
2126
+ }> | Record<string, never>;
2127
+ payment_details: IPaymentDetail[];
1925
2128
  qr_image: IMediaObject & {
1926
2129
  width: number;
1927
2130
  height: number;
@@ -1931,10 +2134,49 @@ export declare namespace LevoEvent {
1931
2134
  width: number;
1932
2135
  height: number;
1933
2136
  }) | null;
2137
+ /** How this booking was created: public (website), manual (dashboard), csv (import) */
2138
+ source: "public" | "manual" | "csv";
2139
+ /** Visit ID or null — populated when `include._visit` is used */
2140
+ _visit: string | null;
2141
+ _page: IBookingPage | null;
2142
+ upgraded_at: Date | null;
1934
2143
  created_at: Date;
1935
2144
  updated_at: Date;
1936
2145
  attendees: LevoEvent.Attendee.Root[];
1937
2146
  }
2147
+ export interface IBillingDetails {
2148
+ name: string;
2149
+ tax_id?: string;
2150
+ address?: {
2151
+ line1: string;
2152
+ line2?: string;
2153
+ city: string;
2154
+ state: string;
2155
+ postal_code: string;
2156
+ country_code: string;
2157
+ };
2158
+ }
2159
+ export interface IPaymentDetail {
2160
+ order_id: string;
2161
+ link_id: string;
2162
+ payment_kind: string;
2163
+ payment_id: string;
2164
+ provider: string;
2165
+ kind: string;
2166
+ identifier: string;
2167
+ amount: number;
2168
+ currency: string;
2169
+ status: string;
2170
+ info: Record<string, any>;
2171
+ created_at: string;
2172
+ }
2173
+ export interface IBookingPage {
2174
+ url: string;
2175
+ hostname: string;
2176
+ pathname: string;
2177
+ id: string;
2178
+ title: string;
2179
+ }
1938
2180
  export type Create = Omit<Pick<Root, "event" | "coupon">, "attendees"> & {
1939
2181
  attendees: Mandatory<LevoEvent.Attendee.Root, "name" | "ticket" | "email">;
1940
2182
  };
@@ -1946,6 +2188,7 @@ export declare namespace LevoEvent {
1946
2188
  name: string;
1947
2189
  description: string;
1948
2190
  cover_image: string | null;
2191
+ icon?: IIcon | null;
1949
2192
  status: "published" | string;
1950
2193
  created_at: string;
1951
2194
  updated_at: string;
@@ -1957,6 +2200,7 @@ export declare namespace LevoEvent {
1957
2200
  }
1958
2201
  export interface Update {
1959
2202
  name: string;
2203
+ icon?: IIcon | null;
1960
2204
  }
1961
2205
  }
1962
2206
  }
@@ -2000,7 +2244,7 @@ export declare const LogicalOperators: {
2000
2244
 
2001
2245
  export declare type LogicalOperators = keyof typeof LogicalOperators;
2002
2246
 
2003
- declare enum LogLevel {
2247
+ export declare enum LogLevel {
2004
2248
  debug = 0,
2005
2249
  info = 1,
2006
2250
  warn = 2,
@@ -2014,12 +2258,21 @@ export declare const MediaKind: Record<"image" | "video" | "audio" | "document",
2014
2258
 
2015
2259
  export declare const MediaKindList: readonly ["image", "video", "audio", "document"];
2016
2260
 
2261
+ /** Reject types assignable to Error — forces `{ exception }` wrapping at the call site. */
2262
+ declare type NotError<T> = T extends Error ? never : T;
2263
+
2017
2264
  export declare type PlanKind = "addon" | "base";
2018
2265
 
2019
2266
  export declare type Prettify<T> = {
2020
2267
  [K in keyof T]: T[K];
2021
2268
  };
2022
2269
 
2270
+ /**
2271
+ * Middleware that batches error logs and sends them to a remote API.
2272
+ * Only forwards `LogLevel.error` — lower levels are ignored.
2273
+ */
2274
+ export declare const remoteLoggerMiddleware: (options: IRemoteLoggerMiddlewareOptions) => ILevoLoggerMiddleware;
2275
+
2023
2276
  export declare type WithinFilterType = {
2024
2277
  latitude: number;
2025
2278
  longitude: number;