@ecodrix/erix-api 2.1.2 → 2.1.4

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.
@@ -234,6 +234,26 @@ declare class Analytics extends APIResource {
234
234
  * ```
235
235
  */
236
236
  whatsapp<T = any>(params?: AnalyticsParams): Promise<T>;
237
+ /**
238
+ * Revenue Intelligence — source attribution, deal velocity, cohorts, pulse.
239
+ */
240
+ revenue<T = any>(): Promise<T>;
241
+ /**
242
+ * Business Health Score — 0-100 composite with sub-scores and top actions.
243
+ */
244
+ health<T = any>(): Promise<T>;
245
+ /**
246
+ * Payment Intelligence — client scores, reminders, cash flow forecast.
247
+ */
248
+ payments<T = any>(): Promise<T>;
249
+ /**
250
+ * Review Engine Stats — requests sent, ratings, Google redirects.
251
+ */
252
+ reviews<T = any>(): Promise<T>;
253
+ /**
254
+ * Customer Retention — churn risk, at-risk leads, re-engagement stats.
255
+ */
256
+ retention<T = any>(): Promise<T>;
237
257
  }
238
258
 
239
259
  declare class AutomationDashboard extends APIResource {
@@ -402,6 +422,144 @@ declare class Automations extends APIResource {
402
422
  }): Promise<T>;
403
423
  }
404
424
 
425
+ /**
426
+ * CRM Campaigns — broadcast campaigns with A/B testing.
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * const campaigns = await ecod.crm.campaigns.list();
431
+ * const analytics = await ecod.crm.campaigns.analytics("campaign-id");
432
+ * const ab = await ecod.crm.campaigns.createAB({ channel: "email", ... });
433
+ * ```
434
+ */
435
+ declare class CRMCampaigns extends APIResource {
436
+ /**
437
+ * List campaigns with metrics.
438
+ */
439
+ list<T = any>(params?: {
440
+ status?: string;
441
+ startDate?: string;
442
+ endDate?: string;
443
+ page?: number;
444
+ limit?: number;
445
+ }): Promise<T>;
446
+ /**
447
+ * Get analytics for a specific campaign.
448
+ */
449
+ analytics<T = any>(campaignId: string): Promise<T>;
450
+ /**
451
+ * Create and send a campaign.
452
+ */
453
+ create<T = any>(payload: {
454
+ channel: "email" | "whatsapp";
455
+ recipients: Array<string | {
456
+ email?: string;
457
+ phone?: string;
458
+ name?: string;
459
+ }>;
460
+ subject?: string;
461
+ html?: string;
462
+ templateName?: string;
463
+ languageCode?: string;
464
+ variables?: Record<string, unknown>;
465
+ }): Promise<T>;
466
+ /**
467
+ * Create an A/B split test campaign.
468
+ */
469
+ createAB<T = any>(payload: {
470
+ channel: "email" | "whatsapp";
471
+ recipients: Array<string | {
472
+ email?: string;
473
+ phone?: string;
474
+ name?: string;
475
+ }>;
476
+ variants: Array<{
477
+ name: string;
478
+ subject?: string;
479
+ html?: string;
480
+ templateName?: string;
481
+ }>;
482
+ testPercent?: number;
483
+ waitHours?: number;
484
+ winnerMetric?: "open" | "click" | "reply" | "delivered";
485
+ }): Promise<T>;
486
+ }
487
+
488
+ /**
489
+ * CRM Documents — document checklist management per lead.
490
+ *
491
+ * @example
492
+ * ```typescript
493
+ * const checklist = await ecod.crm.documents.getChecklist("lead-id");
494
+ * await ecod.crm.documents.createChecklist("lead-id", "consultant__business");
495
+ * await ecod.crm.documents.markReceived("lead-id", "pan_card", fileUrl);
496
+ * await ecod.crm.documents.sendReminder("lead-id");
497
+ * ```
498
+ */
499
+ declare class CRMDocuments extends APIResource {
500
+ /**
501
+ * Get document checklist for a lead.
502
+ */
503
+ getChecklist<T = any>(leadId: string): Promise<T>;
504
+ /**
505
+ * Create a checklist from a niche template.
506
+ */
507
+ createChecklist<T = any>(leadId: string, templateNiche: string): Promise<T>;
508
+ /**
509
+ * Mark a checklist item as received.
510
+ */
511
+ markReceived<T = any>(leadId: string, itemKey: string, fileUrl?: string): Promise<T>;
512
+ /**
513
+ * Send missing documents reminder via WhatsApp.
514
+ */
515
+ sendReminder<T = any>(leadId: string): Promise<T>;
516
+ /**
517
+ * List all leads with incomplete document checklists.
518
+ */
519
+ listIncomplete<T = any>(): Promise<T>;
520
+ /**
521
+ * List available checklist templates.
522
+ */
523
+ listTemplates<T = any>(): Promise<T>;
524
+ }
525
+
526
+ /**
527
+ * CRM Invoice Export — download invoices in accounting formats.
528
+ *
529
+ * @example
530
+ * ```typescript
531
+ * const csv = await ecod.crm.invoiceExport.csv({ from: "2026-01-01", status: "paid" });
532
+ * const tally = await ecod.crm.invoiceExport.tally();
533
+ * const zoho = await ecod.crm.invoiceExport.zoho({ from: "2026-06-01", to: "2026-08-31" });
534
+ * ```
535
+ */
536
+ declare class CRMInvoiceExport extends APIResource {
537
+ /**
538
+ * Export invoices as CSV (universal spreadsheet format).
539
+ */
540
+ csv<T = any>(params?: {
541
+ from?: string;
542
+ to?: string;
543
+ status?: string;
544
+ }): Promise<T>;
545
+ /**
546
+ * Export invoices in Tally Prime-compatible JSON format.
547
+ */
548
+ tally<T = any>(params?: {
549
+ from?: string;
550
+ to?: string;
551
+ status?: string;
552
+ }): Promise<T>;
553
+ /**
554
+ * Export invoices in Zoho Books CSV format.
555
+ */
556
+ zoho<T = any>(params?: {
557
+ from?: string;
558
+ to?: string;
559
+ status?: string;
560
+ }): Promise<T>;
561
+ }
562
+
405
563
  /**
406
564
  * The specific UI control type suggested for a field on a `ResourceManifest`.
407
565
  *
@@ -894,6 +1052,14 @@ declare class Leads extends APIResource {
894
1052
  * List sequence enrollments for this lead.
895
1053
  */
896
1054
  sequences<T = any>(leadId: string): Promise<T>;
1055
+ /**
1056
+ * Merge two duplicate leads. Primary survives, secondary's data is merged in
1057
+ * (conversations, activities, tags) and the secondary is deleted.
1058
+ *
1059
+ * @param primaryId - The lead to keep.
1060
+ * @param secondaryId - The lead to merge into primary and delete.
1061
+ */
1062
+ merge<T = any>(primaryId: string, secondaryId: string): Promise<T>;
897
1063
  }
