@graph8/sdk 0.7.2 → 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 +191 -164
- package/dist/index.d.ts +191 -164
- package/dist/index.js +115 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +115 -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/index.js
CHANGED
|
@@ -67,6 +67,21 @@ var createFormsClient = (writeKey, apiUrl) => {
|
|
|
67
67
|
|
|
68
68
|
// src/utils.ts
|
|
69
69
|
var isServer = typeof window === "undefined";
|
|
70
|
+
var resolveAppBaseUrl = (apiBaseUrl) => {
|
|
71
|
+
try {
|
|
72
|
+
const url = new URL(apiBaseUrl);
|
|
73
|
+
if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
|
|
74
|
+
url.port = "3000";
|
|
75
|
+
return url.origin;
|
|
76
|
+
}
|
|
77
|
+
if (url.hostname.endsWith("graph8.com")) {
|
|
78
|
+
url.hostname = url.hostname.replace(/^be\./, "app.");
|
|
79
|
+
return url.origin;
|
|
80
|
+
}
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
return apiBaseUrl;
|
|
84
|
+
};
|
|
70
85
|
|
|
71
86
|
// src/visitors.ts
|
|
72
87
|
var DEFAULT_API2 = "https://be.graph8.com";
|
|
@@ -179,6 +194,7 @@ var createCopilotClient = (writeKey, apiUrl) => {
|
|
|
179
194
|
var DEFAULT_API4 = "https://be.graph8.com";
|
|
180
195
|
var createChatClient = (writeKey, apiUrl) => {
|
|
181
196
|
const baseUrl = apiUrl || DEFAULT_API4;
|
|
197
|
+
const appUrl = resolveAppBaseUrl(baseUrl);
|
|
182
198
|
const listeners = /* @__PURE__ */ new Map();
|
|
183
199
|
let widgetEl = null;
|
|
184
200
|
let ws = null;
|
|
@@ -193,7 +209,7 @@ var createChatClient = (writeKey, apiUrl) => {
|
|
|
193
209
|
const position = config?.position || "bottom-right";
|
|
194
210
|
const posStyle = position === "bottom-left" ? "left:16px;" : "right:16px;";
|
|
195
211
|
const iframe = document.createElement("iframe");
|
|
196
|
-
iframe.src = `${
|
|
212
|
+
iframe.src = `${appUrl}/webchat/embed?write_key=${writeKey}&theme=${config?.theme || "auto"}`;
|
|
197
213
|
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;`;
|
|
198
214
|
iframe.id = "g8-chat-widget";
|
|
199
215
|
document.body.appendChild(iframe);
|
|
@@ -318,6 +334,19 @@ var G8Error = class _G8Error extends Error {
|
|
|
318
334
|
function isRetryableStatus(status) {
|
|
319
335
|
return status === 429 || status >= 500 && status <= 599;
|
|
320
336
|
}
|
|
337
|
+
function isNonIdempotentMethod(method) {
|
|
338
|
+
const m = method.toUpperCase();
|
|
339
|
+
return m === "POST" || m === "PATCH";
|
|
340
|
+
}
|
|
341
|
+
function newIdempotencyKey() {
|
|
342
|
+
const c = globalThis.crypto;
|
|
343
|
+
if (c?.randomUUID) return c.randomUUID();
|
|
344
|
+
if (c?.getRandomValues) {
|
|
345
|
+
const bytes = c.getRandomValues(new Uint8Array(16));
|
|
346
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
347
|
+
}
|
|
348
|
+
return `g8-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
349
|
+
}
|
|
321
350
|
function parseRetryAfter(header, nowMs = Date.now()) {
|
|
322
351
|
if (!header) return null;
|
|
323
352
|
const secs = Number(header);
|
|
@@ -384,7 +413,8 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
384
413
|
Authorization: `Bearer ${apiKey}`,
|
|
385
414
|
...headers
|
|
386
415
|
};
|
|
387
|
-
|
|
416
|
+
const effectiveIdempotencyKey = idempotencyKey ?? (maxRetries > 0 && isNonIdempotentMethod(method) ? newIdempotencyKey() : void 0);
|
|
417
|
+
if (effectiveIdempotencyKey) finalHeaders["Idempotency-Key"] = effectiveIdempotencyKey;
|
|
388
418
|
let attempt = 0;
|
|
389
419
|
for (; ; ) {
|
|
390
420
|
let resp;
|
|
@@ -462,7 +492,7 @@ var createEnrichClient = (apiKey, apiUrl) => {
|
|
|
462
492
|
});
|
|
463
493
|
return resp.data ?? resp;
|
|
464
494
|
},
|
|
465
|
-
/** Search
|
|
495
|
+
/** Search 700M+ contacts with filters. Credits charged per result. */
|
|
466
496
|
async search(filters, page = 1, limit = 25) {
|
|
467
497
|
const resp = await request(baseUrl, "/api/v1/search/contacts", apiKey, {
|
|
468
498
|
method: "POST",
|
|
@@ -635,45 +665,23 @@ var createCampaignsClient = (apiKey, apiUrl) => {
|
|
|
635
665
|
return resp.data ?? resp;
|
|
636
666
|
},
|
|
637
667
|
async launch(campaignId) {
|
|
638
|
-
await request(
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
};
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
// src/integrations.ts
|
|
648
|
-
var DEFAULT_API9 = "https://be.graph8.com";
|
|
649
|
-
var createIntegrationsClient = (apiKey, apiUrl) => {
|
|
650
|
-
const baseUrl = apiUrl || DEFAULT_API9;
|
|
651
|
-
return {
|
|
652
|
-
async list() {
|
|
653
|
-
const resp = await request(baseUrl, "/api/v1/integrations", apiKey);
|
|
668
|
+
const resp = await request(
|
|
669
|
+
baseUrl,
|
|
670
|
+
`/api/v1/campaigns/${campaignId}/launch`,
|
|
671
|
+
apiKey,
|
|
672
|
+
{ method: "POST" }
|
|
673
|
+
);
|
|
654
674
|
return resp.data ?? resp;
|
|
655
|
-
},
|
|
656
|
-
async connect(provider, config) {
|
|
657
|
-
await request(baseUrl, "/api/v1/integrations/connect", apiKey, {
|
|
658
|
-
method: "POST",
|
|
659
|
-
body: { provider, ...config }
|
|
660
|
-
});
|
|
661
|
-
},
|
|
662
|
-
async sync(provider, config) {
|
|
663
|
-
await request(baseUrl, "/api/v1/integrations/sync", apiKey, {
|
|
664
|
-
method: "POST",
|
|
665
|
-
body: { provider, ...config }
|
|
666
|
-
});
|
|
667
675
|
}
|
|
668
676
|
};
|
|
669
677
|
};
|
|
670
678
|
|
|
671
679
|
// src/signals.ts
|
|
672
|
-
var
|
|
680
|
+
var DEFAULT_API9 = "https://be.graph8.com";
|
|
673
681
|
var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
674
|
-
const baseUrl = apiUrl ||
|
|
682
|
+
const baseUrl = apiUrl || DEFAULT_API9;
|
|
675
683
|
const headers = () => isApiKey ? { "Content-Type": "application/json", "Authorization": `Bearer ${key}` } : { "Content-Type": "application/json", "X-Write-Key": key };
|
|
676
|
-
const endpoint =
|
|
684
|
+
const endpoint = "/api/v1/public/signals/company";
|
|
677
685
|
return {
|
|
678
686
|
/** Get intent signals for a specific company domain. */
|
|
679
687
|
async company(domain) {
|
|
@@ -698,24 +706,10 @@ var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
|
698
706
|
};
|
|
699
707
|
};
|
|
700
708
|
|
|
701
|
-
// src/analytics.ts
|
|
702
|
-
var DEFAULT_API11 = "https://be.graph8.com";
|
|
703
|
-
var createAnalyticsClient = (apiKey, apiUrl) => {
|
|
704
|
-
const baseUrl = apiUrl || DEFAULT_API11;
|
|
705
|
-
return {
|
|
706
|
-
async overview(config) {
|
|
707
|
-
const resp = await request(baseUrl, "/api/v1/analytics/overview", apiKey, {
|
|
708
|
-
query: { period: config?.period }
|
|
709
|
-
});
|
|
710
|
-
return resp.data ?? resp;
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
};
|
|
714
|
-
|
|
715
709
|
// src/voice.ts
|
|
716
|
-
var
|
|
710
|
+
var DEFAULT_API10 = "https://be.graph8.com";
|
|
717
711
|
var createVoiceClient = (apiKey, apiUrl) => {
|
|
718
|
-
const baseUrl = apiUrl ||
|
|
712
|
+
const baseUrl = apiUrl || DEFAULT_API10;
|
|
719
713
|
const listeners = /* @__PURE__ */ new Map();
|
|
720
714
|
const dialer = {
|
|
721
715
|
/** List parallel-dialer sessions with filters + pagination. */
|
|
@@ -848,31 +842,6 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
848
842
|
}
|
|
849
843
|
};
|
|
850
844
|
return {
|
|
851
|
-
/**
|
|
852
|
-
* Start an AI voice session.
|
|
853
|
-
* @deprecated Preview surface — for parallel-dialer flows use `voice.dialer.createSession()`.
|
|
854
|
-
*/
|
|
855
|
-
async start(config) {
|
|
856
|
-
const resp = await request(
|
|
857
|
-
baseUrl,
|
|
858
|
-
"/api/v1/voice/sessions",
|
|
859
|
-
apiKey,
|
|
860
|
-
{ method: "POST", body: config }
|
|
861
|
-
);
|
|
862
|
-
return resp.data ?? resp;
|
|
863
|
-
},
|
|
864
|
-
/**
|
|
865
|
-
* Get call analysis for a completed session.
|
|
866
|
-
* @deprecated Preview surface — for dialer-call grading use `voice.dialer.callGrading(roomName)`.
|
|
867
|
-
*/
|
|
868
|
-
async analysis(sessionId) {
|
|
869
|
-
const resp = await request(
|
|
870
|
-
baseUrl,
|
|
871
|
-
`/api/v1/voice/sessions/${sessionId}/analysis`,
|
|
872
|
-
apiKey
|
|
873
|
-
);
|
|
874
|
-
return resp.data ?? resp;
|
|
875
|
-
},
|
|
876
845
|
/** Listen for voice events. */
|
|
877
846
|
on(event, callback) {
|
|
878
847
|
if (!listeners.has(event)) listeners.set(event, []);
|
|
@@ -883,43 +852,9 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
883
852
|
};
|
|
884
853
|
};
|
|
885
854
|
|
|
886
|
-
// src/pages.ts
|
|
887
|
-
var DEFAULT_API13 = "https://be.graph8.com";
|
|
888
|
-
var createPagesClient = (apiKey, apiUrl) => {
|
|
889
|
-
const baseUrl = apiUrl || DEFAULT_API13;
|
|
890
|
-
return {
|
|
891
|
-
/** Clone a landing page from any URL. */
|
|
892
|
-
async clone(url) {
|
|
893
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages/clone-url", apiKey, {
|
|
894
|
-
method: "POST",
|
|
895
|
-
body: { url }
|
|
896
|
-
});
|
|
897
|
-
return resp.data ?? resp;
|
|
898
|
-
},
|
|
899
|
-
/** Create a landing page from a template. */
|
|
900
|
-
async create(config) {
|
|
901
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages", apiKey, {
|
|
902
|
-
method: "POST",
|
|
903
|
-
body: config
|
|
904
|
-
});
|
|
905
|
-
return resp.data ?? resp;
|
|
906
|
-
},
|
|
907
|
-
/** Publish a landing page to CDN. */
|
|
908
|
-
async publish(pageId) {
|
|
909
|
-
const data = await request(
|
|
910
|
-
baseUrl,
|
|
911
|
-
`/api/v1/landing-pages/${pageId}/publish`,
|
|
912
|
-
apiKey,
|
|
913
|
-
{ method: "POST" }
|
|
914
|
-
);
|
|
915
|
-
return { url: data.published_url || data.data?.published_url || "" };
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
};
|
|
919
|
-
|
|
920
855
|
// src/webhooks.ts
|
|
921
856
|
var import_node_crypto = require("crypto");
|
|
922
|
-
var
|
|
857
|
+
var DEFAULT_API11 = "https://be.graph8.com";
|
|
923
858
|
var KNOWN_WEBHOOK_EVENTS = [
|
|
924
859
|
"campaign.created",
|
|
925
860
|
"campaign.updated",
|
|
@@ -937,7 +872,7 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
937
872
|
"company_intelligence.completed",
|
|
938
873
|
"audience.ready",
|
|
939
874
|
"audience.failed",
|
|
940
|
-
"sequence.
|
|
875
|
+
"sequence.draft_created",
|
|
941
876
|
"sequence.started",
|
|
942
877
|
"sequence.paused",
|
|
943
878
|
"sequence.completed",
|
|
@@ -1000,7 +935,7 @@ function constructEvent(payload, signature, timestamp, secret, opts = {}) {
|
|
|
1000
935
|
}
|
|
1001
936
|
}
|
|
1002
937
|
var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
1003
|
-
const baseUrl = apiUrl ||
|
|
938
|
+
const baseUrl = apiUrl || DEFAULT_API11;
|
|
1004
939
|
return {
|
|
1005
940
|
/** Base URL the webhook subscription API lives under. */
|
|
1006
941
|
baseUrl,
|
|
@@ -1014,9 +949,9 @@ var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
|
1014
949
|
};
|
|
1015
950
|
|
|
1016
951
|
// src/contacts.ts
|
|
1017
|
-
var
|
|
952
|
+
var DEFAULT_API12 = "https://be.graph8.com";
|
|
1018
953
|
var createContactsClient = (apiKey, apiUrl) => {
|
|
1019
|
-
const baseUrl = apiUrl ||
|
|
954
|
+
const baseUrl = apiUrl || DEFAULT_API12;
|
|
1020
955
|
return {
|
|
1021
956
|
/** List contacts with optional filters. */
|
|
1022
957
|
async list(params = {}) {
|
|
@@ -1075,9 +1010,9 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1075
1010
|
};
|
|
1076
1011
|
|
|
1077
1012
|
// src/companies.ts
|
|
1078
|
-
var
|
|
1013
|
+
var DEFAULT_API13 = "https://be.graph8.com";
|
|
1079
1014
|
var createCompaniesClient = (apiKey, apiUrl) => {
|
|
1080
|
-
const baseUrl = apiUrl ||
|
|
1015
|
+
const baseUrl = apiUrl || DEFAULT_API13;
|
|
1081
1016
|
return {
|
|
1082
1017
|
/** List companies with optional filters. */
|
|
1083
1018
|
async list(params = {}) {
|
|
@@ -1123,9 +1058,9 @@ var createCompaniesClient = (apiKey, apiUrl) => {
|
|
|
1123
1058
|
};
|
|
1124
1059
|
|
|
1125
1060
|
// src/lists.ts
|
|
1126
|
-
var
|
|
1061
|
+
var DEFAULT_API14 = "https://be.graph8.com";
|
|
1127
1062
|
var createListsClient = (apiKey, apiUrl) => {
|
|
1128
|
-
const baseUrl = apiUrl ||
|
|
1063
|
+
const baseUrl = apiUrl || DEFAULT_API14;
|
|
1129
1064
|
return {
|
|
1130
1065
|
/** List all lists. */
|
|
1131
1066
|
async list(page = 1, limit = 50) {
|
|
@@ -1165,9 +1100,9 @@ var createListsClient = (apiKey, apiUrl) => {
|
|
|
1165
1100
|
};
|
|
1166
1101
|
|
|
1167
1102
|
// src/notes.ts
|
|
1168
|
-
var
|
|
1103
|
+
var DEFAULT_API15 = "https://be.graph8.com";
|
|
1169
1104
|
var createNotesClient = (apiKey, apiUrl) => {
|
|
1170
|
-
const baseUrl = apiUrl ||
|
|
1105
|
+
const baseUrl = apiUrl || DEFAULT_API15;
|
|
1171
1106
|
return {
|
|
1172
1107
|
/** List all notes on a contact. */
|
|
1173
1108
|
async list(contactId) {
|
|
@@ -1197,9 +1132,9 @@ var createNotesClient = (apiKey, apiUrl) => {
|
|
|
1197
1132
|
};
|
|
1198
1133
|
|
|
1199
1134
|
// src/tasks.ts
|
|
1200
|
-
var
|
|
1135
|
+
var DEFAULT_API16 = "https://be.graph8.com";
|
|
1201
1136
|
var createTasksClient = (apiKey, apiUrl) => {
|
|
1202
|
-
const baseUrl = apiUrl ||
|
|
1137
|
+
const baseUrl = apiUrl || DEFAULT_API16;
|
|
1203
1138
|
return {
|
|
1204
1139
|
/** List tasks on a single contact. Optional status filter ("open" | "completed"). */
|
|
1205
1140
|
async listForContact(contactId, status) {
|
|
@@ -1235,9 +1170,9 @@ var createTasksClient = (apiKey, apiUrl) => {
|
|
|
1235
1170
|
};
|
|
1236
1171
|
|
|
1237
1172
|
// src/fields.ts
|
|
1238
|
-
var
|
|
1173
|
+
var DEFAULT_API17 = "https://be.graph8.com";
|
|
1239
1174
|
var createFieldsClient = (apiKey, apiUrl) => {
|
|
1240
|
-
const baseUrl = apiUrl ||
|
|
1175
|
+
const baseUrl = apiUrl || DEFAULT_API17;
|
|
1241
1176
|
return {
|
|
1242
1177
|
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
1243
1178
|
async listContactFields(listId) {
|
|
@@ -1279,9 +1214,9 @@ var createFieldsClient = (apiKey, apiUrl) => {
|
|
|
1279
1214
|
};
|
|
1280
1215
|
|
|
1281
1216
|
// src/deals.ts
|
|
1282
|
-
var
|
|
1217
|
+
var DEFAULT_API18 = "https://be.graph8.com";
|
|
1283
1218
|
var createDealsClient = (apiKey, apiUrl) => {
|
|
1284
|
-
const baseUrl = apiUrl ||
|
|
1219
|
+
const baseUrl = apiUrl || DEFAULT_API18;
|
|
1285
1220
|
return {
|
|
1286
1221
|
/** List all deal pipelines and their stages. */
|
|
1287
1222
|
async pipelines() {
|
|
@@ -1325,9 +1260,9 @@ var createDealsClient = (apiKey, apiUrl) => {
|
|
|
1325
1260
|
};
|
|
1326
1261
|
|
|
1327
1262
|
// src/inbox.ts
|
|
1328
|
-
var
|
|
1263
|
+
var DEFAULT_API19 = "https://be.graph8.com";
|
|
1329
1264
|
var createInboxClient = (apiKey, apiUrl) => {
|
|
1330
|
-
const baseUrl = apiUrl ||
|
|
1265
|
+
const baseUrl = apiUrl || DEFAULT_API19;
|
|
1331
1266
|
return {
|
|
1332
1267
|
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
1333
1268
|
async list(params = {}) {
|
|
@@ -1380,9 +1315,9 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1380
1315
|
};
|
|
1381
1316
|
|
|
1382
1317
|
// src/quotes.ts
|
|
1383
|
-
var
|
|
1318
|
+
var DEFAULT_API20 = "https://be.graph8.com";
|
|
1384
1319
|
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1385
|
-
const baseUrl = apiUrl ||
|
|
1320
|
+
const baseUrl = apiUrl || DEFAULT_API20;
|
|
1386
1321
|
return {
|
|
1387
1322
|
/** List quotes org-wide with optional filters and pagination. */
|
|
1388
1323
|
async list(params = {}) {
|
|
@@ -1454,9 +1389,9 @@ var createQuotesClient = (apiKey, apiUrl) => {
|
|
|
1454
1389
|
};
|
|
1455
1390
|
|
|
1456
1391
|
// src/pipelines.ts
|
|
1457
|
-
var
|
|
1392
|
+
var DEFAULT_API21 = "https://be.graph8.com";
|
|
1458
1393
|
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1459
|
-
const baseUrl = apiUrl ||
|
|
1394
|
+
const baseUrl = apiUrl || DEFAULT_API21;
|
|
1460
1395
|
return {
|
|
1461
1396
|
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1462
1397
|
async list() {
|
|
@@ -1538,9 +1473,9 @@ var createPipelinesClient = (apiKey, apiUrl) => {
|
|
|
1538
1473
|
};
|
|
1539
1474
|
|
|
1540
1475
|
// src/workflows.ts
|
|
1541
|
-
var
|
|
1476
|
+
var DEFAULT_API22 = "https://be.graph8.com";
|
|
1542
1477
|
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1543
|
-
const baseUrl = apiUrl ||
|
|
1478
|
+
const baseUrl = apiUrl || DEFAULT_API22;
|
|
1544
1479
|
return {
|
|
1545
1480
|
/** List workflows org-wide. */
|
|
1546
1481
|
async list(params = {}) {
|
|
@@ -1656,9 +1591,9 @@ var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
|
1656
1591
|
};
|
|
1657
1592
|
|
|
1658
1593
|
// src/skills.ts
|
|
1659
|
-
var
|
|
1594
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1660
1595
|
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1661
|
-
const baseUrl = apiUrl ||
|
|
1596
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1662
1597
|
return {
|
|
1663
1598
|
/** List skills. */
|
|
1664
1599
|
async list(params = {}) {
|
|
@@ -1745,9 +1680,9 @@ var createSkillsClient = (apiKey, apiUrl) => {
|
|
|
1745
1680
|
};
|
|
1746
1681
|
|
|
1747
1682
|
// src/intent.ts
|
|
1748
|
-
var
|
|
1683
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1749
1684
|
var createIntentClient = (apiKey, apiUrl) => {
|
|
1750
|
-
const baseUrl = apiUrl ||
|
|
1685
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1751
1686
|
const get = (path) => request(baseUrl, `/api/v1${path}`, apiKey);
|
|
1752
1687
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1753
1688
|
const del = (path) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "DELETE" });
|
|
@@ -1816,10 +1751,12 @@ var createIntentClient = (apiKey, apiUrl) => {
|
|
|
1816
1751
|
};
|
|
1817
1752
|
|
|
1818
1753
|
// src/studio.ts
|
|
1819
|
-
var
|
|
1754
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1820
1755
|
var createStudioClient = (apiKey, apiUrl) => {
|
|
1821
|
-
const baseUrl = apiUrl ||
|
|
1756
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1822
1757
|
const get = (path, params = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { query: params });
|
|
1758
|
+
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1759
|
+
const patch = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "PATCH", body });
|
|
1823
1760
|
return {
|
|
1824
1761
|
/** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
|
|
1825
1762
|
* `include_content` defaults to true server-side, so each document includes
|
|
@@ -1842,14 +1779,38 @@ var createStudioClient = (apiKey, apiUrl) => {
|
|
|
1842
1779
|
/** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
|
|
1843
1780
|
async researchReports(params = {}) {
|
|
1844
1781
|
return get("/research-reports", params);
|
|
1782
|
+
},
|
|
1783
|
+
/** Create an ICP manually (no AI scoring). Requires name + website_url. */
|
|
1784
|
+
async createIcp(body) {
|
|
1785
|
+
return post("/icps", body);
|
|
1786
|
+
},
|
|
1787
|
+
/** Update an ICP (partial - send only fields to change). */
|
|
1788
|
+
async updateIcp(icpId, body) {
|
|
1789
|
+
return patch(`/icps/${icpId}`, body);
|
|
1790
|
+
},
|
|
1791
|
+
/** Archive an ICP (soft delete - sets status to "archived"). */
|
|
1792
|
+
async archiveIcp(icpId) {
|
|
1793
|
+
return post(`/icps/${icpId}/archive`);
|
|
1794
|
+
},
|
|
1795
|
+
/** Create a buyer persona manually (no AI generation). Requires title + website_url. */
|
|
1796
|
+
async createPersona(body) {
|
|
1797
|
+
return post("/personas", body);
|
|
1798
|
+
},
|
|
1799
|
+
/** Update a persona (partial). Passing status "archived" is equivalent to archivePersona. */
|
|
1800
|
+
async updatePersona(personaId, body) {
|
|
1801
|
+
return patch(`/personas/${personaId}`, body);
|
|
1802
|
+
},
|
|
1803
|
+
/** Archive a persona (soft delete - sets status to "archived"). */
|
|
1804
|
+
async archivePersona(personaId) {
|
|
1805
|
+
return post(`/personas/${personaId}/archive`);
|
|
1845
1806
|
}
|
|
1846
1807
|
};
|
|
1847
1808
|
};
|
|
1848
1809
|
|
|
1849
1810
|
// src/meetings.ts
|
|
1850
|
-
var
|
|
1811
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1851
1812
|
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
1852
|
-
const baseUrl = apiUrl ||
|
|
1813
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1853
1814
|
return {
|
|
1854
1815
|
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
1855
1816
|
async list(params = {}) {
|
|
@@ -1864,9 +1825,9 @@ var createMeetingsClient = (apiKey, apiUrl) => {
|
|
|
1864
1825
|
};
|
|
1865
1826
|
|
|
1866
1827
|
// src/audiences.ts
|
|
1867
|
-
var
|
|
1828
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1868
1829
|
var createAudiencesClient = (apiKey, apiUrl) => {
|
|
1869
|
-
const baseUrl = apiUrl ||
|
|
1830
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1870
1831
|
const base = "/api/v1/audience-syncs";
|
|
1871
1832
|
return {
|
|
1872
1833
|
/** List all audience syncs for the organization. */
|
|
@@ -1914,9 +1875,9 @@ var createAudiencesClient = (apiKey, apiUrl) => {
|
|
|
1914
1875
|
};
|
|
1915
1876
|
|
|
1916
1877
|
// src/search.ts
|
|
1917
|
-
var
|
|
1878
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1918
1879
|
var createSearchClient = (apiKey, apiUrl) => {
|
|
1919
|
-
const baseUrl = apiUrl ||
|
|
1880
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1920
1881
|
const body = (p) => ({ filters: [], page: 1, limit: 25, ...p });
|
|
1921
1882
|
return {
|
|
1922
1883
|
/** Search open-data contacts by filter. */
|
|
@@ -1947,9 +1908,9 @@ var createSearchClient = (apiKey, apiUrl) => {
|
|
|
1947
1908
|
};
|
|
1948
1909
|
|
|
1949
1910
|
// src/agency.ts
|
|
1950
|
-
var
|
|
1911
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
1951
1912
|
var createAgencyClient = (apiKey, apiUrl) => {
|
|
1952
|
-
const baseUrl = apiUrl ||
|
|
1913
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
1953
1914
|
return {
|
|
1954
1915
|
/** Describe the agency credential: agency org + authorized client count. */
|
|
1955
1916
|
async me() {
|
|
@@ -1964,9 +1925,9 @@ var createAgencyClient = (apiKey, apiUrl) => {
|
|
|
1964
1925
|
};
|
|
1965
1926
|
|
|
1966
1927
|
// src/marketplace.ts
|
|
1967
|
-
var
|
|
1928
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
1968
1929
|
var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
1969
|
-
const baseUrl = apiUrl ||
|
|
1930
|
+
const baseUrl = apiUrl || DEFAULT_API30;
|
|
1970
1931
|
const base = "/api/v1/marketplace";
|
|
1971
1932
|
return {
|
|
1972
1933
|
/** Your own marketplace SDR profile. */
|
|
@@ -2016,9 +1977,9 @@ var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
|
2016
1977
|
};
|
|
2017
1978
|
|
|
2018
1979
|
// src/snippet.ts
|
|
2019
|
-
var
|
|
1980
|
+
var DEFAULT_API31 = "https://be.graph8.com";
|
|
2020
1981
|
var createSnippetClient = (apiKey, apiUrl) => {
|
|
2021
|
-
const baseUrl = apiUrl ||
|
|
1982
|
+
const baseUrl = apiUrl || DEFAULT_API31;
|
|
2022
1983
|
return {
|
|
2023
1984
|
/** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
|
|
2024
1985
|
async get() {
|
|
@@ -2030,7 +1991,7 @@ var createSnippetClient = (apiKey, apiUrl) => {
|
|
|
2030
1991
|
|
|
2031
1992
|
// src/core.ts
|
|
2032
1993
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
2033
|
-
var
|
|
1994
|
+
var DEFAULT_API32 = "https://be.graph8.com";
|
|
2034
1995
|
var G8 = class {
|
|
2035
1996
|
constructor() {
|
|
2036
1997
|
/** @internal */
|
|
@@ -2054,16 +2015,10 @@ var G8 = class {
|
|
|
2054
2015
|
/** @internal */
|
|
2055
2016
|
this._campaigns = null;
|
|
2056
2017
|
/** @internal */
|
|
2057
|
-
this._integrations = null;
|
|
2058
|
-
/** @internal */
|
|
2059
2018
|
this._signals = null;
|
|
2060
2019
|
/** @internal */
|
|
2061
|
-
this._analytics = null;
|
|
2062
|
-
/** @internal */
|
|
2063
2020
|
this._voice = null;
|
|
2064
2021
|
/** @internal */
|
|
2065
|
-
this._pages = null;
|
|
2066
|
-
/** @internal */
|
|
2067
2022
|
this._webhooks = null;
|
|
2068
2023
|
/** @internal */
|
|
2069
2024
|
this._contacts = null;
|
|
@@ -2119,7 +2074,7 @@ var G8 = class {
|
|
|
2119
2074
|
debug: config.debug
|
|
2120
2075
|
});
|
|
2121
2076
|
}
|
|
2122
|
-
const apiUrl = config.apiUrl ||
|
|
2077
|
+
const apiUrl = config.apiUrl || DEFAULT_API32;
|
|
2123
2078
|
const writeKey = config.writeKey || "";
|
|
2124
2079
|
const apiKey = config.apiKey || "";
|
|
2125
2080
|
if (writeKey) {
|
|
@@ -2134,10 +2089,7 @@ var G8 = class {
|
|
|
2134
2089
|
this._enrich = createEnrichClient(apiKey, apiUrl);
|
|
2135
2090
|
this._sequences = createSequencesClient(apiKey, apiUrl);
|
|
2136
2091
|
this._campaigns = createCampaignsClient(apiKey, apiUrl);
|
|
2137
|
-
this._integrations = createIntegrationsClient(apiKey, apiUrl);
|
|
2138
|
-
this._analytics = createAnalyticsClient(apiKey, apiUrl);
|
|
2139
2092
|
this._voice = createVoiceClient(apiKey, apiUrl);
|
|
2140
|
-
this._pages = createPagesClient(apiKey, apiUrl);
|
|
2141
2093
|
this._webhooks = createWebhooksClient(apiKey, apiUrl);
|
|
2142
2094
|
this._contacts = createContactsClient(apiKey, apiUrl);
|
|
2143
2095
|
this._companies = createCompaniesClient(apiKey, apiUrl);
|
|
@@ -2220,31 +2172,16 @@ var G8 = class {
|
|
|
2220
2172
|
this._assertKey("campaigns");
|
|
2221
2173
|
return this._campaigns;
|
|
2222
2174
|
}
|
|
2223
|
-
/** CRM integrations (requires API key). */
|
|
2224
|
-
get integrations() {
|
|
2225
|
-
this._assertKey("integrations");
|
|
2226
|
-
return this._integrations;
|
|
2227
|
-
}
|
|
2228
2175
|
/** Intent signals. */
|
|
2229
2176
|
get signals() {
|
|
2230
2177
|
this._assertInit();
|
|
2231
2178
|
return this._signals;
|
|
2232
2179
|
}
|
|
2233
|
-
/** Analytics (requires API key). */
|
|
2234
|
-
get analytics() {
|
|
2235
|
-
this._assertKey("analytics");
|
|
2236
|
-
return this._analytics;
|
|
2237
|
-
}
|
|
2238
2180
|
/** Voice AI (requires API key). */
|
|
2239
2181
|
get voice() {
|
|
2240
2182
|
this._assertKey("voice");
|
|
2241
2183
|
return this._voice;
|
|
2242
2184
|
}
|
|
2243
|
-
/** Landing pages (requires API key). */
|
|
2244
|
-
get pages() {
|
|
2245
|
-
this._assertKey("pages");
|
|
2246
|
-
return this._pages;
|
|
2247
|
-
}
|
|
2248
2185
|
/** Webhook event listeners (requires API key). */
|
|
2249
2186
|
get webhooks() {
|
|
2250
2187
|
this._assertKey("webhooks");
|