@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.js
CHANGED
|
@@ -61,6 +61,21 @@ var createFormsClient = (writeKey, apiUrl) => {
|
|
|
61
61
|
|
|
62
62
|
// src/utils.ts
|
|
63
63
|
var isServer = typeof window === "undefined";
|
|
64
|
+
var resolveAppBaseUrl = (apiBaseUrl) => {
|
|
65
|
+
try {
|
|
66
|
+
const url = new URL(apiBaseUrl);
|
|
67
|
+
if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
|
|
68
|
+
url.port = "3000";
|
|
69
|
+
return url.origin;
|
|
70
|
+
}
|
|
71
|
+
if (url.hostname.endsWith("graph8.com")) {
|
|
72
|
+
url.hostname = url.hostname.replace(/^be\./, "app.");
|
|
73
|
+
return url.origin;
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
return apiBaseUrl;
|
|
78
|
+
};
|
|
64
79
|
|
|
65
80
|
// src/visitors.ts
|
|
66
81
|
var DEFAULT_API2 = "https://be.graph8.com";
|
|
@@ -173,6 +188,7 @@ var createCopilotClient = (writeKey, apiUrl) => {
|
|
|
173
188
|
var DEFAULT_API4 = "https://be.graph8.com";
|
|
174
189
|
var createChatClient = (writeKey, apiUrl) => {
|
|
175
190
|
const baseUrl = apiUrl || DEFAULT_API4;
|
|
191
|
+
const appUrl = resolveAppBaseUrl(baseUrl);
|
|
176
192
|
const listeners = /* @__PURE__ */ new Map();
|
|
177
193
|
let widgetEl = null;
|
|
178
194
|
let ws = null;
|
|
@@ -187,7 +203,7 @@ var createChatClient = (writeKey, apiUrl) => {
|
|
|
187
203
|
const position = config?.position || "bottom-right";
|
|
188
204
|
const posStyle = position === "bottom-left" ? "left:16px;" : "right:16px;";
|
|
189
205
|
const iframe = document.createElement("iframe");
|
|
190
|
-
iframe.src = `${
|
|
206
|
+
iframe.src = `${appUrl}/webchat/embed?write_key=${writeKey}&theme=${config?.theme || "auto"}`;
|
|
191
207
|
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;`;
|
|
192
208
|
iframe.id = "g8-chat-widget";
|
|
193
209
|
document.body.appendChild(iframe);
|
|
@@ -312,6 +328,19 @@ var G8Error = class _G8Error extends Error {
|
|
|
312
328
|
function isRetryableStatus(status) {
|
|
313
329
|
return status === 429 || status >= 500 && status <= 599;
|
|
314
330
|
}
|
|
331
|
+
function isNonIdempotentMethod(method) {
|
|
332
|
+
const m = method.toUpperCase();
|
|
333
|
+
return m === "POST" || m === "PATCH";
|
|
334
|
+
}
|
|
335
|
+
function newIdempotencyKey() {
|
|
336
|
+
const c = globalThis.crypto;
|
|
337
|
+
if (c?.randomUUID) return c.randomUUID();
|
|
338
|
+
if (c?.getRandomValues) {
|
|
339
|
+
const bytes = c.getRandomValues(new Uint8Array(16));
|
|
340
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
341
|
+
}
|
|
342
|
+
return `g8-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
343
|
+
}
|
|
315
344
|
function parseRetryAfter(header, nowMs = Date.now()) {
|
|
316
345
|
if (!header) return null;
|
|
317
346
|
const secs = Number(header);
|
|
@@ -378,7 +407,8 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
378
407
|
Authorization: `Bearer ${apiKey}`,
|
|
379
408
|
...headers
|
|
380
409
|
};
|
|
381
|
-
|
|
410
|
+
const effectiveIdempotencyKey = idempotencyKey ?? (maxRetries > 0 && isNonIdempotentMethod(method) ? newIdempotencyKey() : void 0);
|
|
411
|
+
if (effectiveIdempotencyKey) finalHeaders["Idempotency-Key"] = effectiveIdempotencyKey;
|
|
382
412
|
let attempt = 0;
|
|
383
413
|
for (; ; ) {
|
|
384
414
|
let resp;
|
|
@@ -446,7 +476,7 @@ var createEnrichClient = (apiKey, apiUrl) => {
|
|
|
446
476
|
});
|
|
447
477
|
return resp.data ?? resp;
|
|
448
478
|
},
|
|
449
|
-
/** Search
|
|
479
|
+
/** Search 700M+ contacts with filters. Credits charged per result. */
|
|
450
480
|
async search(filters, page = 1, limit = 25) {
|
|
451
481
|
const resp = await request(baseUrl, "/api/v1/search/contacts", apiKey, {
|
|
452
482
|
method: "POST",
|
|
@@ -487,21 +517,30 @@ var createSequencesClient = (apiKey, apiUrl) => {
|
|
|
487
517
|
query: params
|
|
488
518
|
});
|
|
489
519
|
},
|
|
490
|
-
/**
|
|
491
|
-
|
|
520
|
+
/**
|
|
521
|
+
* Add contacts to a sequence (V2 queuing). Live or drafted sequences only.
|
|
522
|
+
* Pass `idempotencyKey` to make a retry safe — the same key returns the
|
|
523
|
+
* first result instead of re-enrolling on a 5xx-then-success (A6).
|
|
524
|
+
*/
|
|
525
|
+
async add(config, idempotencyKey) {
|
|
492
526
|
const resp = await request(
|
|
493
527
|
baseUrl,
|
|
494
528
|
`/api/v1/sequences/${config.sequenceId}/contacts`,
|
|
495
529
|
apiKey,
|
|
496
|
-
{ method: "POST", body: { contact_ids: config.contactIds, list_id: config.listId } }
|
|
530
|
+
{ method: "POST", body: { contact_ids: config.contactIds, list_id: config.listId }, idempotencyKey }
|
|
497
531
|
);
|
|
498
532
|
return resp.data ?? resp;
|
|
499
533
|
},
|
|
500
|
-
/**
|
|
501
|
-
|
|
534
|
+
/**
|
|
535
|
+
* Create a new sequence with optional steps + channels. Pass `idempotencyKey`
|
|
536
|
+
* to make a retry safe — the same key returns the first result instead of
|
|
537
|
+
* creating a duplicate sequence on a 5xx-then-success (A6).
|
|
538
|
+
*/
|
|
539
|
+
async create(payload, idempotencyKey) {
|
|
502
540
|
const resp = await request(baseUrl, "/api/v1/sequences", apiKey, {
|
|
503
541
|
method: "POST",
|
|
504
|
-
body: payload
|
|
542
|
+
body: payload,
|
|
543
|
+
idempotencyKey
|
|
505
544
|
});
|
|
506
545
|
return resp.data ?? resp;
|
|
507
546
|
},
|
|
@@ -530,33 +569,43 @@ var createSequencesClient = (apiKey, apiUrl) => {
|
|
|
530
569
|
});
|
|
531
570
|
return resp.data ?? resp;
|
|
532
571
|
},
|
|
533
|
-
/**
|
|
534
|
-
|
|
572
|
+
/**
|
|
573
|
+
* Run/start a DRAFTED sequence (V2 orchestration). Pass `idempotencyKey` to
|
|
574
|
+
* make a retry safe — the same key won't re-trigger the run on a
|
|
575
|
+
* 5xx-then-success (A6).
|
|
576
|
+
*/
|
|
577
|
+
async run(sequenceId, idempotencyKey) {
|
|
535
578
|
const resp = await request(
|
|
536
579
|
baseUrl,
|
|
537
580
|
`/api/v1/sequences/${sequenceId}/run`,
|
|
538
581
|
apiKey,
|
|
539
|
-
{ method: "POST" }
|
|
582
|
+
{ method: "POST", idempotencyKey }
|
|
540
583
|
);
|
|
541
584
|
return resp.data ?? resp;
|
|
542
585
|
},
|
|
543
|
-
/**
|
|
544
|
-
|
|
586
|
+
/**
|
|
587
|
+
* Pause a live sequence. Pass `idempotencyKey` to make a retry safe — the
|
|
588
|
+
* same key won't double-apply on a 5xx-then-success (A6).
|
|
589
|
+
*/
|
|
590
|
+
async pause(sequenceId, idempotencyKey) {
|
|
545
591
|
const resp = await request(
|
|
546
592
|
baseUrl,
|
|
547
593
|
`/api/v1/sequences/${sequenceId}/pause`,
|
|
548
594
|
apiKey,
|
|
549
|
-
{ method: "POST" }
|
|
595
|
+
{ method: "POST", idempotencyKey }
|
|
550
596
|
);
|
|
551
597
|
return resp.data ?? resp;
|
|
552
598
|
},
|
|
553
|
-
/**
|
|
554
|
-
|
|
599
|
+
/**
|
|
600
|
+
* Resume a paused sequence. Pass `idempotencyKey` to make a retry safe — the
|
|
601
|
+
* same key won't double-apply on a 5xx-then-success (A6).
|
|
602
|
+
*/
|
|
603
|
+
async resume(sequenceId, idempotencyKey) {
|
|
555
604
|
const resp = await request(
|
|
556
605
|
baseUrl,
|
|
557
606
|
`/api/v1/sequences/${sequenceId}/resume`,
|
|
558
607
|
apiKey,
|
|
559
|
-
{ method: "POST" }
|
|
608
|
+
{ method: "POST", idempotencyKey }
|
|
560
609
|
);
|
|
561
610
|
return resp.data ?? resp;
|
|
562
611
|
},
|
|
@@ -600,45 +649,23 @@ var createCampaignsClient = (apiKey, apiUrl) => {
|
|
|
600
649
|
return resp.data ?? resp;
|
|
601
650
|
},
|
|
602
651
|
async launch(campaignId) {
|
|
603
|
-
await request(
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
// src/integrations.ts
|
|
613
|
-
var DEFAULT_API9 = "https://be.graph8.com";
|
|
614
|
-
var createIntegrationsClient = (apiKey, apiUrl) => {
|
|
615
|
-
const baseUrl = apiUrl || DEFAULT_API9;
|
|
616
|
-
return {
|
|
617
|
-
async list() {
|
|
618
|
-
const resp = await request(baseUrl, "/api/v1/integrations", apiKey);
|
|
652
|
+
const resp = await request(
|
|
653
|
+
baseUrl,
|
|
654
|
+
`/api/v1/campaigns/${campaignId}/launch`,
|
|
655
|
+
apiKey,
|
|
656
|
+
{ method: "POST" }
|
|
657
|
+
);
|
|
619
658
|
return resp.data ?? resp;
|
|
620
|
-
},
|
|
621
|
-
async connect(provider, config) {
|
|
622
|
-
await request(baseUrl, "/api/v1/integrations/connect", apiKey, {
|
|
623
|
-
method: "POST",
|
|
624
|
-
body: { provider, ...config }
|
|
625
|
-
});
|
|
626
|
-
},
|
|
627
|
-
async sync(provider, config) {
|
|
628
|
-
await request(baseUrl, "/api/v1/integrations/sync", apiKey, {
|
|
629
|
-
method: "POST",
|
|
630
|
-
body: { provider, ...config }
|
|
631
|
-
});
|
|
632
659
|
}
|
|
633
660
|
};
|
|
634
661
|
};
|
|
635
662
|
|
|
636
663
|
// src/signals.ts
|
|
637
|
-
var
|
|
664
|
+
var DEFAULT_API9 = "https://be.graph8.com";
|
|
638
665
|
var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
639
|
-
const baseUrl = apiUrl ||
|
|
666
|
+
const baseUrl = apiUrl || DEFAULT_API9;
|
|
640
667
|
const headers = () => isApiKey ? { "Content-Type": "application/json", "Authorization": `Bearer ${key}` } : { "Content-Type": "application/json", "X-Write-Key": key };
|
|
641
|
-
const endpoint =
|
|
668
|
+
const endpoint = "/api/v1/public/signals/company";
|
|
642
669
|
return {
|
|
643
670
|
/** Get intent signals for a specific company domain. */
|
|
644
671
|
async company(domain) {
|
|
@@ -663,24 +690,10 @@ var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
|
663
690
|
};
|
|
664
691
|
};
|
|
665
692
|
|
|
666
|
-
// src/analytics.ts
|
|
667
|
-
var DEFAULT_API11 = "https://be.graph8.com";
|
|
668
|
-
var createAnalyticsClient = (apiKey, apiUrl) => {
|
|
669
|
-
const baseUrl = apiUrl || DEFAULT_API11;
|
|
670
|
-
return {
|
|
671
|
-
async overview(config) {
|
|
672
|
-
const resp = await request(baseUrl, "/api/v1/analytics/overview", apiKey, {
|
|
673
|
-
query: { period: config?.period }
|
|
674
|
-
});
|
|
675
|
-
return resp.data ?? resp;
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
};
|
|
679
|
-
|
|
680
693
|
// src/voice.ts
|
|
681
|
-
var
|
|
694
|
+
var DEFAULT_API10 = "https://be.graph8.com";
|
|
682
695
|
var createVoiceClient = (apiKey, apiUrl) => {
|
|
683
|
-
const baseUrl = apiUrl ||
|
|
696
|
+
const baseUrl = apiUrl || DEFAULT_API10;
|
|
684
697
|
const listeners = /* @__PURE__ */ new Map();
|
|
685
698
|
const dialer = {
|
|
686
699
|
/** List parallel-dialer sessions with filters + pagination. */
|
|
@@ -813,31 +826,6 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
813
826
|
}
|
|
814
827
|
};
|
|
815
828
|
return {
|
|
816
|
-
/**
|
|
817
|
-
* Start an AI voice session.
|
|
818
|
-
* @deprecated Preview surface — for parallel-dialer flows use `voice.dialer.createSession()`.
|
|
819
|
-
*/
|
|
820
|
-
async start(config) {
|
|
821
|
-
const resp = await request(
|
|
822
|
-
baseUrl,
|
|
823
|
-
"/api/v1/voice/sessions",
|
|
824
|
-
apiKey,
|
|
825
|
-
{ method: "POST", body: config }
|
|
826
|
-
);
|
|
827
|
-
return resp.data ?? resp;
|
|
828
|
-
},
|
|
829
|
-
/**
|
|
830
|
-
* Get call analysis for a completed session.
|
|
831
|
-
* @deprecated Preview surface — for dialer-call grading use `voice.dialer.callGrading(roomName)`.
|
|
832
|
-
*/
|
|
833
|
-
async analysis(sessionId) {
|
|
834
|
-
const resp = await request(
|
|
835
|
-
baseUrl,
|
|
836
|
-
`/api/v1/voice/sessions/${sessionId}/analysis`,
|
|
837
|
-
apiKey
|
|
838
|
-
);
|
|
839
|
-
return resp.data ?? resp;
|
|
840
|
-
},
|
|
841
829
|
/** Listen for voice events. */
|
|
842
830
|
on(event, callback) {
|
|
843
831
|
if (!listeners.has(event)) listeners.set(event, []);
|
|
@@ -848,43 +836,9 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
848
836
|
};
|
|
849
837
|
};
|
|
850
838
|
|
|
851
|
-
// src/pages.ts
|
|
852
|
-
var DEFAULT_API13 = "https://be.graph8.com";
|
|
853
|
-
var createPagesClient = (apiKey, apiUrl) => {
|
|
854
|
-
const baseUrl = apiUrl || DEFAULT_API13;
|
|
855
|
-
return {
|
|
856
|
-
/** Clone a landing page from any URL. */
|
|
857
|
-
async clone(url) {
|
|
858
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages/clone-url", apiKey, {
|
|
859
|
-
method: "POST",
|
|
860
|
-
body: { url }
|
|
861
|
-
});
|
|
862
|
-
return resp.data ?? resp;
|
|
863
|
-
},
|
|
864
|
-
/** Create a landing page from a template. */
|
|
865
|
-
async create(config) {
|
|
866
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages", apiKey, {
|
|
867
|
-
method: "POST",
|
|
868
|
-
body: config
|
|
869
|
-
});
|
|
870
|
-
return resp.data ?? resp;
|
|
871
|
-
},
|
|
872
|
-
/** Publish a landing page to CDN. */
|
|
873
|
-
async publish(pageId) {
|
|
874
|
-
const data = await request(
|
|
875
|
-
baseUrl,
|
|
876
|
-
`/api/v1/landing-pages/${pageId}/publish`,
|
|
877
|
-
apiKey,
|
|
878
|
-
{ method: "POST" }
|
|
879
|
-
);
|
|
880
|
-
return { url: data.published_url || data.data?.published_url || "" };
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
};
|
|
884
|
-
|
|
885
839
|
// src/webhooks.ts
|
|
886
840
|
var import_node_crypto = require("crypto");
|
|
887
|
-
var
|
|
841
|
+
var DEFAULT_API11 = "https://be.graph8.com";
|
|
888
842
|
var KNOWN_WEBHOOK_EVENTS = [
|
|
889
843
|
"campaign.created",
|
|
890
844
|
"campaign.updated",
|
|
@@ -902,7 +856,7 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
902
856
|
"company_intelligence.completed",
|
|
903
857
|
"audience.ready",
|
|
904
858
|
"audience.failed",
|
|
905
|
-
"sequence.
|
|
859
|
+
"sequence.draft_created",
|
|
906
860
|
"sequence.started",
|
|
907
861
|
"sequence.paused",
|
|
908
862
|
"sequence.completed",
|
|
@@ -965,7 +919,7 @@ function constructEvent(payload, signature, timestamp, secret, opts = {}) {
|
|
|
965
919
|
}
|
|
966
920
|
}
|
|
967
921
|
var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
968
|
-
const baseUrl = apiUrl ||
|
|
922
|
+
const baseUrl = apiUrl || DEFAULT_API11;
|
|
969
923
|
return {
|
|
970
924
|
/** Base URL the webhook subscription API lives under. */
|
|
971
925
|
baseUrl,
|
|
@@ -979,9 +933,9 @@ var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
|
979
933
|
};
|
|
980
934
|
|
|
981
935
|
// src/contacts.ts
|
|
982
|
-
var
|
|
936
|
+
var DEFAULT_API12 = "https://be.graph8.com";
|
|
983
937
|
var createContactsClient = (apiKey, apiUrl) => {
|
|
984
|
-
const baseUrl = apiUrl ||
|
|
938
|
+
const baseUrl = apiUrl || DEFAULT_API12;
|
|
985
939
|
return {
|
|
986
940
|
/** List contacts with optional filters. */
|
|
987
941
|
async list(params = {}) {
|
|
@@ -1040,9 +994,9 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1040
994
|
};
|
|
1041
995
|
|
|
1042
996
|
// src/companies.ts
|
|
1043
|
-
var
|
|
997
|
+
var DEFAULT_API13 = "https://be.graph8.com";
|
|
1044
998
|
var createCompaniesClient = (apiKey, apiUrl) => {
|
|
1045
|
-
const baseUrl = apiUrl ||
|
|
999
|
+
const baseUrl = apiUrl || DEFAULT_API13;
|
|
1046
1000
|
return {
|
|
1047
1001
|
/** List companies with optional filters. */
|
|
1048
1002
|
async list(params = {}) {
|
|
@@ -1088,9 +1042,9 @@ var createCompaniesClient = (apiKey, apiUrl) => {
|
|
|
1088
1042
|
};
|
|
1089
1043
|
|
|
1090
1044
|
// src/lists.ts
|
|
1091
|
-
var
|
|
1045
|
+
var DEFAULT_API14 = "https://be.graph8.com";
|
|
1092
1046
|
var createListsClient = (apiKey, apiUrl) => {
|
|
1093
|
-
const baseUrl = apiUrl ||
|
|
1047
|
+
const baseUrl = apiUrl || DEFAULT_API14;
|
|
1094
1048
|
return {
|
|
1095
1049
|
/** List all lists. */
|
|
1096
1050
|
async list(page = 1, limit = 50) {
|
|
@@ -1130,9 +1084,9 @@ var createListsClient = (apiKey, apiUrl) => {
|
|
|
1130
1084
|
};
|
|
1131
1085
|
|
|
1132
1086
|
// src/notes.ts
|
|
1133
|
-
var
|
|
1087
|
+
var DEFAULT_API15 = "https://be.graph8.com";
|
|
1134
1088
|
var createNotesClient = (apiKey, apiUrl) => {
|
|
1135
|
-
const baseUrl = apiUrl ||
|
|
1089
|
+
const baseUrl = apiUrl || DEFAULT_API15;
|
|
1136
1090
|
return {
|
|
1137
1091
|
/** List all notes on a contact. */
|
|
1138
1092
|
async list(contactId) {
|
|
@@ -1162,9 +1116,9 @@ var createNotesClient = (apiKey, apiUrl) => {
|
|
|
1162
1116
|
};
|
|
1163
1117
|
|
|
1164
1118
|
// src/tasks.ts
|
|
1165
|
-
var
|
|
1119
|
+
var DEFAULT_API16 = "https://be.graph8.com";
|
|
1166
1120
|
var createTasksClient = (apiKey, apiUrl) => {
|
|
1167
|
-
const baseUrl = apiUrl ||
|
|
1121
|
+
const baseUrl = apiUrl || DEFAULT_API16;
|
|
1168
1122
|
return {
|
|
1169
1123
|
/** List tasks on a single contact. Optional status filter ("open" | "completed"). */
|
|
1170
1124
|
async listForContact(contactId, status) {
|
|
@@ -1200,9 +1154,9 @@ var createTasksClient = (apiKey, apiUrl) => {
|
|
|
1200
1154
|
};
|
|
1201
1155
|
|
|
1202
1156
|
// src/fields.ts
|
|
1203
|
-
var
|
|
1157
|
+
var DEFAULT_API17 = "https://be.graph8.com";
|
|
1204
1158
|
var createFieldsClient = (apiKey, apiUrl) => {
|
|
1205
|
-
const baseUrl = apiUrl ||
|
|
1159
|
+
const baseUrl = apiUrl || DEFAULT_API17;
|
|
1206
1160
|
return {
|
|
1207
1161
|
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
1208
1162
|
async listContactFields(listId) {
|
|
@@ -1244,9 +1198,9 @@ var createFieldsClient = (apiKey, apiUrl) => {
|
|
|
1244
1198
|
};
|
|
1245
1199
|
|
|
1246
1200
|
// src/deals.ts
|
|
1247
|
-
var
|
|
1201
|
+
var DEFAULT_API18 = "https://be.graph8.com";
|
|
1248
1202
|
var createDealsClient = (apiKey, apiUrl) => {
|
|
1249
|
-
const baseUrl = apiUrl ||
|
|
1203
|
+
const baseUrl = apiUrl || DEFAULT_API18;
|
|
1250
1204
|
return {
|
|
1251
1205
|
/** List all deal pipelines and their stages. */
|
|
1252
1206
|
async pipelines() {
|
|
@@ -1290,9 +1244,9 @@ var createDealsClient = (apiKey, apiUrl) => {
|
|
|
1290
1244
|
};
|
|
1291
1245
|
|
|
1292
1246
|
// src/inbox.ts
|
|
1293
|
-
var
|
|
1247
|
+
var DEFAULT_API19 = "https://be.graph8.com";
|
|
1294
1248
|
var createInboxClient = (apiKey, apiUrl) => {
|
|
1295
|
-
const baseUrl = apiUrl ||
|
|
1249
|
+
const baseUrl = apiUrl || DEFAULT_API19;
|
|
1296
1250
|
return {
|
|
1297
1251
|
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
1298
1252
|
async list(params = {}) {
|
|
@@ -1345,9 +1299,9 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1345
1299
|
};
|
|
1346
1300
|
|
|
1347
1301
|
// src/quotes.ts
|
|
1348
|
-
var
|
|
1302
|
+
var DEFAULT_API20 = "https://be.graph8.com";
|
|
1349
1303
|
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1350
|
-
const baseUrl = apiUrl ||
|
|
1304
|
+
const baseUrl = apiUrl || DEFAULT_API20;
|
|
1351
1305
|
return {
|
|
1352
1306
|
/** List quotes org-wide with optional filters and pagination. */
|
|
1353
1307
|
async list(params = {}) {
|
|
@@ -1419,9 +1373,9 @@ var createQuotesClient = (apiKey, apiUrl) => {
|
|
|
1419
1373
|
};
|
|
1420
1374
|
|
|
1421
1375
|
// src/pipelines.ts
|
|
1422
|
-
var
|
|
1376
|
+
var DEFAULT_API21 = "https://be.graph8.com";
|
|
1423
1377
|
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1424
|
-
const baseUrl = apiUrl ||
|
|
1378
|
+
const baseUrl = apiUrl || DEFAULT_API21;
|
|
1425
1379
|
return {
|
|
1426
1380
|
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1427
1381
|
async list() {
|
|
@@ -1503,9 +1457,9 @@ var createPipelinesClient = (apiKey, apiUrl) => {
|
|
|
1503
1457
|
};
|
|
1504
1458
|
|
|
1505
1459
|
// src/workflows.ts
|
|
1506
|
-
var
|
|
1460
|
+
var DEFAULT_API22 = "https://be.graph8.com";
|
|
1507
1461
|
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1508
|
-
const baseUrl = apiUrl ||
|
|
1462
|
+
const baseUrl = apiUrl || DEFAULT_API22;
|
|
1509
1463
|
return {
|
|
1510
1464
|
/** List workflows org-wide. */
|
|
1511
1465
|
async list(params = {}) {
|
|
@@ -1621,9 +1575,9 @@ var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
|
1621
1575
|
};
|
|
1622
1576
|
|
|
1623
1577
|
// src/skills.ts
|
|
1624
|
-
var
|
|
1578
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1625
1579
|
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1626
|
-
const baseUrl = apiUrl ||
|
|
1580
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1627
1581
|
return {
|
|
1628
1582
|
/** List skills. */
|
|
1629
1583
|
async list(params = {}) {
|
|
@@ -1710,9 +1664,9 @@ var createSkillsClient = (apiKey, apiUrl) => {
|
|
|
1710
1664
|
};
|
|
1711
1665
|
|
|
1712
1666
|
// src/intent.ts
|
|
1713
|
-
var
|
|
1667
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1714
1668
|
var createIntentClient = (apiKey, apiUrl) => {
|
|
1715
|
-
const baseUrl = apiUrl ||
|
|
1669
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1716
1670
|
const get = (path) => request(baseUrl, `/api/v1${path}`, apiKey);
|
|
1717
1671
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1718
1672
|
const del = (path) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "DELETE" });
|
|
@@ -1781,10 +1735,12 @@ var createIntentClient = (apiKey, apiUrl) => {
|
|
|
1781
1735
|
};
|
|
1782
1736
|
|
|
1783
1737
|
// src/studio.ts
|
|
1784
|
-
var
|
|
1738
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1785
1739
|
var createStudioClient = (apiKey, apiUrl) => {
|
|
1786
|
-
const baseUrl = apiUrl ||
|
|
1740
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1787
1741
|
const get = (path, params = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { query: params });
|
|
1742
|
+
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1743
|
+
const patch = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "PATCH", body });
|
|
1788
1744
|
return {
|
|
1789
1745
|
/** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
|
|
1790
1746
|
* `include_content` defaults to true server-side, so each document includes
|
|
@@ -1807,14 +1763,38 @@ var createStudioClient = (apiKey, apiUrl) => {
|
|
|
1807
1763
|
/** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
|
|
1808
1764
|
async researchReports(params = {}) {
|
|
1809
1765
|
return get("/research-reports", params);
|
|
1766
|
+
},
|
|
1767
|
+
/** Create an ICP manually (no AI scoring). Requires name + website_url. */
|
|
1768
|
+
async createIcp(body) {
|
|
1769
|
+
return post("/icps", body);
|
|
1770
|
+
},
|
|
1771
|
+
/** Update an ICP (partial - send only fields to change). */
|
|
1772
|
+
async updateIcp(icpId, body) {
|
|
1773
|
+
return patch(`/icps/${icpId}`, body);
|
|
1774
|
+
},
|
|
1775
|
+
/** Archive an ICP (soft delete - sets status to "archived"). */
|
|
1776
|
+
async archiveIcp(icpId) {
|
|
1777
|
+
return post(`/icps/${icpId}/archive`);
|
|
1778
|
+
},
|
|
1779
|
+
/** Create a buyer persona manually (no AI generation). Requires title + website_url. */
|
|
1780
|
+
async createPersona(body) {
|
|
1781
|
+
return post("/personas", body);
|
|
1782
|
+
},
|
|
1783
|
+
/** Update a persona (partial). Passing status "archived" is equivalent to archivePersona. */
|
|
1784
|
+
async updatePersona(personaId, body) {
|
|
1785
|
+
return patch(`/personas/${personaId}`, body);
|
|
1786
|
+
},
|
|
1787
|
+
/** Archive a persona (soft delete - sets status to "archived"). */
|
|
1788
|
+
async archivePersona(personaId) {
|
|
1789
|
+
return post(`/personas/${personaId}/archive`);
|
|
1810
1790
|
}
|
|
1811
1791
|
};
|
|
1812
1792
|
};
|
|
1813
1793
|
|
|
1814
1794
|
// src/meetings.ts
|
|
1815
|
-
var
|
|
1795
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1816
1796
|
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
1817
|
-
const baseUrl = apiUrl ||
|
|
1797
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1818
1798
|
return {
|
|
1819
1799
|
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
1820
1800
|
async list(params = {}) {
|
|
@@ -1829,9 +1809,9 @@ var createMeetingsClient = (apiKey, apiUrl) => {
|
|
|
1829
1809
|
};
|
|
1830
1810
|
|
|
1831
1811
|
// src/audiences.ts
|
|
1832
|
-
var
|
|
1812
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1833
1813
|
var createAudiencesClient = (apiKey, apiUrl) => {
|
|
1834
|
-
const baseUrl = apiUrl ||
|
|
1814
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1835
1815
|
const base = "/api/v1/audience-syncs";
|
|
1836
1816
|
return {
|
|
1837
1817
|
/** List all audience syncs for the organization. */
|
|
@@ -1879,9 +1859,9 @@ var createAudiencesClient = (apiKey, apiUrl) => {
|
|
|
1879
1859
|
};
|
|
1880
1860
|
|
|
1881
1861
|
// src/search.ts
|
|
1882
|
-
var
|
|
1862
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1883
1863
|
var createSearchClient = (apiKey, apiUrl) => {
|
|
1884
|
-
const baseUrl = apiUrl ||
|
|
1864
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1885
1865
|
const body = (p) => ({ filters: [], page: 1, limit: 25, ...p });
|
|
1886
1866
|
return {
|
|
1887
1867
|
/** Search open-data contacts by filter. */
|
|
@@ -1912,9 +1892,9 @@ var createSearchClient = (apiKey, apiUrl) => {
|
|
|
1912
1892
|
};
|
|
1913
1893
|
|
|
1914
1894
|
// src/agency.ts
|
|
1915
|
-
var
|
|
1895
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
1916
1896
|
var createAgencyClient = (apiKey, apiUrl) => {
|
|
1917
|
-
const baseUrl = apiUrl ||
|
|
1897
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
1918
1898
|
return {
|
|
1919
1899
|
/** Describe the agency credential: agency org + authorized client count. */
|
|
1920
1900
|
async me() {
|
|
@@ -1929,9 +1909,9 @@ var createAgencyClient = (apiKey, apiUrl) => {
|
|
|
1929
1909
|
};
|
|
1930
1910
|
|
|
1931
1911
|
// src/marketplace.ts
|
|
1932
|
-
var
|
|
1912
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
1933
1913
|
var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
1934
|
-
const baseUrl = apiUrl ||
|
|
1914
|
+
const baseUrl = apiUrl || DEFAULT_API30;
|
|
1935
1915
|
const base = "/api/v1/marketplace";
|
|
1936
1916
|
return {
|
|
1937
1917
|
/** Your own marketplace SDR profile. */
|
|
@@ -1981,9 +1961,9 @@ var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
|
1981
1961
|
};
|
|
1982
1962
|
|
|
1983
1963
|
// src/snippet.ts
|
|
1984
|
-
var
|
|
1964
|
+
var DEFAULT_API31 = "https://be.graph8.com";
|
|
1985
1965
|
var createSnippetClient = (apiKey, apiUrl) => {
|
|
1986
|
-
const baseUrl = apiUrl ||
|
|
1966
|
+
const baseUrl = apiUrl || DEFAULT_API31;
|
|
1987
1967
|
return {
|
|
1988
1968
|
/** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
|
|
1989
1969
|
async get() {
|
|
@@ -1995,7 +1975,7 @@ var createSnippetClient = (apiKey, apiUrl) => {
|
|
|
1995
1975
|
|
|
1996
1976
|
// src/core.ts
|
|
1997
1977
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
1998
|
-
var
|
|
1978
|
+
var DEFAULT_API32 = "https://be.graph8.com";
|
|
1999
1979
|
var G8 = class {
|
|
2000
1980
|
constructor() {
|
|
2001
1981
|
/** @internal */
|
|
@@ -2019,16 +1999,10 @@ var G8 = class {
|
|
|
2019
1999
|
/** @internal */
|
|
2020
2000
|
this._campaigns = null;
|
|
2021
2001
|
/** @internal */
|
|
2022
|
-
this._integrations = null;
|
|
2023
|
-
/** @internal */
|
|
2024
2002
|
this._signals = null;
|
|
2025
2003
|
/** @internal */
|
|
2026
|
-
this._analytics = null;
|
|
2027
|
-
/** @internal */
|
|
2028
2004
|
this._voice = null;
|
|
2029
2005
|
/** @internal */
|
|
2030
|
-
this._pages = null;
|
|
2031
|
-
/** @internal */
|
|
2032
2006
|
this._webhooks = null;
|
|
2033
2007
|
/** @internal */
|
|
2034
2008
|
this._contacts = null;
|
|
@@ -2084,7 +2058,7 @@ var G8 = class {
|
|
|
2084
2058
|
debug: config.debug
|
|
2085
2059
|
});
|
|
2086
2060
|
}
|
|
2087
|
-
const apiUrl = config.apiUrl ||
|
|
2061
|
+
const apiUrl = config.apiUrl || DEFAULT_API32;
|
|
2088
2062
|
const writeKey = config.writeKey || "";
|
|
2089
2063
|
const apiKey = config.apiKey || "";
|
|
2090
2064
|
if (writeKey) {
|
|
@@ -2099,10 +2073,7 @@ var G8 = class {
|
|
|
2099
2073
|
this._enrich = createEnrichClient(apiKey, apiUrl);
|
|
2100
2074
|
this._sequences = createSequencesClient(apiKey, apiUrl);
|
|
2101
2075
|
this._campaigns = createCampaignsClient(apiKey, apiUrl);
|
|
2102
|
-
this._integrations = createIntegrationsClient(apiKey, apiUrl);
|
|
2103
|
-
this._analytics = createAnalyticsClient(apiKey, apiUrl);
|
|
2104
2076
|
this._voice = createVoiceClient(apiKey, apiUrl);
|
|
2105
|
-
this._pages = createPagesClient(apiKey, apiUrl);
|
|
2106
2077
|
this._webhooks = createWebhooksClient(apiKey, apiUrl);
|
|
2107
2078
|
this._contacts = createContactsClient(apiKey, apiUrl);
|
|
2108
2079
|
this._companies = createCompaniesClient(apiKey, apiUrl);
|
|
@@ -2185,31 +2156,16 @@ var G8 = class {
|
|
|
2185
2156
|
this._assertKey("campaigns");
|
|
2186
2157
|
return this._campaigns;
|
|
2187
2158
|
}
|
|
2188
|
-
/** CRM integrations (requires API key). */
|
|
2189
|
-
get integrations() {
|
|
2190
|
-
this._assertKey("integrations");
|
|
2191
|
-
return this._integrations;
|
|
2192
|
-
}
|
|
2193
2159
|
/** Intent signals. */
|
|
2194
2160
|
get signals() {
|
|
2195
2161
|
this._assertInit();
|
|
2196
2162
|
return this._signals;
|
|
2197
2163
|
}
|
|
2198
|
-
/** Analytics (requires API key). */
|
|
2199
|
-
get analytics() {
|
|
2200
|
-
this._assertKey("analytics");
|
|
2201
|
-
return this._analytics;
|
|
2202
|
-
}
|
|
2203
2164
|
/** Voice AI (requires API key). */
|
|
2204
2165
|
get voice() {
|
|
2205
2166
|
this._assertKey("voice");
|
|
2206
2167
|
return this._voice;
|
|
2207
2168
|
}
|
|
2208
|
-
/** Landing pages (requires API key). */
|
|
2209
|
-
get pages() {
|
|
2210
|
-
this._assertKey("pages");
|
|
2211
|
-
return this._pages;
|
|
2212
|
-
}
|
|
2213
2169
|
/** Webhook event listeners (requires API key). */
|
|
2214
2170
|
get webhooks() {
|
|
2215
2171
|
this._assertKey("webhooks");
|