@unboundcx/sdk 4.13.176 → 4.13.178

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.176",
3
+ "version": "4.13.178",
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",
package/services/esign.js CHANGED
@@ -165,6 +165,30 @@ export class EsignPublicService {
165
165
  true,
166
166
  );
167
167
  }
168
+
169
+ /**
170
+ * Record that this signer downloaded or printed the document.
171
+ * @param {Object} params
172
+ * @param {string} params.token
173
+ * @param {string} params.action downloaded or printed
174
+ * @returns {Promise<Object>}
175
+ */
176
+ async activity({ token, action }) {
177
+ this.sdk.validateParams(
178
+ { token, action },
179
+ {
180
+ token: { type: 'string', required: true },
181
+ action: { type: 'string', required: true },
182
+ },
183
+ );
184
+ return internalRequest(
185
+ this.sdk,
186
+ `/esign/public/${token}/activity`,
187
+ 'POST',
188
+ { body: { action } },
189
+ true,
190
+ );
191
+ }
168
192
  }
169
193
 
170
194
  /**
@@ -189,6 +213,7 @@ export class EsignService {
189
213
  * @param {boolean} [body.allowDrawn]
190
214
  * @param {string} [body.postSignRedirectUrl]
191
215
  * @param {string[]} [body.feedNotifyEvents] - Subset of `sent`|`opened`|`signed`; auto-posts a chat card to every linked record's feed on each selected event.
216
+ * @param {number} [body.reminderIntervalHours] - `0` off. Any whole number of hours. The first reminder must land before `expiresAt`. Stored only; no sender yet.
192
217
  * @returns {Promise<Object>}
193
218
  */
