@graph8/sdk 0.3.0 → 0.5.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/dist/index.js CHANGED
@@ -349,18 +349,133 @@ var DEFAULT_API7 = "https://be.graph8.com";
349
349
  var createSequencesClient = (apiKey, apiUrl) => {
350
350
  const baseUrl = apiUrl || DEFAULT_API7;
351
351
  const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
352
+ const toQuery = (params) => {
353
+ const qs = new URLSearchParams();
354
+ for (const [k, v] of Object.entries(params)) {
355
+ if (v != null) qs.set(k, String(v));
356
+ }
357
+ const s = qs.toString();
358
+ return s ? `?${s}` : "";
359
+ };
360
+ async function list(pageOrParams, limit) {
361
+ let params;
362
+ if (typeof pageOrParams === "number") {
363
+ params = { page: pageOrParams, limit: limit ?? 50 };
364
+ } else {
365
+ params = pageOrParams ?? {};
366
+ }
367
+ const resp = await fetch(`${baseUrl}/api/v1/sequences${toQuery(params)}`, { headers: headers() });
368
+ const data = await resp.json();
369
+ return data.data || data;
370
+ }
352
371
  return {
353
- async list(page = 1, limit = 50) {
354
- const resp = await fetch(`${baseUrl}/api/v1/sequences?page=${page}&limit=${limit}`, { headers: headers() });
372
+ /** List sequences with pagination + optional status filter. */
373
+ list,
374
+ /** Get full sequence details by ID. */
375
+ async get(sequenceId) {
376
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}`, { headers: headers() });
355
377
  const data = await resp.json();
356
378
  return data.data || data;
357
379
  },
380
+ /** List contacts enrolled in a sequence. Filter by state (e.g. "active", "replied"). */
381
+ async contacts(sequenceId, params = {}) {
382
+ const resp = await fetch(
383
+ `${baseUrl}/api/v1/sequences/${sequenceId}/contacts${toQuery(params)}`,
384
+ { headers: headers() }
385
+ );
386
+ return resp.json();
387
+ },
388
+ /** Add contacts to a sequence (V2 queuing). Live or drafted sequences only. */
358
389
  async add(config) {
359
- await fetch(`${baseUrl}/api/v1/sequences/${config.sequenceId}/contacts`, {
390
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${config.sequenceId}/contacts`, {
360
391
  method: "POST",
361
392
  headers: headers(),
362
393
  body: JSON.stringify({ contact_ids: config.contactIds, list_id: config.listId })
363
394
  });
395
+ const data = await resp.json();
396
+ return data.data || data;
397
+ },
398
+ /** Create a new sequence with optional steps + channels. */
399
+ async create(payload) {
400
+ const resp = await fetch(`${baseUrl}/api/v1/sequences`, {
401
+ method: "POST",
402
+ headers: headers(),
403
+ body: JSON.stringify(payload)
404
+ });
405
+ const data = await resp.json();
406
+ return data.data || data;
407
+ },
408
+ /** Update sequence metadata. Rejected (409) if sequence is in a transitional status. */
409
+ async update(sequenceId, fields) {
410
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}`, {
411
+ method: "PATCH",
412
+ headers: headers(),
413
+ body: JSON.stringify(fields)
414
+ });
415
+ const data = await resp.json();
416
+ return data.data || data;
417
+ },
418
+ /** Update a single step within a sequence. */
419
+ async updateStep(sequenceId, stepId, fields) {
420
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}/steps/${stepId}`, {
421
+ method: "PATCH",
422
+ headers: headers(),
423
+ body: JSON.stringify(fields)
424
+ });
425
+ const data = await resp.json();
426
+ return data.data || data;
427
+ },
428
+ /** Soft-delete (archive) a sequence. */
429
+ async delete(sequenceId) {
430
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}`, {
431
+ method: "DELETE",
432
+ headers: headers()
433
+ });
434
+ const data = await resp.json();
435
+ return data.data || data;
436
+ },
437
+ /** Run/start a DRAFTED sequence (V2 orchestration). */
438
+ async run(sequenceId) {
439
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}/run`, {
440
+ method: "POST",
441
+ headers: headers()
442
+ });
443
+ const data = await resp.json();
444
+ return data.data || data;
445
+ },
446
+ /** Pause a live sequence. */
447
+ async pause(sequenceId) {
448
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}/pause`, {
449
+ method: "POST",
450
+ headers: headers()
451
+ });
452
+ const data = await resp.json();
453
+ return data.data || data;
454
+ },
455
+ /** Resume a paused sequence. */
456
+ async resume(sequenceId) {
457
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}/resume`, {
458
+ method: "POST",
459
+ headers: headers()
460
+ });
461
+ const data = await resp.json();
462
+ return data.data || data;
463
+ },
464
+ /** Read-only sequence preview with all steps + channels (no enrollment). */
465
+ async preview(sequenceId) {
466
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}/preview`, {
467
+ headers: headers()
468
+ });
469
+ const data = await resp.json();
470
+ return data.data || data;
471
+ },
472
+ /** Comprehensive analytics for a sequence. */
473
+ async analytics(sequenceId) {
474
+ const resp = await fetch(`${baseUrl}/api/v1/sequences/${sequenceId}/analytics`, {
475
+ headers: headers()
476
+ });
477
+ const data = await resp.json();
478
+ return data.data || data;
364
479
  }
365
480
  };
366
481
  };
@@ -485,8 +600,148 @@ var createVoiceClient = (apiKey, apiUrl) => {
485
600
  const baseUrl = apiUrl || DEFAULT_API12;
486
601
  const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
487
602
  const listeners = /* @__PURE__ */ new Map();
603
+ const toQuery = (params) => {
604
+ const qs = new URLSearchParams();
605
+ for (const [k, v] of Object.entries(params)) {
606
+ if (v != null) qs.set(k, String(v));
607
+ }
608
+ const s = qs.toString();
609
+ return s ? `?${s}` : "";
610
+ };
611
+ const dialer = {
612
+ /** List parallel-dialer sessions with filters + pagination. */
613
+ async listSessions(params = {}) {
614
+ const resp = await fetch(
615
+ `${baseUrl}/api/v1/voice/dialer/sessions${toQuery(params)}`,
616
+ { headers: headers() }
617
+ );
618
+ const data = await resp.json();
619
+ return data.data || data;
620
+ },
621
+ /** Create a parallel-dialer session in PAUSED state. SDR opens UI to start dialing. */
622
+ async createSession(payload) {
623
+ const resp = await fetch(`${baseUrl}/api/v1/voice/dialer/sessions`, {
624
+ method: "POST",
625
+ headers: headers(),
626
+ body: JSON.stringify(payload)
627
+ });
628
+ const data = await resp.json();
629
+ return data.data || data;
630
+ },
631
+ /** Pause / resume / stop a dialer session via status flip. */
632
+ async updateSessionStatus(sessionId, status) {
633
+ const resp = await fetch(
634
+ `${baseUrl}/api/v1/voice/dialer/sessions/${sessionId}/status`,
635
+ {
636
+ method: "PATCH",
637
+ headers: headers(),
638
+ body: JSON.stringify({ status })
639
+ }
640
+ );
641
+ const data = await resp.json();
642
+ return data.data || data;
643
+ },
644
+ /**
645
+ * Resume a PAUSED dialer session. Auto-fetches the next batch from the source list,
646
+ * filters already-called + phoneless rows, and forwards to voice's start-session.
647
+ * @param maxContacts 1-4 (voice caps parallel dialing at 4). Default 4.
648
+ */
649
+ async resumeSession(sessionId, maxContacts = 4) {
650
+ const resp = await fetch(
651
+ `${baseUrl}/api/v1/voice/dialer/sessions/${sessionId}/resume`,
652
+ {
653
+ method: "POST",
654
+ headers: headers(),
655
+ body: JSON.stringify({ max_contacts: maxContacts })
656
+ }
657
+ );
658
+ const data = await resp.json();
659
+ return data.data || data;
660
+ },
661
+ /** Aggregated dialer analytics (daily breakdown or total). */
662
+ async stats(params = {}) {
663
+ const resp = await fetch(
664
+ `${baseUrl}/api/v1/voice/dialer/stats${toQuery(params)}`,
665
+ { headers: headers() }
666
+ );
667
+ const data = await resp.json();
668
+ return data.data || data;
669
+ },
670
+ /** List dialer-eligible phone numbers with 7-day stats + daily limits. */
671
+ async numbers(userEmail) {
672
+ const params = userEmail ? { user_email: userEmail } : {};
673
+ const resp = await fetch(
674
+ `${baseUrl}/api/v1/voice/dialer/numbers${toQuery(params)}`,
675
+ { headers: headers() }
676
+ );
677
+ const data = await resp.json();
678
+ return data.data || data;
679
+ },
680
+ /** List missed inbound callbacks with caller / contact info. */
681
+ async missedCallbacks(limit = 50) {
682
+ const resp = await fetch(
683
+ `${baseUrl}/api/v1/voice/dialer/missed-callbacks${toQuery({ limit })}`,
684
+ { headers: headers() }
685
+ );
686
+ const data = await resp.json();
687
+ return data.data || data;
688
+ },
689
+ /** AI grading for a single dialer call (returns "pending" while in progress). */
690
+ async callGrading(roomName) {
691
+ const resp = await fetch(
692
+ `${baseUrl}/api/v1/voice/dialer/calls/${encodeURIComponent(roomName)}/grading`,
693
+ { headers: headers() }
694
+ );
695
+ const data = await resp.json();
696
+ return data.data || data;
697
+ },
698
+ /** List voice agents available for dialer sessions (capped at 100; no pagination). */
699
+ async agents(params = {}) {
700
+ const resp = await fetch(
701
+ `${baseUrl}/api/v1/voice/dialer/agents${toQuery(params)}`,
702
+ { headers: headers() }
703
+ );
704
+ const data = await resp.json();
705
+ return data.data || data;
706
+ },
707
+ /** Fetch the full transcript for a single dialer call. */
708
+ async callTranscript(roomName) {
709
+ const resp = await fetch(
710
+ `${baseUrl}/api/v1/voice/dialer/calls/${encodeURIComponent(roomName)}/transcript`,
711
+ { headers: headers() }
712
+ );
713
+ return resp.json();
714
+ },
715
+ /** List dialer calls — pass `contact_id` or `user_email` to scope. */
716
+ async listCalls(params = {}) {
717
+ const resp = await fetch(
718
+ `${baseUrl}/api/v1/voice/dialer/calls${toQuery(params)}`,
719
+ { headers: headers() }
720
+ );
721
+ return resp.json();
722
+ },
723
+ /** Convenience: list calls for a single contact. */
724
+ async listCallsForContact(contactId, extra = {}) {
725
+ const resp = await fetch(
726
+ `${baseUrl}/api/v1/voice/dialer/calls${toQuery({ contact_id: contactId, ...extra })}`,
727
+ { headers: headers() }
728
+ );
729
+ return resp.json();
730
+ },
731
+ /** Convenience: list calls placed by a specific SDR. */
732
+ async listCallsForSdr(userEmail, extra = {}) {
733
+ const resp = await fetch(
734
+ `${baseUrl}/api/v1/voice/dialer/calls${toQuery({ user_email: userEmail, ...extra })}`,
735
+ { headers: headers() }
736
+ );
737
+ return resp.json();
738
+ }
739
+ };
488
740
  return {
489
- /** Start an AI voice session. */
741
+ /**
742
+ * Start an AI voice session.
743
+ * @deprecated Preview surface — for parallel-dialer flows use `voice.dialer.createSession()`.
744
+ */
490
745
  async start(config) {
491
746
  const resp = await fetch(`${baseUrl}/api/v1/voice/sessions`, {
492
747
  method: "POST",
@@ -496,7 +751,10 @@ var createVoiceClient = (apiKey, apiUrl) => {
496
751
  const data = await resp.json();
497
752
  return data.data || data;
498
753
  },
499
- /** Get call analysis for a completed session. */
754
+ /**
755
+ * Get call analysis for a completed session.
756
+ * @deprecated Preview surface — for dialer-call grading use `voice.dialer.callGrading(roomName)`.
757
+ */
500
758
  async analysis(sessionId) {
501
759
  const resp = await fetch(`${baseUrl}/api/v1/voice/sessions/${sessionId}/analysis`, { headers: headers() });
502
760
  const data = await resp.json();
@@ -506,7 +764,9 @@ var createVoiceClient = (apiKey, apiUrl) => {
506
764
  on(event, callback) {
507
765
  if (!listeners.has(event)) listeners.set(event, []);
508
766
  listeners.get(event).push(callback);
509
- }
767
+ },
768
+ /** Parallel-dialer session control + analytics. */
769
+ dialer
510
770
  };
511
771
  };
512
772
 
@@ -1035,98 +1295,869 @@ var createDealsClient = (apiKey, apiUrl) => {
1035
1295
  };
1036
1296
  };
1037
1297
 
1038
- // src/core.ts
1039
- var DEFAULT_HOST = "https://t.graph8.com";
1298
+ // src/inbox.ts
1040
1299
  var DEFAULT_API22 = "https://be.graph8.com";
1041
- var G8 = class {
1042
- constructor() {
1043
- /** @internal */
1044
- this.client = null;
1045
- /** @internal */
1046
- this.config = null;
1047
- /** @internal */
1048
- this._forms = null;
1049
- /** @internal */
1050
- this._visitors = null;
1051
- /** @internal */
1052
- this._copilot = null;
1053
- /** @internal */
1054
- this._chat = null;
1055
- /** @internal */
1056
- this._calendar = null;
1057
- /** @internal */
1058
- this._enrich = null;
1059
- /** @internal */
1060
- this._sequences = null;
1061
- /** @internal */
1062
- this._campaigns = null;
1063
- /** @internal */
1064
- this._integrations = null;
1065
- /** @internal */
1066
- this._signals = null;
1067
- /** @internal */
1068
- this._analytics = null;
1069
- /** @internal */
1070
- this._voice = null;
1071
- /** @internal */
1072
- this._pages = null;
1073
- /** @internal */
1074
- this._webhooks = null;
1075
- /** @internal */
1076
- this._contacts = null;
1077
- /** @internal */
1078
- this._companies = null;
1079
- /** @internal */
1080
- this._lists = null;
1081
- /** @internal */
1082
- this._notes = null;
1083
- /** @internal */
1084
- this._tasks = null;
1085
- /** @internal */
1086
- this._fields = null;
1087
- /** @internal */
1088
- this._deals = null;
1089
- }
1090
- /**
1091
- * Initialize the graph8 SDK. Must be called before any other method.
1092
- * Safe to call on the server (SSR) - becomes a no-op for tracking.
1093
- */
1094
- init(config) {
1095
- this.config = config;
1096
- if (!isServer) {
1097
- this.client = (0, import_js.jitsuAnalytics)({
1098
- host: config.host || DEFAULT_HOST,
1099
- writeKey: config.writeKey || "",
1100
- debug: config.debug
1101
- });
1102
- }
1103
- const apiUrl = config.apiUrl || DEFAULT_API22;
1104
- const writeKey = config.writeKey || "";
1105
- const apiKey = config.apiKey || "";
1106
- if (writeKey) {
1107
- this._forms = createFormsClient(writeKey, apiUrl);
1108
- this._visitors = createVisitorsClient(writeKey, apiUrl);
1109
- this._copilot = createCopilotClient(writeKey, apiUrl);
1110
- this._chat = createChatClient(writeKey, apiUrl);
1111
- this._calendar = createCalendarClient(apiUrl);
1112
- this._signals = createSignalsClient(writeKey, false, apiUrl);
1300
+ var createInboxClient = (apiKey, apiUrl) => {
1301
+ const baseUrl = apiUrl || DEFAULT_API22;
1302
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1303
+ const toQuery = (params) => {
1304
+ const qs = new URLSearchParams();
1305
+ for (const [k, v] of Object.entries(params)) {
1306
+ if (v != null) qs.set(k, String(v));
1113
1307
  }
1114
- if (apiKey) {
1115
- this._enrich = createEnrichClient(apiKey, apiUrl);
1116
- this._sequences = createSequencesClient(apiKey, apiUrl);
1117
- this._campaigns = createCampaignsClient(apiKey, apiUrl);
1118
- this._integrations = createIntegrationsClient(apiKey, apiUrl);
1119
- this._analytics = createAnalyticsClient(apiKey, apiUrl);
1120
- this._voice = createVoiceClient(apiKey, apiUrl);
1121
- this._pages = createPagesClient(apiKey, apiUrl);
1122
- this._webhooks = createWebhooksClient(apiKey, apiUrl);
1123
- this._contacts = createContactsClient(apiKey, apiUrl);
1124
- this._companies = createCompaniesClient(apiKey, apiUrl);
1125
- this._lists = createListsClient(apiKey, apiUrl);
1126
- this._notes = createNotesClient(apiKey, apiUrl);
1127
- this._tasks = createTasksClient(apiKey, apiUrl);
1128
- this._fields = createFieldsClient(apiKey, apiUrl);
1308
+ const s = qs.toString();
1309
+ return s ? `?${s}` : "";
1310
+ };
1311
+ return {
1312
+ /** List inbox threads across email, SMS, and LinkedIn. */
1313
+ async list(params = {}) {
1314
+ const resp = await fetch(`${baseUrl}/api/v1/inbox${toQuery(params)}`, { headers: headers() });
1315
+ return resp.json();
1316
+ },
1317
+ /** Get a single inbox thread. Defaults to email channel. */
1318
+ async get(replyId, channel = "email") {
1319
+ const resp = await fetch(
1320
+ `${baseUrl}/api/v1/inbox/${replyId}${toQuery({ channel })}`,
1321
+ { headers: headers() }
1322
+ );
1323
+ const data = await resp.json();
1324
+ return data.data || data;
1325
+ },
1326
+ /** Assign a user to an inbox thread. */
1327
+ async assign(replyId, assigneeEmail, channel = "email") {
1328
+ const resp = await fetch(
1329
+ `${baseUrl}/api/v1/inbox/${replyId}/assign${toQuery({ channel })}`,
1330
+ {
1331
+ method: "POST",
1332
+ headers: headers(),
1333
+ body: JSON.stringify({ assignee_email: assigneeEmail })
1334
+ }
1335
+ );
1336
+ const data = await resp.json();
1337
+ return data.data || data;
1338
+ },
1339
+ /** Attach tag IDs to an inbox thread. */
1340
+ async tag(replyId, tagIds, channel = "email") {
1341
+ const resp = await fetch(
1342
+ `${baseUrl}/api/v1/inbox/${replyId}/tag${toQuery({ channel })}`,
1343
+ {
1344
+ method: "POST",
1345
+ headers: headers(),
1346
+ body: JSON.stringify({ tag_ids: tagIds })
1347
+ }
1348
+ );
1349
+ const data = await resp.json();
1350
+ return data.data || data;
1351
+ },
1352
+ /**
1353
+ * Generate an AI draft reply for a thread.
1354
+ * Charges credits — server returns 402 if balance is insufficient.
1355
+ */
1356
+ async draft(replyId, channel = "email") {
1357
+ const resp = await fetch(
1358
+ `${baseUrl}/api/v1/inbox/${replyId}/draft${toQuery({ channel })}`,
1359
+ { headers: headers() }
1360
+ );
1361
+ const data = await resp.json();
1362
+ return data.data || data;
1363
+ },
1364
+ /** Send a reply through email, SMS, or LinkedIn. */
1365
+ async send(replyId, payload) {
1366
+ const resp = await fetch(`${baseUrl}/api/v1/inbox/${replyId}/send`, {
1367
+ method: "POST",
1368
+ headers: headers(),
1369
+ body: JSON.stringify(payload)
1370
+ });
1371
+ const data = await resp.json();
1372
+ return data.data || data;
1373
+ }
1374
+ };
1375
+ };
1376
+
1377
+ // src/quotes.ts
1378
+ var DEFAULT_API23 = "https://be.graph8.com";
1379
+ var createQuotesClient = (apiKey, apiUrl) => {
1380
+ const baseUrl = apiUrl || DEFAULT_API23;
1381
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1382
+ const toQuery = (params) => {
1383
+ const qs = new URLSearchParams();
1384
+ for (const [k, v] of Object.entries(params)) {
1385
+ if (v != null) qs.set(k, String(v));
1386
+ }
1387
+ const s = qs.toString();
1388
+ return s ? `?${s}` : "";
1389
+ };
1390
+ return {
1391
+ /** List quotes org-wide with optional filters and pagination. */
1392
+ async list(params = {}) {
1393
+ const resp = await fetch(`${baseUrl}/api/v1/quotes${toQuery(params)}`, { headers: headers() });
1394
+ return resp.json();
1395
+ },
1396
+ /** Get full details for a single quote. */
1397
+ async get(quoteId) {
1398
+ const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}`, { headers: headers() });
1399
+ const data = await resp.json();
1400
+ return data.data || data;
1401
+ },
1402
+ /** Create a new quote from line items. */
1403
+ async create(quote) {
1404
+ const resp = await fetch(`${baseUrl}/api/v1/quotes`, {
1405
+ method: "POST",
1406
+ headers: headers(),
1407
+ body: JSON.stringify(quote)
1408
+ });
1409
+ const data = await resp.json();
1410
+ return data.data || data;
1411
+ },
1412
+ /** Update a draft quote (line items, expiry, notes). */
1413
+ async update(quoteId, fields) {
1414
+ const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}`, {
1415
+ method: "PUT",
1416
+ headers: headers(),
1417
+ body: JSON.stringify(fields)
1418
+ });
1419
+ const data = await resp.json();
1420
+ return data.data || data;
1421
+ },
1422
+ /** Delete a draft quote (irreversible). */
1423
+ async delete(quoteId) {
1424
+ const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}`, {
1425
+ method: "DELETE",
1426
+ headers: headers()
1427
+ });
1428
+ return resp.json();
1429
+ },
1430
+ /** Duplicate an existing quote (all line items copied into a new draft). */
1431
+ async duplicate(quoteId) {
1432
+ const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}/duplicate`, {
1433
+ method: "POST",
1434
+ headers: headers(),
1435
+ body: JSON.stringify({})
1436
+ });
1437
+ const data = await resp.json();
1438
+ return data.data || data;
1439
+ },
1440
+ /** Convert a signed / sent quote back to editable draft state. */
1441
+ async editAsDraft(quoteId) {
1442
+ const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}/edit-as-draft`, {
1443
+ method: "POST",
1444
+ headers: headers(),
1445
+ body: JSON.stringify({})
1446
+ });
1447
+ return resp.json();
1448
+ },
1449
+ /** Send a quote to its recipient via email (with signature + optional payment link). */
1450
+ async send(quoteId, params) {
1451
+ const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}/send`, {
1452
+ method: "POST",
1453
+ headers: headers(),
1454
+ body: JSON.stringify(params)
1455
+ });
1456
+ const data = await resp.json();
1457
+ return data.data || data;
1458
+ },
1459
+ /** List products available for line items. */
1460
+ async products() {
1461
+ const resp = await fetch(`${baseUrl}/api/v1/quotable-products`, { headers: headers() });
1462
+ return resp.json();
1463
+ },
1464
+ /** Get org-level quote settings (currency, tax rate, payment providers, logo). */
1465
+ async settings() {
1466
+ const resp = await fetch(`${baseUrl}/api/v1/quote-settings`, { headers: headers() });
1467
+ const data = await resp.json();
1468
+ return data.data || data;
1469
+ },
1470
+ /** Get all quotes associated with a contact. */
1471
+ async forContact(contactId) {
1472
+ const resp = await fetch(`${baseUrl}/api/v1/contacts/${contactId}/quotes`, { headers: headers() });
1473
+ return resp.json();
1474
+ },
1475
+ /** Get all quotes associated with a company. */
1476
+ async forCompany(companyId) {
1477
+ const resp = await fetch(`${baseUrl}/api/v1/companies/${companyId}/quotes`, { headers: headers() });
1478
+ return resp.json();
1479
+ }
1480
+ };
1481
+ };
1482
+
1483
+ // src/pipelines.ts
1484
+ var DEFAULT_API24 = "https://be.graph8.com";
1485
+ var createPipelinesClient = (apiKey, apiUrl) => {
1486
+ const baseUrl = apiUrl || DEFAULT_API24;
1487
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1488
+ return {
1489
+ /** List all stage-checklist pipelines with stages, evidence, scripts. */
1490
+ async list() {
1491
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines`, { headers: headers() });
1492
+ return resp.json();
1493
+ },
1494
+ /** Get a single pipeline by ID. */
1495
+ async get(pipelineId) {
1496
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}`, { headers: headers() });
1497
+ const data = await resp.json();
1498
+ return data.data || data;
1499
+ },
1500
+ /** Get the canonical evidence-key library (used when defining stages). */
1501
+ async evidenceLibrary() {
1502
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/evidence-library`, { headers: headers() });
1503
+ return resp.json();
1504
+ },
1505
+ /** Create a new pipeline. Defaults to a templated set of stages; pass blank=true for empty. */
1506
+ async create(params) {
1507
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines`, {
1508
+ method: "POST",
1509
+ headers: headers(),
1510
+ body: JSON.stringify(params)
1511
+ });
1512
+ const data = await resp.json();
1513
+ return data.data || data;
1514
+ },
1515
+ /** Update pipeline metadata (name, target). */
1516
+ async update(pipelineId, fields) {
1517
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}`, {
1518
+ method: "PUT",
1519
+ headers: headers(),
1520
+ body: JSON.stringify(fields)
1521
+ });
1522
+ const data = await resp.json();
1523
+ return data.data || data;
1524
+ },
1525
+ /** Delete a pipeline. Only allowed when no deals reference it. */
1526
+ async delete(pipelineId) {
1527
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}`, {
1528
+ method: "DELETE",
1529
+ headers: headers()
1530
+ });
1531
+ return resp.json();
1532
+ },
1533
+ /** Add a new stage to a pipeline. */
1534
+ async createStage(pipelineId, stage) {
1535
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages`, {
1536
+ method: "POST",
1537
+ headers: headers(),
1538
+ body: JSON.stringify(stage)
1539
+ });
1540
+ const data = await resp.json();
1541
+ return data.data || data;
1542
+ },
1543
+ /** Update a stage (evidence, scripts, position). */
1544
+ async updateStage(pipelineId, stageId, fields) {
1545
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages/${stageId}`, {
1546
+ method: "PUT",
1547
+ headers: headers(),
1548
+ body: JSON.stringify(fields)
1549
+ });
1550
+ const data = await resp.json();
1551
+ return data.data || data;
1552
+ },
1553
+ /** Reorder stages within a pipeline (pass full ordered list of stage IDs). */
1554
+ async reorderStages(pipelineId, stageIds) {
1555
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages/reorder`, {
1556
+ method: "PUT",
1557
+ headers: headers(),
1558
+ body: JSON.stringify({ stage_ids: stageIds })
1559
+ });
1560
+ return resp.json();
1561
+ },
1562
+ /** Delete a stage from a pipeline. */
1563
+ async deleteStage(pipelineId, stageId) {
1564
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages/${stageId}`, {
1565
+ method: "DELETE",
1566
+ headers: headers()
1567
+ });
1568
+ return resp.json();
1569
+ },
1570
+ /** Get an AI-suggested pipeline based on org context (brand, ICP, messaging). */
1571
+ async suggest() {
1572
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/suggest`, {
1573
+ method: "POST",
1574
+ headers: headers(),
1575
+ body: JSON.stringify({})
1576
+ });
1577
+ return resp.json();
1578
+ },
1579
+ /** Create a real pipeline from an AI suggestion (optionally with overrides). */
1580
+ async fromSuggestion(suggestionId, overrides) {
1581
+ const resp = await fetch(`${baseUrl}/api/v1/pipelines/from-suggestion`, {
1582
+ method: "POST",
1583
+ headers: headers(),
1584
+ body: JSON.stringify({ suggestion_id: suggestionId, ...overrides || {} })
1585
+ });
1586
+ const data = await resp.json();
1587
+ return data.data || data;
1588
+ }
1589
+ };
1590
+ };
1591
+
1592
+ // src/workflows.ts
1593
+ var DEFAULT_API25 = "https://be.graph8.com";
1594
+ var createWorkflowsClient = (apiKey, apiUrl) => {
1595
+ const baseUrl = apiUrl || DEFAULT_API25;
1596
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1597
+ const toQuery = (params) => {
1598
+ const qs = new URLSearchParams();
1599
+ for (const [k, v] of Object.entries(params)) {
1600
+ if (v != null) qs.set(k, String(v));
1601
+ }
1602
+ const s = qs.toString();
1603
+ return s ? `?${s}` : "";
1604
+ };
1605
+ return {
1606
+ /** List workflows org-wide. */
1607
+ async list(params = {}) {
1608
+ const resp = await fetch(`${baseUrl}/api/v1/workflows${toQuery(params)}`, { headers: headers() });
1609
+ return resp.json();
1610
+ },
1611
+ /** Get full workflow definition (nodes, connections, trigger, execution state). */
1612
+ async get(workflowId) {
1613
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, { headers: headers() });
1614
+ const data = await resp.json();
1615
+ return data.data || data;
1616
+ },
1617
+ /** Create a new workflow. */
1618
+ async create(params) {
1619
+ const resp = await fetch(`${baseUrl}/api/v1/workflows`, {
1620
+ method: "POST",
1621
+ headers: headers(),
1622
+ body: JSON.stringify(params)
1623
+ });
1624
+ const data = await resp.json();
1625
+ return data.data || data;
1626
+ },
1627
+ /**
1628
+ * Update a workflow. Pass the full `config` (nodes + connections) to edit
1629
+ * the graph — node-level CRUD is performed client-side by mutating the
1630
+ * config and submitting the updated record.
1631
+ */
1632
+ async update(workflowId, fields) {
1633
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, {
1634
+ method: "PUT",
1635
+ headers: headers(),
1636
+ body: JSON.stringify(fields)
1637
+ });
1638
+ const data = await resp.json();
1639
+ return data.data || data;
1640
+ },
1641
+ /** Delete a workflow. */
1642
+ async delete(workflowId) {
1643
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, {
1644
+ method: "DELETE",
1645
+ headers: headers()
1646
+ });
1647
+ return resp.json();
1648
+ },
1649
+ /** Validate a workflow definition (orphans, dangling connections, required fields). */
1650
+ async validate(workflow) {
1651
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/validate`, {
1652
+ method: "POST",
1653
+ headers: headers(),
1654
+ body: JSON.stringify(workflow)
1655
+ });
1656
+ return resp.json();
1657
+ },
1658
+ /** Execute a workflow immediately with a trigger payload. */
1659
+ async execute(workflowId, triggerPayload = {}) {
1660
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}/execute`, {
1661
+ method: "POST",
1662
+ headers: headers(),
1663
+ body: JSON.stringify({ trigger_payload: triggerPayload })
1664
+ });
1665
+ const data = await resp.json();
1666
+ return data.data || data;
1667
+ },
1668
+ /** Get the status + output of a workflow execution. */
1669
+ async getExecution(executionId) {
1670
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}`, { headers: headers() });
1671
+ const data = await resp.json();
1672
+ return data.data || data;
1673
+ },
1674
+ /** Pause an in-flight execution. */
1675
+ async pauseExecution(executionId) {
1676
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}/pause`, {
1677
+ method: "POST",
1678
+ headers: headers(),
1679
+ body: JSON.stringify({})
1680
+ });
1681
+ return resp.json();
1682
+ },
1683
+ /** Resume a paused execution. */
1684
+ async resumeExecution(executionId) {
1685
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}/resume`, {
1686
+ method: "POST",
1687
+ headers: headers(),
1688
+ body: JSON.stringify({})
1689
+ });
1690
+ return resp.json();
1691
+ },
1692
+ /** Stop an execution (terminal state — cannot resume). */
1693
+ async stopExecution(executionId) {
1694
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}/stop`, {
1695
+ method: "POST",
1696
+ headers: headers(),
1697
+ body: JSON.stringify({})
1698
+ });
1699
+ return resp.json();
1700
+ },
1701
+ /** Get the status of a workflow's external trigger (e.g. "waiting for webhook"). */
1702
+ async getTriggerStatus(workflowId) {
1703
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}/trigger-status`, { headers: headers() });
1704
+ return resp.json();
1705
+ },
1706
+ /** Reset the trigger cursor (e.g. for event-stream triggers — resume from beginning). */
1707
+ async resetTrigger(workflowId) {
1708
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}/trigger-reset`, {
1709
+ method: "POST",
1710
+ headers: headers(),
1711
+ body: JSON.stringify({})
1712
+ });
1713
+ return resp.json();
1714
+ },
1715
+ /**
1716
+ * List available node types with schemas. Pass a `type` param to fetch one type's full schema.
1717
+ */
1718
+ async nodeTypes(params = {}) {
1719
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/node-types/schema${toQuery(params)}`, { headers: headers() });
1720
+ return resp.json();
1721
+ },
1722
+ /** Slack workspace users (for Slack action recipients). */
1723
+ async listSlackUsers() {
1724
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/slack/users`, { headers: headers() });
1725
+ return resp.json();
1726
+ },
1727
+ /** Slack channels. */
1728
+ async listSlackChannels() {
1729
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/slack/channels`, { headers: headers() });
1730
+ return resp.json();
1731
+ },
1732
+ /** Roam (Copilot chat) users. */
1733
+ async listRoamUsers() {
1734
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/roam/users`, { headers: headers() });
1735
+ return resp.json();
1736
+ },
1737
+ /** Roam (Copilot chat) groups. */
1738
+ async listRoamGroups() {
1739
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/roam/groups`, { headers: headers() });
1740
+ return resp.json();
1741
+ },
1742
+ /** Available MCP servers (for Agent-node integrations). */
1743
+ async listMcpServers() {
1744
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/mcp-servers`, { headers: headers() });
1745
+ return resp.json();
1746
+ },
1747
+ /** Available call dispositions (voice workflow nodes). */
1748
+ async listDispositions() {
1749
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/dispositions`, { headers: headers() });
1750
+ return resp.json();
1751
+ },
1752
+ /** Form field schema for form-trigger nodes. */
1753
+ async listFormFields(formId) {
1754
+ const resp = await fetch(`${baseUrl}/api/v1/workflows/forms/${formId}/fields`, { headers: headers() });
1755
+ return resp.json();
1756
+ }
1757
+ };
1758
+ };
1759
+
1760
+ // src/skills.ts
1761
+ var DEFAULT_API26 = "https://be.graph8.com";
1762
+ var createSkillsClient = (apiKey, apiUrl) => {
1763
+ const baseUrl = apiUrl || DEFAULT_API26;
1764
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1765
+ const toQuery = (params) => {
1766
+ const qs = new URLSearchParams();
1767
+ for (const [k, v] of Object.entries(params)) {
1768
+ if (v != null) qs.set(k, String(v));
1769
+ }
1770
+ const s = qs.toString();
1771
+ return s ? `?${s}` : "";
1772
+ };
1773
+ return {
1774
+ /** List skills. */
1775
+ async list(params = {}) {
1776
+ const resp = await fetch(`${baseUrl}/api/v1/skills${toQuery(params)}`, { headers: headers() });
1777
+ return resp.json();
1778
+ },
1779
+ /** Get a skill by ID. */
1780
+ async get(skillId) {
1781
+ const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, { headers: headers() });
1782
+ const data = await resp.json();
1783
+ return data.data || data;
1784
+ },
1785
+ /** Get the variables required by a skill (extracted from prompt or body template). */
1786
+ async getVariables(skillId) {
1787
+ const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}/variables`, { headers: headers() });
1788
+ return resp.json();
1789
+ },
1790
+ /** List available LLM models. */
1791
+ async listModels() {
1792
+ const resp = await fetch(`${baseUrl}/api/v1/skills/models`, { headers: headers() });
1793
+ return resp.json();
1794
+ },
1795
+ /** List skill templates. */
1796
+ async listTemplates(params = {}) {
1797
+ const resp = await fetch(`${baseUrl}/api/v1/skills/templates${toQuery(params)}`, { headers: headers() });
1798
+ return resp.json();
1799
+ },
1800
+ /** Create an LLM skill (prompt + model + schemas). */
1801
+ async createLLM(params) {
1802
+ const resp = await fetch(`${baseUrl}/api/v1/skills`, {
1803
+ method: "POST",
1804
+ headers: headers(),
1805
+ body: JSON.stringify({ ...params, type: "llm" })
1806
+ });
1807
+ const data = await resp.json();
1808
+ return data.data || data;
1809
+ },
1810
+ /** Create an API skill (HTTP request wrapper). */
1811
+ async createAPI(params) {
1812
+ const resp = await fetch(`${baseUrl}/api/v1/skills`, {
1813
+ method: "POST",
1814
+ headers: headers(),
1815
+ body: JSON.stringify({ ...params, type: "api" })
1816
+ });
1817
+ const data = await resp.json();
1818
+ return data.data || data;
1819
+ },
1820
+ /** Create a skill from a built-in template. */
1821
+ async createFromTemplate(params) {
1822
+ const resp = await fetch(`${baseUrl}/api/v1/skills/from-template`, {
1823
+ method: "POST",
1824
+ headers: headers(),
1825
+ body: JSON.stringify(params)
1826
+ });
1827
+ const data = await resp.json();
1828
+ return data.data || data;
1829
+ },
1830
+ /** Lift a workflow node into a reusable skill. */
1831
+ async createFromNode(params) {
1832
+ const resp = await fetch(`${baseUrl}/api/v1/skills/from-node`, {
1833
+ method: "POST",
1834
+ headers: headers(),
1835
+ body: JSON.stringify(params)
1836
+ });
1837
+ const data = await resp.json();
1838
+ return data.data || data;
1839
+ },
1840
+ /** Update an LLM skill. */
1841
+ async updateLLM(skillId, fields) {
1842
+ const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, {
1843
+ method: "PUT",
1844
+ headers: headers(),
1845
+ body: JSON.stringify({ ...fields, type: "llm" })
1846
+ });
1847
+ const data = await resp.json();
1848
+ return data.data || data;
1849
+ },
1850
+ /** Update an API skill. */
1851
+ async updateAPI(skillId, fields) {
1852
+ const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, {
1853
+ method: "PUT",
1854
+ headers: headers(),
1855
+ body: JSON.stringify({ ...fields, type: "api" })
1856
+ });
1857
+ const data = await resp.json();
1858
+ return data.data || data;
1859
+ },
1860
+ /** Delete a skill (irreversible if in-use workflows exist). */
1861
+ async delete(skillId) {
1862
+ const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, {
1863
+ method: "DELETE",
1864
+ headers: headers()
1865
+ });
1866
+ return resp.json();
1867
+ },
1868
+ /** Validate a skill definition (without saving). */
1869
+ async validate(skill) {
1870
+ const resp = await fetch(`${baseUrl}/api/v1/skills/validate`, {
1871
+ method: "POST",
1872
+ headers: headers(),
1873
+ body: JSON.stringify(skill)
1874
+ });
1875
+ return resp.json();
1876
+ },
1877
+ /** Execute a skill immediately with an input payload (test / preview). */
1878
+ async execute(skillId, inputPayload) {
1879
+ const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}/execute`, {
1880
+ method: "POST",
1881
+ headers: headers(),
1882
+ body: JSON.stringify(inputPayload)
1883
+ });
1884
+ return resp.json();
1885
+ }
1886
+ };
1887
+ };
1888
+
1889
+ // src/intent.ts
1890
+ var DEFAULT_API27 = "https://be.graph8.com";
1891
+ var createIntentClient = (apiKey, apiUrl) => {
1892
+ const baseUrl = apiUrl || DEFAULT_API27;
1893
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1894
+ const get = async (path) => {
1895
+ const resp = await fetch(`${baseUrl}/api/v1${path}`, { headers: headers() });
1896
+ return resp.json();
1897
+ };
1898
+ const post = async (path, body = {}) => {
1899
+ const resp = await fetch(`${baseUrl}/api/v1${path}`, {
1900
+ method: "POST",
1901
+ headers: headers(),
1902
+ body: JSON.stringify(body)
1903
+ });
1904
+ return resp.json();
1905
+ };
1906
+ const del = async (path) => {
1907
+ const resp = await fetch(`${baseUrl}/api/v1${path}`, { method: "DELETE", headers: headers() });
1908
+ return resp.json();
1909
+ };
1910
+ return {
1911
+ /** Org-level intent stats (totals over the last 30 days). */
1912
+ async stats() {
1913
+ return get("/intent/stats");
1914
+ },
1915
+ /** List tracked keywords with optional pagination. */
1916
+ async listKeywords(params = {}) {
1917
+ return post("/intent/keywords/list", params);
1918
+ },
1919
+ /** Create a keyword group from a domain (auto-tracks all pages). */
1920
+ async createFromDomain(domain) {
1921
+ return post("/intent/keywords/create-from-domain", { domain });
1922
+ },
1923
+ /** Stop tracking a keyword (irreversible — historical data is retained). */
1924
+ async deleteKeyword(keywordId) {
1925
+ return del(`/intent/keywords/${keywordId}`);
1926
+ },
1927
+ /** Companies showing interest in a tracked keyword. */
1928
+ async keywordCompanies(keywordId, params = {}) {
1929
+ return post(`/intent/keywords/${keywordId}/companies`, params);
1930
+ },
1931
+ /** Contacts showing interest in a tracked keyword. */
1932
+ async keywordContacts(keywordId, params = {}) {
1933
+ return post(`/intent/keywords/${keywordId}/contacts`, params);
1934
+ },
1935
+ /** URLs associated with a keyword (pages visitors landed on while interested). */
1936
+ async keywordUrls(keywordId, params = {}) {
1937
+ return post(`/intent/keywords/${keywordId}/urls`, params);
1938
+ },
1939
+ /** Pages tracked on a specific domain. */
1940
+ async pagesByDomain(domain, params = {}) {
1941
+ return post("/intent/pages-by-domain", { domain, ...params });
1942
+ },
1943
+ /** Search tracked pages by URL fragment or keyword. */
1944
+ async searchPages(query, params = {}) {
1945
+ return post("/intent/pages/search", { query, ...params });
1946
+ },
1947
+ /** Get visitor records for a specific page URL. */
1948
+ async pageVisitors(pageUrl, params = {}) {
1949
+ return post("/intent/pages/visitors", { url: pageUrl, ...params });
1950
+ },
1951
+ /** Get contacts who visited a specific page URL. */
1952
+ async pageContacts(pageUrl, params = {}) {
1953
+ return post("/intent/pages/contacts", { url: pageUrl, ...params });
1954
+ },
1955
+ /** Visitor count aggregates by page (pass an array of URLs). */
1956
+ async pageVisitorCounts(urls) {
1957
+ return post("/intent/pages/visitor-counts", { urls });
1958
+ },
1959
+ /**
1960
+ * Find companies whose users visited a specific URL (intent search).
1961
+ *
1962
+ * Note: this endpoint lives at the bare host (no `/api/v1` prefix), unlike the rest
1963
+ * of the intent surface — we call it directly here instead of through the shared `post()` helper.
1964
+ */
1965
+ async urlCompanies(url, params = {}) {
1966
+ const resp = await fetch(`${baseUrl}/intent-search/url-companies`, {
1967
+ method: "POST",
1968
+ headers: headers(),
1969
+ body: JSON.stringify({ url, ...params })
1970
+ });
1971
+ return resp.json();
1972
+ }
1973
+ };
1974
+ };
1975
+
1976
+ // src/studio.ts
1977
+ var DEFAULT_API28 = "https://be.graph8.com";
1978
+ var createStudioClient = (apiKey, apiUrl) => {
1979
+ const baseUrl = apiUrl || DEFAULT_API28;
1980
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
1981
+ const toQuery = (params) => {
1982
+ const qs = new URLSearchParams();
1983
+ for (const [k, v] of Object.entries(params)) {
1984
+ if (v != null) qs.set(k, String(v));
1985
+ }
1986
+ const s = qs.toString();
1987
+ return s ? `?${s}` : "";
1988
+ };
1989
+ const get = async (path, params = {}) => {
1990
+ const resp = await fetch(`${baseUrl}/api/v1${path}${toQuery(params)}`, { headers: headers() });
1991
+ return resp.json();
1992
+ };
1993
+ return {
1994
+ /** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.). */
1995
+ async globalContext(params = {}) {
1996
+ return get("/global-context/documents", params);
1997
+ },
1998
+ /** ICP definitions. */
1999
+ async icps(params = {}) {
2000
+ return get("/icps", params);
2001
+ },
2002
+ /** Buyer persona definitions. */
2003
+ async personas(params = {}) {
2004
+ return get("/personas", params);
2005
+ },
2006
+ /** Intelligence data (website scrapes, enrichment, competitor research). */
2007
+ async intelligenceData(params = {}) {
2008
+ return get("/intelligence-data", params);
2009
+ },
2010
+ /** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
2011
+ async researchReports(params = {}) {
2012
+ return get("/research-reports", params);
2013
+ }
2014
+ };
2015
+ };
2016
+
2017
+ // src/meetings.ts
2018
+ var DEFAULT_API29 = "https://be.graph8.com";
2019
+ var createMeetingsClient = (apiKey, apiUrl) => {
2020
+ const baseUrl = apiUrl || DEFAULT_API29;
2021
+ const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
2022
+ const toQuery = (params) => {
2023
+ const qs = new URLSearchParams();
2024
+ for (const [k, v] of Object.entries(params)) {
2025
+ if (v != null) qs.set(k, String(v));
2026
+ }
2027
+ const s = qs.toString();
2028
+ return s ? `?${s}` : "";
2029
+ };
2030
+ return {
2031
+ /** List meetings with optional filters. Returns summary rows without transcript / analysis. */
2032
+ async list(params = {}) {
2033
+ const resp = await fetch(`${baseUrl}/api/v1/inbox/meetings${toQuery(params)}`, { headers: headers() });
2034
+ return resp.json();
2035
+ },
2036
+ /** Get full meeting detail including transcript + AI analysis (transcript available 1-5 min after meeting ends). */
2037
+ async get(meetingId) {
2038
+ const resp = await fetch(`${baseUrl}/api/v1/inbox/meetings/${meetingId}`, { headers: headers() });
2039
+ const data = await resp.json();
2040
+ return data.data || data;
2041
+ }
2042
+ };
2043
+ };
2044
+
2045
+ // src/core.ts
2046
+ var DEFAULT_HOST = "https://t.graph8.com";
2047
+ var DEFAULT_API30 = "https://be.graph8.com";
2048
+ var G8 = class {
2049
+ constructor() {
2050
+ /** @internal */
2051
+ this.client = null;
2052
+ /** @internal */
2053
+ this.config = null;
2054
+ /** @internal */
2055
+ this._forms = null;
2056
+ /** @internal */
2057
+ this._visitors = null;
2058
+ /** @internal */
2059
+ this._copilot = null;
2060
+ /** @internal */
2061
+ this._chat = null;
2062
+ /** @internal */
2063
+ this._calendar = null;
2064
+ /** @internal */
2065
+ this._enrich = null;
2066
+ /** @internal */
2067
+ this._sequences = null;
2068
+ /** @internal */
2069
+ this._campaigns = null;
2070
+ /** @internal */
2071
+ this._integrations = null;
2072
+ /** @internal */
2073
+ this._signals = null;
2074
+ /** @internal */
2075
+ this._analytics = null;
2076
+ /** @internal */
2077
+ this._voice = null;
2078
+ /** @internal */
2079
+ this._pages = null;
2080
+ /** @internal */
2081
+ this._webhooks = null;
2082
+ /** @internal */
2083
+ this._contacts = null;
2084
+ /** @internal */
2085
+ this._companies = null;
2086
+ /** @internal */
2087
+ this._lists = null;
2088
+ /** @internal */
2089
+ this._notes = null;
2090
+ /** @internal */
2091
+ this._tasks = null;
2092
+ /** @internal */
2093
+ this._fields = null;
2094
+ /** @internal */
2095
+ this._deals = null;
2096
+ /** @internal */
2097
+ this._inbox = null;
2098
+ /** @internal */
2099
+ this._quotes = null;
2100
+ /** @internal */
2101
+ this._pipelines = null;
2102
+ /** @internal */
2103
+ this._workflows = null;
2104
+ /** @internal */
2105
+ this._skills = null;
2106
+ /** @internal */
2107
+ this._intent = null;
2108
+ /** @internal */
2109
+ this._studio = null;
2110
+ /** @internal */
2111
+ this._meetings = null;
2112
+ }
2113
+ /**
2114
+ * Initialize the graph8 SDK. Must be called before any other method.
2115
+ * Safe to call on the server (SSR) - becomes a no-op for tracking.
2116
+ */
2117
+ init(config) {
2118
+ this.config = config;
2119
+ if (!isServer) {
2120
+ this.client = (0, import_js.jitsuAnalytics)({
2121
+ host: config.host || DEFAULT_HOST,
2122
+ writeKey: config.writeKey || "",
2123
+ debug: config.debug
2124
+ });
2125
+ }
2126
+ const apiUrl = config.apiUrl || DEFAULT_API30;
2127
+ const writeKey = config.writeKey || "";
2128
+ const apiKey = config.apiKey || "";
2129
+ if (writeKey) {
2130
+ this._forms = createFormsClient(writeKey, apiUrl);
2131
+ this._visitors = createVisitorsClient(writeKey, apiUrl);
2132
+ this._copilot = createCopilotClient(writeKey, apiUrl);
2133
+ this._chat = createChatClient(writeKey, apiUrl);
2134
+ this._calendar = createCalendarClient(apiUrl);
2135
+ this._signals = createSignalsClient(writeKey, false, apiUrl);
2136
+ }
2137
+ if (apiKey) {
2138
+ this._enrich = createEnrichClient(apiKey, apiUrl);
2139
+ this._sequences = createSequencesClient(apiKey, apiUrl);
2140
+ this._campaigns = createCampaignsClient(apiKey, apiUrl);
2141
+ this._integrations = createIntegrationsClient(apiKey, apiUrl);
2142
+ this._analytics = createAnalyticsClient(apiKey, apiUrl);
2143
+ this._voice = createVoiceClient(apiKey, apiUrl);
2144
+ this._pages = createPagesClient(apiKey, apiUrl);
2145
+ this._webhooks = createWebhooksClient(apiKey, apiUrl);
2146
+ this._contacts = createContactsClient(apiKey, apiUrl);
2147
+ this._companies = createCompaniesClient(apiKey, apiUrl);
2148
+ this._lists = createListsClient(apiKey, apiUrl);
2149
+ this._notes = createNotesClient(apiKey, apiUrl);
2150
+ this._tasks = createTasksClient(apiKey, apiUrl);
2151
+ this._fields = createFieldsClient(apiKey, apiUrl);
1129
2152
  this._deals = createDealsClient(apiKey, apiUrl);
2153
+ this._inbox = createInboxClient(apiKey, apiUrl);
2154
+ this._quotes = createQuotesClient(apiKey, apiUrl);
2155
+ this._pipelines = createPipelinesClient(apiKey, apiUrl);
2156
+ this._workflows = createWorkflowsClient(apiKey, apiUrl);
2157
+ this._skills = createSkillsClient(apiKey, apiUrl);
2158
+ this._intent = createIntentClient(apiKey, apiUrl);
2159
+ this._studio = createStudioClient(apiKey, apiUrl);
2160
+ this._meetings = createMeetingsClient(apiKey, apiUrl);
1130
2161
  this._signals = createSignalsClient(apiKey, true, apiUrl);
1131
2162
  }
1132
2163
  }
@@ -1253,6 +2284,46 @@ var G8 = class {
1253
2284
  this._assertKey("deals");
1254
2285
  return this._deals;
1255
2286
  }
2287
+ /** Multi-channel inbox — read + reply across email, SMS, LinkedIn (requires API key). */
2288
+ get inbox() {
2289
+ this._assertKey("inbox");
2290
+ return this._inbox;
2291
+ }
2292
+ /** Quote-to-cash: draft, send, sign, payment-link quotes (requires API key). */
2293
+ get quotes() {
2294
+ this._assertKey("quotes");
2295
+ return this._quotes;
2296
+ }
2297
+ /** Stage Checklist v2 pipelines: workflow stages with evidence + scripts (requires API key). */
2298
+ get pipelines() {
2299
+ this._assertKey("pipelines");
2300
+ return this._pipelines;
2301
+ }
2302
+ /** Workflow builder — multi-node automation graphs with execution lifecycle (requires API key). */
2303
+ get workflows() {
2304
+ this._assertKey("workflows");
2305
+ return this._workflows;
2306
+ }
2307
+ /** Skill authoring — LLM and API building blocks that workflows compose (requires API key). */
2308
+ get skills() {
2309
+ this._assertKey("skills");
2310
+ return this._skills;
2311
+ }
2312
+ /** Intent tracking — keyword groups, page visitors, account-level intent (requires API key). */
2313
+ get intent() {
2314
+ this._assertKey("intent");
2315
+ return this._intent;
2316
+ }
2317
+ /** Studio context — ICPs, personas, brand briefs, intelligence, AI research reports (requires API key). */
2318
+ get studio() {
2319
+ this._assertKey("studio");
2320
+ return this._studio;
2321
+ }
2322
+ /** Meetings — read scheduled, completed, cancelled meetings with transcripts + AI analysis (requires API key). */
2323
+ get meetings() {
2324
+ this._assertKey("meetings");
2325
+ return this._meetings;
2326
+ }
1256
2327
  /** Whether the SDK has been initialized. */
1257
2328
  get initialized() {
1258
2329
  return this.config !== null;