@verdocs/js-sdk 1.1.12 → 1.1.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.
@@ -177,3 +177,4 @@ export declare const getDocumentRecipients: (documentId: string) => Promise<IRec
177
177
  export declare const getDocument: (documentId: string) => Promise<IDocument>;
178
178
  export declare const getDocumentFile: (documentId: string, envelopeDocumentId: string) => Promise<string>;
179
179
  export declare const updateDocumentField: (documentId: string, fieldName: string, value: any) => Promise<IFieldSetting>;
180
+ export declare const updateDocumentFieldSignature: (documentId: string, fieldName: string, signatureId: string) => Promise<IFieldSetting>;
@@ -115,3 +115,10 @@ export var updateDocumentField = function (documentId, fieldName, value) { retur
115
115
  .then(function (r) { return r.data; })];
116
116
  });
117
117
  }); };
118
+ export var updateDocumentFieldSignature = function (documentId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {
119
+ return __generator(this, function (_a) {
120
+ return [2 /*return*/, getEndpoint()
121
+ .api.put("/documents/".concat(documentId, "/fields/").concat(fieldName, "/signature/").concat(signatureId))
122
+ .then(function (r) { return r.data; })];
123
+ });
124
+ }); };
@@ -2,8 +2,8 @@ export interface IInitials {
2
2
  id?: string;
3
3
  profile_id: string;
4
4
  url: string;
5
- created_at?: Date;
6
- updated_at?: Date;
5
+ created_at?: string;
6
+ updated_at?: string;
7
7
  }
8
8
  /**
9
9
  * Create an initials block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
@@ -1,9 +1,10 @@
1
1
  export interface ISignature {
2
- id?: string;
2
+ id: string;
3
3
  profile_id: string;
4
4
  url: string;
5
- created_at?: Date;
6
- updated_at?: Date;
5
+ deleted: boolean;
6
+ created_at: string;
7
+ updated_at: string;
7
8
  }
8
9
  /**
9
10
  * Create a signature block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
@@ -5,12 +5,12 @@ export interface IOrganization {
5
5
  /** The organization's name. */
6
6
  name: string;
7
7
  address: string | null;
8
+ address2: string | null;
8
9
  phone: string | null;
9
- /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
10
- business_name: string | null;
11
10
  /** If true, the organization is a business */
12
11
  is_business: boolean;
13
- address2: string | null;
12
+ /** If the organization is a business, its name. Note that a business name can be different from an organization name. */
13
+ business_name: string | null;
14
14
  contact_email: string | null;
15
15
  timezone: string | null;
16
16
  envelope_responsible: boolean;