194
219
  async createPackage({
@@ -201,6 +226,7 @@ export class EsignService {
201
226
  allowDrawn,
202
227
  postSignRedirectUrl,
203
228
  feedNotifyEvents,
229
+ reminderIntervalHours,
204
230
  } = {}) {
205
231
  this.sdk.validateParams(
206
232
  { generatedDocumentId, name, recipients },
@@ -214,6 +240,7 @@ export class EsignService {
214
240
  allowDrawn: { type: 'boolean', required: false },
215
241
  postSignRedirectUrl: { type: 'string', required: false },
216
242
  feedNotifyEvents: { type: 'array', required: false },
243
+ reminderIntervalHours: { type: 'number', required: false },
217
244
  },
218
245
  );
219
246
 
@@ -228,6 +255,9 @@ export class EsignService {
228
255
  if (feedNotifyEvents !== undefined) {
229
256
  body.feedNotifyEvents = feedNotifyEvents;
230
257
  }
258
+ if (reminderIntervalHours !== undefined) {
259
+ body.reminderIntervalHours = reminderIntervalHours;
260
+ }
231
261
 
232
262
  return internalRequest(this.sdk, '/esign/packages', 'POST', { body });
233
263
  }
@@ -239,14 +269,37 @@ export class EsignService {
239
269
  * @param {string} [query.recordId] - Requires `objectName`
240
270
  * @param {string} [query.objectName] - Requires `recordId`
241
271
  * @param {string} [query.status]
272
+ * @param {string} [query.statusGroup] - `open` is sent + in_progress
273
+ * @param {string} [query.createdBy]
274
+ * @param {string} [query.sentFrom]
275
+ * @param {string} [query.sentTo]
276
+ * @param {string} [query.q] - agreement name contains
277
+ * @param {boolean} [query.includeSigners] - explicit; omit on the limit:1 probe
242
278
  * @param {number} [query.limit]
243
279
  * @returns {Promise<{results: Object[]}>}
244
280
  */
245
- async listPackages({ recordId, objectName, status, limit } = {}) {
281
+ async listPackages({
282
+ recordId,
283
+ objectName,
284
+ status,
285
+ statusGroup,
286
+ createdBy,
287
+ sentFrom,
288
+ sentTo,
289
+ q,
290
+ includeSigners,
291
+ limit,
292
+ } = {}) {
246
293
  const query = {};
247
294
  if (recordId) query.recordId = recordId;
248
295
  if (objectName) query.objectName = objectName;
249
296
  if (status) query.status = status;
297
+ if (statusGroup) query.statusGroup = statusGroup;
298
+ if (createdBy) query.createdBy = createdBy;
299
+ if (sentFrom) query.sentFrom = sentFrom;
300
+ if (sentTo) query.sentTo = sentTo;
301
+ if (q) query.q = q;
302
+ if (includeSigners) query.includeSigners = '1';
250
303
  if (limit) query.limit = limit;
251
304
  return internalRequest(this.sdk, '/esign/packages', 'GET', { query });
252
305
  }
@@ -273,6 +326,7 @@ export class EsignService {
273
326
  * @param {boolean} [body.allowDrawn]
274
327
  * @param {string} [body.postSignRedirectUrl]
275
328
  * @param {string[]} [body.feedNotifyEvents] - Subset of `sent`|`opened`|`signed`; auto-posts a chat card to every linked record's feed on each selected event.
329
+ * @param {number} [body.reminderIntervalHours] - `0` off. Any whole number of hours. The first reminder must land before `expiresAt`. Stored only; no sender yet.
276
330
  * @returns {Promise<Object>}
277
331
  */
278
332
  async updatePackage(
@@ -286,6 +340,7 @@ export class EsignService {
286
340
  allowDrawn,
287
341
  postSignRedirectUrl,
288
342
  feedNotifyEvents,
343
+ reminderIntervalHours,
289
344
  } = {},
290
345
  ) {
291
346
  this.sdk.validateParams(
@@ -300,6 +355,7 @@ export class EsignService {
300
355
  allowDrawn: { type: 'boolean', required: false },
301
356
  postSignRedirectUrl: { type: 'string', required: false },
302
357
  feedNotifyEvents: { type: 'array', required: false },
358
+ reminderIntervalHours: { type: 'number', required: false },
303
359
  },
304
360
  );
305
361
 
@@ -316,6 +372,9 @@ export class EsignService {
316
372
  if (feedNotifyEvents !== undefined) {
317
373
  body.feedNotifyEvents = feedNotifyEvents;
318
374
  }
375
+ if (reminderIntervalHours !== undefined) {
376
+ body.reminderIntervalHours = reminderIntervalHours;
377
+ }
319
378
 
320
379
  return internalRequest(this.sdk, `/esign/packages/${id}`, 'PATCH', {
321
380
  body,
@@ -6,6 +6,7 @@ import { EmailAnalyticsService } from './EmailAnalyticsService.js';
6
6
  import { EmailQueueService } from './EmailQueueService.js';
7
7
  import { EmailSuppressionService } from './EmailSuppressionService.js';
8
8
  import { EmailAccountSettingsService } from './EmailAccountSettingsService.js';
9
+ import { EmailSignaturesService } from './EmailSignaturesService.js';
9
10
 
10
11
  import { internalRequest } from '../../base.js';
11
12
  export class EmailService {
@@ -20,6 +21,7 @@ export class EmailService {
20
21
  this.suppression = new EmailSuppressionService(sdk);
21
22
  // Account-level email settings (plan §3.3).
22
23
  this.settings = new EmailAccountSettingsService(sdk);
24
+ this.signatures = new EmailSignaturesService(sdk);
23
25
  }
24
26
 
25
27
  /**
@@ -0,0 +1,275 @@
1
+ import { internalRequest } from '../../base.js';
2
+
3
+ /**
4
+ * Mail-app email signatures. Exposed as `sdk.messaging.email.signatures`.
5
+ */
6
+ export class EmailSignaturesService {
7
+ constructor(sdk) {
8
+ this.sdk = sdk;
9
+ this.me = new EmailSignatureMeService(sdk);
10
+ this.templates = new EmailSignatureTemplatesService(sdk);
11
+ this.groups = new EmailSignatureGroupsService(sdk);
12
+ }
13
+
14
+ /**
15
+ * Merge fields the signature editor can insert.
16
+ * @returns {Promise<Object>} { fields }
17
+ * @example
18
+ * const { fields } = await sdk.messaging.email.signatures.fields();
19
+ */
20
+ async fields() {
21
+ return internalRequest(this.sdk, '/messaging/email/signatures/fields', 'GET');
22
+ }
23
+
24
+ /**
25
+ * Render a signature for a user.
26
+ * @param {Object} params
27
+ * @param {string} params.html - Signature HTML, including merge tags
28
+ * @param {string} [params.userId] - User to render. Defaults to the caller.
29
+ * @returns {Promise<Object>} { html }
30
+ * @example
31
+ * const { html } = await sdk.messaging.email.signatures.preview({
32
+ * html: 'Hello {{firstName}}',
33
+ * });
34
+ */
35
+ async preview({ html, userId } = {}) {
36
+ this.sdk.validateParams(
37
+ { html, userId },
38
+ {
39
+ html: { type: 'string', required: true },
40
+ userId: { type: 'string', required: false },
41
+ },
42
+ );
43
+ const body = { html };
44
+ if (userId !== undefined) body.userId = userId;
45
+ return internalRequest(this.sdk, '/messaging/email/signatures/preview', 'POST', {
46
+ body,
47
+ });
48
+ }
49
+ }
50
+
51
+ class EmailSignatureMeService {
52
+ constructor(sdk) {
53
+ this.sdk = sdk;
54
+ }
55
+
56
+ /**
57
+ * The caller's effective signature, including shared and forced options.
58
+ * @returns {Promise<Object>}
59
+ * @example
60
+ * const me = await sdk.messaging.email.signatures.me.get();
61
+ */
62
+ async get() {
63
+ return internalRequest(this.sdk, '/messaging/email/signatures/me', 'GET');
64
+ }
65
+
66
+ /**
67
+ * Save the caller's signature choice. Personal html is ignored unless the
68
+ * active option is their own signature.
69
+ * @param {Object} body
70
+ * @param {string} [body.activeId] - `personal` or a shared template id
71
+ * @param {string} [body.html] - Personal signature HTML
72
+ * @param {boolean} [body.addOnNew]
73
+ * @param {boolean} [body.addOnReply]
74
+ * @returns {Promise<Object>}
75
+ * @example
76
+ * await sdk.messaging.email.signatures.me.update({
77
+ * activeId: 'personal',
78
+ * html: '<p>{{fullName__g}}</p>',
79
+ * addOnNew: true,
80
+ * addOnReply: true,
81
+ * });
82
+ */
83
+ async update(body = {}) {
84
+ return internalRequest(this.sdk, '/messaging/email/signatures/me', 'PUT', {
85
+ body,
86
+ });
87
+ }
88
+
89
+ /**
90
+ * Copy a shared signature onto the caller so they can edit it.
91
+ * @param {string} templateId
92
+ * @returns {Promise<Object>}
93
+ * @example
94
+ * await sdk.messaging.email.signatures.me.copy('351...');
95
+ */
96
+ async copy(templateId) {
97
+ this.sdk.validateParams(
98
+ { templateId },
99
+ { templateId: { type: 'string', required: true } },
100
+ );
101
+ return internalRequest(this.sdk, '/messaging/email/signatures/me/copy', 'POST', {
102
+ body: { templateId },
103
+ });
104
+ }
105
+ }
106
+
107
+ class EmailSignatureTemplatesService {
108
+ constructor(sdk) {
109
+ this.sdk = sdk;
110
+ }
111
+
112
+ /**
113
+ * List account signature templates and their assignments.
114
+ * @returns {Promise<Object>} { templates }
115
+ * @example
116
+ * const { templates } = await sdk.messaging.email.signatures.templates.list();
117
+ */
118
+ async list() {
119
+ return internalRequest(
120
+ this.sdk,
121
+ '/messaging/email/signatures/templates',
122
+ 'GET',
123
+ );
124
+ }
125
+
126
+ /**
127
+ * Create an account signature template.
128
+ * @param {Object} body
129
+ * @param {string} body.name
130
+ * @param {string} [body.html]
131
+ * @param {number} [body.priority]
132
+ * @returns {Promise<Object>}
133
+ * @example
134
+ * await sdk.messaging.email.signatures.templates.create({
135
+ * name: 'Standard',
136
+ * html: '<p>{{fullName__g}}</p>',
137
+ * priority: 0,
138
+ * });
139
+ */
140
+ async create(body = {}) {
141
+ this.sdk.validateParams(
142
+ { name: body.name },
143
+ { name: { type: 'string', required: true } },
144
+ );
145
+ return internalRequest(
146
+ this.sdk,
147
+ '/messaging/email/signatures/templates',
148
+ 'POST',
149
+ { body },
150
+ );
151
+ }
152
+
153
+ /**
154
+ * Update an account signature template.
155
+ * @param {string} id
156
+ * @param {Object} body
157
+ * @returns {Promise<Object>}
158
+ * @example
159
+ * await sdk.messaging.email.signatures.templates.update('351...', {
160
+ * name: 'Standard',
161
+ * html: '<p>{{fullName__g}}</p>',
162
+ * });
163
+ */
164
+ async update(id, body = {}) {
165
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
166
+ return internalRequest(
167
+ this.sdk,
168
+ `/messaging/email/signatures/templates/${id}`,
169
+ 'PUT',
170
+ { body },
171
+ );
172
+ }
173
+
174
+ /**
175
+ * Delete an account signature template.
176
+ * @param {string} id
177
+ * @returns {Promise<Object>}
178
+ * @example
179
+ * await sdk.messaging.email.signatures.templates.delete('351...');
180
+ */
181
+ async delete(id) {
182
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
183
+ return internalRequest(
184
+ this.sdk,
185
+ `/messaging/email/signatures/templates/${id}`,
186
+ 'DELETE',
187
+ );
188
+ }
189
+
190
+ /**
191
+ * Assign a template to a user or group as shared or forced.
192
+ * @param {string} id - Template id
193
+ * @param {Object} body
194
+ * @param {string} body.principalType - `user` or `group`
195
+ * @param {string} body.principalId
196
+ * @param {string} body.mode - `shared` or `forced`
197
+ * @returns {Promise<Object>}
198
+ * @example
199
+ * await sdk.messaging.email.signatures.templates.assign('351...', {
200
+ * principalType: 'user',
201
+ * principalId: '002...',
202
+ * mode: 'shared',
203
+ * });
204
+ */
205
+ async assign(id, body = {}) {
206
+ this.sdk.validateParams(
207
+ { id, ...body },
208
+ {
209
+ id: { type: 'string', required: true },
210
+ principalType: { type: 'string', required: true },
211
+ principalId: { type: 'string', required: true },
212
+ mode: { type: 'string', required: true },
213
+ },
214
+ );
215
+ return internalRequest(
216
+ this.sdk,
217
+ `/messaging/email/signatures/templates/${id}/assignments`,
218
+ 'POST',
219
+ { body },
220
+ );
221
+ }
222
+
223
+ /**
224
+ * Remove one assignment from a template.
225
+ * @param {string} templateId
226
+ * @param {string} assignmentId
227
+ * @returns {Promise<Object>}
228
+ * @example
229
+ * await sdk.messaging.email.signatures.templates.unassign('351...', '352...');
230
+ */
231
+ async unassign(templateId, assignmentId) {
232
+ this.sdk.validateParams(
233
+ { templateId, assignmentId },
234
+ {
235
+ templateId: { type: 'string', required: true },
236
+ assignmentId: { type: 'string', required: true },
237
+ },
238
+ );
239
+ return internalRequest(
240
+ this.sdk,
241
+ `/messaging/email/signatures/templates/${templateId}/assignments/${assignmentId}`,
242
+ 'DELETE',
243
+ );
244
+ }
245
+ }
246
+
247
+ class EmailSignatureGroupsService {
248
+ constructor(sdk) {
249
+ this.sdk = sdk;
250
+ }
251
+
252
+ /**
253
+ * Search groups for signature assignment. Returns at most 20 name matches,
254
+ * or the named ids. An empty query returns no rows.
255
+ * @param {Object} [params]
256
+ * @param {string} [params.q]
257
+ * @param {string[]} [params.ids]
258
+ * @returns {Promise<Object>} { results }
259
+ * @example
260
+ * const { results } = await sdk.messaging.email.signatures.groups.search({
261
+ * q: 'support',
262
+ * });
263
+ */
264
+ async search({ q, ids } = {}) {
265
+ const params = new URLSearchParams();
266
+ if (q) params.set('q', q);
267
+ if (ids?.length) params.set('ids', ids.join(','));
268
+ const query = params.toString();
269
+ return internalRequest(
270
+ this.sdk,
271
+ `/messaging/email/signatures/groups${query ? `?${query}` : ''}`,
272
+ 'GET',
273
+ );
274
+ }
275
+ }