@verdocs/js-sdk 1.1.4 → 1.1.8

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.
@@ -149,3 +149,4 @@ export interface ISigningSessionResult {
149
149
  export declare const getSigningSession: (params: ISigningSessionRequest) => Promise<ISigningSessionResult>;
150
150
  export declare const getDocumentRecipients: (documentId: string) => Promise<IRecipient[]>;
151
151
  export declare const getDocument: (documentId: string) => Promise<IDocument>;
152
+ export declare const getDocumentFile: (documentId: string, envelopeDocumentId: string) => Promise<string>;
@@ -99,3 +99,12 @@ export var getDocument = function (documentId) { return __awaiter(void 0, void 0
99
99
  .then(function (r) { return r.data; })];
100
100
  });
101
101
  }); };
102
+ export var getDocumentFile = function (documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
103
+ return __generator(this, function (_a) {
104
+ return [2 /*return*/, getEndpoint()
105
+ .api.get("/documents/".concat(documentId, "/envelope_documents/").concat(envelopeDocumentId, "?file=true"), {
106
+ responseType: 'arraybuffer',
107
+ })
108
+ .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
109
+ });
110
+ }); };
@@ -0,0 +1,7 @@
1
+ import { IRecipient } from './Documents';
2
+ export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
3
+ export interface IUpdateRecipientParams {
4
+ new_full_name?: string;
5
+ agreed?: boolean;
6
+ }
7
+ export declare const updateRecipientStatus: (documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams | undefined) => Promise<IRecipient>;
@@ -0,0 +1,55 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { getEndpoint } from '../HTTP/Transport';
49
+ export var updateRecipientStatus = function (documentId, roleName, action, params) { return __awaiter(void 0, void 0, void 0, function () {
50
+ return __generator(this, function (_a) {
51
+ return [2 /*return*/, getEndpoint()
52
+ .api.put("/documents/".concat(documentId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
53
+ .then(function (r) { return r.data; })];
54
+ });
55
+ }); };
@@ -1,4 +1,5 @@
1
1
  export * as Documents from './Documents';
2
+ export * as Recipients from './Recipients';
2
3
  export * as Stars from './Stars';
3
4
  export * as Signatures from './Signatures';
4
5
  export * as Types from './Types';
@@ -1,4 +1,5 @@
1
1
  export * as Documents from './Documents';
2
+ export * as Recipients from './Recipients';
2
3
  export * as Stars from './Stars';
3
4
  export * as Signatures from './Signatures';
4
5
  export * as Types from './Types';
@@ -49,6 +49,24 @@ export declare enum TemplatePermissions {
49
49
  TEMPLATE_MEMBER_DELETE = "template:member:delete",
50
50
  TEMPLATE_MEMBER_VISIBILITY = "template:member:visibility"
51
51
  }
52
+ export declare enum TemplateSenderTypes {
53
+ CREATOR = "creator",
54
+ ORGANIZATION_MEMBER = "organization_member",
55
+ ORGANIZATION_MEMBER_AS_CREATOR = "organization_member_as_creator",
56
+ EVERYONE = "everyone",
57
+ EVERYONE_AS_CREATOR = "everyone_as_creator"
58
+ }
59
+ export declare enum TemplateActions {
60
+ CREATE_PERSONAL = "create_personal",
61
+ CREATE_ORG = "create_org",
62
+ CREATE_PUBLIC = "create_public",
63
+ READ = "read",
64
+ WRITE = "write",
65
+ DELETE = "delete",
66
+ CHANGE_VISIBILITY_PERSONAL = "change_visibility_personal",
67
+ CHANGE_VISIBILITY_ORG = "change_visibility_org",
68
+ CHANGE_VISIBILITY_PUBLIC = "change_visibility_public"
69
+ }
52
70
  export interface ITemplateSearchParams {
53
71
  id?: string;
54
72
  name?: string;
@@ -114,6 +132,7 @@ export interface IRole {
114
132
  delegator?: boolean;
115
133
  message?: string;
116
134
  phone?: string;
135
+ rgba?: string;
117
136
  }
118
137
  export interface IDocument {
119
138
  url: string;
@@ -136,6 +155,7 @@ export interface IField {
136
155
  page_sequence: number;
137
156
  validator?: string;
138
157
  label?: string;
158
+ prepared?: boolean;
139
159
  }
140
160
  export interface ISetting {
141
161
  x?: number;
@@ -10,6 +10,26 @@ export var TemplatePermissions;
10
10
  TemplatePermissions["TEMPLATE_MEMBER_DELETE"] = "template:member:delete";
11
11
  TemplatePermissions["TEMPLATE_MEMBER_VISIBILITY"] = "template:member:visibility";
12
12
  })(TemplatePermissions || (TemplatePermissions = {}));
13
+ export var TemplateSenderTypes;
14
+ (function (TemplateSenderTypes) {
15
+ TemplateSenderTypes["CREATOR"] = "creator";
16
+ TemplateSenderTypes["ORGANIZATION_MEMBER"] = "organization_member";
17
+ TemplateSenderTypes["ORGANIZATION_MEMBER_AS_CREATOR"] = "organization_member_as_creator";
18
+ TemplateSenderTypes["EVERYONE"] = "everyone";
19
+ TemplateSenderTypes["EVERYONE_AS_CREATOR"] = "everyone_as_creator"; // Creator would be sender of envelope no matter who creates the envelope
20
+ })(TemplateSenderTypes || (TemplateSenderTypes = {}));
21
+ export var TemplateActions;
22
+ (function (TemplateActions) {
23
+ TemplateActions["CREATE_PERSONAL"] = "create_personal";
24
+ TemplateActions["CREATE_ORG"] = "create_org";
25
+ TemplateActions["CREATE_PUBLIC"] = "create_public";
26
+ TemplateActions["READ"] = "read";
27
+ TemplateActions["WRITE"] = "write";
28
+ TemplateActions["DELETE"] = "delete";
29
+ TemplateActions["CHANGE_VISIBILITY_PERSONAL"] = "change_visibility_personal";
30
+ TemplateActions["CHANGE_VISIBILITY_ORG"] = "change_visibility_org";
31
+ TemplateActions["CHANGE_VISIBILITY_PUBLIC"] = "change_visibility_public";
32
+ })(TemplateActions || (TemplateActions = {}));
13
33
  export var SortOptions;
14
34
  (function (SortOptions) {
15
35
  SortOptions["CREATED_AT"] = "created_at";
@@ -1,6 +1,11 @@
1
+ import { IRole, ITag } from './Types';
1
2
  export interface IValidator {
2
3
  name: string;
3
4
  regex: string;
4
5
  }
5
6
  export declare const getValidators: () => Promise<IValidator[]>;
6
7
  export declare const getValidator: (validatorName: string) => Promise<IValidator>;
8
+ export declare const isValidEmail: (value: string) => boolean;
9
+ export declare const isValidPhone: (value: string) => boolean;
10
+ export declare const isValidRoleName: (value: string, roles: IRole[]) => boolean;
11
+ export declare const isValidTag: (value: string, tags: ITag[]) => boolean;
@@ -1,3 +1,4 @@
1
+ import { simpleE164Validator } from '../Utils/Locales';
1
2
  import { getEndpoint } from '../HTTP/Transport';
2
3
  export var getValidators = function () {
3
4
  return getEndpoint()
@@ -9,3 +10,11 @@ export var getValidator = function (validatorName) {
9
10
  .api.get("/validators/".concat(validatorName))
10
11
  .then(function (r) { return r.data; });
11
12
  };
13
+ var EmailRegEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
14
+ export var isValidEmail = function (value) { return EmailRegEx.test(value); };
15
+ export var isValidPhone = function (value) { return simpleE164Validator(value); };
16
+ export var isValidRoleName = function (value, roles) { return roles.findIndex(function (role) { return role.name === value; }) !== -1; };
17
+ var TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
18
+ export var isValidTag = function (value, tags) {
19
+ return TagRegEx.test(value) || tags.findIndex(function (tag) { return tag.tag_name === value; }) !== -1;
20
+ };
@@ -0,0 +1,18 @@
1
+ import { IRole } from '../Templates/Types';
2
+ /**
3
+ * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
4
+ */
5
+ export declare function getRGB(rgba: string): string;
6
+ /**
7
+ * Given a signer role index, return the color code for that signer.
8
+ */
9
+ export declare function getRGBA(roleIndex: number): "rgba(255, 193, 7, 0.4)" | "rgba(134, 134, 134, 0.3)" | "rgba(156, 39, 176, .4)" | "rgba(33, 150, 243, .4)" | "rgba(220, 231, 117, 0.3)" | "rgba(121, 134, 203, 0.3)" | "rgba(77, 182, 172, 0.3)" | "rgba(255, 202, 165, 0.3)" | "rgba(2, 247, 190, 0.3)" | "rgba(255, 138, 101, 0.3)" | "rgba(82, 255, 79, 0.3)" | "rgba(229, 115, 155, 0.3)";
10
+ /**
11
+ * Given a role name, return a color code for it. This works by computing a hash code so the specific color returned
12
+ * is not specified explicitly, but will be the same for every call with the same input value.
13
+ */
14
+ export declare function nameToRGBA(str: string): string | undefined;
15
+ /**
16
+ * Helper function to obtain a color code given a role name given various possible inputs.
17
+ */
18
+ export declare function getRoleColor(name: string, roles: IRole[], index?: number): string | undefined;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
3
+ */
4
+ export function getRGB(rgba) {
5
+ var rgbNumbers = rgba.replace('rgba(', '').replace(')', '').split(',');
6
+ var rgbObject = {
7
+ red: +rgbNumbers[0],
8
+ green: +rgbNumbers[1],
9
+ blue: +rgbNumbers[2],
10
+ alpha: +rgbNumbers[3],
11
+ };
12
+ var alpha = 1 - rgbObject.alpha;
13
+ var red = Math.round((rgbObject.alpha * (rgbObject.red / 255) + alpha) * 255);
14
+ var green = Math.round((rgbObject.alpha * (rgbObject.green / 255) + alpha) * 255);
15
+ var blue = Math.round((rgbObject.alpha * (rgbObject.blue / 255) + alpha) * 255);
16
+ return '#' + rgbToHex(red) + rgbToHex(green) + rgbToHex(blue);
17
+ }
18
+ /**
19
+ * Given an RGB string value, returns the hex equivalent.
20
+ */
21
+ function rgbToHex(rgb) {
22
+ var hex = rgb.toString(16);
23
+ if (hex.length < 2) {
24
+ return '0' + hex;
25
+ }
26
+ return hex;
27
+ }
28
+ /**
29
+ * Given a signer role index, return the color code for that signer.
30
+ */
31
+ export function getRGBA(roleIndex) {
32
+ switch (roleIndex % 10) {
33
+ case 0:
34
+ return roleIndex === 0 ? 'rgba(255, 193, 7, 0.4)' : 'rgba(134, 134, 134, 0.3)'; // #FFE69C
35
+ case 1:
36
+ return 'rgba(156, 39, 176, .4)'; // '#E3C3E9'
37
+ case 2:
38
+ return 'rgba(33, 150, 243, .4)'; // '#C1E1FB'
39
+ case 3:
40
+ return 'rgba(220, 231, 117, 0.3)';
41
+ case 4:
42
+ return 'rgba(121, 134, 203, 0.3)';
43
+ case 5:
44
+ return 'rgba(77, 182, 172, 0.3)';
45
+ case 6:
46
+ return 'rgba(255, 202, 165, 0.3)';
47
+ case 7:
48
+ return 'rgba(2, 247, 190, 0.3)';
49
+ case 8:
50
+ return 'rgba(255, 138, 101, 0.3)';
51
+ case 9:
52
+ return 'rgba(82, 255, 79, 0.3)';
53
+ default:
54
+ return 'rgba(229, 115, 155, 0.3)';
55
+ }
56
+ }
57
+ /**
58
+ * Given a role name, return a color code for it. This works by computing a hash code so the specific color returned
59
+ * is not specified explicitly, but will be the same for every call with the same input value.
60
+ */
61
+ export function nameToRGBA(str) {
62
+ if (!!str) {
63
+ var validNum = parseInt(str.slice(-1), 10);
64
+ if (!isNaN(validNum)) {
65
+ str += (validNum * 99).toString();
66
+ }
67
+ var hash = 0;
68
+ for (var i = 0; i < str.length; i++) {
69
+ hash = str.charCodeAt(i) + ((hash << 5) - hash);
70
+ }
71
+ hash = Math.round(hash / 1.3);
72
+ var c = (hash & 0x00ffff08).toString(16).toUpperCase();
73
+ var hex = '#' + '00000'.substring(0, 6 - c.length) + c;
74
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
75
+ var color = {
76
+ r: parseInt(result[1], 16),
77
+ g: parseInt(result[2], 16),
78
+ b: parseInt(result[3], 16),
79
+ };
80
+ return "rgba(".concat(color.r, ", ").concat(color.g, ", ").concat(color.b, ", 0.2)");
81
+ }
82
+ }
83
+ /**
84
+ * Helper function to obtain a color code given a role name given various possible inputs.
85
+ */
86
+ export function getRoleColor(name, roles, index) {
87
+ if (index) {
88
+ return getRGBA(index);
89
+ }
90
+ else if (roles && roles.length > 0) {
91
+ var roleIndex = roles.findIndex(function (role) { return role.name === name; });
92
+ if (roleIndex > -1) {
93
+ return roles[roleIndex].rgba || getRGBA(roleIndex);
94
+ }
95
+ else {
96
+ return nameToRGBA(name);
97
+ }
98
+ }
99
+ else {
100
+ return nameToRGBA(name);
101
+ }
102
+ }
@@ -1 +1,6 @@
1
1
  export declare const formatShortTimeAgo: (val: any) => string;
2
+ export interface ITimePeriod {
3
+ start_time: string;
4
+ end_time: string;
5
+ }
6
+ export declare function timePeriod(type: string): ITimePeriod | null;
package/Utils/DateTime.js CHANGED
@@ -39,3 +39,41 @@ export var formatShortTimeAgo = function (val) {
39
39
  }
40
40
  return "".concat(timeDiff, "S");
41
41
  };
42
+ export function timePeriod(type) {
43
+ var endDate = new Date().getTime();
44
+ var today = new Date();
45
+ var month = today.getMonth();
46
+ var year = today.getFullYear();
47
+ var startDate = null;
48
+ switch (type) {
49
+ case '30d':
50
+ startDate = endDate - 60 * 60 * 24 * 30 * 1000;
51
+ break;
52
+ case '60d':
53
+ startDate = endDate - 60 * 60 * 24 * 60 * 1000;
54
+ break;
55
+ case '6m':
56
+ startDate = endDate - 60 * 60 * 24 * 30 * 6 * 1000;
57
+ break;
58
+ case 'this_month':
59
+ startDate = new Date(year, month, 1).getTime();
60
+ break;
61
+ case 'last_month':
62
+ startDate = new Date(year, month - 1, 1).getTime();
63
+ endDate = new Date(year, month, 0).getTime();
64
+ break;
65
+ case 'this_year':
66
+ startDate = new Date(year, 0, 1);
67
+ break;
68
+ case 'all_time':
69
+ default:
70
+ return null;
71
+ }
72
+ if (startDate === null && endDate === null) {
73
+ return null;
74
+ }
75
+ return {
76
+ start_time: new Date(startDate).toISOString(),
77
+ end_time: new Date(endDate).toISOString(),
78
+ };
79
+ }
@@ -0,0 +1,12 @@
1
+ import { IField } from '../Templates/Types';
2
+ export declare function getHeight(field: IField): number;
3
+ export declare function getWidth(field: IField): number;
4
+ export declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
5
+ export declare function getRLeft(x: number, ratio: number): number;
6
+ export declare function getRValue(y: number, ratio: number): number;
7
+ export declare function getStyle(field: IField): Record<string, string>;
8
+ export declare function blobToBase64(image: Blob): Promise<unknown>;
9
+ export declare function getInputStyle(field: IField, mode: string, browserType: string): Record<string, string>;
10
+ export declare function getCheckboxLabelStyle(required: boolean): Record<string, any>;
11
+ export declare function getLetterSpacing(browserType: string): -0.0018 | -0.23594210526315787 | -0.0019;
12
+ export declare function rescale(r: number, n: number): number;
@@ -0,0 +1,175 @@
1
+ export function getHeight(field) {
2
+ var _a;
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 ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.height) || 0;
16
+ }
17
+ export function getWidth(field) {
18
+ var _a, _b;
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 ((_a = field.setting) === null || _a === void 0 ? void 0 : _a.width) || 64;
34
+ }
35
+ return ((_b = field.setting) === null || _b === void 0 ? void 0 : _b.width) || 0;
36
+ }
37
+ export function getRTop(y, fieldHeight, iTextHeight, yRatio) {
38
+ return iTextHeight - (y + fieldHeight) * yRatio;
39
+ }
40
+ export function getRLeft(x, ratio) {
41
+ return x * ratio;
42
+ }
43
+ export function getRValue(y, ratio) {
44
+ return y * ratio;
45
+ }
46
+ export function getStyle(field) {
47
+ var _a, _b, _c;
48
+ var height = getHeight(field);
49
+ var style = {
50
+ left: (((_a = field.setting) === null || _a === void 0 ? void 0 : _a.x) || 0) + 'px',
51
+ bottom: (((_b = field.setting) === null || _b === void 0 ? void 0 : _b.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 = (((_c = field.setting) === null || _c === void 0 ? void 0 : _c.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
+ export function blobToBase64(image) {
85
+ var fileReader = new FileReader();
86
+ return new Promise(function (resolve, reject) {
87
+ fileReader.onerror = function () {
88
+ reject(new DOMException('Problem reading blob.'));
89
+ };
90
+ fileReader.onload = function () {
91
+ resolve(fileReader.result);
92
+ };
93
+ fileReader.readAsDataURL(image);
94
+ });
95
+ }
96
+ export function getInputStyle(field, mode, browserType) {
97
+ var fontSize = 11;
98
+ var _a = field.setting, setting = _a === void 0 ? {} : _a;
99
+ var style = {
100
+ height: '100%',
101
+ width: '100%',
102
+ background: 'none',
103
+ };
104
+ if (setting.font_size ||
105
+ field.type === 'date' ||
106
+ field.type === 'signature' ||
107
+ field.type === 'initial' ||
108
+ field.type === 'timestamp') {
109
+ style.fontSize = fontSize + 'px';
110
+ style.letterSpacing = '.3px !important';
111
+ }
112
+ if (field.type === 'dropdown') {
113
+ style.fontSize = '10.8px';
114
+ delete style.background;
115
+ }
116
+ if (field.type === 'textbox') {
117
+ style.fontSize = fontSize + 'px';
118
+ style.letterSpacing = getLetterSpacing(browserType) + 'px';
119
+ }
120
+ if (field.required) {
121
+ style.border = '1px solid #cc0000';
122
+ }
123
+ if ((field === null || field === void 0 ? void 0 : field.prepared) === true && mode !== 'prepareview') {
124
+ style.visibility = 'hidden';
125
+ }
126
+ if (setting.color) {
127
+ style.color = setting.color;
128
+ }
129
+ if (setting.upperCase) {
130
+ style.textTransform = 'uppercase';
131
+ }
132
+ if (setting.leading > 0) {
133
+ style.lineHeight = "".concat(rescale(1, setting.leading + 0.5), "px");
134
+ }
135
+ return style;
136
+ }
137
+ export function getCheckboxLabelStyle(required) {
138
+ var labelStyle = {
139
+ position: 'absolute',
140
+ top: 0,
141
+ left: 0,
142
+ cursor: 'pointer',
143
+ height: "13.5px",
144
+ width: "13.5px",
145
+ backgroundColor: 'transparent',
146
+ border: '1px solid #777',
147
+ };
148
+ if (required) {
149
+ labelStyle.boxShadow = '0 0 0 1px #cc0000';
150
+ }
151
+ return labelStyle;
152
+ }
153
+ export function getLetterSpacing(browserType) {
154
+ switch (browserType) {
155
+ case 'opera':
156
+ return -0.0018;
157
+ case 'firefox':
158
+ return -0.23594210526315787;
159
+ case 'ie':
160
+ return -0.0019;
161
+ case 'edge':
162
+ return -0.0019;
163
+ case 'chrome':
164
+ return -0.0018;
165
+ case 'safari':
166
+ return -0.0018;
167
+ case 'blink':
168
+ return -0.0018;
169
+ default:
170
+ return -0.0018;
171
+ }
172
+ }
173
+ export function rescale(r, n) {
174
+ return r * n;
175
+ }
@@ -0,0 +1,18 @@
1
+ export interface ICountry {
2
+ code: string;
3
+ name: string;
4
+ value: string;
5
+ }
6
+ export declare const Countries: ICountry[];
7
+ export declare function getCountryByCode(code: string): ICountry | null;
8
+ export declare function isFrenchGuiana(code: string): boolean;
9
+ export declare function isGuadeloupe(code: string): boolean;
10
+ export declare function isMartinique(code: string): boolean;
11
+ export declare function isMayotte(code: string): boolean;
12
+ export declare function getPlusOneCountry(code: string): ICountry | null;
13
+ export declare function isCanada(code: string): boolean;
14
+ export declare function isAmericanSamoa(code: string): boolean;
15
+ export declare function isDominicanRepublic(code: string): boolean;
16
+ export declare function isPuertoRico(code: string): boolean;
17
+ export declare function getMatchingCountry(code: string, substrings: number): number;
18
+ export declare function simpleE164Validator(code: string): boolean;