@@ -1,3 +1,4 @@
1
+ import { IOrganization } from '../Organizations/Types';
1
2
  export interface ITemplate {
2
3
  template_document?: ITemplateAsset;
3
4
  pages?: IPage[];
@@ -7,9 +8,9 @@ export interface ITemplate {
7
8
  name: string;
8
9
  id?: string;
9
10
  profile_id?: string;
10
- created_at?: Date;
11
- updated_at?: Date;
12
- last_used_at?: Date;
11
+ created_at?: string;
12
+ updated_at?: string;
13
+ last_used_at?: string;
13
14
  token?: string;
14
15
  reminder_id?: string;
15
16
  reminder?: IReminder;
@@ -18,6 +19,7 @@ export interface ITemplate {
18
19
  is_public?: boolean;
19
20
  sender?: TTemplateSender;
20
21
  description?: string;
22
+ organization?: IOrganization;
21
23
  }
22
24
  export interface ITemplateSummaryEntry {
23
25
  id: string;
@@ -115,7 +117,7 @@ export interface ITag {
115
117
  export interface ITags {
116
118
  name: string;
117
119
  featured?: boolean;
118
- created_at?: Date;
120
+ created_at?: string;
119
121
  }
120
122
  export interface IStar {
121
123
  template_id: string;
@@ -139,8 +141,8 @@ export interface ITemplateAsset {
139
141
  name: string;
140
142
  page_numbers: number;
141
143
  id?: string;
142
- updated_at?: Date;
143
- created_at?: Date;
144
+ updated_at?: string;
145
+ created_at?: string;
144
146
  template_id: string;
145
147
  mime: string;
146
148
  thumbnail_url: string;
@@ -157,8 +159,8 @@ export interface ITemplateField {
157
159
  label?: string;
158
160
  }
159
161
  export interface IFieldSetting {
160
- x?: number;
161
- y?: number;
162
+ x: number;
163
+ y: number;
162
164
  width?: number;
163
165
  height?: number;
164
166
  result?: any;
@@ -168,6 +170,11 @@ export interface IFieldSetting {
168
170
  alignment?: number;
169
171
  upperCase?: boolean;
170
172
  options?: any[];
173
+ base64?: string;
174
+ hash?: string;
175
+ ip_address?: string;
176
+ signature_id?: string;
177
+ signed_at?: string;
171
178
  [key: string]: any;
172
179
  }
173
180
  export interface IPage {
@@ -181,7 +188,7 @@ export interface IPage {
181
188
  }
182
189
  export interface IReminder {
183
190
  id?: string;
184
- created_at?: Date;
191
+ created_at?: string;
185
192
  is_on: boolean;
186
193
  setup_time: number;
187
194
  interval_time: number;
package/Utils/Fields.d.ts CHANGED
@@ -1,11 +1,5 @@
1
- import { IDocumentField } from '../Documents/Documents';
2
- export declare function getHeight(field: IDocumentField): number;
3
- export declare function getWidth(field: IDocumentField): number;
4
1
  export declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
5
2
  export declare function getRLeft(x: number, ratio: number): number;
6
3
  export declare function getRValue(y: number, ratio: number): number;
7
4
  export declare function blobToBase64(image: Blob): Promise<unknown>;
8
- export declare function getInputStyle(field: IDocumentField, mode: string, browserType: string): Record<string, string>;
9
- export declare function getCheckboxLabelStyle(required: boolean): Record<string, any>;
10
- export declare function getLetterSpacing(browserType: string): -0.0018 | -0.23594210526315787 | -0.0019;
11
5
  export declare function rescale(r: number, n: number): number;
package/Utils/Fields.js CHANGED
@@ -1,39 +1,3 @@
1
- export function getHeight(field) {
2
- var settings = field.settings || field.setting || {};
3
- switch (field.type) {
4
- case 'signature':
5
- case 'initial':
6
- return 36;
7
- case 'checkbox':
8
- case 'checkbox_group':
9
- case 'radio_button_group':
10
- return 13.5;
11
- case 'attachment':
12
- case 'payment':
13
- return 24;
14
- }
15
- return settings.height || 0;
16
- }
17
- export function getWidth(field) {
18
- var settings = field.settings || field.setting || {};
19
- switch (field.type) {
20
- case 'signature':
21
- case 'initial':
22
- return 82.63636363636;
23
- case 'checkbox':
24
- case 'checkbox_group':
25
- case 'radio_button_group':
26
- return 13.5;
27
- case 'attachment':
28
- case 'payment':
29
- return 24;
30
- case 'date':
31
- return 64;
32
- case 'dropdown':
33
- return (settings === null || settings === void 0 ? void 0 : settings.width) || 64;
34
- }
35
- return (settings === null || settings === void 0 ? void 0 : settings.width) || 0;
36
- }
37
1
  export function getRTop(y, fieldHeight, iTextHeight, yRatio) {
38
2
  return iTextHeight - (y + fieldHeight) * yRatio;
39
3
  }
@@ -55,83 +19,6 @@ export function blobToBase64(image) {
55
19
  fileReader.readAsDataURL(image);
56
20
  });
57
21
  }
58
- export function getInputStyle(field, mode, browserType) {
59
- var settings = field.settings || field.setting || {};
60
- var fontSize = (settings === null || settings === void 0 ? void 0 : settings.font_size) || 11;
61
- var style = {
62
- height: '100%',
63
- width: '100%',
64
- background: 'none',
65
- };
66
- if (settings.font_size ||
67
- field.type === 'date' ||
68
- field.type === 'signature' ||
69
- field.type === 'initial' ||
70
- field.type === 'timestamp') {
71
- style.fontSize = fontSize + 'px';
72
- style.letterSpacing = '.3px !important';
73
- }
74
- if (field.type === 'dropdown') {
75
- style.fontSize = '10.8px';
76
- delete style.background;
77
- }
78
- if (field.type === 'textbox') {
79
- style.fontSize = fontSize + 'px';
80
- style.letterSpacing = getLetterSpacing(browserType) + 'px';
81
- }
82
- if (field.required) {
83
- style.border = '1px solid #cc0000';
84
- }
85
- if ((field === null || field === void 0 ? void 0 : field.prepared) === true && mode !== 'prepareview') {
86
- style.visibility = 'hidden';
87
- }
88
- if (settings.color) {
89
- style.color = settings.color;
90
- }
91
- if (settings.upperCase) {
92
- style.textTransform = 'uppercase';
93
- }
94
- if (settings.leading) {
95
- style.lineHeight = "".concat(rescale(1, settings.leading + 0.5), "px");
96
- }
97
- return style;
98
- }
99
- export function getCheckboxLabelStyle(required) {
100
- var labelStyle = {
101
- position: 'absolute',
102
- top: 0,
103
- left: 0,
104
- cursor: 'pointer',
105
- height: "13.5px",
106
- width: "13.5px",
107
- backgroundColor: 'transparent',
108
- border: '1px solid #777',
109
- };
110
- if (required) {
111
- labelStyle.boxShadow = '0 0 0 1px #cc0000';
112
- }
113
- return labelStyle;
114
- }
115
- export function getLetterSpacing(browserType) {
116
- switch (browserType) {
117
- case 'opera':
118
- return -0.0018;
119
- case 'firefox':
120
- return -0.23594210526315787;
121
- case 'ie':
122
- return -0.0019;
123
- case 'edge':
124
- return -0.0019;
125
- case 'chrome':
126
- return -0.0018;
127
- case 'safari':
128
- return -0.0018;
129
- case 'blink':
130
- return -0.0018;
131
- default:
132
- return -0.0018;
133
- }
134
- }
135
22
  export function rescale(r, n) {
136
23
  return r * n;
137
24
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
3
+ * includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
4
+ */
5
+ export declare const fileToDataUrl: (file: File) => Promise<unknown>;
package/Utils/Files.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
3
+ * includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
4
+ */
5
+ export var fileToDataUrl = function (file) {
6
+ return new Promise(function (resolve, reject) {
7
+ var reader = new FileReader();
8
+ reader.onload = function () {
9
+ return resolve({
10
+ lastModified: file.lastModified,
11
+ size: file.size,
12
+ type: file.type,
13
+ name: file.name,
14
+ data: reader.result,
15
+ });
16
+ };
17
+ reader.onerror = reject;
18
+ if (file) {
19
+ reader.readAsDataURL(file);
20
+ }
21
+ else {
22
+ reject(new Error('Invalid file'));
23
+ }
24
+ });
25
+ };
package/Utils/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * as Colors from './Colors';
2
2
  export * as DateTime from './DateTime';
3
3
  export * as Fields from './Fields';
4
+ export * as Files from './Files';
4
5
  export * as Locales from './Locales';
5
6
  export * as Token from './Token';
package/Utils/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * as Colors from './Colors';
2
2
  export * as DateTime from './DateTime';
3
3
  export * as Fields from './Fields';
4
+ export * as Files from './Files';
4
5
  export * as Locales from './Locales';
5
6
  export * as Token from './Token';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "1.1.12",
3
+ "version": "1.1.16",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",