@graph8/sdk 0.7.2 → 0.12.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 +67 -39
- package/dist/index.d.mts +416 -164
- package/dist/index.d.ts +416 -164
- package/dist/index.js +291 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +284 -178
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +186 -156
- package/dist/react.d.ts +186 -156
- package/dist/react.js +115 -178
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +115 -178
- 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",
|
|
@@ -619,45 +649,23 @@ var createCampaignsClient = (apiKey, apiUrl) => {
|
|
|
619
649
|
return resp.data ?? resp;
|
|
620
650
|
},
|
|
621
651
|
async launch(campaignId) {
|
|
622
|
-
await request(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
};
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
// src/integrations.ts
|
|
632
|
-
var DEFAULT_API9 = "https://be.graph8.com";
|
|
633
|
-
var createIntegrationsClient = (apiKey, apiUrl) => {
|
|
634
|
-
const baseUrl = apiUrl || DEFAULT_API9;
|
|
635
|
-
return {
|
|
636
|
-
async list() {
|
|
637
|
-
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
|
+
);
|
|
638
658
|
return resp.data ?? resp;
|
|
639
|
-
},
|
|
640
|
-
async connect(provider, config) {
|
|
641
|
-
await request(baseUrl, "/api/v1/integrations/connect", apiKey, {
|
|
642
|
-
method: "POST",
|
|
643
|
-
body: { provider, ...config }
|
|
644
|
-
});
|
|
645
|
-
},
|
|
646
|
-
async sync(provider, config) {
|
|
647
|
-
await request(baseUrl, "/api/v1/integrations/sync", apiKey, {
|
|
648
|
-
method: "POST",
|
|
649
|
-
body: { provider, ...config }
|
|
650
|
-
});
|
|
651
659
|
}
|
|
652
660
|
};
|
|
653
661
|
};
|
|
654
662
|
|
|
655
663
|
// src/signals.ts
|
|
656
|
-
var
|
|
664
|
+
var DEFAULT_API9 = "https://be.graph8.com";
|
|
657
665
|
var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
658
|
-
const baseUrl = apiUrl ||
|
|
666
|
+
const baseUrl = apiUrl || DEFAULT_API9;
|
|
659
667
|
const headers = () => isApiKey ? { "Content-Type": "application/json", "Authorization": `Bearer ${key}` } : { "Content-Type": "application/json", "X-Write-Key": key };
|
|
660
|
-
const endpoint =
|
|
668
|
+
const endpoint = "/api/v1/public/signals/company";
|
|
661
669
|
return {
|
|
662
670
|
/** Get intent signals for a specific company domain. */
|
|
663
671
|
async company(domain) {
|
|
@@ -682,24 +690,10 @@ var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
|
682
690
|
};
|
|
683
691
|
};
|
|
684
692
|
|
|
685
|
-
// src/analytics.ts
|
|
686
|
-
var DEFAULT_API11 = "https://be.graph8.com";
|
|
687
|
-
var createAnalyticsClient = (apiKey, apiUrl) => {
|
|
688
|
-
const baseUrl = apiUrl || DEFAULT_API11;
|
|
689
|
-
return {
|
|
690
|
-
async overview(config) {
|
|
691
|
-
const resp = await request(baseUrl, "/api/v1/analytics/overview", apiKey, {
|
|
692
|
-
query: { period: config?.period }
|
|
693
|
-
});
|
|
694
|
-
return resp.data ?? resp;
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
};
|
|
698
|
-
|
|
699
693
|
// src/voice.ts
|
|
700
|
-
var
|
|
694
|
+
var DEFAULT_API10 = "https://be.graph8.com";
|
|
701
695
|
var createVoiceClient = (apiKey, apiUrl) => {
|
|
702
|
-
const baseUrl = apiUrl ||
|
|
696
|
+
const baseUrl = apiUrl || DEFAULT_API10;
|
|
703
697
|
const listeners = /* @__PURE__ */ new Map();
|
|
704
698
|
const dialer = {
|
|
705
699
|
/** List parallel-dialer sessions with filters + pagination. */
|
|
@@ -832,31 +826,6 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
832
826
|
}
|
|
833
827
|
};
|
|
834
828
|
return {
|
|
835
|
-
/**
|
|
836
|
-
* Start an AI voice session.
|
|
837
|
-
* @deprecated Preview surface — for parallel-dialer flows use `voice.dialer.createSession()`.
|
|
838
|
-
*/
|
|
839
|
-
async start(config) {
|
|
840
|
-
const resp = await request(
|
|
841
|
-
baseUrl,
|
|
842
|
-
"/api/v1/voice/sessions",
|
|
843
|
-
apiKey,
|
|
844
|
-
{ method: "POST", body: config }
|
|
845
|
-
);
|
|
846
|
-
return resp.data ?? resp;
|
|
847
|
-
},
|
|
848
|
-
/**
|
|
849
|
-
* Get call analysis for a completed session.
|
|
850
|
-
* @deprecated Preview surface — for dialer-call grading use `voice.dialer.callGrading(roomName)`.
|
|
851
|
-
*/
|
|
852
|
-
async analysis(sessionId) {
|
|
853
|
-
const resp = await request(
|
|
854
|
-
baseUrl,
|
|
855
|
-
`/api/v1/voice/sessions/${sessionId}/analysis`,
|
|
856
|
-
apiKey
|
|
857
|
-
);
|
|
858
|
-
return resp.data ?? resp;
|
|
859
|
-
},
|
|
860
829
|
/** Listen for voice events. */
|
|
861
830
|
on(event, callback) {
|
|
862
831
|
if (!listeners.has(event)) listeners.set(event, []);
|
|
@@ -867,43 +836,9 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
867
836
|
};
|
|
868
837
|
};
|
|
869
838
|
|
|
870
|
-
// src/pages.ts
|
|
871
|
-
var DEFAULT_API13 = "https://be.graph8.com";
|
|
872
|
-
var createPagesClient = (apiKey, apiUrl) => {
|
|
873
|
-
const baseUrl = apiUrl || DEFAULT_API13;
|
|
874
|
-
return {
|
|
875
|
-
/** Clone a landing page from any URL. */
|
|
876
|
-
async clone(url) {
|
|
877
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages/clone-url", apiKey, {
|
|
878
|
-
method: "POST",
|
|
879
|
-
body: { url }
|
|
880
|
-
});
|
|
881
|
-
return resp.data ?? resp;
|
|
882
|
-
},
|
|
883
|
-
/** Create a landing page from a template. */
|
|
884
|
-
async create(config) {
|
|
885
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages", apiKey, {
|
|
886
|
-
method: "POST",
|
|
887
|
-
body: config
|
|
888
|
-
});
|
|
889
|
-
return resp.data ?? resp;
|
|
890
|
-
},
|
|
891
|
-
/** Publish a landing page to CDN. */
|
|
892
|
-
async publish(pageId) {
|
|
893
|
-
const data = await request(
|
|
894
|
-
baseUrl,
|
|
895
|
-
`/api/v1/landing-pages/${pageId}/publish`,
|
|
896
|
-
apiKey,
|
|
897
|
-
{ method: "POST" }
|
|
898
|
-
);
|
|
899
|
-
return { url: data.published_url || data.data?.published_url || "" };
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
};
|
|
903
|
-
|
|
904
839
|
// src/webhooks.ts
|
|
905
840
|
var import_node_crypto = require("crypto");
|
|
906
|
-
var
|
|
841
|
+
var DEFAULT_API11 = "https://be.graph8.com";
|
|
907
842
|
var KNOWN_WEBHOOK_EVENTS = [
|
|
908
843
|
"campaign.created",
|
|
909
844
|
"campaign.updated",
|
|
@@ -921,7 +856,7 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
921
856
|
"company_intelligence.completed",
|
|
922
857
|
"audience.ready",
|
|
923
858
|
"audience.failed",
|
|
924
|
-
"sequence.
|
|
859
|
+
"sequence.draft_created",
|
|
925
860
|
"sequence.started",
|
|
926
861
|
"sequence.paused",
|
|
927
862
|
"sequence.completed",
|
|
@@ -984,7 +919,7 @@ function constructEvent(payload, signature, timestamp, secret, opts = {}) {
|
|
|
984
919
|
}
|
|
985
920
|
}
|
|
986
921
|
var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
987
|
-
const baseUrl = apiUrl ||
|
|
922
|
+
const baseUrl = apiUrl || DEFAULT_API11;
|
|
988
923
|
return {
|
|
989
924
|
/** Base URL the webhook subscription API lives under. */
|
|
990
925
|
baseUrl,
|
|
@@ -998,9 +933,9 @@ var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
|
998
933
|
};
|
|
999
934
|
|
|
1000
935
|
// src/contacts.ts
|
|
1001
|
-
var
|
|
936
|
+
var DEFAULT_API12 = "https://be.graph8.com";
|
|
1002
937
|
var createContactsClient = (apiKey, apiUrl) => {
|
|
1003
|
-
const baseUrl = apiUrl ||
|
|
938
|
+
const baseUrl = apiUrl || DEFAULT_API12;
|
|
1004
939
|
return {
|
|
1005
940
|
/** List contacts with optional filters. */
|
|
1006
941
|
async list(params = {}) {
|
|
@@ -1059,9 +994,9 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1059
994
|
};
|
|
1060
995
|
|
|
1061
996
|
// src/companies.ts
|
|
1062
|
-
var
|
|
997
|
+
var DEFAULT_API13 = "https://be.graph8.com";
|
|
1063
998
|
var createCompaniesClient = (apiKey, apiUrl) => {
|
|
1064
|
-
const baseUrl = apiUrl ||
|
|
999
|
+
const baseUrl = apiUrl || DEFAULT_API13;
|
|
1065
1000
|
return {
|
|
1066
1001
|
/** List companies with optional filters. */
|
|
1067
1002
|
async list(params = {}) {
|
|
@@ -1107,9 +1042,9 @@ var createCompaniesClient = (apiKey, apiUrl) => {
|
|
|
1107
1042
|
};
|
|
1108
1043
|
|
|
1109
1044
|
// src/lists.ts
|
|
1110
|
-
var
|
|
1045
|
+
var DEFAULT_API14 = "https://be.graph8.com";
|
|
1111
1046
|
var createListsClient = (apiKey, apiUrl) => {
|
|
1112
|
-
const baseUrl = apiUrl ||
|
|
1047
|
+
const baseUrl = apiUrl || DEFAULT_API14;
|
|
1113
1048
|
return {
|
|
1114
1049
|
/** List all lists. */
|
|
1115
1050
|
async list(page = 1, limit = 50) {
|
|
@@ -1149,9 +1084,9 @@ var createListsClient = (apiKey, apiUrl) => {
|
|
|
1149
1084
|
};
|
|
1150
1085
|
|
|
1151
1086
|
// src/notes.ts
|
|
1152
|
-
var
|
|
1087
|
+
var DEFAULT_API15 = "https://be.graph8.com";
|
|
1153
1088
|
var createNotesClient = (apiKey, apiUrl) => {
|
|
1154
|
-
const baseUrl = apiUrl ||
|
|
1089
|
+
const baseUrl = apiUrl || DEFAULT_API15;
|
|
1155
1090
|
return {
|
|
1156
1091
|
/** List all notes on a contact. */
|
|
1157
1092
|
async list(contactId) {
|
|
@@ -1181,9 +1116,9 @@ var createNotesClient = (apiKey, apiUrl) => {
|
|
|
1181
1116
|
};
|
|
1182
1117
|
|
|
1183
1118
|
// src/tasks.ts
|
|
1184
|
-
var
|
|
1119
|
+
var DEFAULT_API16 = "https://be.graph8.com";
|
|
1185
1120
|
var createTasksClient = (apiKey, apiUrl) => {
|
|
1186
|
-
const baseUrl = apiUrl ||
|
|
1121
|
+
const baseUrl = apiUrl || DEFAULT_API16;
|
|
1187
1122
|
return {
|
|
1188
1123
|
/** List tasks on a single contact. Optional status filter ("open" | "completed"). */
|
|
1189
1124
|
async listForContact(contactId, status) {
|
|
@@ -1219,9 +1154,9 @@ var createTasksClient = (apiKey, apiUrl) => {
|
|
|
1219
1154
|
};
|
|
1220
1155
|
|
|
1221
1156
|
// src/fields.ts
|
|
1222
|
-
var
|
|
1157
|
+
var DEFAULT_API17 = "https://be.graph8.com";
|
|
1223
1158
|
var createFieldsClient = (apiKey, apiUrl) => {
|
|
1224
|
-
const baseUrl = apiUrl ||
|
|
1159
|
+
const baseUrl = apiUrl || DEFAULT_API17;
|
|
1225
1160
|
return {
|
|
1226
1161
|
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
1227
1162
|
async listContactFields(listId) {
|
|
@@ -1263,9 +1198,9 @@ var createFieldsClient = (apiKey, apiUrl) => {
|
|
|
1263
1198
|
};
|
|
1264
1199
|
|
|
1265
1200
|
// src/deals.ts
|
|
1266
|
-
var
|
|
1201
|
+
var DEFAULT_API18 = "https://be.graph8.com";
|
|
1267
1202
|
var createDealsClient = (apiKey, apiUrl) => {
|
|
1268
|
-
const baseUrl = apiUrl ||
|
|
1203
|
+
const baseUrl = apiUrl || DEFAULT_API18;
|
|
1269
1204
|
return {
|
|
1270
1205
|
/** List all deal pipelines and their stages. */
|
|
1271
1206
|
async pipelines() {
|
|
@@ -1309,9 +1244,9 @@ var createDealsClient = (apiKey, apiUrl) => {
|
|
|
1309
1244
|
};
|
|
1310
1245
|
|
|
1311
1246
|
// src/inbox.ts
|
|
1312
|
-
var
|
|
1247
|
+
var DEFAULT_API19 = "https://be.graph8.com";
|
|
1313
1248
|
var createInboxClient = (apiKey, apiUrl) => {
|
|
1314
|
-
const baseUrl = apiUrl ||
|
|
1249
|
+
const baseUrl = apiUrl || DEFAULT_API19;
|
|
1315
1250
|
return {
|
|
1316
1251
|
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
1317
1252
|
async list(params = {}) {
|
|
@@ -1364,9 +1299,9 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1364
1299
|
};
|
|
1365
1300
|
|
|
1366
1301
|
// src/quotes.ts
|
|
1367
|
-
var
|
|
1302
|
+
var DEFAULT_API20 = "https://be.graph8.com";
|
|
1368
1303
|
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1369
|
-
const baseUrl = apiUrl ||
|
|
1304
|
+
const baseUrl = apiUrl || DEFAULT_API20;
|
|
1370
1305
|
return {
|
|
1371
1306
|
/** List quotes org-wide with optional filters and pagination. */
|
|
1372
1307
|
async list(params = {}) {
|
|
@@ -1438,9 +1373,9 @@ var createQuotesClient = (apiKey, apiUrl) => {
|
|
|
1438
1373
|
};
|
|
1439
1374
|
|
|
1440
1375
|
// src/pipelines.ts
|
|
1441
|
-
var
|
|
1376
|
+
var DEFAULT_API21 = "https://be.graph8.com";
|
|
1442
1377
|
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1443
|
-
const baseUrl = apiUrl ||
|
|
1378
|
+
const baseUrl = apiUrl || DEFAULT_API21;
|
|
1444
1379
|
return {
|
|
1445
1380
|
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1446
1381
|
async list() {
|
|
@@ -1522,9 +1457,9 @@ var createPipelinesClient = (apiKey, apiUrl) => {
|
|
|
1522
1457
|
};
|
|
1523
1458
|
|
|
1524
1459
|
// src/workflows.ts
|
|
1525
|
-
var
|
|
1460
|
+
var DEFAULT_API22 = "https://be.graph8.com";
|
|
1526
1461
|
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1527
|
-
const baseUrl = apiUrl ||
|
|
1462
|
+
const baseUrl = apiUrl || DEFAULT_API22;
|
|
1528
1463
|
return {
|
|
1529
1464
|
/** List workflows org-wide. */
|
|
1530
1465
|
async list(params = {}) {
|
|
@@ -1640,9 +1575,9 @@ var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
|
1640
1575
|
};
|
|
1641
1576
|
|
|
1642
1577
|
// src/skills.ts
|
|
1643
|
-
var
|
|
1578
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1644
1579
|
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1645
|
-
const baseUrl = apiUrl ||
|
|
1580
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1646
1581
|
return {
|
|
1647
1582
|
/** List skills. */
|
|
1648
1583
|
async list(params = {}) {
|
|
@@ -1729,9 +1664,9 @@ var createSkillsClient = (apiKey, apiUrl) => {
|
|
|
1729
1664
|
};
|
|
1730
1665
|
|
|
1731
1666
|
// src/intent.ts
|
|
1732
|
-
var
|
|
1667
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1733
1668
|
var createIntentClient = (apiKey, apiUrl) => {
|
|
1734
|
-
const baseUrl = apiUrl ||
|
|
1669
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1735
1670
|
const get = (path) => request(baseUrl, `/api/v1${path}`, apiKey);
|
|
1736
1671
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1737
1672
|
const del = (path) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "DELETE" });
|
|
@@ -1800,10 +1735,12 @@ var createIntentClient = (apiKey, apiUrl) => {
|
|
|
1800
1735
|
};
|
|
1801
1736
|
|
|
1802
1737
|
// src/studio.ts
|
|
1803
|
-
var
|
|
1738
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1804
1739
|
var createStudioClient = (apiKey, apiUrl) => {
|
|
1805
|
-
const baseUrl = apiUrl ||
|
|
1740
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1806
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 });
|
|
1807
1744
|
return {
|
|
1808
1745
|
/** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
|
|
1809
1746
|
* `include_content` defaults to true server-side, so each document includes
|
|
@@ -1826,14 +1763,38 @@ var createStudioClient = (apiKey, apiUrl) => {
|
|
|
1826
1763
|
/** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
|
|
1827
1764
|
async researchReports(params = {}) {
|
|
1828
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`);
|
|
1829
1790
|
}
|
|
1830
1791
|
};
|
|
1831
1792
|
};
|
|
1832
1793
|
|
|
1833
1794
|
// src/meetings.ts
|
|
1834
|
-
var
|
|
1795
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1835
1796
|
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
1836
|
-
const baseUrl = apiUrl ||
|
|
1797
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1837
1798
|
return {
|
|
1838
1799
|
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
1839
1800
|
async list(params = {}) {
|
|
@@ -1848,9 +1809,9 @@ var createMeetingsClient = (apiKey, apiUrl) => {
|
|
|
1848
1809
|
};
|
|
1849
1810
|
|
|
1850
1811
|
// src/audiences.ts
|
|
1851
|
-
var
|
|
1812
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1852
1813
|
var createAudiencesClient = (apiKey, apiUrl) => {
|
|
1853
|
-
const baseUrl = apiUrl ||
|
|
1814
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1854
1815
|
const base = "/api/v1/audience-syncs";
|
|
1855
1816
|
return {
|
|
1856
1817
|
/** List all audience syncs for the organization. */
|
|
@@ -1898,9 +1859,9 @@ var createAudiencesClient = (apiKey, apiUrl) => {
|
|
|
1898
1859
|
};
|
|
1899
1860
|
|
|
1900
1861
|
// src/search.ts
|
|
1901
|
-
var
|
|
1862
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1902
1863
|
var createSearchClient = (apiKey, apiUrl) => {
|
|
1903
|
-
const baseUrl = apiUrl ||
|
|
1864
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1904
1865
|
const body = (p) => ({ filters: [], page: 1, limit: 25, ...p });
|
|
1905
1866
|
return {
|
|
1906
1867
|
/** Search open-data contacts by filter. */
|
|
@@ -1931,9 +1892,9 @@ var createSearchClient = (apiKey, apiUrl) => {
|
|
|
1931
1892
|
};
|
|
1932
1893
|
|
|
1933
1894
|
// src/agency.ts
|
|
1934
|
-
var
|
|
1895
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
1935
1896
|
var createAgencyClient = (apiKey, apiUrl) => {
|
|
1936
|
-
const baseUrl = apiUrl ||
|
|
1897
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
1937
1898
|
return {
|
|
1938
1899
|
/** Describe the agency credential: agency org + authorized client count. */
|
|
1939
1900
|
async me() {
|
|
@@ -1948,9 +1909,9 @@ var createAgencyClient = (apiKey, apiUrl) => {
|
|
|
1948
1909
|
};
|
|
1949
1910
|
|
|
1950
1911
|
// src/marketplace.ts
|
|
1951
|
-
var
|
|
1912
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
1952
1913
|
var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
1953
|
-
const baseUrl = apiUrl ||
|
|
1914
|
+
const baseUrl = apiUrl || DEFAULT_API30;
|
|
1954
1915
|
const base = "/api/v1/marketplace";
|
|
1955
1916
|
return {
|
|
1956
1917
|
/** Your own marketplace SDR profile. */
|
|
@@ -2000,9 +1961,9 @@ var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
|
2000
1961
|
};
|
|
2001
1962
|
|
|
2002
1963
|
// src/snippet.ts
|
|
2003
|
-
var
|
|
1964
|
+
var DEFAULT_API31 = "https://be.graph8.com";
|
|
2004
1965
|
var createSnippetClient = (apiKey, apiUrl) => {
|
|
2005
|
-
const baseUrl = apiUrl ||
|
|
1966
|
+
const baseUrl = apiUrl || DEFAULT_API31;
|
|
2006
1967
|
return {
|
|
2007
1968
|
/** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
|
|
2008
1969
|
async get() {
|
|
@@ -2014,7 +1975,7 @@ var createSnippetClient = (apiKey, apiUrl) => {
|
|
|
2014
1975
|
|
|
2015
1976
|
// src/core.ts
|
|
2016
1977
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
2017
|
-
var
|
|
1978
|
+
var DEFAULT_API32 = "https://be.graph8.com";
|
|
2018
1979
|
var G8 = class {
|
|
2019
1980
|
constructor() {
|
|
2020
1981
|
/** @internal */
|
|
@@ -2038,16 +1999,10 @@ var G8 = class {
|
|
|
2038
1999
|
/** @internal */
|
|
2039
2000
|
this._campaigns = null;
|
|
2040
2001
|
/** @internal */
|
|
2041
|
-
this._integrations = null;
|
|
2042
|
-
/** @internal */
|
|
2043
2002
|
this._signals = null;
|
|
2044
2003
|
/** @internal */
|
|
2045
|
-
this._analytics = null;
|
|
2046
|
-
/** @internal */
|
|
2047
2004
|
this._voice = null;
|
|
2048
2005
|
/** @internal */
|
|
2049
|
-
this._pages = null;
|
|
2050
|
-
/** @internal */
|
|
2051
2006
|
this._webhooks = null;
|
|
2052
2007
|
/** @internal */
|
|
2053
2008
|
this._contacts = null;
|
|
@@ -2103,7 +2058,7 @@ var G8 = class {
|
|
|
2103
2058
|
debug: config.debug
|
|
2104
2059
|
});
|
|
2105
2060
|
}
|
|
2106
|
-
const apiUrl = config.apiUrl ||
|
|
2061
|
+
const apiUrl = config.apiUrl || DEFAULT_API32;
|
|
2107
2062
|
const writeKey = config.writeKey || "";
|
|
2108
2063
|
const apiKey = config.apiKey || "";
|
|
2109
2064
|
if (writeKey) {
|
|
@@ -2118,10 +2073,7 @@ var G8 = class {
|
|
|
2118
2073
|
this._enrich = createEnrichClient(apiKey, apiUrl);
|
|
2119
2074
|
this._sequences = createSequencesClient(apiKey, apiUrl);
|
|
2120
2075
|
this._campaigns = createCampaignsClient(apiKey, apiUrl);
|
|
2121
|
-
this._integrations = createIntegrationsClient(apiKey, apiUrl);
|
|
2122
|
-
this._analytics = createAnalyticsClient(apiKey, apiUrl);
|
|
2123
2076
|
this._voice = createVoiceClient(apiKey, apiUrl);
|
|
2124
|
-
this._pages = createPagesClient(apiKey, apiUrl);
|
|
2125
2077
|
this._webhooks = createWebhooksClient(apiKey, apiUrl);
|
|
2126
2078
|
this._contacts = createContactsClient(apiKey, apiUrl);
|
|
2127
2079
|
this._companies = createCompaniesClient(apiKey, apiUrl);
|
|
@@ -2204,31 +2156,16 @@ var G8 = class {
|
|
|
2204
2156
|
this._assertKey("campaigns");
|
|
2205
2157
|
return this._campaigns;
|
|
2206
2158
|
}
|
|
2207
|
-
/** CRM integrations (requires API key). */
|
|
2208
|
-
get integrations() {
|
|
2209
|
-
this._assertKey("integrations");
|
|
2210
|
-
return this._integrations;
|
|
2211
|
-
}
|
|
2212
2159
|
/** Intent signals. */
|
|
2213
2160
|
get signals() {
|
|
2214
2161
|
this._assertInit();
|
|
2215
2162
|
return this._signals;
|
|
2216
2163
|
}
|
|
2217
|
-
/** Analytics (requires API key). */
|
|
2218
|
-
get analytics() {
|
|
2219
|
-
this._assertKey("analytics");
|
|
2220
|
-
return this._analytics;
|
|
2221
|
-
}
|
|
2222
2164
|
/** Voice AI (requires API key). */
|
|
2223
2165
|
get voice() {
|
|
2224
2166
|
this._assertKey("voice");
|
|
2225
2167
|
return this._voice;
|
|
2226
2168
|
}
|
|
2227
|
-
/** Landing pages (requires API key). */
|
|
2228
|
-
get pages() {
|
|
2229
|
-
this._assertKey("pages");
|
|
2230
|
-
return this._pages;
|
|
2231
|
-
}
|
|
2232
2169
|
/** Webhook event listeners (requires API key). */
|
|
2233
2170
|
get webhooks() {
|
|
2234
2171
|
this._assertKey("webhooks");
|