@graph8/sdk 0.7.1 → 0.11.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 +21 -44
- package/dist/index.d.mts +224 -179
- package/dist/index.d.ts +224 -179
- package/dist/index.js +149 -193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -193
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +219 -171
- package/dist/react.d.ts +219 -171
- package/dist/react.js +149 -193
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +149 -193
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -37,6 +37,21 @@ var createFormsClient = (writeKey, apiUrl) => {
|
|
|
37
37
|
|
|
38
38
|
// src/utils.ts
|
|
39
39
|
var isServer = typeof window === "undefined";
|
|
40
|
+
var resolveAppBaseUrl = (apiBaseUrl) => {
|
|
41
|
+
try {
|
|
42
|
+
const url = new URL(apiBaseUrl);
|
|
43
|
+
if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
|
|
44
|
+
url.port = "3000";
|
|
45
|
+
return url.origin;
|
|
46
|
+
}
|
|
47
|
+
if (url.hostname.endsWith("graph8.com")) {
|
|
48
|
+
url.hostname = url.hostname.replace(/^be\./, "app.");
|
|
49
|
+
return url.origin;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
return apiBaseUrl;
|
|
54
|
+
};
|
|
40
55
|
|
|
41
56
|
// src/visitors.ts
|
|
42
57
|
var DEFAULT_API2 = "https://be.graph8.com";
|
|
@@ -149,6 +164,7 @@ var createCopilotClient = (writeKey, apiUrl) => {
|
|
|
149
164
|
var DEFAULT_API4 = "https://be.graph8.com";
|
|
150
165
|
var createChatClient = (writeKey, apiUrl) => {
|
|
151
166
|
const baseUrl = apiUrl || DEFAULT_API4;
|
|
167
|
+
const appUrl = resolveAppBaseUrl(baseUrl);
|
|
152
168
|
const listeners = /* @__PURE__ */ new Map();
|
|
153
169
|
let widgetEl = null;
|
|
154
170
|
let ws = null;
|
|
@@ -163,7 +179,7 @@ var createChatClient = (writeKey, apiUrl) => {
|
|
|
163
179
|
const position = config?.position || "bottom-right";
|
|
164
180
|
const posStyle = position === "bottom-left" ? "left:16px;" : "right:16px;";
|
|
165
181
|
const iframe = document.createElement("iframe");
|
|
166
|
-
iframe.src = `${
|
|
182
|
+
iframe.src = `${appUrl}/webchat/embed?write_key=${writeKey}&theme=${config?.theme || "auto"}`;
|
|
167
183
|
iframe.style.cssText = `position:fixed;bottom:16px;${posStyle}width:380px;height:560px;border:none;border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,0.15);z-index:99997;`;
|
|
168
184
|
iframe.id = "g8-chat-widget";
|
|
169
185
|
document.body.appendChild(iframe);
|
|
@@ -288,6 +304,19 @@ var G8Error = class _G8Error extends Error {
|
|
|
288
304
|
function isRetryableStatus(status) {
|
|
289
305
|
return status === 429 || status >= 500 && status <= 599;
|
|
290
306
|
}
|
|
307
|
+
function isNonIdempotentMethod(method) {
|
|
308
|
+
const m = method.toUpperCase();
|
|
309
|
+
return m === "POST" || m === "PATCH";
|
|
310
|
+
}
|
|
311
|
+
function newIdempotencyKey() {
|
|
312
|
+
const c = globalThis.crypto;
|
|
313
|
+
if (c?.randomUUID) return c.randomUUID();
|
|
314
|
+
if (c?.getRandomValues) {
|
|
315
|
+
const bytes = c.getRandomValues(new Uint8Array(16));
|
|
316
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
317
|
+
}
|
|
318
|
+
return `g8-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
319
|
+
}
|
|
291
320
|
function parseRetryAfter(header, nowMs = Date.now()) {
|
|
292
321
|
if (!header) return null;
|
|
293
322
|
const secs = Number(header);
|
|
@@ -354,7 +383,8 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
354
383
|
Authorization: `Bearer ${apiKey}`,
|
|
355
384
|
...headers
|
|
356
385
|
};
|
|
357
|
-
|
|
386
|
+
const effectiveIdempotencyKey = idempotencyKey ?? (maxRetries > 0 && isNonIdempotentMethod(method) ? newIdempotencyKey() : void 0);
|
|
387
|
+
if (effectiveIdempotencyKey) finalHeaders["Idempotency-Key"] = effectiveIdempotencyKey;
|
|
358
388
|
let attempt = 0;
|
|
359
389
|
for (; ; ) {
|
|
360
390
|
let resp;
|
|
@@ -422,7 +452,7 @@ var createEnrichClient = (apiKey, apiUrl) => {
|
|
|
422
452
|
});
|
|
423
453
|
return resp.data ?? resp;
|
|
424
454
|
},
|
|
425
|
-
/** Search
|
|
455
|
+
/** Search 700M+ contacts with filters. Credits charged per result. */
|
|
426
456
|
async search(filters, page = 1, limit = 25) {
|
|
427
457
|
const resp = await request(baseUrl, "/api/v1/search/contacts", apiKey, {
|
|
428
458
|
method: "POST",
|
|
@@ -463,21 +493,30 @@ var createSequencesClient = (apiKey, apiUrl) => {
|
|
|
463
493
|
query: params
|
|
464
494
|
});
|
|
465
495
|
},
|
|
466
|
-
/**
|
|
467
|
-
|
|
496
|
+
/**
|
|
497
|
+
* Add contacts to a sequence (V2 queuing). Live or drafted sequences only.
|
|
498
|
+
* Pass `idempotencyKey` to make a retry safe — the same key returns the
|
|
499
|
+
* first result instead of re-enrolling on a 5xx-then-success (A6).
|
|
500
|
+
*/
|
|
501
|
+
async add(config, idempotencyKey) {
|
|
468
502
|
const resp = await request(
|
|
469
503
|
baseUrl,
|
|
470
504
|
`/api/v1/sequences/${config.sequenceId}/contacts`,
|
|
471
505
|
apiKey,
|
|
472
|
-
{ method: "POST", body: { contact_ids: config.contactIds, list_id: config.listId } }
|
|
506
|
+
{ method: "POST", body: { contact_ids: config.contactIds, list_id: config.listId }, idempotencyKey }
|
|
473
507
|
);
|
|
474
508
|
return resp.data ?? resp;
|
|
475
509
|
},
|
|
476
|
-
/**
|
|
477
|
-
|
|
510
|
+
/**
|
|
511
|
+
* Create a new sequence with optional steps + channels. Pass `idempotencyKey`
|
|
512
|
+
* to make a retry safe — the same key returns the first result instead of
|
|
513
|
+
* creating a duplicate sequence on a 5xx-then-success (A6).
|
|
514
|
+
*/
|
|
515
|
+
async create(payload, idempotencyKey) {
|
|
478
516
|
const resp = await request(baseUrl, "/api/v1/sequences", apiKey, {
|
|
479
517
|
method: "POST",
|
|
480
|
-
body: payload
|
|
518
|
+
body: payload,
|
|
519
|
+
idempotencyKey
|
|
481
520
|
});
|
|
482
521
|
return resp.data ?? resp;
|
|
483
522
|
},
|
|
@@ -506,33 +545,43 @@ var createSequencesClient = (apiKey, apiUrl) => {
|
|
|
506
545
|
});
|
|
507
546
|
return resp.data ?? resp;
|
|
508
547
|
},
|
|
509
|
-
/**
|
|
510
|
-
|
|
548
|
+
/**
|
|
549
|
+
* Run/start a DRAFTED sequence (V2 orchestration). Pass `idempotencyKey` to
|
|
550
|
+
* make a retry safe — the same key won't re-trigger the run on a
|
|
551
|
+
* 5xx-then-success (A6).
|
|
552
|
+
*/
|
|
553
|
+
async run(sequenceId, idempotencyKey) {
|
|
511
554
|
const resp = await request(
|
|
512
555
|
baseUrl,
|
|
513
556
|
`/api/v1/sequences/${sequenceId}/run`,
|
|
514
557
|
apiKey,
|
|
515
|
-
{ method: "POST" }
|
|
558
|
+
{ method: "POST", idempotencyKey }
|
|
516
559
|
);
|
|
517
560
|
return resp.data ?? resp;
|
|
518
561
|
},
|
|
519
|
-
/**
|
|
520
|
-
|
|
562
|
+
/**
|
|
563
|
+
* Pause a live sequence. Pass `idempotencyKey` to make a retry safe — the
|
|
564
|
+
* same key won't double-apply on a 5xx-then-success (A6).
|
|
565
|
+
*/
|
|
566
|
+
async pause(sequenceId, idempotencyKey) {
|
|
521
567
|
const resp = await request(
|
|
522
568
|
baseUrl,
|
|
523
569
|
`/api/v1/sequences/${sequenceId}/pause`,
|
|
524
570
|
apiKey,
|
|
525
|
-
{ method: "POST" }
|
|
571
|
+
{ method: "POST", idempotencyKey }
|
|
526
572
|
);
|
|
527
573
|
return resp.data ?? resp;
|
|
528
574
|
},
|
|
529
|
-
/**
|
|
530
|
-
|
|
575
|
+
/**
|
|
576
|
+
* Resume a paused sequence. Pass `idempotencyKey` to make a retry safe — the
|
|
577
|
+
* same key won't double-apply on a 5xx-then-success (A6).
|
|
578
|
+
*/
|
|
579
|
+
async resume(sequenceId, idempotencyKey) {
|
|
531
580
|
const resp = await request(
|
|
532
581
|
baseUrl,
|
|
533
582
|
`/api/v1/sequences/${sequenceId}/resume`,
|
|
534
583
|
apiKey,
|
|
535
|
-
{ method: "POST" }
|
|
584
|
+
{ method: "POST", idempotencyKey }
|
|
536
585
|
);
|
|
537
586
|
return resp.data ?? resp;
|
|
538
587
|
},
|
|
@@ -576,45 +625,23 @@ var createCampaignsClient = (apiKey, apiUrl) => {
|
|
|
576
625
|
return resp.data ?? resp;
|
|
577
626
|
},
|
|
578
627
|
async launch(campaignId) {
|
|
579
|
-
await request(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
};
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
// src/integrations.ts
|
|
589
|
-
var DEFAULT_API9 = "https://be.graph8.com";
|
|
590
|
-
var createIntegrationsClient = (apiKey, apiUrl) => {
|
|
591
|
-
const baseUrl = apiUrl || DEFAULT_API9;
|
|
592
|
-
return {
|
|
593
|
-
async list() {
|
|
594
|
-
const resp = await request(baseUrl, "/api/v1/integrations", apiKey);
|
|
628
|
+
const resp = await request(
|
|
629
|
+
baseUrl,
|
|
630
|
+
`/api/v1/campaigns/${campaignId}/launch`,
|
|
631
|
+
apiKey,
|
|
632
|
+
{ method: "POST" }
|
|
633
|
+
);
|
|
595
634
|
return resp.data ?? resp;
|
|
596
|
-
},
|
|
597
|
-
async connect(provider, config) {
|
|
598
|
-
await request(baseUrl, "/api/v1/integrations/connect", apiKey, {
|
|
599
|
-
method: "POST",
|
|
600
|
-
body: { provider, ...config }
|
|
601
|
-
});
|
|
602
|
-
},
|
|
603
|
-
async sync(provider, config) {
|
|
604
|
-
await request(baseUrl, "/api/v1/integrations/sync", apiKey, {
|
|
605
|
-
method: "POST",
|
|
606
|
-
body: { provider, ...config }
|
|
607
|
-
});
|
|
608
635
|
}
|
|
609
636
|
};
|
|
610
637
|
};
|
|
611
638
|
|
|
612
639
|
// src/signals.ts
|
|
613
|
-
var
|
|
640
|
+
var DEFAULT_API9 = "https://be.graph8.com";
|
|
614
641
|
var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
615
|
-
const baseUrl = apiUrl ||
|
|
642
|
+
const baseUrl = apiUrl || DEFAULT_API9;
|
|
616
643
|
const headers = () => isApiKey ? { "Content-Type": "application/json", "Authorization": `Bearer ${key}` } : { "Content-Type": "application/json", "X-Write-Key": key };
|
|
617
|
-
const endpoint =
|
|
644
|
+
const endpoint = "/api/v1/public/signals/company";
|
|
618
645
|
return {
|
|
619
646
|
/** Get intent signals for a specific company domain. */
|
|
620
647
|
async company(domain) {
|
|
@@ -639,24 +666,10 @@ var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
|
639
666
|
};
|
|
640
667
|
};
|
|
641
668
|
|
|
642
|
-
// src/analytics.ts
|
|
643
|
-
var DEFAULT_API11 = "https://be.graph8.com";
|
|
644
|
-
var createAnalyticsClient = (apiKey, apiUrl) => {
|
|
645
|
-
const baseUrl = apiUrl || DEFAULT_API11;
|
|
646
|
-
return {
|
|
647
|
-
async overview(config) {
|
|
648
|
-
const resp = await request(baseUrl, "/api/v1/analytics/overview", apiKey, {
|
|
649
|
-
query: { period: config?.period }
|
|
650
|
-
});
|
|
651
|
-
return resp.data ?? resp;
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
|
|
656
669
|
// src/voice.ts
|
|
657
|
-
var
|
|
670
|
+
var DEFAULT_API10 = "https://be.graph8.com";
|
|
658
671
|
var createVoiceClient = (apiKey, apiUrl) => {
|
|
659
|
-
const baseUrl = apiUrl ||
|
|
672
|
+
const baseUrl = apiUrl || DEFAULT_API10;
|
|
660
673
|
const listeners = /* @__PURE__ */ new Map();
|
|
661
674
|
const dialer = {
|
|
662
675
|
/** List parallel-dialer sessions with filters + pagination. */
|
|
@@ -789,31 +802,6 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
789
802
|
}
|
|
790
803
|
};
|
|
791
804
|
return {
|
|
792
|
-
/**
|
|
793
|
-
* Start an AI voice session.
|
|
794
|
-
* @deprecated Preview surface — for parallel-dialer flows use `voice.dialer.createSession()`.
|
|
795
|
-
*/
|
|
796
|
-
async start(config) {
|
|
797
|
-
const resp = await request(
|
|
798
|
-
baseUrl,
|
|
799
|
-
"/api/v1/voice/sessions",
|
|
800
|
-
apiKey,
|
|
801
|
-
{ method: "POST", body: config }
|
|
802
|
-
);
|
|
803
|
-
return resp.data ?? resp;
|
|
804
|
-
},
|
|
805
|
-
/**
|
|
806
|
-
* Get call analysis for a completed session.
|
|
807
|
-
* @deprecated Preview surface — for dialer-call grading use `voice.dialer.callGrading(roomName)`.
|
|
808
|
-
*/
|
|
809
|
-
async analysis(sessionId) {
|
|
810
|
-
const resp = await request(
|
|
811
|
-
baseUrl,
|
|
812
|
-
`/api/v1/voice/sessions/${sessionId}/analysis`,
|
|
813
|
-
apiKey
|
|
814
|
-
);
|
|
815
|
-
return resp.data ?? resp;
|
|
816
|
-
},
|
|
817
805
|
/** Listen for voice events. */
|
|
818
806
|
on(event, callback) {
|
|
819
807
|
if (!listeners.has(event)) listeners.set(event, []);
|
|
@@ -824,43 +812,9 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
824
812
|
};
|
|
825
813
|
};
|
|
826
814
|
|
|
827
|
-
// src/pages.ts
|
|
828
|
-
var DEFAULT_API13 = "https://be.graph8.com";
|
|
829
|
-
var createPagesClient = (apiKey, apiUrl) => {
|
|
830
|
-
const baseUrl = apiUrl || DEFAULT_API13;
|
|
831
|
-
return {
|
|
832
|
-
/** Clone a landing page from any URL. */
|
|
833
|
-
async clone(url) {
|
|
834
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages/clone-url", apiKey, {
|
|
835
|
-
method: "POST",
|
|
836
|
-
body: { url }
|
|
837
|
-
});
|
|
838
|
-
return resp.data ?? resp;
|
|
839
|
-
},
|
|
840
|
-
/** Create a landing page from a template. */
|
|
841
|
-
async create(config) {
|
|
842
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages", apiKey, {
|
|
843
|
-
method: "POST",
|
|
844
|
-
body: config
|
|
845
|
-
});
|
|
846
|
-
return resp.data ?? resp;
|
|
847
|
-
},
|
|
848
|
-
/** Publish a landing page to CDN. */
|
|
849
|
-
async publish(pageId) {
|
|
850
|
-
const data = await request(
|
|
851
|
-
baseUrl,
|
|
852
|
-
`/api/v1/landing-pages/${pageId}/publish`,
|
|
853
|
-
apiKey,
|
|
854
|
-
{ method: "POST" }
|
|
855
|
-
);
|
|
856
|
-
return { url: data.published_url || data.data?.published_url || "" };
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
};
|
|
860
|
-
|
|
861
815
|
// src/webhooks.ts
|
|
862
816
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
863
|
-
var
|
|
817
|
+
var DEFAULT_API11 = "https://be.graph8.com";
|
|
864
818
|
var KNOWN_WEBHOOK_EVENTS = [
|
|
865
819
|
"campaign.created",
|
|
866
820
|
"campaign.updated",
|
|
@@ -878,7 +832,7 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
878
832
|
"company_intelligence.completed",
|
|
879
833
|
"audience.ready",
|
|
880
834
|
"audience.failed",
|
|
881
|
-
"sequence.
|
|
835
|
+
"sequence.draft_created",
|
|
882
836
|
"sequence.started",
|
|
883
837
|
"sequence.paused",
|
|
884
838
|
"sequence.completed",
|
|
@@ -941,7 +895,7 @@ function constructEvent(payload, signature, timestamp, secret, opts = {}) {
|
|
|
941
895
|
}
|
|
942
896
|
}
|
|
943
897
|
var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
944
|
-
const baseUrl = apiUrl ||
|
|
898
|
+
const baseUrl = apiUrl || DEFAULT_API11;
|
|
945
899
|
return {
|
|
946
900
|
/** Base URL the webhook subscription API lives under. */
|
|
947
901
|
baseUrl,
|
|
@@ -955,9 +909,9 @@ var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
|
955
909
|
};
|
|
956
910
|
|
|
957
911
|
// src/contacts.ts
|
|
958
|
-
var
|
|
912
|
+
var DEFAULT_API12 = "https://be.graph8.com";
|
|
959
913
|
var createContactsClient = (apiKey, apiUrl) => {
|
|
960
|
-
const baseUrl = apiUrl ||
|
|
914
|
+
const baseUrl = apiUrl || DEFAULT_API12;
|
|
961
915
|
return {
|
|
962
916
|
/** List contacts with optional filters. */
|
|
963
917
|
async list(params = {}) {
|
|
@@ -1016,9 +970,9 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1016
970
|
};
|
|
1017
971
|
|
|
1018
972
|
// src/companies.ts
|
|
1019
|
-
var
|
|
973
|
+
var DEFAULT_API13 = "https://be.graph8.com";
|
|
1020
974
|
var createCompaniesClient = (apiKey, apiUrl) => {
|
|
1021
|
-
const baseUrl = apiUrl ||
|
|
975
|
+
const baseUrl = apiUrl || DEFAULT_API13;
|
|
1022
976
|
return {
|
|
1023
977
|
/** List companies with optional filters. */
|
|
1024
978
|
async list(params = {}) {
|
|
@@ -1064,9 +1018,9 @@ var createCompaniesClient = (apiKey, apiUrl) => {
|
|
|
1064
1018
|
};
|
|
1065
1019
|
|
|
1066
1020
|
// src/lists.ts
|
|
1067
|
-
var
|
|
1021
|
+
var DEFAULT_API14 = "https://be.graph8.com";
|
|
1068
1022
|
var createListsClient = (apiKey, apiUrl) => {
|
|
1069
|
-
const baseUrl = apiUrl ||
|
|
1023
|
+
const baseUrl = apiUrl || DEFAULT_API14;
|
|
1070
1024
|
return {
|
|
1071
1025
|
/** List all lists. */
|
|
1072
1026
|
async list(page = 1, limit = 50) {
|
|
@@ -1106,9 +1060,9 @@ var createListsClient = (apiKey, apiUrl) => {
|
|
|
1106
1060
|
};
|
|
1107
1061
|
|
|
1108
1062
|
// src/notes.ts
|
|
1109
|
-
var
|
|
1063
|
+
var DEFAULT_API15 = "https://be.graph8.com";
|
|
1110
1064
|
var createNotesClient = (apiKey, apiUrl) => {
|
|
1111
|
-
const baseUrl = apiUrl ||
|
|
1065
|
+
const baseUrl = apiUrl || DEFAULT_API15;
|
|
1112
1066
|
return {
|
|
1113
1067
|
/** List all notes on a contact. */
|
|
1114
1068
|
async list(contactId) {
|
|
@@ -1138,9 +1092,9 @@ var createNotesClient = (apiKey, apiUrl) => {
|
|
|
1138
1092
|
};
|
|
1139
1093
|
|
|
1140
1094
|
// src/tasks.ts
|
|
1141
|
-
var
|
|
1095
|
+
var DEFAULT_API16 = "https://be.graph8.com";
|
|
1142
1096
|
var createTasksClient = (apiKey, apiUrl) => {
|
|
1143
|
-
const baseUrl = apiUrl ||
|
|
1097
|
+
const baseUrl = apiUrl || DEFAULT_API16;
|
|
1144
1098
|
return {
|
|
1145
1099
|
/** List tasks on a single contact. Optional status filter ("open" | "completed"). */
|
|
1146
1100
|
async listForContact(contactId, status) {
|
|
@@ -1176,9 +1130,9 @@ var createTasksClient = (apiKey, apiUrl) => {
|
|
|
1176
1130
|
};
|
|
1177
1131
|
|
|
1178
1132
|
// src/fields.ts
|
|
1179
|
-
var
|
|
1133
|
+
var DEFAULT_API17 = "https://be.graph8.com";
|
|
1180
1134
|
var createFieldsClient = (apiKey, apiUrl) => {
|
|
1181
|
-
const baseUrl = apiUrl ||
|
|
1135
|
+
const baseUrl = apiUrl || DEFAULT_API17;
|
|
1182
1136
|
return {
|
|
1183
1137
|
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
1184
1138
|
async listContactFields(listId) {
|
|
@@ -1220,9 +1174,9 @@ var createFieldsClient = (apiKey, apiUrl) => {
|
|
|
1220
1174
|
};
|
|
1221
1175
|
|
|
1222
1176
|
// src/deals.ts
|
|
1223
|
-
var
|
|
1177
|
+
var DEFAULT_API18 = "https://be.graph8.com";
|
|
1224
1178
|
var createDealsClient = (apiKey, apiUrl) => {
|
|
1225
|
-
const baseUrl = apiUrl ||
|
|
1179
|
+
const baseUrl = apiUrl || DEFAULT_API18;
|
|
1226
1180
|
return {
|
|
1227
1181
|
/** List all deal pipelines and their stages. */
|
|
1228
1182
|
async pipelines() {
|
|
@@ -1266,9 +1220,9 @@ var createDealsClient = (apiKey, apiUrl) => {
|
|
|
1266
1220
|
};
|
|
1267
1221
|
|
|
1268
1222
|
// src/inbox.ts
|
|
1269
|
-
var
|
|
1223
|
+
var DEFAULT_API19 = "https://be.graph8.com";
|
|
1270
1224
|
var createInboxClient = (apiKey, apiUrl) => {
|
|
1271
|
-
const baseUrl = apiUrl ||
|
|
1225
|
+
const baseUrl = apiUrl || DEFAULT_API19;
|
|
1272
1226
|
return {
|
|
1273
1227
|
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
1274
1228
|
async list(params = {}) {
|
|
@@ -1321,9 +1275,9 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1321
1275
|
};
|
|
1322
1276
|
|
|
1323
1277
|
// src/quotes.ts
|
|
1324
|
-
var
|
|
1278
|
+
var DEFAULT_API20 = "https://be.graph8.com";
|
|
1325
1279
|
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1326
|
-
const baseUrl = apiUrl ||
|
|
1280
|
+
const baseUrl = apiUrl || DEFAULT_API20;
|
|
1327
1281
|
return {
|
|
1328
1282
|
/** List quotes org-wide with optional filters and pagination. */
|
|
1329
1283
|
async list(params = {}) {
|
|
@@ -1395,9 +1349,9 @@ var createQuotesClient = (apiKey, apiUrl) => {
|
|
|
1395
1349
|
};
|
|
1396
1350
|
|
|
1397
1351
|
// src/pipelines.ts
|
|
1398
|
-
var
|
|
1352
|
+
var DEFAULT_API21 = "https://be.graph8.com";
|
|
1399
1353
|
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1400
|
-
const baseUrl = apiUrl ||
|
|
1354
|
+
const baseUrl = apiUrl || DEFAULT_API21;
|
|
1401
1355
|
return {
|
|
1402
1356
|
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1403
1357
|
async list() {
|
|
@@ -1479,9 +1433,9 @@ var createPipelinesClient = (apiKey, apiUrl) => {
|
|
|
1479
1433
|
};
|
|
1480
1434
|
|
|
1481
1435
|
// src/workflows.ts
|
|
1482
|
-
var
|
|
1436
|
+
var DEFAULT_API22 = "https://be.graph8.com";
|
|
1483
1437
|
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1484
|
-
const baseUrl = apiUrl ||
|
|
1438
|
+
const baseUrl = apiUrl || DEFAULT_API22;
|
|
1485
1439
|
return {
|
|
1486
1440
|
/** List workflows org-wide. */
|
|
1487
1441
|
async list(params = {}) {
|
|
@@ -1597,9 +1551,9 @@ var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
|
1597
1551
|
};
|
|
1598
1552
|
|
|
1599
1553
|
// src/skills.ts
|
|
1600
|
-
var
|
|
1554
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1601
1555
|
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1602
|
-
const baseUrl = apiUrl ||
|
|
1556
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1603
1557
|
return {
|
|
1604
1558
|
/** List skills. */
|
|
1605
1559
|
async list(params = {}) {
|
|
@@ -1686,9 +1640,9 @@ var createSkillsClient = (apiKey, apiUrl) => {
|
|
|
1686
1640
|
};
|
|
1687
1641
|
|
|
1688
1642
|
// src/intent.ts
|
|
1689
|
-
var
|
|
1643
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1690
1644
|
var createIntentClient = (apiKey, apiUrl) => {
|
|
1691
|
-
const baseUrl = apiUrl ||
|
|
1645
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1692
1646
|
const get = (path) => request(baseUrl, `/api/v1${path}`, apiKey);
|
|
1693
1647
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1694
1648
|
const del = (path) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "DELETE" });
|
|
@@ -1757,10 +1711,12 @@ var createIntentClient = (apiKey, apiUrl) => {
|
|
|
1757
1711
|
};
|
|
1758
1712
|
|
|
1759
1713
|
// src/studio.ts
|
|
1760
|
-
var
|
|
1714
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1761
1715
|
var createStudioClient = (apiKey, apiUrl) => {
|
|
1762
|
-
const baseUrl = apiUrl ||
|
|
1716
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1763
1717
|
const get = (path, params = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { query: params });
|
|
1718
|
+
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1719
|
+
const patch = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "PATCH", body });
|
|
1764
1720
|
return {
|
|
1765
1721
|
/** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
|
|
1766
1722
|
* `include_content` defaults to true server-side, so each document includes
|
|
@@ -1783,14 +1739,38 @@ var createStudioClient = (apiKey, apiUrl) => {
|
|
|
1783
1739
|
/** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
|
|
1784
1740
|
async researchReports(params = {}) {
|
|
1785
1741
|
return get("/research-reports", params);
|
|
1742
|
+
},
|
|
1743
|
+
/** Create an ICP manually (no AI scoring). Requires name + website_url. */
|
|
1744
|
+
async createIcp(body) {
|
|
1745
|
+
return post("/icps", body);
|
|
1746
|
+
},
|
|
1747
|
+
/** Update an ICP (partial - send only fields to change). */
|
|
1748
|
+
async updateIcp(icpId, body) {
|
|
1749
|
+
return patch(`/icps/${icpId}`, body);
|
|
1750
|
+
},
|
|
1751
|
+
/** Archive an ICP (soft delete - sets status to "archived"). */
|
|
1752
|
+
async archiveIcp(icpId) {
|
|
1753
|
+
return post(`/icps/${icpId}/archive`);
|
|
1754
|
+
},
|
|
1755
|
+
/** Create a buyer persona manually (no AI generation). Requires title + website_url. */
|
|
1756
|
+
async createPersona(body) {
|
|
1757
|
+
return post("/personas", body);
|
|
1758
|
+
},
|
|
1759
|
+
/** Update a persona (partial). Passing status "archived" is equivalent to archivePersona. */
|
|
1760
|
+
async updatePersona(personaId, body) {
|
|
1761
|
+
return patch(`/personas/${personaId}`, body);
|
|
1762
|
+
},
|
|
1763
|
+
/** Archive a persona (soft delete - sets status to "archived"). */
|
|
1764
|
+
async archivePersona(personaId) {
|
|
1765
|
+
return post(`/personas/${personaId}/archive`);
|
|
1786
1766
|
}
|
|
1787
1767
|
};
|
|
1788
1768
|
};
|
|
1789
1769
|
|
|
1790
1770
|
// src/meetings.ts
|
|
1791
|
-
var
|
|
1771
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1792
1772
|
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
1793
|
-
const baseUrl = apiUrl ||
|
|
1773
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1794
1774
|
return {
|
|
1795
1775
|
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
1796
1776
|
async list(params = {}) {
|
|
@@ -1805,9 +1785,9 @@ var createMeetingsClient = (apiKey, apiUrl) => {
|
|
|
1805
1785
|
};
|
|
1806
1786
|
|
|
1807
1787
|
// src/audiences.ts
|
|
1808
|
-
var
|
|
1788
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1809
1789
|
var createAudiencesClient = (apiKey, apiUrl) => {
|
|
1810
|
-
const baseUrl = apiUrl ||
|
|
1790
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1811
1791
|
const base = "/api/v1/audience-syncs";
|
|
1812
1792
|
return {
|
|
1813
1793
|
/** List all audience syncs for the organization. */
|
|
@@ -1855,9 +1835,9 @@ var createAudiencesClient = (apiKey, apiUrl) => {
|
|
|
1855
1835
|
};
|
|
1856
1836
|
|
|
1857
1837
|
// src/search.ts
|
|
1858
|
-
var
|
|
1838
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1859
1839
|
var createSearchClient = (apiKey, apiUrl) => {
|
|
1860
|
-
const baseUrl = apiUrl ||
|
|
1840
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1861
1841
|
const body = (p) => ({ filters: [], page: 1, limit: 25, ...p });
|
|
1862
1842
|
return {
|
|
1863
1843
|
/** Search open-data contacts by filter. */
|
|
@@ -1888,9 +1868,9 @@ var createSearchClient = (apiKey, apiUrl) => {
|
|
|
1888
1868
|
};
|
|
1889
1869
|
|
|
1890
1870
|
// src/agency.ts
|
|
1891
|
-
var
|
|
1871
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
1892
1872
|
var createAgencyClient = (apiKey, apiUrl) => {
|
|
1893
|
-
const baseUrl = apiUrl ||
|
|
1873
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
1894
1874
|
return {
|
|
1895
1875
|
/** Describe the agency credential: agency org + authorized client count. */
|
|
1896
1876
|
async me() {
|
|
@@ -1905,9 +1885,9 @@ var createAgencyClient = (apiKey, apiUrl) => {
|
|
|
1905
1885
|
};
|
|
1906
1886
|
|
|
1907
1887
|
// src/marketplace.ts
|
|
1908
|
-
var
|
|
1888
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
1909
1889
|
var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
1910
|
-
const baseUrl = apiUrl ||
|
|
1890
|
+
const baseUrl = apiUrl || DEFAULT_API30;
|
|
1911
1891
|
const base = "/api/v1/marketplace";
|
|
1912
1892
|
return {
|
|
1913
1893
|
/** Your own marketplace SDR profile. */
|
|
@@ -1957,9 +1937,9 @@ var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
|
1957
1937
|
};
|
|
1958
1938
|
|
|
1959
1939
|
// src/snippet.ts
|
|
1960
|
-
var
|
|
1940
|
+
var DEFAULT_API31 = "https://be.graph8.com";
|
|
1961
1941
|
var createSnippetClient = (apiKey, apiUrl) => {
|
|
1962
|
-
const baseUrl = apiUrl ||
|
|
1942
|
+
const baseUrl = apiUrl || DEFAULT_API31;
|
|
1963
1943
|
return {
|
|
1964
1944
|
/** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
|
|
1965
1945
|
async get() {
|
|
@@ -1971,7 +1951,7 @@ var createSnippetClient = (apiKey, apiUrl) => {
|
|
|
1971
1951
|
|
|
1972
1952
|
// src/core.ts
|
|
1973
1953
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
1974
|
-
var
|
|
1954
|
+
var DEFAULT_API32 = "https://be.graph8.com";
|
|
1975
1955
|
var G8 = class {
|
|
1976
1956
|
constructor() {
|
|
1977
1957
|
/** @internal */
|
|
@@ -1995,16 +1975,10 @@ var G8 = class {
|
|
|
1995
1975
|
/** @internal */
|
|
1996
1976
|
this._campaigns = null;
|
|
1997
1977
|
/** @internal */
|
|
1998
|
-
this._integrations = null;
|
|
1999
|
-
/** @internal */
|
|
2000
1978
|
this._signals = null;
|
|
2001
1979
|
/** @internal */
|
|
2002
|
-
this._analytics = null;
|
|
2003
|
-
/** @internal */
|
|
2004
1980
|
this._voice = null;
|
|
2005
1981
|
/** @internal */
|
|
2006
|
-
this._pages = null;
|
|
2007
|
-
/** @internal */
|
|
2008
1982
|
this._webhooks = null;
|
|
2009
1983
|
/** @internal */
|
|
2010
1984
|
this._contacts = null;
|
|
@@ -2060,7 +2034,7 @@ var G8 = class {
|
|
|
2060
2034
|
debug: config.debug
|
|
2061
2035
|
});
|
|
2062
2036
|
}
|
|
2063
|
-
const apiUrl = config.apiUrl ||
|
|
2037
|
+
const apiUrl = config.apiUrl || DEFAULT_API32;
|
|
2064
2038
|
const writeKey = config.writeKey || "";
|
|
2065
2039
|
const apiKey = config.apiKey || "";
|
|
2066
2040
|
if (writeKey) {
|
|
@@ -2075,10 +2049,7 @@ var G8 = class {
|
|
|
2075
2049
|
this._enrich = createEnrichClient(apiKey, apiUrl);
|
|
2076
2050
|
this._sequences = createSequencesClient(apiKey, apiUrl);
|
|
2077
2051
|
this._campaigns = createCampaignsClient(apiKey, apiUrl);
|
|
2078
|
-
this._integrations = createIntegrationsClient(apiKey, apiUrl);
|
|
2079
|
-
this._analytics = createAnalyticsClient(apiKey, apiUrl);
|
|
2080
2052
|
this._voice = createVoiceClient(apiKey, apiUrl);
|
|
2081
|
-
this._pages = createPagesClient(apiKey, apiUrl);
|
|
2082
2053
|
this._webhooks = createWebhooksClient(apiKey, apiUrl);
|
|
2083
2054
|
this._contacts = createContactsClient(apiKey, apiUrl);
|
|
2084
2055
|
this._companies = createCompaniesClient(apiKey, apiUrl);
|
|
@@ -2161,31 +2132,16 @@ var G8 = class {
|
|
|
2161
2132
|
this._assertKey("campaigns");
|
|
2162
2133
|
return this._campaigns;
|
|
2163
2134
|
}
|
|
2164
|
-
/** CRM integrations (requires API key). */
|
|
2165
|
-
get integrations() {
|
|
2166
|
-
this._assertKey("integrations");
|
|
2167
|
-
return this._integrations;
|
|
2168
|
-
}
|
|
2169
2135
|
/** Intent signals. */
|
|
2170
2136
|
get signals() {
|
|
2171
2137
|
this._assertInit();
|
|
2172
2138
|
return this._signals;
|
|
2173
2139
|
}
|
|
2174
|
-
/** Analytics (requires API key). */
|
|
2175
|
-
get analytics() {
|
|
2176
|
-
this._assertKey("analytics");
|
|
2177
|
-
return this._analytics;
|
|
2178
|
-
}
|
|
2179
2140
|
/** Voice AI (requires API key). */
|
|
2180
2141
|
get voice() {
|
|
2181
2142
|
this._assertKey("voice");
|
|
2182
2143
|
return this._voice;
|
|
2183
2144
|
}
|
|
2184
|
-
/** Landing pages (requires API key). */
|
|
2185
|
-
get pages() {
|
|
2186
|
-
this._assertKey("pages");
|
|
2187
|
-
return this._pages;
|
|
2188
|
-
}
|
|
2189
2145
|
/** Webhook event listeners (requires API key). */
|
|
2190
2146
|
get webhooks() {
|
|
2191
2147
|
this._assertKey("webhooks");
|