@verdocs/js-sdk 3.0.14 → 3.0.16
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/Envelopes/Envelopes.js +1 -3
- package/Templates/TemplateDocuments.js +2 -6
- package/Utils/Files.d.ts +4 -0
- package/Utils/Files.js +17 -0
- package/Utils/Primitives.d.ts +9 -0
- package/Utils/Primitives.js +18 -0
- package/Utils/index.d.ts +1 -0
- package/Utils/index.js +1 -0
- package/VerdocsEndpoint.d.ts +3 -1
- package/VerdocsEndpoint.js +5 -3
- package/package.json +8 -8
package/Envelopes/Envelopes.js
CHANGED
|
@@ -191,9 +191,7 @@ export var userCanAct = function (email, recipientsWithActions) {
|
|
|
191
191
|
export var getEnvelopeFile = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
192
|
return __generator(this, function (_a) {
|
|
193
193
|
return [2 /*return*/, endpoint.api //
|
|
194
|
-
.get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "?file=true"), {
|
|
195
|
-
responseType: 'arraybuffer',
|
|
196
|
-
})
|
|
194
|
+
.get("/envelopes/".concat(envelopeId, "/envelope_documents/").concat(documentId, "?file=true"), { responseType: 'blob' })
|
|
197
195
|
.then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
|
|
198
196
|
});
|
|
199
197
|
}); };
|
|
@@ -112,9 +112,7 @@ export var deleteTemplateDocument = function (endpoint, templateId, documentId)
|
|
|
112
112
|
export var getTemplateDocumentFile = function (endpoint, templateId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
113
|
return __generator(this, function (_a) {
|
|
114
114
|
return [2 /*return*/, endpoint.api //
|
|
115
|
-
.get("/templates/".concat(templateId, "/documents/").concat(documentId, "?file=true"), {
|
|
116
|
-
responseType: 'arraybuffer',
|
|
117
|
-
})
|
|
115
|
+
.get("/templates/".concat(templateId, "/documents/").concat(documentId, "?file=true"), { responseType: 'blob' })
|
|
118
116
|
.then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
|
|
119
117
|
});
|
|
120
118
|
}); };
|
|
@@ -126,9 +124,7 @@ export var getTemplateDocumentFile = function (endpoint, templateId, documentId)
|
|
|
126
124
|
export var getTemplateDocumentThumbnail = function (endpoint, templateId, documentId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
127
125
|
return __generator(this, function (_a) {
|
|
128
126
|
return [2 /*return*/, endpoint.api //
|
|
129
|
-
.get("/templates/".concat(templateId, "/documents/").concat(documentId, "?thumbnail=true"), {
|
|
130
|
-
responseType: 'arraybuffer',
|
|
131
|
-
})
|
|
127
|
+
.get("/templates/".concat(templateId, "/documents/").concat(documentId, "?thumbnail=true"), { responseType: 'blob' })
|
|
132
128
|
.then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
|
|
133
129
|
});
|
|
134
130
|
}); };
|
package/Utils/Files.d.ts
CHANGED
|
@@ -10,3 +10,7 @@ export interface FileWithData {
|
|
|
10
10
|
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
11
11
|
*/
|
|
12
12
|
export declare const fileToDataUrl: (file: File) => Promise<FileWithData>;
|
|
13
|
+
/**
|
|
14
|
+
* Trigger a download dialog to save a blob as a file on disk.
|
|
15
|
+
*/
|
|
16
|
+
export declare const downloadBlob: (blob: Blob, name?: string) => void;
|
package/Utils/Files.js
CHANGED
|
@@ -23,3 +23,20 @@ export var fileToDataUrl = function (file) {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Trigger a download dialog to save a blob as a file on disk.
|
|
28
|
+
*/
|
|
29
|
+
export var downloadBlob = function (blob, name) {
|
|
30
|
+
if (name === void 0) { name = 'file.pdf'; }
|
|
31
|
+
var blobUrl = URL.createObjectURL(blob);
|
|
32
|
+
var link = document.createElement('a');
|
|
33
|
+
link.href = blobUrl;
|
|
34
|
+
link.download = name;
|
|
35
|
+
document.body.appendChild(link);
|
|
36
|
+
link.dispatchEvent(new MouseEvent('click', {
|
|
37
|
+
bubbles: true,
|
|
38
|
+
cancelable: true,
|
|
39
|
+
view: window,
|
|
40
|
+
}));
|
|
41
|
+
document.body.removeChild(link);
|
|
42
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an array containing a sequence of integers, e.g. [START, START+1, START+2, ...] This is frequently useful
|
|
3
|
+
* in rendering operations when there is no source array to .map() across.
|
|
4
|
+
*/
|
|
5
|
+
export declare const integerSequence: (start: number, count: number) => number[];
|
|
6
|
+
/**
|
|
7
|
+
* Generate suggested initials for a full name, e.g. "John Doe" will yield "JD".
|
|
8
|
+
*/
|
|
9
|
+
export declare const fullNameToInitials: (name: string) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an array containing a sequence of integers, e.g. [START, START+1, START+2, ...] This is frequently useful
|
|
3
|
+
* in rendering operations when there is no source array to .map() across.
|
|
4
|
+
*/
|
|
5
|
+
export var integerSequence = function (start, count) {
|
|
6
|
+
return Array(count)
|
|
7
|
+
.fill(1)
|
|
8
|
+
.map(function (_, index) { return index + start; });
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Generate suggested initials for a full name, e.g. "John Doe" will yield "JD".
|
|
12
|
+
*/
|
|
13
|
+
export var fullNameToInitials = function (name) {
|
|
14
|
+
return name
|
|
15
|
+
.split(' ')
|
|
16
|
+
.map(function (word) { return word[0]; })
|
|
17
|
+
.join('');
|
|
18
|
+
};
|
package/Utils/index.d.ts
CHANGED
package/Utils/index.js
CHANGED
package/VerdocsEndpoint.d.ts
CHANGED
|
@@ -133,7 +133,9 @@ export declare class VerdocsEndpoint {
|
|
|
133
133
|
*/
|
|
134
134
|
setClientID(clientID: string): VerdocsEndpoint;
|
|
135
135
|
/**
|
|
136
|
-
* Set the timeout for API calls in milliseconds.
|
|
136
|
+
* Set the timeout for API calls in milliseconds. 5000-20000ms is recommended for most purposes. 15000ms is the default.
|
|
137
|
+
* Note that some calls may involve rendering operations that require some time to complete, so very short timeouts
|
|
138
|
+
* are not recommended.
|
|
137
139
|
*
|
|
138
140
|
* ```typescript
|
|
139
141
|
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
package/VerdocsEndpoint.js
CHANGED
|
@@ -44,7 +44,7 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
44
44
|
this.sessionType = 'user';
|
|
45
45
|
this.baseURL = 'https://api.verdocs.com';
|
|
46
46
|
this.clientID = 'not-set';
|
|
47
|
-
this.timeout =
|
|
47
|
+
this.timeout = 15000;
|
|
48
48
|
this.token = null;
|
|
49
49
|
this.nextListenerId = 0;
|
|
50
50
|
this.sessionListeners = new Map();
|
|
@@ -56,7 +56,7 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
56
56
|
*/
|
|
57
57
|
this.session = null;
|
|
58
58
|
this.baseURL = (options === null || options === void 0 ? void 0 : options.baseURL) || 'https://api.verdocs.com';
|
|
59
|
-
this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) ||
|
|
59
|
+
this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 15000;
|
|
60
60
|
this.environment = (options === null || options === void 0 ? void 0 : options.environment) || 'verdocs';
|
|
61
61
|
this.sessionType = (options === null || options === void 0 ? void 0 : options.sessionType) || 'user';
|
|
62
62
|
this.clientID = (options === null || options === void 0 ? void 0 : options.clientID) || 'not-set';
|
|
@@ -172,7 +172,9 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
172
172
|
return this;
|
|
173
173
|
};
|
|
174
174
|
/**
|
|
175
|
-
* Set the timeout for API calls in milliseconds.
|
|
175
|
+
* Set the timeout for API calls in milliseconds. 5000-20000ms is recommended for most purposes. 15000ms is the default.
|
|
176
|
+
* Note that some calls may involve rendering operations that require some time to complete, so very short timeouts
|
|
177
|
+
* are not recommended.
|
|
176
178
|
*
|
|
177
179
|
* ```typescript
|
|
178
180
|
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdocs/js-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": "https://github.com/Verdocs/js-sdk",
|
|
6
6
|
"description": "Verdocs JS SDK",
|
|
@@ -46,21 +46,21 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"axios": "^1.2.
|
|
49
|
+
"axios": "^1.2.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"typescript": "^4.7.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@jest/globals": "^
|
|
56
|
-
"@types/jest": "^
|
|
55
|
+
"@jest/globals": "^29.3.1",
|
|
56
|
+
"@types/jest": "^29.2.6",
|
|
57
57
|
"axios-mock-adapter": "^1.21.2",
|
|
58
|
-
"jest": "^
|
|
59
|
-
"prettier": "^2.8.
|
|
60
|
-
"ts-jest": "^
|
|
58
|
+
"jest": "^29.3.1",
|
|
59
|
+
"prettier": "^2.8.3",
|
|
60
|
+
"ts-jest": "^29.0.5",
|
|
61
61
|
"tslint": "^6.1.3",
|
|
62
62
|
"tslint-config-prettier": "^1.18.0",
|
|
63
|
-
"typedoc": "^0.23.
|
|
63
|
+
"typedoc": "^0.23.24",
|
|
64
64
|
"typedoc-plugin-markdown": "^3.14.0",
|
|
65
65
|
"typescript": "^4.7.4"
|
|
66
66
|
}
|