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