@graph8/sdk 0.2.0

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.
@@ -0,0 +1,860 @@
1
+ import * as _jitsu_js from '@jitsu/js';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ReactNode } from 'react';
4
+
5
+ interface ContactList {
6
+ id: number;
7
+ title: string;
8
+ type: "contacts" | "companies";
9
+ contact_count: number | null;
10
+ created_at: string | null;
11
+ }
12
+ interface ListContact {
13
+ id: number;
14
+ first_name: string | null;
15
+ last_name: string | null;
16
+ work_email: string | null;
17
+ job_title: string | null;
18
+ company_name: string | null;
19
+ }
20
+ /**
21
+ * Lists API - manage contact and company lists. Requires API key (server-side).
22
+ */
23
+ declare const createListsClient: (apiKey: string, apiUrl?: string) => {
24
+ /** List all lists. */
25
+ list(page?: number, limit?: number): Promise<{
26
+ data: ContactList[];
27
+ total: number;
28
+ }>;
29
+ /** Create a new list. */
30
+ create(title: string, type?: "contacts" | "companies"): Promise<ContactList>;
31
+ /** Delete a list (soft-delete). */
32
+ delete(listId: number): Promise<{
33
+ deleted: boolean;
34
+ }>;
35
+ /** Get contacts in a list. */
36
+ contacts(listId: number, page?: number, limit?: number): Promise<{
37
+ data: ListContact[];
38
+ total: number;
39
+ }>;
40
+ /** Add contacts to a list. */
41
+ addContacts(listId: number, contactIds: number[]): Promise<{
42
+ added: number;
43
+ }>;
44
+ /** Remove contacts from a list. */
45
+ removeContacts(listId: number, contactIds: number[]): Promise<{
46
+ removed: number;
47
+ }>;
48
+ };
49
+
50
+ interface Company {
51
+ id: number;
52
+ name: string | null;
53
+ domain: string | null;
54
+ industry: string | null;
55
+ employee_count: number | null;
56
+ revenue: number | null;
57
+ founded_year: number | null;
58
+ description: string | null;
59
+ linkedin_url: string | null;
60
+ country: string | null;
61
+ state: string | null;
62
+ city: string | null;
63
+ }
64
+ interface CompanyListParams {
65
+ page?: number;
66
+ limit?: number;
67
+ domain?: string;
68
+ industry?: string;
69
+ name?: string;
70
+ country?: string;
71
+ }
72
+ interface CompanyUpdateParams {
73
+ name?: string;
74
+ domain?: string;
75
+ industry?: string;
76
+ description?: string;
77
+ linkedin_url?: string;
78
+ country?: string;
79
+ state?: string;
80
+ city?: string;
81
+ }
82
+ interface CompanyContact {
83
+ id: number;
84
+ first_name: string | null;
85
+ last_name: string | null;
86
+ work_email: string | null;
87
+ job_title: string | null;
88
+ }
89
+ /**
90
+ * Companies API - search and manage CRM companies. Requires API key (server-side).
91
+ */
92
+ declare const createCompaniesClient: (apiKey: string, apiUrl?: string) => {
93
+ /** List companies with optional filters. */
94
+ list(params?: CompanyListParams): Promise<{
95
+ data: Company[];
96
+ total: number;
97
+ }>;
98
+ /** Get a single company by ID. */
99
+ get(companyId: number): Promise<Company>;
100
+ /** Get contacts belonging to a company. */
101
+ contacts(companyId: number, limit?: number, offset?: number): Promise<{
102
+ data: CompanyContact[];
103
+ total: number;
104
+ }>;
105
+ /** Update a company (partial). */
106
+ update(companyId: number, fields: CompanyUpdateParams): Promise<{
107
+ updated: number;
108
+ }>;
109
+ /** Delete a company (soft-delete). */
110
+ delete(companyId: number): Promise<{
111
+ deleted: boolean;
112
+ }>;
113
+ };
114
+
115
+ interface Contact {
116
+ id: number;
117
+ first_name: string | null;
118
+ last_name: string | null;
119
+ work_email: string | null;
120
+ job_title: string | null;
121
+ seniority_level: string | null;
122
+ company_name: string | null;
123
+ company_domain: string | null;
124
+ linkedin_url: string | null;
125
+ direct_phone: string | null;
126
+ mobile_phone: string | null;
127
+ city: string | null;
128
+ state: string | null;
129
+ country: string | null;
130
+ }
131
+ interface ContactListParams {
132
+ page?: number;
133
+ limit?: number;
134
+ email?: string;
135
+ name?: string;
136
+ job_title?: string;
137
+ seniority_level?: string;
138
+ company_name?: string;
139
+ country?: string;
140
+ list_id?: number;
141
+ }
142
+ interface ContactCreateParams {
143
+ work_email: string;
144
+ first_name?: string;
145
+ last_name?: string;
146
+ job_title?: string;
147
+ company_domain?: string;
148
+ linkedin_url?: string;
149
+ direct_phone?: string;
150
+ mobile_phone?: string;
151
+ city?: string;
152
+ state?: string;
153
+ country?: string;
154
+ list_id?: number;
155
+ }
156
+ interface ContactUpdateParams {
157
+ first_name?: string;
158
+ last_name?: string;
159
+ work_email?: string;
160
+ job_title?: string;
161
+ company_domain?: string;
162
+ linkedin_url?: string;
163
+ direct_phone?: string;
164
+ mobile_phone?: string;
165
+ city?: string;
166
+ state?: string;
167
+ country?: string;
168
+ }
169
+ /**
170
+ * Contacts API - full CRUD for CRM contacts. Requires API key (server-side).
171
+ */
172
+ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
173
+ /** List contacts with optional filters. */
174
+ list(params?: ContactListParams): Promise<{
175
+ data: Contact[];
176
+ total: number;
177
+ }>;
178
+ /** Get a single contact by ID. */
179
+ get(contactId: number): Promise<Contact>;
180
+ /** Create a new contact. */
181
+ create(contact: ContactCreateParams): Promise<Contact>;
182
+ /** Update a contact (partial). */
183
+ update(contactId: number, fields: ContactUpdateParams): Promise<{
184
+ updated: number;
185
+ }>;
186
+ /** Delete a contact (soft-delete). */
187
+ delete(contactId: number): Promise<{
188
+ deleted: boolean;
189
+ }>;
190
+ };
191
+
192
+ type WebhookEvent = "reply_received" | "meeting_booked" | "contact_enriched" | "contact_created" | "sequence_completed" | "sequence_replied" | "campaign_launched" | "form_submitted" | "visitor_identified";
193
+ type WebhookCallback = (data: Record<string, unknown>) => void;
194
+ /**
195
+ * Webhooks - listen for graph8 events. Requires API key (server-side).
196
+ *
197
+ * For client-side real-time events, use g8.visitors.onIntent() or g8.chat.on() instead.
198
+ */
199
+ declare const createWebhooksClient: (apiKey: string, apiUrl?: string) => {
200
+ /** Register a listener for a webhook event. Starts polling automatically. */
201
+ on(event: WebhookEvent, callback: WebhookCallback): void;
202
+ /** Stop all webhook polling. */
203
+ stop(): void;
204
+ };
205
+
206
+ interface LandingPage {
207
+ id: string;
208
+ title: string;
209
+ slug: string;
210
+ status: string;
211
+ published_url: string | null;
212
+ }
213
+ /**
214
+ * Landing pages - clone, create, publish. Requires API key (server-side).
215
+ */
216
+ declare const createPagesClient: (apiKey: string, apiUrl?: string) => {
217
+ /** Clone a landing page from any URL. */
218
+ clone(url: string): Promise<LandingPage>;
219
+ /** Create a landing page from a template. */
220
+ create(config: {
221
+ template?: string;
222
+ title?: string;
223
+ content?: Record<string, unknown>;
224
+ }): Promise<LandingPage>;
225
+ /** Publish a landing page to CDN. */
226
+ publish(pageId: string): Promise<{
227
+ url: string;
228
+ }>;
229
+ };
230
+
231
+ interface VoiceSession {
232
+ id: string;
233
+ status: string;
234
+ agent: string;
235
+ started_at: string;
236
+ }
237
+ interface CallAnalysis {
238
+ duration_seconds: number;
239
+ sentiment: "positive" | "neutral" | "negative";
240
+ summary: string;
241
+ next_steps: string[];
242
+ objections: string[];
243
+ transcript: Array<{
244
+ speaker: string;
245
+ text: string;
246
+ timestamp: number;
247
+ }>;
248
+ }
249
+ type VoiceEvent = "connected" | "transcription" | "ended" | "error";
250
+ type VoiceCallback = (data: Record<string, unknown>) => void;
251
+ /**
252
+ * Voice AI - start AI voice calls, get transcriptions and analysis. Requires API key.
253
+ */
254
+ declare const createVoiceClient: (apiKey: string, apiUrl?: string) => {
255
+ /** Start an AI voice session. */
256
+ start(config: {
257
+ agent?: string;
258
+ contactId?: number;
259
+ context?: Record<string, unknown>;
260
+ }): Promise<VoiceSession>;
261
+ /** Get call analysis for a completed session. */
262
+ analysis(sessionId: string): Promise<CallAnalysis>;
263
+ /** Listen for voice events. */
264
+ on(event: VoiceEvent, callback: VoiceCallback): void;
265
+ };
266
+
267
+ interface AnalyticsOverview {
268
+ visitors: number;
269
+ contacts_created: number;
270
+ emails_sent: number;
271
+ emails_opened: number;
272
+ replies: number;
273
+ meetings_booked: number;
274
+ period: string;
275
+ }
276
+ /**
277
+ * Analytics - dashboard data and metrics. Requires API key (server-side).
278
+ */
279
+ declare const createAnalyticsClient: (apiKey: string, apiUrl?: string) => {
280
+ overview(config?: {
281
+ period?: string;
282
+ metrics?: string[];
283
+ }): Promise<AnalyticsOverview>;
284
+ };
285
+
286
+ interface IntentSignals {
287
+ domain: string;
288
+ score: number;
289
+ intent: "low" | "medium" | "high";
290
+ signals: string[];
291
+ last_seen: string | null;
292
+ }
293
+ /**
294
+ * Intent signals - company-level buying signals. Write key for public, API key for full access.
295
+ */
296
+ declare const createSignalsClient: (key: string, isApiKey: boolean, apiUrl?: string) => {
297
+ /** Get intent signals for a specific company domain. */
298
+ company(domain: string): Promise<IntentSignals>;
299
+ /** Stream intent signals - calls callback every 30s with latest data. */
300
+ stream(domains: string[], callback: (signals: IntentSignals[]) => void): () => void;
301
+ };
302
+
303
+ interface Integration {
304
+ id: string;
305
+ provider: string;
306
+ status: string;
307
+ connected_at: string | null;
308
+ }
309
+ /**
310
+ * Integrations - connect CRM platforms, trigger syncs. Requires API key (server-side).
311
+ */
312
+ declare const createIntegrationsClient: (apiKey: string, apiUrl?: string) => {
313
+ list(): Promise<Integration[]>;
314
+ connect(provider: string, config?: Record<string, unknown>): Promise<void>;
315
+ sync(provider: string, config?: {
316
+ direction?: "inbound" | "outbound" | "bidirectional";
317
+ }): Promise<void>;
318
+ };
319
+
320
+ interface Campaign {
321
+ id: string;
322
+ name: string;
323
+ slug: string;
324
+ status: string;
325
+ category: string | null;
326
+ goal: string | null;
327
+ target_persona: string | null;
328
+ }
329
+ interface CampaignCreateConfig {
330
+ name: string;
331
+ category?: string;
332
+ brief?: string;
333
+ core_concept?: string;
334
+ primary_hook?: string;
335
+ target_persona?: string;
336
+ goal?: string;
337
+ }
338
+ interface CampaignStats {
339
+ sent: number;
340
+ opened: number;
341
+ replied: number;
342
+ meetings: number;
343
+ }
344
+ /**
345
+ * Campaigns - create, manage, launch campaigns. Requires API key (server-side).
346
+ */
347
+ declare const createCampaignsClient: (apiKey: string, apiUrl?: string) => {
348
+ list(page?: number, limit?: number): Promise<Campaign[]>;
349
+ get(campaignId: string): Promise<Campaign>;
350
+ create(config: CampaignCreateConfig): Promise<Campaign>;
351
+ launch(campaignId: string): Promise<void>;
352
+ stats(campaignId: string): Promise<CampaignStats>;
353
+ };
354
+
355
+ interface Sequence {
356
+ id: string;
357
+ name: string;
358
+ status: string;
359
+ step_count: number | null;
360
+ contact_count: number | null;
361
+ }
362
+ interface AddToSequenceConfig {
363
+ sequenceId: string;
364
+ contactIds: number[];
365
+ listId: number;
366
+ }
367
+ /**
368
+ * Sequences - manage outbound sequences. Requires API key (server-side).
369
+ */
370
+ declare const createSequencesClient: (apiKey: string, apiUrl?: string) => {
371
+ list(page?: number, limit?: number): Promise<Sequence[]>;
372
+ add(config: AddToSequenceConfig): Promise<void>;
373
+ };
374
+
375
+ interface PersonEnrichment {
376
+ found: boolean;
377
+ confidence: number;
378
+ data: Record<string, unknown>;
379
+ }
380
+ interface CompanyEnrichment {
381
+ found: boolean;
382
+ confidence: number;
383
+ data: Record<string, unknown>;
384
+ }
385
+ interface EmailVerification {
386
+ email: string;
387
+ valid: boolean;
388
+ deliverable: boolean;
389
+ catch_all: boolean;
390
+ }
391
+ interface SearchFilter {
392
+ field: string;
393
+ operator: "any_of" | "contains" | "all_of" | "none_of" | "is_empty" | "is_not_empty" | "between" | "exists";
394
+ value: unknown;
395
+ }
396
+ interface SearchResults {
397
+ contacts: Record<string, unknown>[];
398
+ total: number;
399
+ page: number;
400
+ }
401
+ /**
402
+ * Enrichment API - person/company lookup, email verification, prospecting search.
403
+ *
404
+ * Requires API key (server-side only). Credits charged per call.
405
+ */
406
+ declare const createEnrichClient: (apiKey: string, apiUrl?: string) => {
407
+ /** Look up a person by email, LinkedIn, or name + company. Costs 1 credit. */
408
+ person(params: {
409
+ email?: string;
410
+ linkedin_url?: string;
411
+ first_name?: string;
412
+ last_name?: string;
413
+ company_domain?: string;
414
+ }): Promise<PersonEnrichment>;
415
+ /** Look up a company by domain or name. Costs 1 credit. */
416
+ company(params: {
417
+ domain?: string;
418
+ name?: string;
419
+ }): Promise<CompanyEnrichment>;
420
+ /** Verify an email address. Costs 1 credit. */
421
+ verifyEmail(email: string): Promise<EmailVerification>;
422
+ /** Search 300M+ contacts with filters. Credits charged per result. */
423
+ search(filters: SearchFilter[], page?: number, limit?: number): Promise<SearchResults>;
424
+ };
425
+
426
+ interface CalendarConfig {
427
+ /** Event type slug (e.g. "demo-30min") */
428
+ eventType: string;
429
+ /** Username of the host */
430
+ username: string;
431
+ /** Pre-fill attendee info */
432
+ prefill?: {
433
+ name?: string;
434
+ email?: string;
435
+ notes?: string;
436
+ };
437
+ }
438
+ interface TimeSlot {
439
+ start: string;
440
+ end: string;
441
+ available: boolean;
442
+ }
443
+ interface Booking {
444
+ uid: string;
445
+ confirmation_url: string;
446
+ start_time: string;
447
+ end_time: string;
448
+ }
449
+ interface BookingRequest {
450
+ event_type_id: number;
451
+ slot: string;
452
+ attendee: {
453
+ name: string;
454
+ email: string;
455
+ notes?: string;
456
+ };
457
+ }
458
+ type CalendarEvent = "booked" | "cancelled" | "slot_selected";
459
+ type CalendarCallback = (data: Record<string, unknown>) => void;
460
+ /**
461
+ * Calendar and booking - show scheduling widgets, get slots, book meetings.
462
+ *
463
+ * Public endpoints - no API key needed.
464
+ */
465
+ declare const createCalendarClient: (apiUrl?: string) => {
466
+ /** Show a booking modal overlay. */
467
+ show(config: CalendarConfig): void;
468
+ /** Embed booking widget inline in a container element. */
469
+ embed(selector: string, config: CalendarConfig): void;
470
+ /** Get available time slots for an event type. */
471
+ slots(username: string, eventSlug: string, range: {
472
+ start: string;
473
+ end: string;
474
+ }): Promise<TimeSlot[]>;
475
+ /** Book a meeting programmatically. */
476
+ book(request: BookingRequest): Promise<Booking | null>;
477
+ /** Listen for calendar events. */
478
+ on(event: CalendarEvent, callback: CalendarCallback): void;
479
+ };
480
+
481
+ interface ChatConfig {
482
+ /** Agent ID to connect to */
483
+ agentId?: string;
484
+ /** Pre-filled first message */
485
+ message?: string;
486
+ /** Widget position */
487
+ position?: "bottom-right" | "bottom-left";
488
+ /** Widget theme */
489
+ theme?: "light" | "dark" | "auto";
490
+ /** Custom greeting */
491
+ greeting?: string;
492
+ /** Custom avatar URL */
493
+ avatar?: string;
494
+ }
495
+ type ChatEvent = "message" | "human_transfer" | "open" | "close" | "error";
496
+ type ChatCallback = (data: Record<string, unknown>) => void;
497
+ /**
498
+ * Webchat - live chat + AI chat embedded in any app.
499
+ *
500
+ * Uses WebSocket connection to the voice/chat agent backend.
501
+ * Public - no API key needed (org/agent IDs are in the config).
502
+ */
503
+ declare const createChatClient: (writeKey: string, apiUrl?: string) => {
504
+ /** Open the chat widget. */
505
+ open(config?: ChatConfig): void;
506
+ /** Send a message. */
507
+ send(message: string): void;
508
+ /** Listen for chat events. */
509
+ on(event: ChatEvent, callback: ChatCallback): void;
510
+ /** Configure the chat appearance. */
511
+ configure(config: Partial<ChatConfig>): void;
512
+ /** Close the chat widget. */
513
+ close(): void;
514
+ };
515
+
516
+ interface CopilotConfig {
517
+ /** Initial greeting message */
518
+ greeting?: string;
519
+ /** Context passed to the AI */
520
+ context?: Record<string, unknown>;
521
+ /** Widget position */
522
+ position?: "bottom-right" | "bottom-left";
523
+ /** Widget theme */
524
+ theme?: "light" | "dark" | "auto";
525
+ }
526
+ type CopilotEvent = "message" | "tool_used" | "open" | "close" | "error";
527
+ type CopilotCallback = (data: Record<string, unknown>) => void;
528
+ type ActionHandler = (params: Record<string, unknown>) => void | Promise<void>;
529
+ /**
530
+ * Copilot - embeddable AI assistant with org knowledge base access.
531
+ *
532
+ * Client-side (write key) for the widget embed.
533
+ */
534
+ declare const createCopilotClient: (writeKey: string, apiUrl?: string) => {
535
+ /** Open the copilot widget. */
536
+ open(config?: CopilotConfig): void;
537
+ /** Send a message to the copilot programmatically. */
538
+ ask(message: string): Promise<string>;
539
+ /** Register a custom action the copilot can trigger. */
540
+ registerAction(name: string, handler: ActionHandler): void;
541
+ /** Listen for copilot events. */
542
+ on(event: CopilotEvent, callback: CopilotCallback): void;
543
+ /** Close the copilot widget. */
544
+ close(): void;
545
+ };
546
+
547
+ interface VisitorCompany {
548
+ company_name: string | null;
549
+ company_domain: string | null;
550
+ industry: string | null;
551
+ employee_count: string | null;
552
+ city: string | null;
553
+ country: string | null;
554
+ confidence: number;
555
+ }
556
+ interface VisitorScore {
557
+ engagement: number;
558
+ intent: "low" | "medium" | "high";
559
+ signals: string[];
560
+ }
561
+ type IntentCallback = (visitor: VisitorCompany & VisitorScore) => void;
562
+ /**
563
+ * Visitor intelligence - identify anonymous visitors by IP → company.
564
+ *
565
+ * Requires write key auth. Works client-side only.
566
+ */
567
+ declare const createVisitorsClient: (writeKey: string, apiUrl?: string) => {
568
+ /** Identify the current visitor's company from their IP address. */
569
+ identify(): Promise<VisitorCompany>;
570
+ /** Get engagement score for the current visitor. */
571
+ score(): Promise<VisitorScore>;
572
+ /** Listen for visitors matching an intent level. Polls every 30 seconds. */
573
+ onIntent(level: "low" | "medium" | "high", callback: IntentCallback): () => void;
574
+ };
575
+
576
+ /** Configuration for g8.init() */
577
+ interface G8Config {
578
+ /** Write key for client-side tracking (from Settings > MCP & API) */
579
+ writeKey?: string;
580
+ /** API key for server-side operations (from Settings > MCP & API > API tab) */
581
+ apiKey?: string;
582
+ /** Tracking host URL (default: https://t.graph8.com) */
583
+ host?: string;
584
+ /** Backend API URL (default: https://be.graph8.com) */
585
+ apiUrl?: string;
586
+ /** Privacy controls */
587
+ privacy?: G8PrivacyConfig;
588
+ /** Enable debug logging (default: false) */
589
+ debug?: boolean;
590
+ }
591
+ interface G8PrivacyConfig {
592
+ /** Disable all cookies and event sending */
593
+ dontSend?: boolean;
594
+ /** Disable storing user identifiers */
595
+ dontStoreUserIds?: boolean;
596
+ /** IP address handling policy */
597
+ ipPolicy?: "keep" | "stripLastOctet" | "remove";
598
+ }
599
+ /** Properties for g8.track() events */
600
+ interface TrackProperties {
601
+ [key: string]: string | number | boolean | null | undefined;
602
+ }
603
+ /** Properties for g8.identify() calls */
604
+ interface IdentifyProperties {
605
+ email?: string;
606
+ name?: string;
607
+ first_name?: string;
608
+ last_name?: string;
609
+ company?: string;
610
+ company_domain?: string;
611
+ job_title?: string;
612
+ phone?: string;
613
+ [key: string]: string | number | boolean | null | undefined;
614
+ }
615
+ /** Result from g8.forms.lookup() */
616
+ interface EnrichLookupResult {
617
+ found: boolean;
618
+ known_fields: Record<string, string>;
619
+ missing_fields: string[];
620
+ }
621
+
622
+ /**
623
+ * Progressive form enrichment - checks what fields graph8 already knows
624
+ * about a contact so your form can skip those fields.
625
+ *
626
+ * Calls POST /api/v1/public/enrich/lookup (authenticated via write key).
627
+ */
628
+ declare const createFormsClient: (writeKey: string, apiUrl?: string) => {
629
+ /**
630
+ * Look up known fields for an email address.
631
+ *
632
+ * Use this in progressive forms: after the user enters their email,
633
+ * check what graph8 already knows and only show missing fields.
634
+ */
635
+ lookup(email: string): Promise<EnrichLookupResult>;
636
+ };
637
+
638
+ interface G8ProviderProps {
639
+ /** Your graph8 write key */
640
+ writeKey: string;
641
+ /** Tracking host (default: https://t.graph8.com) */
642
+ host?: string;
643
+ /** Additional config options */
644
+ config?: Partial<Omit<G8Config, "writeKey" | "host">>;
645
+ children: ReactNode;
646
+ }
647
+ /**
648
+ * graph8 React provider. Initializes the SDK once and provides it to all children.
649
+ *
650
+ * Usage:
651
+ * import { G8Provider } from '@graph8/js/react';
652
+ *
653
+ * <G8Provider writeKey="your_write_key">
654
+ * <App />
655
+ * </G8Provider>
656
+ */
657
+ declare const G8Provider: ({ writeKey, host, config, children, }: G8ProviderProps) => react_jsx_runtime.JSX.Element;
658
+ /**
659
+ * Hook to access the graph8 SDK from any component.
660
+ *
661
+ * Usage:
662
+ * const { track, identify, page, forms } = useG8();
663
+ * track('button_click', { button: 'cta' });
664
+ */
665
+ declare const useG8: () => {
666
+ /** Track a custom event */
667
+ track: (event: string, properties?: TrackProperties) => void;
668
+ /** Identify a user */
669
+ identify: (userId: string, properties?: IdentifyProperties) => void;
670
+ /** Track a page view */
671
+ page: (properties?: TrackProperties) => void;
672
+ /** Clear user identity */
673
+ reset: () => void;
674
+ /** Progressive form helpers */
675
+ forms: {
676
+ lookup(email: string): Promise<EnrichLookupResult>;
677
+ };
678
+ /** Raw g8 client instance */
679
+ g8: {
680
+ client: _jitsu_js.AnalyticsInterface | null;
681
+ config: G8Config | null;
682
+ _forms: ReturnType<typeof createFormsClient> | null;
683
+ _visitors: ReturnType<typeof createVisitorsClient> | null;
684
+ _copilot: ReturnType<typeof createCopilotClient> | null;
685
+ _chat: ReturnType<typeof createChatClient> | null;
686
+ _calendar: ReturnType<typeof createCalendarClient> | null;
687
+ _enrich: ReturnType<typeof createEnrichClient> | null;
688
+ _sequences: ReturnType<typeof createSequencesClient> | null;
689
+ _campaigns: ReturnType<typeof createCampaignsClient> | null;
690
+ _integrations: ReturnType<typeof createIntegrationsClient> | null;
691
+ _signals: ReturnType<typeof createSignalsClient> | null;
692
+ _analytics: ReturnType<typeof createAnalyticsClient> | null;
693
+ _voice: ReturnType<typeof createVoiceClient> | null;
694
+ _pages: ReturnType<typeof createPagesClient> | null;
695
+ _webhooks: ReturnType<typeof createWebhooksClient> | null;
696
+ _contacts: ReturnType<typeof createContactsClient> | null;
697
+ _companies: ReturnType<typeof createCompaniesClient> | null;
698
+ _lists: ReturnType<typeof createListsClient> | null;
699
+ init(config: G8Config): void;
700
+ track(event: string, properties?: TrackProperties): void;
701
+ identify(userId: string, properties?: IdentifyProperties): void;
702
+ page(properties?: TrackProperties): void;
703
+ reset(): void;
704
+ get forms(): {
705
+ lookup(email: string): Promise<EnrichLookupResult>;
706
+ };
707
+ get visitors(): {
708
+ identify(): Promise<VisitorCompany>;
709
+ score(): Promise<VisitorScore>;
710
+ onIntent(level: "low" | "medium" | "high", callback: (visitor: VisitorCompany & VisitorScore) => void): () => void;
711
+ };
712
+ get copilot(): {
713
+ open(config?: CopilotConfig): void;
714
+ ask(message: string): Promise<string>;
715
+ registerAction(name: string, handler: (params: Record<string, unknown>) => void | Promise<void>): void;
716
+ on(event: "message" | "tool_used" | "open" | "close" | "error", callback: (data: Record<string, unknown>) => void): void;
717
+ close(): void;
718
+ };
719
+ get chat(): {
720
+ open(config?: ChatConfig): void;
721
+ send(message: string): void;
722
+ on(event: "message" | "open" | "close" | "error" | "human_transfer", callback: (data: Record<string, unknown>) => void): void;
723
+ configure(config: Partial<ChatConfig>): void;
724
+ close(): void;
725
+ };
726
+ get calendar(): {
727
+ show(config: CalendarConfig): void;
728
+ embed(selector: string, config: CalendarConfig): void;
729
+ slots(username: string, eventSlug: string, range: {
730
+ start: string;
731
+ end: string;
732
+ }): Promise<TimeSlot[]>;
733
+ book(request: BookingRequest): Promise<Booking | null>;
734
+ on(event: "booked" | "cancelled" | "slot_selected", callback: (data: Record<string, unknown>) => void): void;
735
+ };
736
+ get enrich(): {
737
+ person(params: {
738
+ email?: string;
739
+ linkedin_url?: string;
740
+ first_name?: string;
741
+ last_name?: string;
742
+ company_domain?: string;
743
+ }): Promise<PersonEnrichment>;
744
+ company(params: {
745
+ domain?: string;
746
+ name?: string;
747
+ }): Promise<CompanyEnrichment>;
748
+ verifyEmail(email: string): Promise<EmailVerification>;
749
+ search(filters: SearchFilter[], page?: number, limit?: number): Promise<SearchResults>;
750
+ };
751
+ get sequences(): {
752
+ list(page?: number, limit?: number): Promise<Sequence[]>;
753
+ add(config: AddToSequenceConfig): Promise<void>;
754
+ };
755
+ get campaigns(): {
756
+ list(page?: number, limit?: number): Promise<Campaign[]>;
757
+ get(campaignId: string): Promise<Campaign>;
758
+ create(config: CampaignCreateConfig): Promise<Campaign>;
759
+ launch(campaignId: string): Promise<void>;
760
+ stats(campaignId: string): Promise<CampaignStats>;
761
+ };
762
+ get integrations(): {
763
+ list(): Promise<Integration[]>;
764
+ connect(provider: string, config?: Record<string, unknown>): Promise<void>;
765
+ sync(provider: string, config?: {
766
+ direction?: "inbound" | "outbound" | "bidirectional";
767
+ }): Promise<void>;
768
+ };
769
+ get signals(): {
770
+ company(domain: string): Promise<IntentSignals>;
771
+ stream(domains: string[], callback: (signals: IntentSignals[]) => void): () => void;
772
+ };
773
+ get analytics(): {
774
+ overview(config?: {
775
+ period?: string;
776
+ metrics?: string[];
777
+ }): Promise<AnalyticsOverview>;
778
+ };
779
+ get voice(): {
780
+ start(config: {
781
+ agent?: string;
782
+ contactId?: number;
783
+ context?: Record<string, unknown>;
784
+ }): Promise<VoiceSession>;
785
+ analysis(sessionId: string): Promise<CallAnalysis>;
786
+ on(event: "error" | "ended" | "connected" | "transcription", callback: (data: Record<string, unknown>) => void): void;
787
+ };
788
+ get pages(): {
789
+ clone(url: string): Promise<LandingPage>;
790
+ create(config: {
791
+ template?: string;
792
+ title?: string;
793
+ content?: Record<string, unknown>;
794
+ }): Promise<LandingPage>;
795
+ publish(pageId: string): Promise<{
796
+ url: string;
797
+ }>;
798
+ };
799
+ get webhooks(): {
800
+ on(event: WebhookEvent, callback: (data: Record<string, unknown>) => void): void;
801
+ stop(): void;
802
+ };
803
+ get contacts(): {
804
+ list(params?: ContactListParams): Promise<{
805
+ data: Contact[];
806
+ total: number;
807
+ }>;
808
+ get(contactId: number): Promise<Contact>;
809
+ create(contact: ContactCreateParams): Promise<Contact>;
810
+ update(contactId: number, fields: ContactUpdateParams): Promise<{
811
+ updated: number;
812
+ }>;
813
+ delete(contactId: number): Promise<{
814
+ deleted: boolean;
815
+ }>;
816
+ };
817
+ get companies(): {
818
+ list(params?: CompanyListParams): Promise<{
819
+ data: Company[];
820
+ total: number;
821
+ }>;
822
+ get(companyId: number): Promise<Company>;
823
+ contacts(companyId: number, limit?: number, offset?: number): Promise<{
824
+ data: CompanyContact[];
825
+ total: number;
826
+ }>;
827
+ update(companyId: number, fields: CompanyUpdateParams): Promise<{
828
+ updated: number;
829
+ }>;
830
+ delete(companyId: number): Promise<{
831
+ deleted: boolean;
832
+ }>;
833
+ };
834
+ get lists(): {
835
+ list(page?: number, limit?: number): Promise<{
836
+ data: ContactList[];
837
+ total: number;
838
+ }>;
839
+ create(title: string, type?: "contacts" | "companies"): Promise<ContactList>;
840
+ delete(listId: number): Promise<{
841
+ deleted: boolean;
842
+ }>;
843
+ contacts(listId: number, page?: number, limit?: number): Promise<{
844
+ data: ListContact[];
845
+ total: number;
846
+ }>;
847
+ addContacts(listId: number, contactIds: number[]): Promise<{
848
+ added: number;
849
+ }>;
850
+ removeContacts(listId: number, contactIds: number[]): Promise<{
851
+ removed: number;
852
+ }>;
853
+ };
854
+ get initialized(): boolean;
855
+ _assertInit(): void;
856
+ _assertKey(module: string): void;
857
+ };
858
+ };
859
+
860
+ export { G8Provider, useG8 };