@unboundcx/sdk 4.13.52 → 4.13.53

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.52",
3
+ "version": "4.13.53",
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",
@@ -89,6 +89,7 @@ export class TaskService {
89
89
  aiChatSessionId,
90
90
  parentTaskId,
91
91
  preferredWorkerId,
92
+ isRoutable,
92
93
  metadata,
93
94
  source,
94
95
  } = options;
@@ -112,6 +113,7 @@ export class TaskService {
112
113
  aiChatSessionId,
113
114
  parentTaskId,
114
115
  preferredWorkerId,
116
+ isRoutable,
115
117
  metadata,
116
118
  source,
117
119
  },
@@ -133,6 +135,7 @@ export class TaskService {
133
135
  aiChatSessionId: { type: 'string', required: false },
134
136
  parentTaskId: { type: 'string', required: false },
135
137
  preferredWorkerId: { type: 'string', required: false },
138
+ isRoutable: { type: 'boolean', required: false },
136
139
  metadata: { type: 'object', required: false },
137
140
  source: { type: 'string', required: false },
138
141
  },
@@ -205,6 +208,10 @@ export class TaskService {
205
208
  params.body.preferredWorkerId = preferredWorkerId;
206
209
  }
207
210
 
211
+ if (isRoutable !== undefined) {
212
+ params.body.isRoutable = isRoutable;
213
+ }
214
+
208
215
  if (metadata !== undefined) {
209
216
  params.body.metadata = metadata;
210
217
  }
@@ -468,44 +475,53 @@ export class TaskService {
468
475
  }
469
476
 
470
477
  /**
471
- * Toggle task hold status
478
+ * Toggle or set task hold status
472
479
  * Place a connected task on hold or resume a held task.
473
- * If the task is currently 'connected', it will be set to 'hold'.
474
- * If the task is currently 'hold', it will be set back to 'connected'.
480
+ * If `held` is omitted, the current status is toggled: 'connected' -> 'hold'
481
+ * and 'hold' -> 'connected'. If `held` is a boolean, it explicitly sets the
482
+ * target status: `true` -> 'hold', `false` -> 'connected'.
475
483
  *
476
484
  * @param {Object} options - Parameters
477
485
  * @param {string} options.taskId - The task ID to hold/resume (required)
486
+ * @param {boolean} [options.held] - Explicit target hold state; omit for legacy toggle behavior
478
487
  * @returns {Promise<Object>} Object containing the task ID and new status
479
488
  * @returns {string} result.taskId - The task ID that was modified
480
489
  * @returns {string} result.status - The new status ('hold' or 'connected')
490
+ * @returns {boolean} result.changed - Whether the status actually changed
481
491
  *
482
492
  * @example
483
493
  * // Put a connected task on hold
484
- * const result = await sdk.taskRouter.task.hold({ taskId: 'task123' });
494
+ * const result = await sdk.taskRouter.task.hold({ taskId: 'task123', held: true });
485
495
  * console.log(result.status); // "hold"
486
496
  *
487
497
  * @example
488
498
  * // Resume a held task
489
- * const result = await sdk.taskRouter.task.hold({ taskId: 'task123' });
499
+ * const result = await sdk.taskRouter.task.hold({ taskId: 'task123', held: false });
490
500
  * console.log(result.status); // "connected"
501
+ *
502
+ * @example
503
+ * // Legacy toggle (no `held`)
504
+ * const result = await sdk.taskRouter.task.hold({ taskId: 'task123' });
491
505
  */
492
506
  async hold(options = {}) {
493
- const { taskId } = options;
507
+ const { taskId, held } = options;
494
508
 
495
509
  this.sdk.validateParams(
496
- { taskId },
510
+ { taskId, held },
497
511
  {
498
512
  taskId: { type: 'string', required: true },
513
+ held: { type: 'boolean', required: false },
499
514
  },
500
515
  );
501
516
 
502
517
  const params = {
503
518
  body: {
504
519
  taskId,
520
+ ...(typeof held === 'boolean' && { held }),
505
521
  },
506
522
  };
507
523
 
508
- const result = await internalRequest(this.sdk,
524
+ const result = await internalRequest(this.sdk,
509
525
  '/taskRouter/tasks/hold',
510
526
  'PUT',
511
527
  params,
@@ -904,6 +920,35 @@ export class TaskService {
904
920
  );
905
921
  }
906
922
 
923
+ /**
924
+ * Resume a parked task ("customer is back"). Flips the task back to
925
+ * pending so the distributor re-offers it; preferredWorkerId (stamped by
926
+ * park) is left alone so the parking worker gets first refusal.
927
+ *
928
+ * PUT /taskRouter/tasks/unpark
929
+ *
930
+ * @param {Object} options - Parameters
931
+ * @param {string} options.taskId - The parked task ID (required)
932
+ * @returns {Promise<Object>} { taskId, status: 'pending' }
933
+ */
934
+ async unpark(options = {}) {
935
+ const { taskId } = options;
936
+
937
+ this.sdk.validateParams(
938
+ { taskId },
939
+ { taskId: { type: 'string', required: true } },
940
+ );
941
+
942
+ const params = { body: { taskId } };
943
+
944
+ return await internalRequest(
945
+ this.sdk,
946
+ '/taskRouter/tasks/unpark',
947
+ 'PUT',
948
+ params,
949
+ );
950
+ }
951
+
907
952
  /**
908
953
  * Public reply on a ticket task: writes the customer-visible post and
909
954
  * emails requester + CCs (transactional) from the queue mailbox.