@verdocs/js-sdk 2.0.10 → 2.0.11
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/Documents/Documents.d.ts +21 -1
- package/Documents/Documents.js +30 -0
- package/package.json +1 -1
package/Documents/Documents.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface IDocumentsSearchResultEntry {
|
|
|
17
17
|
no_contact: boolean;
|
|
18
18
|
organization_id: string;
|
|
19
19
|
profile_id: string;
|
|
20
|
-
recipients:
|
|
20
|
+
recipients: IRecipient[];
|
|
21
21
|
reminder_id: string | null;
|
|
22
22
|
status: TDocumentStatus;
|
|
23
23
|
next_recipient: {
|
|
@@ -192,6 +192,26 @@ export declare const getDocumentRecipients: (endpoint: VerdocsEndpoint, document
|
|
|
192
192
|
* Get all metadata for a Document.
|
|
193
193
|
*/
|
|
194
194
|
export declare const getDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IDocument>;
|
|
195
|
+
/**
|
|
196
|
+
* Cancel a Document.
|
|
197
|
+
*/
|
|
198
|
+
export declare const cancelDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IDocument>;
|
|
199
|
+
/**
|
|
200
|
+
* Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
|
|
201
|
+
*/
|
|
202
|
+
export declare const recipientHasAction: (recipient: IRecipient) => boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
|
|
205
|
+
*/
|
|
206
|
+
export declare const getRecipientsWithActions: (document: IDocument) => IRecipient[];
|
|
207
|
+
/**
|
|
208
|
+
* Returns true if the recipient can act.
|
|
209
|
+
*/
|
|
210
|
+
export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IRecipient[]) => boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Returns true if the user can act.
|
|
213
|
+
*/
|
|
214
|
+
export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
|
|
195
215
|
/**
|
|
196
216
|
* Get (binary download) a file attached to a Document.
|
|
197
217
|
*/
|
package/Documents/Documents.js
CHANGED
|
@@ -104,6 +104,36 @@ export var getDocument = function (endpoint, documentId) { return __awaiter(void
|
|
|
104
104
|
.then(function (r) { return r.data; })];
|
|
105
105
|
});
|
|
106
106
|
}); };
|
|
107
|
+
/**
|
|
108
|
+
* Cancel a Document.
|
|
109
|
+
*/
|
|
110
|
+
export var cancelDocument = function (endpoint, documentId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
return [2 /*return*/, endpoint.api //
|
|
113
|
+
.put("/documents/".concat(documentId), { action: 'cancel' })
|
|
114
|
+
.then(function (r) { return r.data; })];
|
|
115
|
+
});
|
|
116
|
+
}); };
|
|
117
|
+
/**
|
|
118
|
+
* Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
|
|
119
|
+
*/
|
|
120
|
+
export var recipientHasAction = function (recipient) { return !['submitted', 'canceled', 'declined'].includes(recipient.status); };
|
|
121
|
+
/**
|
|
122
|
+
* Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
|
|
123
|
+
*/
|
|
124
|
+
export var getRecipientsWithActions = function (document) { return ((document === null || document === void 0 ? void 0 : document.recipients) || []).filter(recipientHasAction); };
|
|
125
|
+
/**
|
|
126
|
+
* Returns true if the recipient can act.
|
|
127
|
+
*/
|
|
128
|
+
export var recipientCanAct = function (recipient, recipientsWithActions) { var _a; return recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence); };
|
|
129
|
+
/**
|
|
130
|
+
* Returns true if the user can act.
|
|
131
|
+
*/
|
|
132
|
+
export var userCanAct = function (email, recipientsWithActions) {
|
|
133
|
+
var _a;
|
|
134
|
+
var recipient = recipientsWithActions.find(function (r) { return r.email === email; });
|
|
135
|
+
return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);
|
|
136
|
+
};
|
|
107
137
|
/**
|
|
108
138
|
* Get (binary download) a file attached to a Document.
|
|
109
139
|
*/
|