@verdocs/js-sdk 1.1.9 → 1.1.10
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 +4 -3
- package/Documents/Documents.js +10 -0
- package/Templates/Types.d.ts +7 -4
- package/Utils/Fields.d.ts +0 -1
- package/Utils/Fields.js +0 -38
- package/package.json +1 -1
package/Documents/Documents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISigningSession, ISigningSessionRequest } from './Types';
|
|
2
|
-
import {
|
|
2
|
+
import { IFieldSetting } from '../Templates/Types';
|
|
3
3
|
export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
|
|
4
4
|
export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
|
|
5
5
|
export declare type TRecipientType = 'signer' | 'cc' | 'approver';
|
|
@@ -81,8 +81,8 @@ export interface IDocumentField {
|
|
|
81
81
|
recipient_role: string;
|
|
82
82
|
type: string;
|
|
83
83
|
required: boolean;
|
|
84
|
-
settings?:
|
|
85
|
-
setting?:
|
|
84
|
+
settings?: IFieldSetting;
|
|
85
|
+
setting?: IFieldSetting;
|
|
86
86
|
validator: string | null;
|
|
87
87
|
prepared?: boolean;
|
|
88
88
|
}
|
|
@@ -176,3 +176,4 @@ export declare const getSigningSession: (params: ISigningSessionRequest) => Prom
|
|
|
176
176
|
export declare const getDocumentRecipients: (documentId: string) => Promise<IRecipient[]>;
|
|
177
177
|
export declare const getDocument: (documentId: string) => Promise<IDocument>;
|
|
178
178
|
export declare const getDocumentFile: (documentId: string, envelopeDocumentId: string) => Promise<string>;
|
|
179
|
+
export declare const updateDocumentField: (documentId: string, fieldName: string, value: any) => Promise<IFieldSetting>;
|
package/Documents/Documents.js
CHANGED
|
@@ -108,3 +108,13 @@ export var getDocumentFile = function (documentId, envelopeDocumentId) { return
|
|
|
108
108
|
.then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
|
|
109
109
|
});
|
|
110
110
|
}); };
|
|
111
|
+
// {"name":"textboxP2-0","recipient_role":"Recipient 1","envelope_id":"29b99d0b-8079-4e98-827c-28c375e5ecb7","page":2,"type":"textbox",
|
|
112
|
+
// "required":true,"settings":{"x":0,"y":772.0000000000001,"width":150,"height":15,"result":"Text 1","leading":0,"alignment":0,"upperCase":false},
|
|
113
|
+
// "validator":null,"label":null,"prepared":false}
|
|
114
|
+
export var updateDocumentField = function (documentId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
return [2 /*return*/, getEndpoint()
|
|
117
|
+
.api.put("/documents/".concat(documentId, "/fields/").concat(fieldName), value)
|
|
118
|
+
.then(function (r) { return r.data; })];
|
|
119
|
+
});
|
|
120
|
+
}); };
|
package/Templates/Types.d.ts
CHANGED
|
@@ -151,20 +151,23 @@ export interface ITemplateField {
|
|
|
151
151
|
template_id: string;
|
|
152
152
|
type: string;
|
|
153
153
|
required: boolean;
|
|
154
|
-
setting?:
|
|
154
|
+
setting?: IFieldSetting;
|
|
155
155
|
page_sequence: number;
|
|
156
156
|
validator?: string;
|
|
157
157
|
label?: string;
|
|
158
158
|
}
|
|
159
|
-
export interface
|
|
159
|
+
export interface IFieldSetting {
|
|
160
160
|
x?: number;
|
|
161
161
|
y?: number;
|
|
162
162
|
width?: number;
|
|
163
163
|
height?: number;
|
|
164
|
-
result?:
|
|
164
|
+
result?: any;
|
|
165
165
|
type?: string;
|
|
166
|
-
options?: any[];
|
|
167
166
|
value?: string;
|
|
167
|
+
leading?: number;
|
|
168
|
+
alignment?: number;
|
|
169
|
+
upperCase?: boolean;
|
|
170
|
+
options?: any[];
|
|
168
171
|
[key: string]: any;
|
|
169
172
|
}
|
|
170
173
|
export interface IPage {
|
package/Utils/Fields.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare function getWidth(field: IDocumentField): number;
|
|
|
4
4
|
export declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
5
5
|
export declare function getRLeft(x: number, ratio: number): number;
|
|
6
6
|
export declare function getRValue(y: number, ratio: number): number;
|
|
7
|
-
export declare function getStyle(field: IDocumentField): Record<string, string>;
|
|
8
7
|
export declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
9
8
|
export declare function getInputStyle(field: IDocumentField, mode: string, browserType: string): Record<string, string>;
|
|
10
9
|
export declare function getCheckboxLabelStyle(required: boolean): Record<string, any>;
|
package/Utils/Fields.js
CHANGED
|
@@ -43,44 +43,6 @@ export function getRLeft(x, ratio) {
|
|
|
43
43
|
export function getRValue(y, ratio) {
|
|
44
44
|
return y * ratio;
|
|
45
45
|
}
|
|
46
|
-
export function getStyle(field) {
|
|
47
|
-
var settings = field.settings || field.setting || {};
|
|
48
|
-
var height = getHeight(field);
|
|
49
|
-
var style = {
|
|
50
|
-
left: ((settings === null || settings === void 0 ? void 0 : settings.x) || 0) + 'px',
|
|
51
|
-
bottom: ((settings === null || settings === void 0 ? void 0 : settings.y) || 0) + 'px',
|
|
52
|
-
height: '100%',
|
|
53
|
-
width: '100%',
|
|
54
|
-
};
|
|
55
|
-
switch (field.type) {
|
|
56
|
-
case 'textbox':
|
|
57
|
-
case 'date':
|
|
58
|
-
case 'timestamp':
|
|
59
|
-
case 'placeholder':
|
|
60
|
-
case 'dropdown':
|
|
61
|
-
style.maxHeight = height + 'px';
|
|
62
|
-
style.maxWidth = ((settings === null || settings === void 0 ? void 0 : settings.width) || 0) + 'px';
|
|
63
|
-
break;
|
|
64
|
-
case 'checkbox':
|
|
65
|
-
case 'checkbox_group':
|
|
66
|
-
case 'radio_button_group':
|
|
67
|
-
style.maxHeight = 13.5 + 'px';
|
|
68
|
-
style.maxWidth = 13.5 + 'px';
|
|
69
|
-
break;
|
|
70
|
-
case 'attachment':
|
|
71
|
-
case 'payment':
|
|
72
|
-
style.maxHeight = 24 + 'px';
|
|
73
|
-
style.maxWidth = 24 + 'px';
|
|
74
|
-
break;
|
|
75
|
-
case 'signature':
|
|
76
|
-
case 'initial':
|
|
77
|
-
style.maxHeight = 36 + 'px';
|
|
78
|
-
style.maxWidth = 82.63636363636 + 'px';
|
|
79
|
-
style['line-height'] = 36 + 'px';
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
return style;
|
|
83
|
-
}
|
|
84
46
|
export function blobToBase64(image) {
|
|
85
47
|
var fileReader = new FileReader();
|
|
86
48
|
return new Promise(function (resolve, reject) {
|