@pliancy/salesforce-cpq-sdk 2.0.0 → 3.0.0

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.
@@ -100,6 +100,17 @@ export type QuoteWithLineItems = Quote & {
100
100
  };
101
101
  export type UpdateQuoteLine = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>;
102
102
  export type UpdateQuoteLinesRequest = UpdateQuoteLine[];
103
- export type ApprovalStatus = 'Approved' | 'Rejected' | 'Pending' | 'Approval Not Required' | 'Required : Not Sent for Approval';
103
+ export declare enum ApprovalStatus {
104
+ APPROVED = "Approved",
105
+ REJECTED = "Rejected",
106
+ PENDING = "Pending",
107
+ REQUIRED = "Required : Not Sent for Approval",
108
+ NOT_REQUIRED = "Approval Not Required"
109
+ }
104
110
  export type QuoteQuery = QueryCondition<Schema, 'SBQQ__Quote__c'>;
105
111
  export type UpdateQuoteQuery = SObjectUpdateRecord<Schema, 'SBQQ__Quote__c'>;
112
+ export interface ApprovalProcessRequest {
113
+ success: boolean;
114
+ errors?: string[];
115
+ newWorkItemIds?: string[];
116
+ }
@@ -1,2 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApprovalStatus = void 0;
4
+ var ApprovalStatus;
5
+ (function (ApprovalStatus) {
6
+ ApprovalStatus["APPROVED"] = "Approved";
7
+ ApprovalStatus["REJECTED"] = "Rejected";
8
+ ApprovalStatus["PENDING"] = "Pending";
9
+ ApprovalStatus["REQUIRED"] = "Required : Not Sent for Approval";
10
+ ApprovalStatus["NOT_REQUIRED"] = "Approval Not Required";
11
+ })(ApprovalStatus || (exports.ApprovalStatus = ApprovalStatus = {}));
@@ -14,12 +14,12 @@ export declare class Quotes {
14
14
  order(quoteId: string, options?: UpdateQuoteQuery): Promise<SaveResult>;
15
15
  submitAndApprove(quoteId: string, comments?: string): Promise<{
16
16
  success: boolean;
17
- workItemId: any;
17
+ workItemId: string;
18
18
  errors?: undefined;
19
19
  error?: undefined;
20
20
  } | {
21
21
  success: boolean;
22
- errors: any;
22
+ errors: string[] | undefined;
23
23
  workItemId?: undefined;
24
24
  error?: undefined;
25
25
  } | {
@@ -73,8 +73,8 @@ class Quotes {
73
73
  const submission = (await approvalProcess.submit(quoteId, comments, {
74
74
  skipEntryCriteria: true,
75
75
  }));
76
- if (submission.success) {
77
- const workItemId = submission === null || submission === void 0 ? void 0 : submission.newWorkItemIds[0];
76
+ if ((submission === null || submission === void 0 ? void 0 : submission.newWorkItemIds) && (submission === null || submission === void 0 ? void 0 : submission.newWorkItemIds.length)) {
77
+ const workItemId = submission.newWorkItemIds[0];
78
78
  if (!workItemId)
79
79
  return { success: false, errors: ['No workItemId returned'] };
80
80
  await approvalProcess.approve(workItemId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pliancy/salesforce-cpq-sdk",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "description": "Salesforce CPQ SDK for Node.js",