@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/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",
|
|
@@ -595,45 +625,23 @@ var createCampaignsClient = (apiKey, apiUrl) => {
|
|
|
595
625
|
return resp.data ?? resp;
|
|
596
626
|
},
|
|
597
627
|
async launch(campaignId) {
|
|
598
|
-
await request(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
};
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
// src/integrations.ts
|
|
608
|
-
var DEFAULT_API9 = "https://be.graph8.com";
|
|
609
|
-
var createIntegrationsClient = (apiKey, apiUrl) => {
|
|
610
|
-
const baseUrl = apiUrl || DEFAULT_API9;
|
|
611
|
-
return {
|
|
612
|
-
async list() {
|
|
613
|
-
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
|
+
);
|
|
614
634
|
return resp.data ?? resp;
|
|
615
|
-
},
|
|
616
|
-
async connect(provider, config) {
|
|
617
|
-
await request(baseUrl, "/api/v1/integrations/connect", apiKey, {
|
|
618
|
-
method: "POST",
|
|
619
|
-
body: { provider, ...config }
|
|
620
|
-
});
|
|
621
|
-
},
|
|
622
|
-
async sync(provider, config) {
|
|
623
|
-
await request(baseUrl, "/api/v1/integrations/sync", apiKey, {
|
|
624
|
-
method: "POST",
|
|
625
|
-
body: { provider, ...config }
|
|
626
|
-
});
|
|
627
635
|
}
|
|
628
636
|
};
|
|
629
637
|
};
|
|
630
638
|
|
|
631
639
|
// src/signals.ts
|
|
632
|
-
var
|
|
640
|
+
var DEFAULT_API9 = "https://be.graph8.com";
|
|
633
641
|
var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
634
|
-
const baseUrl = apiUrl ||
|
|
642
|
+
const baseUrl = apiUrl || DEFAULT_API9;
|
|
635
643
|
const headers = () => isApiKey ? { "Content-Type": "application/json", "Authorization": `Bearer ${key}` } : { "Content-Type": "application/json", "X-Write-Key": key };
|
|
636
|
-
const endpoint =
|
|
644
|
+
const endpoint = "/api/v1/public/signals/company";
|
|
637
645
|
return {
|
|
638
646
|
/** Get intent signals for a specific company domain. */
|
|
639
647
|
async company(domain) {
|
|
@@ -658,24 +666,10 @@ var createSignalsClient = (key, isApiKey, apiUrl) => {
|
|
|
658
666
|
};
|
|
659
667
|
};
|
|
660
668
|
|
|
661
|
-
// src/analytics.ts
|
|
662
|
-
var DEFAULT_API11 = "https://be.graph8.com";
|
|
663
|
-
var createAnalyticsClient = (apiKey, apiUrl) => {
|
|
664
|
-
const baseUrl = apiUrl || DEFAULT_API11;
|
|
665
|
-
return {
|
|
666
|
-
async overview(config) {
|
|
667
|
-
const resp = await request(baseUrl, "/api/v1/analytics/overview", apiKey, {
|
|
668
|
-
query: { period: config?.period }
|
|
669
|
-
});
|
|
670
|
-
return resp.data ?? resp;
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
};
|
|
674
|
-
|
|
675
669
|
// src/voice.ts
|
|
676
|
-
var
|
|
670
|
+
var DEFAULT_API10 = "https://be.graph8.com";
|
|
677
671
|
var createVoiceClient = (apiKey, apiUrl) => {
|
|
678
|
-
const baseUrl = apiUrl ||
|
|
672
|
+
const baseUrl = apiUrl || DEFAULT_API10;
|
|
679
673
|
const listeners = /* @__PURE__ */ new Map();
|
|
680
674
|
const dialer = {
|
|
681
675
|
/** List parallel-dialer sessions with filters + pagination. */
|
|
@@ -808,31 +802,6 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
808
802
|
}
|
|
809
803
|
};
|
|
810
804
|
return {
|
|
811
|
-
/**
|
|
812
|
-
* Start an AI voice session.
|
|
813
|
-
* @deprecated Preview surface — for parallel-dialer flows use `voice.dialer.createSession()`.
|
|
814
|
-
*/
|
|
815
|
-
async start(config) {
|
|
816
|
-
const resp = await request(
|
|
817
|
-
baseUrl,
|
|
818
|
-
"/api/v1/voice/sessions",
|
|
819
|
-
apiKey,
|
|
820
|
-
{ method: "POST", body: config }
|
|
821
|
-
);
|
|
822
|
-
return resp.data ?? resp;
|
|
823
|
-
},
|
|
824
|
-
/**
|
|
825
|
-
* Get call analysis for a completed session.
|
|
826
|
-
* @deprecated Preview surface — for dialer-call grading use `voice.dialer.callGrading(roomName)`.
|
|
827
|
-
*/
|
|
828
|
-
async analysis(sessionId) {
|
|
829
|
-
const resp = await request(
|
|
830
|
-
baseUrl,
|
|
831
|
-
`/api/v1/voice/sessions/${sessionId}/analysis`,
|
|
832
|
-
apiKey
|
|
833
|
-
);
|
|
834
|
-
return resp.data ?? resp;
|
|
835
|
-
},
|
|
836
805
|
/** Listen for voice events. */
|
|
837
806
|
on(event, callback) {
|
|
838
807
|
if (!listeners.has(event)) listeners.set(event, []);
|
|
@@ -843,43 +812,9 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
843
812
|
};
|
|
844
813
|
};
|
|
845
814
|
|
|
846
|
-
// src/pages.ts
|
|
847
|
-
var DEFAULT_API13 = "https://be.graph8.com";
|
|
848
|
-
var createPagesClient = (apiKey, apiUrl) => {
|
|
849
|
-
const baseUrl = apiUrl || DEFAULT_API13;
|
|
850
|
-
return {
|
|
851
|
-
/** Clone a landing page from any URL. */
|
|
852
|
-
async clone(url) {
|
|
853
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages/clone-url", apiKey, {
|
|
854
|
-
method: "POST",
|
|
855
|
-
body: { url }
|
|
856
|
-
});
|
|
857
|
-
return resp.data ?? resp;
|
|
858
|
-
},
|
|
859
|
-
/** Create a landing page from a template. */
|
|
860
|
-
async create(config) {
|
|
861
|
-
const resp = await request(baseUrl, "/api/v1/landing-pages", apiKey, {
|
|
862
|
-
method: "POST",
|
|
863
|
-
body: config
|
|
864
|
-
});
|
|
865
|
-
return resp.data ?? resp;
|
|
866
|
-
},
|
|
867
|
-
/** Publish a landing page to CDN. */
|
|
868
|
-
async publish(pageId) {
|
|
869
|
-
const data = await request(
|
|
870
|
-
baseUrl,
|
|
871
|
-
`/api/v1/landing-pages/${pageId}/publish`,
|
|
872
|
-
apiKey,
|
|
873
|
-
{ method: "POST" }
|
|
874
|
-
);
|
|
875
|
-
return { url: data.published_url || data.data?.published_url || "" };
|
|
876
|
-
}
|
|
877
|
-
};
|
|
878
|
-
};
|
|
879
|
-
|
|
880
815
|
// src/webhooks.ts
|
|
881
816
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
882
|
-
var
|
|
817
|
+
var DEFAULT_API11 = "https://be.graph8.com";
|
|
883
818
|
var KNOWN_WEBHOOK_EVENTS = [
|
|
884
819
|
"campaign.created",
|
|
885
820
|
"campaign.updated",
|
|
@@ -897,7 +832,7 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
897
832
|
"company_intelligence.completed",
|
|
898
833
|
"audience.ready",
|
|
899
834
|
"audience.failed",
|
|
900
|
-
"sequence.
|
|
835
|
+
"sequence.draft_created",
|
|
901
836
|
"sequence.started",
|
|
902
837
|
"sequence.paused",
|
|
903
838
|
"sequence.completed",
|
|
@@ -960,7 +895,7 @@ function constructEvent(payload, signature, timestamp, secret, opts = {}) {
|
|
|
960
895
|
}
|
|
961
896
|
}
|
|
962
897
|
var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
963
|
-
const baseUrl = apiUrl ||
|
|
898
|
+
const baseUrl = apiUrl || DEFAULT_API11;
|
|
964
899
|
return {
|
|
965
900
|
/** Base URL the webhook subscription API lives under. */
|
|
966
901
|
baseUrl,
|
|
@@ -974,9 +909,9 @@ var createWebhooksClient = (_apiKey, apiUrl) => {
|
|
|
974
909
|
};
|
|
975
910
|
|
|
976
911
|
// src/contacts.ts
|
|
977
|
-
var
|
|
912
|
+
var DEFAULT_API12 = "https://be.graph8.com";
|
|
978
913
|
var createContactsClient = (apiKey, apiUrl) => {
|
|
979
|
-
const baseUrl = apiUrl ||
|
|
914
|
+
const baseUrl = apiUrl || DEFAULT_API12;
|
|
980
915
|
return {
|
|
981
916
|
/** List contacts with optional filters. */
|
|
982
917
|
async list(params = {}) {
|
|
@@ -1035,9 +970,9 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1035
970
|
};
|
|
1036
971
|
|
|
1037
972
|
// src/companies.ts
|
|
1038
|
-
var
|
|
973
|
+
var DEFAULT_API13 = "https://be.graph8.com";
|
|
1039
974
|
var createCompaniesClient = (apiKey, apiUrl) => {
|
|
1040
|
-
const baseUrl = apiUrl ||
|
|
975
|
+
const baseUrl = apiUrl || DEFAULT_API13;
|
|
1041
976
|
return {
|
|
1042
977
|
/** List companies with optional filters. */
|
|
1043
978
|
async list(params = {}) {
|
|
@@ -1083,9 +1018,9 @@ var createCompaniesClient = (apiKey, apiUrl) => {
|
|
|
1083
1018
|
};
|
|
1084
1019
|
|
|
1085
1020
|
// src/lists.ts
|
|
1086
|
-
var
|
|
1021
|
+
var DEFAULT_API14 = "https://be.graph8.com";
|
|
1087
1022
|
var createListsClient = (apiKey, apiUrl) => {
|
|
1088
|
-
const baseUrl = apiUrl ||
|
|
1023
|
+
const baseUrl = apiUrl || DEFAULT_API14;
|
|
1089
1024
|
return {
|
|
1090
1025
|
/** List all lists. */
|
|
1091
1026
|
async list(page = 1, limit = 50) {
|
|
@@ -1125,9 +1060,9 @@ var createListsClient = (apiKey, apiUrl) => {
|
|
|
1125
1060
|
};
|
|
1126
1061
|
|
|
1127
1062
|
// src/notes.ts
|
|
1128
|
-
var
|
|
1063
|
+
var DEFAULT_API15 = "https://be.graph8.com";
|
|
1129
1064
|
var createNotesClient = (apiKey, apiUrl) => {
|
|
1130
|
-
const baseUrl = apiUrl ||
|
|
1065
|
+
const baseUrl = apiUrl || DEFAULT_API15;
|
|
1131
1066
|
return {
|
|
1132
1067
|
/** List all notes on a contact. */
|
|
1133
1068
|
async list(contactId) {
|
|
@@ -1157,9 +1092,9 @@ var createNotesClient = (apiKey, apiUrl) => {
|
|
|
1157
1092
|
};
|
|
1158
1093
|
|
|
1159
1094
|
// src/tasks.ts
|
|
1160
|
-
var
|
|
1095
|
+
var DEFAULT_API16 = "https://be.graph8.com";
|
|
1161
1096
|
var createTasksClient = (apiKey, apiUrl) => {
|
|
1162
|
-
const baseUrl = apiUrl ||
|
|
1097
|
+
const baseUrl = apiUrl || DEFAULT_API16;
|
|
1163
1098
|
return {
|
|
1164
1099
|
/** List tasks on a single contact. Optional status filter ("open" | "completed"). */
|
|
1165
1100
|
async listForContact(contactId, status) {
|
|
@@ -1195,9 +1130,9 @@ var createTasksClient = (apiKey, apiUrl) => {
|
|
|
1195
1130
|
};
|
|
1196
1131
|
|
|
1197
1132
|
// src/fields.ts
|
|
1198
|
-
var
|
|
1133
|
+
var DEFAULT_API17 = "https://be.graph8.com";
|
|
1199
1134
|
var createFieldsClient = (apiKey, apiUrl) => {
|
|
1200
|
-
const baseUrl = apiUrl ||
|
|
1135
|
+
const baseUrl = apiUrl || DEFAULT_API17;
|
|
1201
1136
|
return {
|
|
1202
1137
|
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
1203
1138
|
async listContactFields(listId) {
|
|
@@ -1239,9 +1174,9 @@ var createFieldsClient = (apiKey, apiUrl) => {
|
|
|
1239
1174
|
};
|
|
1240
1175
|
|
|
1241
1176
|
// src/deals.ts
|
|
1242
|
-
var
|
|
1177
|
+
var DEFAULT_API18 = "https://be.graph8.com";
|
|
1243
1178
|
var createDealsClient = (apiKey, apiUrl) => {
|
|
1244
|
-
const baseUrl = apiUrl ||
|
|
1179
|
+
const baseUrl = apiUrl || DEFAULT_API18;
|
|
1245
1180
|
return {
|
|
1246
1181
|
/** List all deal pipelines and their stages. */
|
|
1247
1182
|
async pipelines() {
|
|
@@ -1285,9 +1220,9 @@ var createDealsClient = (apiKey, apiUrl) => {
|
|
|
1285
1220
|
};
|
|
1286
1221
|
|
|
1287
1222
|
// src/inbox.ts
|
|
1288
|
-
var
|
|
1223
|
+
var DEFAULT_API19 = "https://be.graph8.com";
|
|
1289
1224
|
var createInboxClient = (apiKey, apiUrl) => {
|
|
1290
|
-
const baseUrl = apiUrl ||
|
|
1225
|
+
const baseUrl = apiUrl || DEFAULT_API19;
|
|
1291
1226
|
return {
|
|
1292
1227
|
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
1293
1228
|
async list(params = {}) {
|
|
@@ -1340,9 +1275,9 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1340
1275
|
};
|
|
1341
1276
|
|
|
1342
1277
|
// src/quotes.ts
|
|
1343
|
-
var
|
|
1278
|
+
var DEFAULT_API20 = "https://be.graph8.com";
|
|
1344
1279
|
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1345
|
-
const baseUrl = apiUrl ||
|
|
1280
|
+
const baseUrl = apiUrl || DEFAULT_API20;
|
|
1346
1281
|
return {
|
|
1347
1282
|
/** List quotes org-wide with optional filters and pagination. */
|
|
1348
1283
|
async list(params = {}) {
|
|
@@ -1414,9 +1349,9 @@ var createQuotesClient = (apiKey, apiUrl) => {
|
|
|
1414
1349
|
};
|
|
1415
1350
|
|
|
1416
1351
|
// src/pipelines.ts
|
|
1417
|
-
var
|
|
1352
|
+
var DEFAULT_API21 = "https://be.graph8.com";
|
|
1418
1353
|
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1419
|
-
const baseUrl = apiUrl ||
|
|
1354
|
+
const baseUrl = apiUrl || DEFAULT_API21;
|
|
1420
1355
|
return {
|
|
1421
1356
|
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1422
1357
|
async list() {
|
|
@@ -1498,9 +1433,9 @@ var createPipelinesClient = (apiKey, apiUrl) => {
|
|
|
1498
1433
|
};
|
|
1499
1434
|
|
|
1500
1435
|
// src/workflows.ts
|
|
1501
|
-
var
|
|
1436
|
+
var DEFAULT_API22 = "https://be.graph8.com";
|
|
1502
1437
|
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1503
|
-
const baseUrl = apiUrl ||
|
|
1438
|
+
const baseUrl = apiUrl || DEFAULT_API22;
|
|
1504
1439
|
return {
|
|
1505
1440
|
/** List workflows org-wide. */
|
|
1506
1441
|
async list(params = {}) {
|
|
@@ -1616,9 +1551,9 @@ var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
|
1616
1551
|
};
|
|
1617
1552
|
|
|
1618
1553
|
// src/skills.ts
|
|
1619
|
-
var
|
|
1554
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1620
1555
|
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1621
|
-
const baseUrl = apiUrl ||
|
|
1556
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1622
1557
|
return {
|
|
1623
1558
|
/** List skills. */
|
|
1624
1559
|
async list(params = {}) {
|
|
@@ -1705,9 +1640,9 @@ var createSkillsClient = (apiKey, apiUrl) => {
|
|
|
1705
1640
|
};
|
|
1706
1641
|
|
|
1707
1642
|
// src/intent.ts
|
|
1708
|
-
var
|
|
1643
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1709
1644
|
var createIntentClient = (apiKey, apiUrl) => {
|
|
1710
|
-
const baseUrl = apiUrl ||
|
|
1645
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1711
1646
|
const get = (path) => request(baseUrl, `/api/v1${path}`, apiKey);
|
|
1712
1647
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1713
1648
|
const del = (path) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "DELETE" });
|
|
@@ -1776,10 +1711,12 @@ var createIntentClient = (apiKey, apiUrl) => {
|
|
|
1776
1711
|
};
|
|
1777
1712
|
|
|
1778
1713
|
// src/studio.ts
|
|
1779
|
-
var
|
|
1714
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1780
1715
|
var createStudioClient = (apiKey, apiUrl) => {
|
|
1781
|
-
const baseUrl = apiUrl ||
|
|
1716
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1782
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 });
|
|
1783
1720
|
return {
|
|
1784
1721
|
/** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
|
|
1785
1722
|
* `include_content` defaults to true server-side, so each document includes
|
|
@@ -1802,14 +1739,38 @@ var createStudioClient = (apiKey, apiUrl) => {
|
|
|
1802
1739
|
/** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
|
|
1803
1740
|
async researchReports(params = {}) {
|
|
1804
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`);
|
|
1805
1766
|
}
|
|
1806
1767
|
};
|
|
1807
1768
|
};
|
|
1808
1769
|
|
|
1809
1770
|
// src/meetings.ts
|
|
1810
|
-
var
|
|
1771
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1811
1772
|
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
1812
|
-
const baseUrl = apiUrl ||
|
|
1773
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1813
1774
|
return {
|
|
1814
1775
|
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
1815
1776
|
async list(params = {}) {
|
|
@@ -1824,9 +1785,9 @@ var createMeetingsClient = (apiKey, apiUrl) => {
|
|
|
1824
1785
|
};
|
|
1825
1786
|
|
|
1826
1787
|
// src/audiences.ts
|
|
1827
|
-
var
|
|
1788
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1828
1789
|
var createAudiencesClient = (apiKey, apiUrl) => {
|
|
1829
|
-
const baseUrl = apiUrl ||
|
|
1790
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1830
1791
|
const base = "/api/v1/audience-syncs";
|
|
1831
1792
|
return {
|
|
1832
1793
|
/** List all audience syncs for the organization. */
|
|
@@ -1874,9 +1835,9 @@ var createAudiencesClient = (apiKey, apiUrl) => {
|
|
|
1874
1835
|
};
|
|
1875
1836
|
|
|
1876
1837
|
// src/search.ts
|
|
1877
|
-
var
|
|
1838
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1878
1839
|
var createSearchClient = (apiKey, apiUrl) => {
|
|
1879
|
-
const baseUrl = apiUrl ||
|
|
1840
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1880
1841
|
const body = (p) => ({ filters: [], page: 1, limit: 25, ...p });
|
|
1881
1842
|
return {
|
|
1882
1843
|
/** Search open-data contacts by filter. */
|
|
@@ -1907,9 +1868,9 @@ var createSearchClient = (apiKey, apiUrl) => {
|
|
|
1907
1868
|
};
|
|
1908
1869
|
|
|
1909
1870
|
// src/agency.ts
|
|
1910
|
-
var
|
|
1871
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
1911
1872
|
var createAgencyClient = (apiKey, apiUrl) => {
|
|
1912
|
-
const baseUrl = apiUrl ||
|
|
1873
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
1913
1874
|
return {
|
|
1914
1875
|
/** Describe the agency credential: agency org + authorized client count. */
|
|
1915
1876
|
async me() {
|
|
@@ -1924,9 +1885,9 @@ var createAgencyClient = (apiKey, apiUrl) => {
|
|
|
1924
1885
|
};
|
|
1925
1886
|
|
|
1926
1887
|
// src/marketplace.ts
|
|
1927
|
-
var
|
|
1888
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
1928
1889
|
var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
1929
|
-
const baseUrl = apiUrl ||
|
|
1890
|
+
const baseUrl = apiUrl || DEFAULT_API30;
|
|
1930
1891
|
const base = "/api/v1/marketplace";
|
|
1931
1892
|
return {
|
|
1932
1893
|
/** Your own marketplace SDR profile. */
|
|
@@ -1976,9 +1937,9 @@ var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
|
1976
1937
|
};
|
|
1977
1938
|
|
|
1978
1939
|
// src/snippet.ts
|
|
1979
|
-
var
|
|
1940
|
+
var DEFAULT_API31 = "https://be.graph8.com";
|
|
1980
1941
|
var createSnippetClient = (apiKey, apiUrl) => {
|
|
1981
|
-
const baseUrl = apiUrl ||
|
|
1942
|
+
const baseUrl = apiUrl || DEFAULT_API31;
|
|
1982
1943
|
return {
|
|
1983
1944
|
/** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
|
|
1984
1945
|
async get() {
|
|
@@ -1990,7 +1951,7 @@ var createSnippetClient = (apiKey, apiUrl) => {
|
|
|
1990
1951
|
|
|
1991
1952
|
// src/core.ts
|
|
1992
1953
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
1993
|
-
var
|
|
1954
|
+
var DEFAULT_API32 = "https://be.graph8.com";
|
|
1994
1955
|
var G8 = class {
|
|
1995
1956
|
constructor() {
|
|
1996
1957
|
/** @internal */
|
|
@@ -2014,16 +1975,10 @@ var G8 = class {
|
|
|
2014
1975
|
/** @internal */
|
|
2015
1976
|
this._campaigns = null;
|
|
2016
1977
|
/** @internal */
|
|
2017
|
-
this._integrations = null;
|
|
2018
|
-
/** @internal */
|
|
2019
1978
|
this._signals = null;
|
|
2020
1979
|
/** @internal */
|
|
2021
|
-
this._analytics = null;
|
|
2022
|
-
/** @internal */
|
|
2023
1980
|
this._voice = null;
|
|
2024
1981
|
/** @internal */
|
|
2025
|
-
this._pages = null;
|
|
2026
|
-
/** @internal */
|
|
2027
1982
|
this._webhooks = null;
|
|
2028
1983
|
/** @internal */
|
|
2029
1984
|
this._contacts = null;
|
|
@@ -2079,7 +2034,7 @@ var G8 = class {
|
|
|
2079
2034
|
debug: config.debug
|
|
2080
2035
|
});
|
|
2081
2036
|
}
|
|
2082
|
-
const apiUrl = config.apiUrl ||
|
|
2037
|
+
const apiUrl = config.apiUrl || DEFAULT_API32;
|
|
2083
2038
|
const writeKey = config.writeKey || "";
|
|
2084
2039
|
const apiKey = config.apiKey || "";
|
|
2085
2040
|
if (writeKey) {
|
|
@@ -2094,10 +2049,7 @@ var G8 = class {
|
|
|
2094
2049
|
this._enrich = createEnrichClient(apiKey, apiUrl);
|
|
2095
2050
|
this._sequences = createSequencesClient(apiKey, apiUrl);
|
|
2096
2051
|
this._campaigns = createCampaignsClient(apiKey, apiUrl);
|
|
2097
|
-
this._integrations = createIntegrationsClient(apiKey, apiUrl);
|
|
2098
|
-
this._analytics = createAnalyticsClient(apiKey, apiUrl);
|
|
2099
2052
|
this._voice = createVoiceClient(apiKey, apiUrl);
|
|
2100
|
-
this._pages = createPagesClient(apiKey, apiUrl);
|
|
2101
2053
|
this._webhooks = createWebhooksClient(apiKey, apiUrl);
|
|
2102
2054
|
this._contacts = createContactsClient(apiKey, apiUrl);
|
|
2103
2055
|
this._companies = createCompaniesClient(apiKey, apiUrl);
|
|
@@ -2180,31 +2132,16 @@ var G8 = class {
|
|
|
2180
2132
|
this._assertKey("campaigns");
|
|
2181
2133
|
return this._campaigns;
|
|
2182
2134
|
}
|
|
2183
|
-
/** CRM integrations (requires API key). */
|
|
2184
|
-
get integrations() {
|
|
2185
|
-
this._assertKey("integrations");
|
|
2186
|
-
return this._integrations;
|
|
2187
|
-
}
|
|
2188
2135
|
/** Intent signals. */
|
|
2189
2136
|
get signals() {
|
|
2190
2137
|
this._assertInit();
|
|
2191
2138
|
return this._signals;
|
|
2192
2139
|
}
|
|
2193
|
-
/** Analytics (requires API key). */
|
|
2194
|
-
get analytics() {
|
|
2195
|
-
this._assertKey("analytics");
|
|
2196
|
-
return this._analytics;
|
|
2197
|
-
}
|
|
2198
2140
|
/** Voice AI (requires API key). */
|
|
2199
2141
|
get voice() {
|
|
2200
2142
|
this._assertKey("voice");
|
|
2201
2143
|
return this._voice;
|
|
2202
2144
|
}
|
|
2203
|
-
/** Landing pages (requires API key). */
|
|
2204
|
-
get pages() {
|
|
2205
|
-
this._assertKey("pages");
|
|
2206
|
-
return this._pages;
|
|
2207
|
-
}
|
|
2208
2145
|
/** Webhook event listeners (requires API key). */
|
|
2209
2146
|
get webhooks() {
|
|
2210
2147
|
this._assertKey("webhooks");
|