@verdocs/js-sdk 3.10.30 → 4.0.1
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/dist/README.md +75 -0
- package/dist/index.d.mts +40458 -0
- package/dist/index.d.ts +40458 -0
- package/dist/index.js +3040 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3032 -0
- package/dist/index.mjs.map +1 -0
- package/dist/package.json +76 -0
- package/dist/tsconfig.json +16 -0
- package/package.json +28 -20
- package/.github/workflows/generate-docs.yml +0 -41
- package/Envelopes/Envelopes.d.ts +0 -242
- package/Envelopes/Envelopes.js +0 -339
- package/Envelopes/Initials.d.ts +0 -15
- package/Envelopes/Initials.js +0 -13
- package/Envelopes/Permissions.d.ts +0 -52
- package/Envelopes/Permissions.js +0 -84
- package/Envelopes/Recipients.d.ts +0 -89
- package/Envelopes/Recipients.js +0 -112
- package/Envelopes/Reminders.d.ts +0 -23
- package/Envelopes/Reminders.js +0 -33
- package/Envelopes/Signatures.d.ts +0 -28
- package/Envelopes/Signatures.js +0 -37
- package/Envelopes/Types.d.ts +0 -390
- package/Envelopes/Types.js +0 -45
- package/Envelopes/index.d.ts +0 -7
- package/Envelopes/index.js +0 -7
- package/Organizations/ApiKeys.d.ts +0 -64
- package/Organizations/ApiKeys.js +0 -82
- package/Organizations/Groups.d.ts +0 -47
- package/Organizations/Groups.js +0 -76
- package/Organizations/Invitations.d.ts +0 -24
- package/Organizations/Invitations.js +0 -45
- package/Organizations/Members.d.ts +0 -12
- package/Organizations/Members.js +0 -30
- package/Organizations/Organizations.d.ts +0 -27
- package/Organizations/Organizations.js +0 -45
- package/Organizations/Types.d.ts +0 -104
- package/Organizations/Types.js +0 -1
- package/Organizations/Webhooks.d.ts +0 -34
- package/Organizations/Webhooks.js +0 -10
- package/Organizations/Whitelabel.d.ts +0 -31
- package/Organizations/Whitelabel.js +0 -38
- package/Organizations/index.d.ts +0 -16
- package/Organizations/index.js +0 -16
- package/Sessions/Types.d.ts +0 -54
- package/Sessions/Types.js +0 -1
- package/Sessions/index.d.ts +0 -6
- package/Sessions/index.js +0 -7
- package/Templates/Actions.d.ts +0 -26
- package/Templates/Actions.js +0 -104
- package/Templates/Fields.d.ts +0 -14
- package/Templates/Fields.js +0 -24
- package/Templates/Pages.d.ts +0 -30
- package/Templates/Pages.js +0 -41
- package/Templates/Permissions.d.ts +0 -73
- package/Templates/Permissions.js +0 -124
- package/Templates/Reminders.d.ts +0 -23
- package/Templates/Reminders.js +0 -33
- package/Templates/Roles.d.ts +0 -16
- package/Templates/Roles.js +0 -42
- package/Templates/Stars.d.ts +0 -10
- package/Templates/Stars.js +0 -16
- package/Templates/Tags.d.ts +0 -33
- package/Templates/Tags.js +0 -55
- package/Templates/TemplateDocuments.d.ts +0 -66
- package/Templates/TemplateDocuments.js +0 -139
- package/Templates/Templates.d.ts +0 -284
- package/Templates/Templates.js +0 -309
- package/Templates/Types.d.ts +0 -346
- package/Templates/Types.js +0 -29
- package/Templates/Validators.d.ts +0 -21
- package/Templates/Validators.js +0 -27
- package/Templates/index.d.ts +0 -11
- package/Templates/index.js +0 -11
- package/Users/Auth.d.ts +0 -123
- package/Users/Auth.js +0 -142
- package/Users/Billing.d.ts +0 -1
- package/Users/Billing.js +0 -2
- package/Users/Notifications.d.ts +0 -2
- package/Users/Notifications.js +0 -43
- package/Users/Profiles.d.ts +0 -151
- package/Users/Profiles.js +0 -179
- package/Users/Types.d.ts +0 -146
- package/Users/Types.js +0 -47
- package/Users/index.d.ts +0 -5
- package/Users/index.js +0 -5
- package/Utils/Colors.d.ts +0 -18
- package/Utils/Colors.js +0 -102
- package/Utils/DateTime.d.ts +0 -6
- package/Utils/DateTime.js +0 -79
- package/Utils/Fields.d.ts +0 -5
- package/Utils/Fields.js +0 -24
- package/Utils/Files.d.ts +0 -16
- package/Utils/Files.js +0 -42
- package/Utils/Locales.d.ts +0 -17
- package/Utils/Locales.js +0 -1358
- package/Utils/Primitives.d.ts +0 -18
- package/Utils/Primitives.js +0 -31
- package/Utils/Strings.d.ts +0 -9
- package/Utils/Strings.js +0 -28
- package/Utils/Token.d.ts +0 -19
- package/Utils/Token.js +0 -67
- package/Utils/globalThis.d.ts +0 -2
- package/Utils/globalThis.js +0 -52
- package/Utils/index.d.ts +0 -8
- package/Utils/index.js +0 -8
- package/VerdocsEndpoint.d.ts +0 -199
- package/VerdocsEndpoint.js +0 -319
- package/index.d.ts +0 -18
- package/index.js +0 -18
- package/tsconfig-typedoc.json +0 -26
package/Utils/Primitives.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IProfile } from '../Users/Types';
|
|
2
|
-
/**
|
|
3
|
-
* Create an array containing a sequence of integers, e.g. [START, START+1, START+2, ...] This is frequently useful
|
|
4
|
-
* in rendering operations when there is no source array to .map() across.
|
|
5
|
-
*/
|
|
6
|
-
export declare const integerSequence: (start: number, count: number) => number[];
|
|
7
|
-
/**
|
|
8
|
-
* Format a profile's full name
|
|
9
|
-
*/
|
|
10
|
-
export declare const formatFullName: (profile?: IProfile) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Format a profile's initials
|
|
13
|
-
*/
|
|
14
|
-
export declare const formatInitials: (profile?: IProfile) => string;
|
|
15
|
-
/**
|
|
16
|
-
* Generate suggested initials for a full name, e.g. "John Doe" will yield "JD".
|
|
17
|
-
*/
|
|
18
|
-
export declare const fullNameToInitials: (name: string) => string;
|
package/Utils/Primitives.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { capitalize } from './Strings';
|
|
2
|
-
/**
|
|
3
|
-
* Create an array containing a sequence of integers, e.g. [START, START+1, START+2, ...] This is frequently useful
|
|
4
|
-
* in rendering operations when there is no source array to .map() across.
|
|
5
|
-
*/
|
|
6
|
-
export var integerSequence = function (start, count) {
|
|
7
|
-
return Array(count)
|
|
8
|
-
.fill(1)
|
|
9
|
-
.map(function (_, index) { return index + start; });
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Format a profile's full name
|
|
13
|
-
*/
|
|
14
|
-
export var formatFullName = function (profile) {
|
|
15
|
-
return profile ? "".concat(capitalize(profile.first_name), " ").concat(capitalize(profile.last_name)) : 'Invalid User';
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Format a profile's initials
|
|
19
|
-
*/
|
|
20
|
-
export var formatInitials = function (profile) {
|
|
21
|
-
return profile ? "".concat(capitalize(profile.first_name).charAt(0), " ").concat(capitalize(profile.last_name).charAt(0)) : '--';
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Generate suggested initials for a full name, e.g. "John Doe" will yield "JD".
|
|
25
|
-
*/
|
|
26
|
-
export var fullNameToInitials = function (name) {
|
|
27
|
-
return name
|
|
28
|
-
.split(' ')
|
|
29
|
-
.map(function (word) { return word[0]; })
|
|
30
|
-
.join('');
|
|
31
|
-
};
|
package/Utils/Strings.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capitalize the first letter of a string.
|
|
3
|
-
*/
|
|
4
|
-
export declare const capitalize: (str: string) => string;
|
|
5
|
-
/**
|
|
6
|
-
* Convert a phone-number-like string to E164 format.
|
|
7
|
-
* @see https://46elks.com/kb/e164
|
|
8
|
-
*/
|
|
9
|
-
export declare const convertToE164: (input: string) => string;
|
package/Utils/Strings.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capitalize the first letter of a string.
|
|
3
|
-
*/
|
|
4
|
-
export var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.slice(1); };
|
|
5
|
-
/**
|
|
6
|
-
* Convert a phone-number-like string to E164 format.
|
|
7
|
-
* @see https://46elks.com/kb/e164
|
|
8
|
-
*/
|
|
9
|
-
export var convertToE164 = function (input) {
|
|
10
|
-
// "(212) 555-1212" => +12125551212
|
|
11
|
-
// "+46766861004" => "+46766861004"
|
|
12
|
-
// "212-555-1212" => +12125551212
|
|
13
|
-
// "212.555.1212" => +12125551212
|
|
14
|
-
// "212 555 1212" => +12125551212
|
|
15
|
-
var temp = (input || '').trim();
|
|
16
|
-
// If we are already prefixed, assume the user did it deliberately and attempt to use what they entered. We also short-circuit blanks.
|
|
17
|
-
if (!temp || temp.startsWith('+')) {
|
|
18
|
-
return temp;
|
|
19
|
-
}
|
|
20
|
-
// Remove any spaces, parenthesis or other punctuation.
|
|
21
|
-
temp = temp.replace(/[^0-9]/g, '');
|
|
22
|
-
// If the number begins with a zero, remove the leading zero. Do not combine this with the previous step because it needs to be removed
|
|
23
|
-
// whether it's the actual first character e.g. `0(5)` or just the first digit e.g. `(05`.
|
|
24
|
-
temp = temp.replace(/^0/g, '');
|
|
25
|
-
// Prepend the country code and +. We're assuming US in this case given the target demographic. Users in other countries would/should be
|
|
26
|
-
// already entering a prefix so they'd shortcut out of this routine via the + prefix check.
|
|
27
|
-
return "+1".concat(temp);
|
|
28
|
-
};
|
package/Utils/Token.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { TSession } from '../Sessions/Types';
|
|
2
|
-
/**
|
|
3
|
-
* Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
|
|
4
|
-
* Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
|
|
5
|
-
*/
|
|
6
|
-
export declare const AtoB: (str: string) => string;
|
|
7
|
-
/**
|
|
8
|
-
* Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
|
|
9
|
-
* many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
|
|
10
|
-
*/
|
|
11
|
-
export declare const decodeJWTBody: (token: string) => any;
|
|
12
|
-
/**
|
|
13
|
-
* Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
|
|
14
|
-
* `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
|
|
15
|
-
* will be removed. Note that user and signing sessions have different access token formats. The calling
|
|
16
|
-
* application should distinguish between the two based on the context of the authenticated session, or by
|
|
17
|
-
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
18
|
-
*/
|
|
19
|
-
export declare const decodeAccessTokenBody: (token: string) => TSession;
|
package/Utils/Token.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:no-bitwise */
|
|
2
|
-
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
3
|
-
// Regular expression to check formal correctness of base64 encoded strings
|
|
4
|
-
var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
5
|
-
/**
|
|
6
|
-
* Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
|
|
7
|
-
* Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
|
|
8
|
-
*/
|
|
9
|
-
export var AtoB = function (str) {
|
|
10
|
-
// atob can work with strings with whitespaces, even inside the encoded part,
|
|
11
|
-
// but only \t, \n, \f, \r and ' ', which can be stripped.
|
|
12
|
-
str = String(str).replace(/[\t\n\f\r ]+/g, '');
|
|
13
|
-
if (!b64re.test(str))
|
|
14
|
-
throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
|
|
15
|
-
// Adding the padding if missing, for semplicity
|
|
16
|
-
str += '=='.slice(2 - (str.length & 3));
|
|
17
|
-
var bitmap;
|
|
18
|
-
var result = '';
|
|
19
|
-
var r1;
|
|
20
|
-
var r2;
|
|
21
|
-
var i = 0;
|
|
22
|
-
for (; i < str.length;) {
|
|
23
|
-
bitmap =
|
|
24
|
-
(b64.indexOf(str.charAt(i++)) << 18) |
|
|
25
|
-
(b64.indexOf(str.charAt(i++)) << 12) |
|
|
26
|
-
((r1 = b64.indexOf(str.charAt(i++))) << 6) |
|
|
27
|
-
(r2 = b64.indexOf(str.charAt(i++)));
|
|
28
|
-
result +=
|
|
29
|
-
r1 === 64
|
|
30
|
-
? String.fromCharCode((bitmap >> 16) & 255)
|
|
31
|
-
: r2 === 64
|
|
32
|
-
? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
|
|
33
|
-
: String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
|
|
39
|
-
* many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
|
|
40
|
-
*/
|
|
41
|
-
export var decodeJWTBody = function (token) { return JSON.parse(AtoB((token || '').split('.')[1] || '')); };
|
|
42
|
-
/**
|
|
43
|
-
* Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
|
|
44
|
-
* `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
|
|
45
|
-
* will be removed. Note that user and signing sessions have different access token formats. The calling
|
|
46
|
-
* application should distinguish between the two based on the context of the authenticated session, or by
|
|
47
|
-
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
48
|
-
*/
|
|
49
|
-
export var decodeAccessTokenBody = function (token) {
|
|
50
|
-
var decoded;
|
|
51
|
-
try {
|
|
52
|
-
decoded = decodeJWTBody(token);
|
|
53
|
-
if (decoded === null) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
Object.keys(decoded).forEach(function (key) {
|
|
61
|
-
if (typeof key === 'string' && key.startsWith('https://verdocs.com/')) {
|
|
62
|
-
decoded[key.replace('https://verdocs.com/', '')] = decoded[key];
|
|
63
|
-
delete decoded[key];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
return decoded;
|
|
67
|
-
};
|
package/Utils/globalThis.d.ts
DELETED
package/Utils/globalThis.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
|
|
3
|
-
// an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
|
|
4
|
-
// (this js-sdk) and we want that library to provide a common endpoint to all callers (so authentication
|
|
5
|
-
// tokens only need to be tracked in one place). The trouble is, one of those libraries is based on
|
|
6
|
-
// StencilJS and is compiling its modules into Web Components. Because of how module resolution works,
|
|
7
|
-
// when those Components load js-sdk they get a separate instance. Without messy options like having to
|
|
8
|
-
// pass raw data from the caller to each Component, or pass around references to a common Endpoint, they
|
|
9
|
-
// have no way to access authenticated sessions unless we make the Endpoint a true global.
|
|
10
|
-
//
|
|
11
|
-
// @credit https://github.com/medikoo/es5-ext/blob/master/global.js
|
|
12
|
-
// @credit https://mathiasbynens.be/notes/globalthis
|
|
13
|
-
var naiveFallback = function () {
|
|
14
|
-
if (typeof self === 'object' && self)
|
|
15
|
-
return self;
|
|
16
|
-
if (typeof window === 'object' && window)
|
|
17
|
-
return window;
|
|
18
|
-
throw new Error('Unable to resolve global `this`');
|
|
19
|
-
};
|
|
20
|
-
module.exports = (function () {
|
|
21
|
-
if (this)
|
|
22
|
-
return this;
|
|
23
|
-
// Unexpected strict mode (may happen if e.g. bundled into ESM module)
|
|
24
|
-
// Fallback to standard globalThis if available
|
|
25
|
-
if (typeof globalThis === 'object' && globalThis)
|
|
26
|
-
return globalThis;
|
|
27
|
-
// Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
|
|
28
|
-
// In all ES5+ engines global object inherits from Object.prototype
|
|
29
|
-
// (if you approached one that doesn't please report)
|
|
30
|
-
try {
|
|
31
|
-
Object.defineProperty(Object.prototype, '__global__', {
|
|
32
|
-
get: function () {
|
|
33
|
-
return this;
|
|
34
|
-
},
|
|
35
|
-
configurable: true,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
// Unfortunate case of updates to Object.prototype being restricted
|
|
40
|
-
// via preventExtensions, seal or freeze
|
|
41
|
-
return naiveFallback();
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
// Safari case (window.__global__ works, but __global__ does not)
|
|
45
|
-
if (!__global__)
|
|
46
|
-
return naiveFallback();
|
|
47
|
-
return __global__;
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
delete Object.prototype.__global__;
|
|
51
|
-
}
|
|
52
|
-
})();
|
package/Utils/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * as Colors from './Colors';
|
|
2
|
-
export * as DateTime from './DateTime';
|
|
3
|
-
export * as Fields from './Fields';
|
|
4
|
-
export * as Files from './Files';
|
|
5
|
-
export * as Locales from './Locales';
|
|
6
|
-
export * as Primitives from './Primitives';
|
|
7
|
-
export * as Strings from './Strings';
|
|
8
|
-
export * as Token from './Token';
|
package/Utils/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * as Colors from './Colors';
|
|
2
|
-
export * as DateTime from './DateTime';
|
|
3
|
-
export * as Fields from './Fields';
|
|
4
|
-
export * as Files from './Files';
|
|
5
|
-
export * as Locales from './Locales';
|
|
6
|
-
export * as Primitives from './Primitives';
|
|
7
|
-
export * as Strings from './Strings';
|
|
8
|
-
export * as Token from './Token';
|
package/VerdocsEndpoint.d.ts
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { TSession, TSessionType } from './Sessions/Types';
|
|
3
|
-
export type TEnvironment = 'verdocs' | 'verdocs-stage';
|
|
4
|
-
export type TSessionChangedListener = (endpoint: VerdocsEndpoint, session: TSession) => void;
|
|
5
|
-
export interface VerdocsEndpointOptions {
|
|
6
|
-
baseURL?: string;
|
|
7
|
-
timeout?: number;
|
|
8
|
-
environment?: TEnvironment;
|
|
9
|
-
sessionType?: TSessionType;
|
|
10
|
-
clientID?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
|
|
14
|
-
* Endpoints can be used for isolated session tasks.
|
|
15
|
-
*
|
|
16
|
-
* For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
|
|
17
|
-
* In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
|
|
18
|
-
* discarded once signing is complete.
|
|
19
|
-
*
|
|
20
|
-
* Note that endpoint configuration functions return the instance, so they can be chained, e.g.
|
|
21
|
-
*
|
|
22
|
-
* ```typescript
|
|
23
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
24
|
-
*
|
|
25
|
-
* const endpoint = new VerdocsEndpoint();
|
|
26
|
-
* endpoint
|
|
27
|
-
* .setSessionType('signing')
|
|
28
|
-
* .logRequests(true)
|
|
29
|
-
* .setClientID('1234)
|
|
30
|
-
* .setTimeout(30000);
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare class VerdocsEndpoint {
|
|
34
|
-
private environment;
|
|
35
|
-
private sessionType;
|
|
36
|
-
private baseURL;
|
|
37
|
-
private clientID;
|
|
38
|
-
private timeout;
|
|
39
|
-
private token;
|
|
40
|
-
private nextListenerId;
|
|
41
|
-
private sessionListeners;
|
|
42
|
-
private requestLoggerId;
|
|
43
|
-
/**
|
|
44
|
-
* The current user session, or null if not authenticated. May be either a User or Signing session. If set, the
|
|
45
|
-
* presence of the `document_id` field can be used to differentiate the types. Only signing sessions are associated
|
|
46
|
-
* with Envelopes.
|
|
47
|
-
*/
|
|
48
|
-
session: TSession;
|
|
49
|
-
api: AxiosInstance;
|
|
50
|
-
/**
|
|
51
|
-
* Create a new VerdocsEndpoint to call Verdocs platform services.
|
|
52
|
-
*
|
|
53
|
-
* ```typescript
|
|
54
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
55
|
-
* const endpoint = new VerdocsEndpoint();
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
constructor(options?: VerdocsEndpointOptions);
|
|
59
|
-
setDefault(): void;
|
|
60
|
-
static getDefault(): VerdocsEndpoint;
|
|
61
|
-
/**
|
|
62
|
-
* Get the current environment.
|
|
63
|
-
*/
|
|
64
|
-
getEnvironment(): TEnvironment;
|
|
65
|
-
/**
|
|
66
|
-
* Get the current session type.
|
|
67
|
-
*/
|
|
68
|
-
getSessionType(): TSessionType;
|
|
69
|
-
/**
|
|
70
|
-
* Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
|
|
71
|
-
*/
|
|
72
|
-
getBaseURL(): string;
|
|
73
|
-
/**
|
|
74
|
-
* Get the current client ID, if set.
|
|
75
|
-
*/
|
|
76
|
-
getClientID(): string;
|
|
77
|
-
/**
|
|
78
|
-
* Get the current timeout.
|
|
79
|
-
*/
|
|
80
|
-
getTimeout(): number;
|
|
81
|
-
/**
|
|
82
|
-
* Get the current session, if any.
|
|
83
|
-
*/
|
|
84
|
-
getSession(): TSession;
|
|
85
|
-
/**
|
|
86
|
-
* Set the operating environment. This should rarely be anything other than 'verdocs'.
|
|
87
|
-
*
|
|
88
|
-
* ```typescript
|
|
89
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
90
|
-
*
|
|
91
|
-
* const endpoint = new VerdocsEndpoint();
|
|
92
|
-
* endpoint.setEnvironment('verdocs-stage');
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
setEnvironment(environment: TEnvironment): VerdocsEndpoint;
|
|
96
|
-
/**
|
|
97
|
-
* Set the session type. In general this should be done immediately when the endpoint is created. Changing the
|
|
98
|
-
* session type may be done at any time, but may have unintended consequences if the endpoint is shared between
|
|
99
|
-
* multiple widgets.
|
|
100
|
-
*
|
|
101
|
-
* Changing the session type will clear/reload the action session. This may trigger notifications to session state
|
|
102
|
-
* observers. Apps that use observers to trigger UI updates such as logging the user out should be prepared to
|
|
103
|
-
* handle this event.
|
|
104
|
-
*
|
|
105
|
-
* ```typescript
|
|
106
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
107
|
-
*
|
|
108
|
-
* const endpoint = new VerdocsEndpoint();
|
|
109
|
-
* endpoint.setEnvironment('verdocs-stage');
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
setSessionType(sessionType: TSessionType): VerdocsEndpoint;
|
|
113
|
-
/**
|
|
114
|
-
* Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
|
|
115
|
-
*
|
|
116
|
-
* ```typescript
|
|
117
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
118
|
-
*
|
|
119
|
-
* const endpoint = new VerdocsEndpoint();
|
|
120
|
-
* endpoint.setBaseURL('https://api.verdocs.com');
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
setBaseURL(url: string): VerdocsEndpoint;
|
|
124
|
-
/**
|
|
125
|
-
* Set the Client ID for Verdocs API calls.
|
|
126
|
-
*
|
|
127
|
-
* ```typescript
|
|
128
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
129
|
-
*
|
|
130
|
-
* const endpoint = new VerdocsEndpoint();
|
|
131
|
-
* endpoint.setClientID('1234);
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
setClientID(clientID: string): VerdocsEndpoint;
|
|
135
|
-
/**
|
|
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.
|
|
139
|
-
*
|
|
140
|
-
* ```typescript
|
|
141
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
142
|
-
*
|
|
143
|
-
* const endpoint = new VerdocsEndpoint();
|
|
144
|
-
* endpoint.setTimeout(3000);
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
setTimeout(timeout: number): VerdocsEndpoint;
|
|
148
|
-
/**
|
|
149
|
-
* Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
|
|
150
|
-
*
|
|
151
|
-
* ```typescript
|
|
152
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
153
|
-
*
|
|
154
|
-
* const endpoint = new VerdocsEndpoint();
|
|
155
|
-
* endpoint.logRequests(true);
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
logRequests(enable: boolean): VerdocsEndpoint;
|
|
159
|
-
/**
|
|
160
|
-
* Set the authorization token that will be used for Verdocs API calls. This will also set the session metadata
|
|
161
|
-
* and notify any listeners of the new data.
|
|
162
|
-
*
|
|
163
|
-
* If this Endpoint will be used for non-default purposes (e.g. signing, or in an alternate environment) those
|
|
164
|
-
* settings should be made before calling this. Sessions are persisted to localStorage, and the environment and
|
|
165
|
-
* type become part of the storage key.
|
|
166
|
-
*
|
|
167
|
-
* ```typescript
|
|
168
|
-
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
169
|
-
*
|
|
170
|
-
* const endpoint = new VerdocsEndpoint();
|
|
171
|
-
* endpoint.setToken(accessToken);
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
setToken(token: string | null): VerdocsEndpoint;
|
|
175
|
-
/**
|
|
176
|
-
* Retrieves the current session token, if any. Tokens should rarely be used for direct actions, but this is
|
|
177
|
-
* required by the `<VerdocsView>` and other components to authorize requests to raw PDF files.
|
|
178
|
-
*/
|
|
179
|
-
getToken(): string | null;
|
|
180
|
-
private sessionStorageKey;
|
|
181
|
-
/**
|
|
182
|
-
* Clear the active session.
|
|
183
|
-
*/
|
|
184
|
-
clearSession(): this;
|
|
185
|
-
/**
|
|
186
|
-
* Clear the active signing session.
|
|
187
|
-
*/
|
|
188
|
-
clearSignerSession(): this;
|
|
189
|
-
private notifySessionListeners;
|
|
190
|
-
/**
|
|
191
|
-
* Subscribe to session state change events.
|
|
192
|
-
*/
|
|
193
|
-
onSessionChanged(listener: TSessionChangedListener): () => void;
|
|
194
|
-
/**
|
|
195
|
-
* Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app
|
|
196
|
-
* or component starts.
|
|
197
|
-
*/
|
|
198
|
-
loadSession(): VerdocsEndpoint;
|
|
199
|
-
}
|