@unboundcx/sdk 4.13.171 → 4.13.172
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/package.json +1 -1
- package/services/reportingMarketing.js +29 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.172",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { internalRequest } from
|
|
1
|
+
import { internalRequest } from "../base.js";
|
|
2
2
|
|
|
3
3
|
// Local helper, same as reporting.js / reportingSurveys.js (no shared util
|
|
4
4
|
// module between these files today).
|
|
5
5
|
function queryString(params = {}) {
|
|
6
6
|
const parts = [];
|
|
7
7
|
for (const [key, value] of Object.entries(params)) {
|
|
8
|
-
if (value === undefined || value === null || value ===
|
|
9
|
-
const v = Array.isArray(value) ? value.join(
|
|
8
|
+
if (value === undefined || value === null || value === "") continue;
|
|
9
|
+
const v = Array.isArray(value) ? value.join(",") : value;
|
|
10
10
|
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);
|
|
11
11
|
}
|
|
12
|
-
return parts.length ? `?${parts.join(
|
|
12
|
+
return parts.length ? `?${parts.join("&")}` : "";
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const RANGE_RULES = {
|
|
16
|
-
from: { type:
|
|
17
|
-
to: { type:
|
|
16
|
+
from: { type: "string", required: true },
|
|
17
|
+
to: { type: "string", required: true },
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
// marketing-reports-plan.md §5/§6 -- Marketing reports family
|
|
@@ -23,7 +23,8 @@ const RANGE_RULES = {
|
|
|
23
23
|
// task_router (on the Standard User allow list like reporting:surveys:read).
|
|
24
24
|
// Every method takes ISO `from`/`to` plus optional `timeZone` and the
|
|
25
25
|
// website filters (country, utmSource, utmMedium, utmCampaign, landingPage,
|
|
26
|
-
// page, device).
|
|
26
|
+
// page, device). List and summary responses never contain raw IPs.
|
|
27
|
+
// visitorDetail is the exception: the visitor-details modal.
|
|
27
28
|
export class ReportingMarketingService {
|
|
28
29
|
constructor(sdk) {
|
|
29
30
|
this.sdk = sdk;
|
|
@@ -35,7 +36,7 @@ export class ReportingMarketingService {
|
|
|
35
36
|
return internalRequest(
|
|
36
37
|
this.sdk,
|
|
37
38
|
`/reporting/marketing/${path}${queryString(params)}`,
|
|
38
|
-
|
|
39
|
+
"GET",
|
|
39
40
|
);
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -47,7 +48,7 @@ export class ReportingMarketingService {
|
|
|
47
48
|
* await sdk.reporting.marketing.website({ from, to, timeZone, country: 'US' });
|
|
48
49
|
*/
|
|
49
50
|
async website(params = {}) {
|
|
50
|
-
return this._get(
|
|
51
|
+
return this._get("website", params);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/**
|
|
@@ -55,7 +56,7 @@ export class ReportingMarketingService {
|
|
|
55
56
|
* @returns {Promise<Object>} { countries: [{ code, sessions, visitors, formFills }], cities: [...] }
|
|
56
57
|
*/
|
|
57
58
|
async websiteGeo(params = {}) {
|
|
58
|
-
return this._get(
|
|
59
|
+
return this._get("website/geo", params);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -64,7 +65,17 @@ export class ReportingMarketingService {
|
|
|
64
65
|
* @returns {Promise<Object>} { rows, nextCursor }
|
|
65
66
|
*/
|
|
66
67
|
async websiteSessions(params = {}) {
|
|
67
|
-
return this._get(
|
|
68
|
+
return this._get("website/sessions", params);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* One visitor in the report range: identity, each session (IP, provider,
|
|
73
|
+
* geo), and the events under those sessions.
|
|
74
|
+
* @param {Object} params - { from, to, visitor, timeZone? }
|
|
75
|
+
* @returns {Promise<Object>} { visitorKey, person, company, sessions, truncated }
|
|
76
|
+
*/
|
|
77
|
+
async visitorDetail(params = {}) {
|
|
78
|
+
return this._get("website/visitors", params);
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
/**
|
|
@@ -74,12 +85,12 @@ export class ReportingMarketingService {
|
|
|
74
85
|
async sessionEvents(sessionId) {
|
|
75
86
|
this.sdk.validateParams(
|
|
76
87
|
{ sessionId },
|
|
77
|
-
{ sessionId: { type:
|
|
88
|
+
{ sessionId: { type: "string", required: true } },
|
|
78
89
|
);
|
|
79
90
|
return internalRequest(
|
|
80
91
|
this.sdk,
|
|
81
92
|
`/reporting/marketing/website/sessions/${encodeURIComponent(sessionId)}/events`,
|
|
82
|
-
|
|
93
|
+
"GET",
|
|
83
94
|
);
|
|
84
95
|
}
|
|
85
96
|
|
|
@@ -88,7 +99,7 @@ export class ReportingMarketingService {
|
|
|
88
99
|
* @param {Object} params - range + { formId }
|
|
89
100
|
*/
|
|
90
101
|
async forms(params = {}) {
|
|
91
|
-
return this._get(
|
|
102
|
+
return this._get("forms", params);
|
|
92
103
|
}
|
|
93
104
|
|
|
94
105
|
/**
|
|
@@ -97,7 +108,7 @@ export class ReportingMarketingService {
|
|
|
97
108
|
* @returns {Promise<Object>} { rows, nextCursor }
|
|
98
109
|
*/
|
|
99
110
|
async formSubmissions(params = {}) {
|
|
100
|
-
return this._get(
|
|
111
|
+
return this._get("forms/submissions", params);
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
/**
|
|
@@ -106,14 +117,14 @@ export class ReportingMarketingService {
|
|
|
106
117
|
* @returns {Promise<Object>} { model, dimension, kpis, rows }
|
|
107
118
|
*/
|
|
108
119
|
async attribution(params = {}) {
|
|
109
|
-
return this._get(
|
|
120
|
+
return this._get("attribution", params);
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
/**
|
|
113
124
|
* Lead scoring summary (histogram, rules, trend, top people).
|
|
114
125
|
*/
|
|
115
126
|
async scoring(params = {}) {
|
|
116
|
-
return this._get(
|
|
127
|
+
return this._get("scoring", params);
|
|
117
128
|
}
|
|
118
129
|
|
|
119
130
|
/**
|
|
@@ -121,6 +132,6 @@ export class ReportingMarketingService {
|
|
|
121
132
|
* @param {Object} params - range + { journeyId }
|
|
122
133
|
*/
|
|
123
134
|
async engagement(params = {}) {
|
|
124
|
-
return this._get(
|
|
135
|
+
return this._get("engagement", params);
|
|
125
136
|
}
|
|
126
137
|
}
|