@unboundcx/sdk 4.13.151 → 4.13.152

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/index.js CHANGED
@@ -20,6 +20,7 @@ import { ContentService } from './services/content.js';
20
20
  import { VerificationService } from './services/verification.js';
21
21
  import { PortalsService } from './services/portals.js';
22
22
  import { DealRegistrationsService } from './services/dealRegistrations.js';
23
+ import { DiscountApprovalsService } from './services/discountApprovals.js';
23
24
  import { SipEndpointsService } from './services/sipEndpoints.js';
24
25
  import { RingGroupsService } from './services/ringGroups.js';
25
26
  import { LineGroupsService } from './services/lineGroups.js';
@@ -133,6 +134,7 @@ class UnboundSDK extends BaseSDK {
133
134
  this.verification = new VerificationService(this);
134
135
  this.portals = new PortalsService(this);
135
136
  this.dealRegistrations = new DealRegistrationsService(this);
137
+ this.discountApprovals = new DiscountApprovalsService(this);
136
138
  this.sipEndpoints = new SipEndpointsService(this);
137
139
  this.ringGroups = new RingGroupsService(this);
138
140
  this.lineGroups = new LineGroupsService(this);
@@ -347,6 +349,7 @@ export {
347
349
  export { VerificationService } from './services/verification.js';
348
350
  export { PortalsService } from './services/portals.js';
349
351
  export { DealRegistrationsService } from './services/dealRegistrations.js';
352
+ export { DiscountApprovalsService } from './services/discountApprovals.js';
350
353
  export { SipEndpointsService } from './services/sipEndpoints.js';
351
354
  export { RingGroupsService } from './services/ringGroups.js';
352
355
  export { LineGroupsService } from './services/lineGroups.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.151",
3
+ "version": "4.13.152",
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",
@@ -0,0 +1,51 @@
1
+ import { internalRequest } from '../base.js';
2
+
3
+ /**
4
+ * opportunity-product-options-plan.md r18 §Routes & scopes decide route /
5
+ * §SDK ("DiscountApprovalsService.decide(id, {decision, decisionNote})
6
+ * ... built and published in P3"). Staff-only — endpoints live under
7
+ * `/discount-approvals/` (checkApiAuth), separate from the generic
8
+ * `discountApprovals` object (which is isCreateable=0/isEditable=0 and so
9
+ * has no CRUD surface through `sdk.objects.*` at all). The partner portal
10
+ * is NOT a consumer of this package — its equivalent discount-request/
11
+ * withdraw methods live in app1-customer-portals' own local
12
+ * `portalDeals.mixin.js`, never here.
13
+ */
14
+ export class DiscountApprovalsService {
15
+ constructor(sdk) {
16
+ this.sdk = sdk;
17
+ }
18
+
19
+ /**
20
+ * Approve, reject, or withdraw a pending discount-approval request.
21
+ * `deciderId` is never a parameter here — the server always uses the
22
+ * calling session's own authenticated user id (Invariant 9).
23
+ * @param {string} id - discountApprovals record id
24
+ * @param {Object} options
25
+ * @param {'approved'|'rejected'|'withdrawn'} options.decision
26
+ * @param {string} [options.decisionNote]
27
+ * @returns {Promise<Object>} { id, status, rollup }
28
+ */
29
+ async decide(id, { decision, decisionNote } = {}) {
30
+ this.sdk.validateParams(
31
+ { id, decision, decisionNote },
32
+ {
33
+ id: { type: 'string', required: true },
34
+ decision: { type: 'string', required: true },
35
+ decisionNote: { type: 'string', required: false },
36
+ },
37
+ );
38
+ if (!['approved', 'rejected', 'withdrawn'].includes(decision)) {
39
+ throw new Error(
40
+ "decision must be one of 'approved', 'rejected', 'withdrawn'",
41
+ );
42
+ }
43
+ const body = { decision };
44
+ if (decisionNote !== undefined) body.decisionNote = decisionNote;
45
+ return internalRequest(this.sdk, `/discount-approvals/${id}/decide`, 'POST', {
46
+ body,
47
+ });
48
+ }
49
+ }
50
+
51
+ export default DiscountApprovalsService;