@unboundcx/sdk 4.9.0 → 4.9.2
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/schemas/layouts/SCHEMA.md +316 -36
- package/schemas/layouts/section.js +17 -0
- package/services/chat.js +725 -226
- package/services/messaging/CampaignsService.js +27 -0
- package/services/objects.js +21 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TollFreeCampaignsService } from './TollFreeCampaignsService.js';
|
|
2
2
|
import { TenDlcCampaignsService } from './TenDlcCampaignsService.js';
|
|
3
|
+
import { internalRequest } from '../../base.js';
|
|
3
4
|
|
|
4
5
|
export class CampaignsService {
|
|
5
6
|
constructor(sdk) {
|
|
@@ -7,4 +8,30 @@ export class CampaignsService {
|
|
|
7
8
|
this.tollFree = new TollFreeCampaignsService(sdk);
|
|
8
9
|
this.tenDlc = new TenDlcCampaignsService(sdk);
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Fetch a privacy-policy URL and regex-check SMS disclosure language.
|
|
14
|
+
* Does not block registration — callers should warn, not fail.
|
|
15
|
+
* @param {Object} params
|
|
16
|
+
* @param {string} params.url
|
|
17
|
+
* @param {'privacy'|'optin'} [params.kind]
|
|
18
|
+
* @returns {Promise<Object>}
|
|
19
|
+
*/
|
|
20
|
+
async checkPrivacyPolicy({ url, kind }) {
|
|
21
|
+
this.sdk.validateParams(
|
|
22
|
+
{ url, kind },
|
|
23
|
+
{
|
|
24
|
+
url: { type: 'string', required: true },
|
|
25
|
+
kind: { type: 'string', required: false },
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
const body = { url };
|
|
29
|
+
if (kind) body.kind = kind;
|
|
30
|
+
return internalRequest(
|
|
31
|
+
this.sdk,
|
|
32
|
+
'/messaging/campaigns/privacy-check',
|
|
33
|
+
'POST',
|
|
34
|
+
{ body },
|
|
35
|
+
);
|
|
36
|
+
}
|
|
10
37
|
}
|
package/services/objects.js
CHANGED
|
@@ -1136,14 +1136,33 @@ export class ObjectsService {
|
|
|
1136
1136
|
/**
|
|
1137
1137
|
* Record activity feed for a single record.
|
|
1138
1138
|
* @param {string} recordId
|
|
1139
|
+
* @param {object} [options]
|
|
1140
|
+
* @param {string[]} [options.sources] - item kinds to include (see
|
|
1141
|
+
* TIMELINE_SOURCES in schemas/layouts/section.js); omit for all.
|
|
1142
|
+
* @param {number} [options.limit]
|
|
1139
1143
|
* @returns {Promise<{results: object[]}>}
|
|
1140
1144
|
*/
|
|
1141
|
-
async getActivity(recordId) {
|
|
1145
|
+
async getActivity(recordId, { sources, limit } = {}) {
|
|
1142
1146
|
this.sdk.validateParams(
|
|
1143
1147
|
{ recordId },
|
|
1144
1148
|
{ recordId: { type: 'string', required: true } },
|
|
1145
1149
|
);
|
|
1146
|
-
|
|
1150
|
+
// Repeated `sources=a&sources=b` keys, not `sources=a,b` — some
|
|
1151
|
+
// environments' ingress/WAF blocks literal/encoded commas in query
|
|
1152
|
+
// strings, so this is built by hand (bypassing internalRequest's
|
|
1153
|
+
// generic `query` object, which would join array values with `,` via
|
|
1154
|
+
// URLSearchParams) rather than the usual query param shape.
|
|
1155
|
+
const params = new URLSearchParams();
|
|
1156
|
+
if (Array.isArray(sources) && sources.length) {
|
|
1157
|
+
for (const source of sources) params.append('sources', source);
|
|
1158
|
+
}
|
|
1159
|
+
if (limit) params.append('limit', String(limit));
|
|
1160
|
+
const qs = params.toString();
|
|
1161
|
+
return internalRequest(
|
|
1162
|
+
this.sdk,
|
|
1163
|
+
`/object/${recordId}/activity${qs ? `?${qs}` : ''}`,
|
|
1164
|
+
'GET',
|
|
1165
|
+
);
|
|
1147
1166
|
}
|
|
1148
1167
|
|
|
1149
1168
|
/**
|