898
1064
 
899
1065
  declare class Payments extends APIResource {
@@ -1073,6 +1239,12 @@ declare class Pipelines extends APIResource {
1073
1239
  deleteStage(stageId: string, moveLeadsToStageId?: string): Promise<unknown>;
1074
1240
  }
1075
1241
 
1242
+ /** Optional time-decay: leads lose points once idle past `afterDays`. */
1243
+ interface ScoreDecay {
1244
+ enabled: boolean;
1245
+ afterDays: number;
1246
+ pointsPerDay: number;
1247
+ }
1076
1248
  interface ScoringConfig {
1077
1249
  /** Scoring rules — each rule adds/subtracts points based on field conditions. */
1078
1250
  rules: any[];
@@ -1091,6 +1263,8 @@ interface ScoringConfig {
1091
1263
  * @example ["lead_created", "appointment_booked"]
1092
1264
  */
1093
1265
  recalculateOnTriggers?: string[];
1266
+ /** Optional time-decay for idle leads. */
1267
+ decay?: ScoreDecay;
1094
1268
  }
1095
1269
  declare class Scoring extends APIResource {
1096
1270
  /**
@@ -1118,6 +1292,13 @@ declare class Scoring extends APIResource {
1118
1292
  * ```
1119
1293
  */
1120
1294
  recalculate<T = any>(leadId: string): Promise<T>;
1295
+ /**
1296
+ * Preview a lead's score + per-rule breakdown WITHOUT persisting it.
1297
+ * Powers the scoring config "why this lead scores X" panel.
1298
+ *
1299
+ * @param leadId - The unique ID of the lead to evaluate.
1300
+ */
1301
+ preview<T = any>(leadId: string): Promise<T>;
1121
1302
  }
1122
1303
 
1123
1304
  declare class Sequences extends APIResource {
@@ -1959,6 +2140,36 @@ declare class Logs extends APIResource {
1959
2140
  }>;
1960
2141
  }
1961
2142
 
2143
+ /**
2144
+ * Niche Resources — Workflow packs + WhatsApp template suggestions.
2145
+ *
2146
+ * @example
2147
+ * ```typescript
2148
+ * const packs = await ecod.niche.workflowPacks();
2149
+ * const detail = await ecod.niche.workflowPackDetail("pack_healthcare");
2150
+ * const result = await ecod.niche.installWorkflowPack("pack_healthcare");
2151
+ * const templates = await ecod.niche.templateSuggestions();
2152
+ * ```
2153
+ */
2154
+ declare class NicheResources extends APIResource {
2155
+ /**
2156
+ * List workflow packs available for the org's niche.
2157
+ */
2158
+ workflowPacks<T = any>(): Promise<T>;
2159
+ /**
2160
+ * Get a specific workflow pack with full flow details.
2161
+ */
2162
+ workflowPackDetail<T = any>(packId: string): Promise<T>;
2163
+ /**
2164
+ * Install a workflow pack — clone all flows into the org's workspace.
2165
+ */
2166
+ installWorkflowPack<T = any>(packId: string): Promise<T>;
2167
+ /**
2168
+ * WhatsApp template suggestions for the org's niche.
2169
+ */
2170
+ templateSuggestions<T = any>(): Promise<T>;
2171
+ }
2172
+
1962
2173
  /**
1963
2174
  * Portal Inbox — team-side unified inbox for portal conversations.
1964
2175
  *
@@ -6490,6 +6701,10 @@ declare class ErixProduct {
6490
6701
  readonly projects: ProjectDocuments;
6491
6702
  readonly campaigns: Campaigns;
6492
6703
  readonly portalInbox: PortalInbox;
6704
+ readonly niche: NicheResources;
6705
+ readonly documents: CRMDocuments;
6706
+ readonly invoiceExport: CRMInvoiceExport;
6707
+ readonly crmCampaigns: CRMCampaigns;
6493
6708
  constructor(client: AxiosInstance);
6494
6709
  }
6495
6710
  /** Product domain root (`/v1/api/product/*`). */
@@ -6741,6 +6956,12 @@ interface ECODrIxAPIOptions {
6741
6956
  * never set this and never pass a URL.
6742
6957
  */
6743
6958
  baseUrl?: string;
6959
+ /**
6960
+ * Per-request timeout in milliseconds. A request that gets no response
6961
+ * within this window is aborted and rejected (rather than hanging the
6962
+ * caller forever). Defaults to 30000 (30s). Set 0 to disable.
6963
+ */
6964
+ timeout?: number;
6744
6965
  }
6745
6966
  /**
6746
6967
  * The primary entry point for the ECODrIx SDK.