@verdocs/js-sdk 4.2.27 → 4.2.30
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/index.d.mts +158 -227
- package/dist/index.d.ts +158 -227
- package/dist/index.js +43 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -108
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -847,8 +847,6 @@ interface ITemplateField {
|
|
|
847
847
|
placeholder: string | null;
|
|
848
848
|
/** For fields that support grouping (radio buttons and check boxes) the value selected will be stored under this name. */
|
|
849
849
|
group: string | null;
|
|
850
|
-
// @deprecated. Use settings instead.
|
|
851
|
-
setting?: ITemplateFieldSetting | null;
|
|
852
850
|
}
|
|
853
851
|
interface ITextFieldSetting {
|
|
854
852
|
x: number;
|
|
@@ -2111,16 +2109,34 @@ declare const canPerformTemplateAction: (profile: IProfile | null | undefined, a
|
|
|
2111
2109
|
declare const hasRequiredPermissions: (profile: IProfile | null | undefined, permissions: TPermission[]) => boolean;
|
|
2112
2110
|
/**
|
|
2113
2111
|
* Add a field to a template.
|
|
2112
|
+
*
|
|
2113
|
+
* ```typescript
|
|
2114
|
+
* import {createField} from '@verdocs/js-sdk/Templates';
|
|
2115
|
+
*
|
|
2116
|
+
* await createField((VerdocsEndpoint.getDefault(), template_id, { ... });
|
|
2117
|
+
* ```
|
|
2114
2118
|
*/
|
|
2115
2119
|
declare const createField: (endpoint: VerdocsEndpoint, templateId: string, params: ITemplateField) => Promise<ITemplateField>;
|
|
2116
2120
|
/**
|
|
2117
2121
|
* Update a template field.
|
|
2122
|
+
*
|
|
2123
|
+
* ```typescript
|
|
2124
|
+
* import {updateField} from '@verdocs/js-sdk/Templates';
|
|
2125
|
+
*
|
|
2126
|
+
* await updateField((VerdocsEndpoint.getDefault(), template_id, field_name, { ... });
|
|
2127
|
+
* ```
|
|
2118
2128
|
*/
|
|
2119
|
-
declare const updateField: (endpoint: VerdocsEndpoint, templateId: string,
|
|
2129
|
+
declare const updateField: (endpoint: VerdocsEndpoint, templateId: string, name: string, params: Partial<ITemplateField>) => Promise<ITemplateField>;
|
|
2120
2130
|
/**
|
|
2121
|
-
*
|
|
2131
|
+
* Remove a field from a template.
|
|
2132
|
+
*
|
|
2133
|
+
* ```typescript
|
|
2134
|
+
* import {deleteField} from '@verdocs/js-sdk/Templates';
|
|
2135
|
+
*
|
|
2136
|
+
* await deleteField((VerdocsEndpoint.getDefault(), template_id, field_name);
|
|
2137
|
+
* ```
|
|
2122
2138
|
*/
|
|
2123
|
-
declare const deleteField: (endpoint: VerdocsEndpoint, templateId: string,
|
|
2139
|
+
declare const deleteField: (endpoint: VerdocsEndpoint, templateId: string, name: string) => Promise<any>;
|
|
2124
2140
|
/**
|
|
2125
2141
|
* Check to see if the user created the template.
|
|
2126
2142
|
*/
|
|
@@ -2239,131 +2255,6 @@ declare const updateTemplateRole: (endpoint: VerdocsEndpoint, template_id: strin
|
|
|
2239
2255
|
* ```
|
|
2240
2256
|
*/
|
|
2241
2257
|
declare const deleteTemplateRole: (endpoint: VerdocsEndpoint, template_id: string, name: string) => Promise<any>;
|
|
2242
|
-
/**
|
|
2243
|
-
* Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
|
|
2244
|
-
*/
|
|
2245
|
-
declare function getRGB(rgba: string): string;
|
|
2246
|
-
/**
|
|
2247
|
-
* Given a signer role index, return the color code for that signer.
|
|
2248
|
-
*/
|
|
2249
|
-
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)";
|
|
2250
|
-
/**
|
|
2251
|
-
* Given a role name, return a color code for it. This works by computing a hash code so the specific color returned
|
|
2252
|
-
* is not specified explicitly, but will be the same for every call with the same input value.
|
|
2253
|
-
*/
|
|
2254
|
-
declare function nameToRGBA(str: string): string | undefined;
|
|
2255
|
-
/**
|
|
2256
|
-
* Helper function to obtain a color code given a role name given various possible inputs.
|
|
2257
|
-
*/
|
|
2258
|
-
declare function getRoleColor(name: string, roles: TRole[], index?: number): string | undefined;
|
|
2259
|
-
interface IFileWithData {
|
|
2260
|
-
lastModified: number;
|
|
2261
|
-
size: number;
|
|
2262
|
-
type: string;
|
|
2263
|
-
name: string;
|
|
2264
|
-
data: string;
|
|
2265
|
-
}
|
|
2266
|
-
interface ICountry {
|
|
2267
|
-
code: string;
|
|
2268
|
-
name: string;
|
|
2269
|
-
value: string;
|
|
2270
|
-
}
|
|
2271
|
-
interface ITimePeriod {
|
|
2272
|
-
start_time: string;
|
|
2273
|
-
end_time: string;
|
|
2274
|
-
}
|
|
2275
|
-
declare const formatShortTimeAgo: (val: any) => string;
|
|
2276
|
-
declare function timePeriod(type: string): ITimePeriod | null;
|
|
2277
|
-
declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
2278
|
-
declare function getRLeft(x: number, ratio: number): number;
|
|
2279
|
-
declare function getRValue(y: number, ratio: number): number;
|
|
2280
|
-
declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
2281
|
-
declare function rescale(r: number, n: number): number;
|
|
2282
|
-
/**
|
|
2283
|
-
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
2284
|
-
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
2285
|
-
*/
|
|
2286
|
-
declare const fileToDataUrl: (file: File) => Promise<IFileWithData>;
|
|
2287
|
-
/**
|
|
2288
|
-
* Trigger a download dialog to save a blob as a file on disk.
|
|
2289
|
-
*/
|
|
2290
|
-
declare const downloadBlob: (blob: Blob, name?: string) => void;
|
|
2291
|
-
declare const Countries: ICountry[];
|
|
2292
|
-
declare function getCountryByCode(code: string): ICountry | null;
|
|
2293
|
-
declare function isFrenchGuiana(code: string): boolean;
|
|
2294
|
-
declare function isGuadeloupe(code: string): boolean;
|
|
2295
|
-
declare function isMartinique(code: string): boolean;
|
|
2296
|
-
declare function isMayotte(code: string): boolean;
|
|
2297
|
-
declare function getPlusOneCountry(code: string): ICountry | null;
|
|
2298
|
-
declare function isCanada(code: string): boolean;
|
|
2299
|
-
declare function isAmericanSamoa(code: string): boolean;
|
|
2300
|
-
declare function isDominicanRepublic(code: string): boolean;
|
|
2301
|
-
declare function isPuertoRico(code: string): boolean;
|
|
2302
|
-
// need to finish
|
|
2303
|
-
declare function getMatchingCountry(code: string, substrings: number): number;
|
|
2304
|
-
/**
|
|
2305
|
-
* Create an array containing a sequence of integers, e.g. [START, START+1, START+2, ...] This is frequently useful
|
|
2306
|
-
* in rendering operations when there is no source array to .map() across.
|
|
2307
|
-
*/
|
|
2308
|
-
declare const integerSequence: (start: number, count: number) => number[];
|
|
2309
|
-
/**
|
|
2310
|
-
* Format a profile's full name
|
|
2311
|
-
*/
|
|
2312
|
-
declare const formatFullName: (profile?: IProfile) => string;
|
|
2313
|
-
/**
|
|
2314
|
-
* Format a profile's initials
|
|
2315
|
-
*/
|
|
2316
|
-
declare const formatInitials: (profile?: IProfile) => string;
|
|
2317
|
-
/**
|
|
2318
|
-
* Generate suggested initials for a full name, e.g. "John Doe" will yield "JD".
|
|
2319
|
-
*/
|
|
2320
|
-
declare const fullNameToInitials: (name: string) => string;
|
|
2321
|
-
/**
|
|
2322
|
-
* Capitalize the first letter of a string.
|
|
2323
|
-
*/
|
|
2324
|
-
declare const capitalize: (str: string) => string;
|
|
2325
|
-
/**
|
|
2326
|
-
* Convert a phone-number-like string to E164 format.
|
|
2327
|
-
* @see https://46elks.com/kb/e164
|
|
2328
|
-
*/
|
|
2329
|
-
declare const convertToE164: (input: string) => string;
|
|
2330
|
-
/**
|
|
2331
|
-
* Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
|
|
2332
|
-
* Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
|
|
2333
|
-
*/
|
|
2334
|
-
declare const AtoB: (str: string) => string;
|
|
2335
|
-
/**
|
|
2336
|
-
* Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
|
|
2337
|
-
* many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
|
|
2338
|
-
*/
|
|
2339
|
-
declare const decodeJWTBody: (token: string) => any;
|
|
2340
|
-
/**
|
|
2341
|
-
* Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
|
|
2342
|
-
* `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
|
|
2343
|
-
* will be removed. Note that user and signing sessions have different access token formats. The calling
|
|
2344
|
-
* application should distinguish between the two based on the context of the authenticated session, or by
|
|
2345
|
-
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
2346
|
-
*/
|
|
2347
|
-
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
2348
|
-
interface ITemplateSearchParams {
|
|
2349
|
-
id?: string;
|
|
2350
|
-
name?: string;
|
|
2351
|
-
sender?: string;
|
|
2352
|
-
description?: string;
|
|
2353
|
-
profile_id?: string;
|
|
2354
|
-
organization_id?: string;
|
|
2355
|
-
updated_at?: ITimePeriod;
|
|
2356
|
-
created_at?: ITimePeriod;
|
|
2357
|
-
last_used_at?: ITimePeriod;
|
|
2358
|
-
is_personal?: boolean;
|
|
2359
|
-
is_public?: boolean;
|
|
2360
|
-
tags?: string[];
|
|
2361
|
-
document_name?: string;
|
|
2362
|
-
sort_by?: TSortTemplateBy;
|
|
2363
|
-
ascending?: boolean;
|
|
2364
|
-
row?: number;
|
|
2365
|
-
page?: number;
|
|
2366
|
-
}
|
|
2367
2258
|
interface ITemplateTag {
|
|
2368
2259
|
tag_name: string;
|
|
2369
2260
|
template_id: string;
|
|
@@ -2416,53 +2307,50 @@ declare const getTag: (endpoint: VerdocsEndpoint, name: string) => Promise<ITag>
|
|
|
2416
2307
|
* Get all tags available for use by an Organization.
|
|
2417
2308
|
*/
|
|
2418
2309
|
declare const getAllTags: (endpoint: VerdocsEndpoint) => Promise<ITag[]>;
|
|
2310
|
+
type ITemplateSortBy = "created_at" | "updated_at" | "name" | "last_used_at" | "counter" | "star_counter";
|
|
2419
2311
|
interface IGetTemplatesParams {
|
|
2312
|
+
/** List only those templates whose names, descriptions, etc contain this search term. */
|
|
2313
|
+
q?: string;
|
|
2314
|
+
/** List only those templates with at least one "star". */
|
|
2420
2315
|
is_starred?: boolean;
|
|
2316
|
+
/** List only those templates created by the caller. */
|
|
2421
2317
|
is_creator?: boolean;
|
|
2422
|
-
|
|
2318
|
+
/**
|
|
2319
|
+
* List only personal templates. To list shared templates, set this to false and is_public to false.
|
|
2320
|
+
* To list all templates, omit this field.
|
|
2321
|
+
*/
|
|
2322
|
+
is_personal?: boolean;
|
|
2323
|
+
/** List only public templates */
|
|
2324
|
+
is_public?: boolean;
|
|
2325
|
+
/** Sort order */
|
|
2326
|
+
sort_by?: TSortTemplateBy;
|
|
2327
|
+
/** Set to true or false to control the sort order. Omit this field to sort dates descending, names ascending. */
|
|
2328
|
+
ascending?: boolean;
|
|
2329
|
+
/** Number of rows to retrieve. Defaults to 10. */
|
|
2330
|
+
rows?: number;
|
|
2331
|
+
/** Page to retrieve (0-based). Defaults to 0. */
|
|
2332
|
+
page?: number;
|
|
2423
2333
|
}
|
|
2424
2334
|
/**
|
|
2425
2335
|
* Get all templates accessible by the caller, with optional filters.
|
|
2426
2336
|
*
|
|
2427
2337
|
* ```typescript
|
|
2428
|
-
* import {
|
|
2338
|
+
* import {getTemplates} from '@verdocs/js-sdk/Templates';
|
|
2429
2339
|
*
|
|
2430
|
-
* await
|
|
2431
|
-
* await
|
|
2432
|
-
* await
|
|
2433
|
-
* await
|
|
2340
|
+
* await getTemplates((VerdocsEndpoint.getDefault());
|
|
2341
|
+
* await getTemplates((VerdocsEndpoint.getDefault(), { is_starred: true });
|
|
2342
|
+
* await getTemplates((VerdocsEndpoint.getDefault(), { is_creator: true });
|
|
2343
|
+
* await getTemplates((VerdocsEndpoint.getDefault(), { is_organization: true });
|
|
2434
2344
|
* ```
|
|
2435
2345
|
*/
|
|
2436
2346
|
declare const getTemplates: (endpoint: VerdocsEndpoint, params?: IGetTemplatesParams) => Promise<ITemplate[]>;
|
|
2437
|
-
// export interface IListTemplatesParams {
|
|
2438
|
-
// name?: string;
|
|
2439
|
-
// sharing?: 'all' | 'personal' | 'shared' | 'public';
|
|
2440
|
-
// starred?: 'all' | 'starred' | 'unstarred';
|
|
2441
|
-
// sort?: 'name' | 'created_at' | 'updated_at' | 'last_used_at' | 'counter' | 'star_counter';
|
|
2442
|
-
// direction?: 'asc' | 'desc';
|
|
2443
|
-
// page?: number;
|
|
2444
|
-
// rows?: number;
|
|
2445
|
-
// }
|
|
2446
|
-
/**
|
|
2447
|
-
* Lists all templates accessible by the caller, with optional filters.
|
|
2448
|
-
*
|
|
2449
|
-
* ```typescript
|
|
2450
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2451
|
-
*
|
|
2452
|
-
* await Templates.listTemplates((VerdocsEndpoint.getDefault(), { sharing: 'personal', sort: 'last_used_at' });
|
|
2453
|
-
* ```
|
|
2454
|
-
*/
|
|
2455
|
-
// export const listTemplates = (endpoint: VerdocsEndpoint, params?: IListTemplatesParams) =>
|
|
2456
|
-
// endpoint.api //
|
|
2457
|
-
// .post<ITemplateSummaries>('/templates/list', params, {baseURL: endpoint.getBaseURLv2()})
|
|
2458
|
-
// .then((r) => r.data);
|
|
2459
2347
|
/**
|
|
2460
2348
|
* Get one template by its ID.
|
|
2461
2349
|
*
|
|
2462
2350
|
* ```typescript
|
|
2463
|
-
* import {
|
|
2351
|
+
* import {getTemplate} from '@verdocs/js-sdk/Templates';
|
|
2464
2352
|
*
|
|
2465
|
-
* const template = await
|
|
2353
|
+
* const template = await getTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
2466
2354
|
* ```
|
|
2467
2355
|
*/
|
|
2468
2356
|
declare const getTemplate: (endpoint: VerdocsEndpoint, templateId: string) => Promise<ITemplate>;
|
|
@@ -2524,9 +2412,9 @@ interface ITemplateCreateParams {
|
|
|
2524
2412
|
* Create a template.
|
|
2525
2413
|
*
|
|
2526
2414
|
* ```typescript
|
|
2527
|
-
* import {
|
|
2415
|
+
* import {createTemplate} from '@verdocs/js-sdk/Templates';
|
|
2528
2416
|
*
|
|
2529
|
-
* const newTemplate = await
|
|
2417
|
+
* const newTemplate = await createTemplate((VerdocsEndpoint.getDefault(), {...});
|
|
2530
2418
|
* ```
|
|
2531
2419
|
*/
|
|
2532
2420
|
declare const createTemplate: (endpoint: VerdocsEndpoint, params: ITemplateCreateParams, onUploadProgress?: (percent: number, loadedBytes: number, totalBytes: number) => void) => Promise<ITemplate>;
|
|
@@ -2548,9 +2436,9 @@ interface ITemplateCreateFromSharepointParams {
|
|
|
2548
2436
|
* Create a template from a Sharepoint asset.
|
|
2549
2437
|
*
|
|
2550
2438
|
* ```typescript
|
|
2551
|
-
* import {
|
|
2439
|
+
* import {createTemplateFromSharepoint} from '@verdocs/js-sdk/Templates';
|
|
2552
2440
|
*
|
|
2553
|
-
* const newTemplate = await
|
|
2441
|
+
* const newTemplate = await createTemplateFromSharepoint((VerdocsEndpoint.getDefault(), {...});
|
|
2554
2442
|
* ```
|
|
2555
2443
|
*/
|
|
2556
2444
|
declare const createTemplateFromSharepoint: (endpoint: VerdocsEndpoint, params: ITemplateCreateFromSharepointParams) => Promise<ITemplate>;
|
|
@@ -2558,9 +2446,9 @@ declare const createTemplateFromSharepoint: (endpoint: VerdocsEndpoint, params:
|
|
|
2558
2446
|
* Update a template.
|
|
2559
2447
|
*
|
|
2560
2448
|
* ```typescript
|
|
2561
|
-
* import {
|
|
2449
|
+
* import {updateTemplate} from '@verdocs/js-sdk/Templates';
|
|
2562
2450
|
*
|
|
2563
|
-
* const updatedTemplate = await
|
|
2451
|
+
* const updatedTemplate = await updateTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9', { name: 'New Name' });
|
|
2564
2452
|
* ```
|
|
2565
2453
|
*/
|
|
2566
2454
|
declare const updateTemplate: (endpoint: VerdocsEndpoint, templateId: string, params: Partial<ITemplateCreateParams>) => Promise<ITemplate>;
|
|
@@ -2568,70 +2456,12 @@ declare const updateTemplate: (endpoint: VerdocsEndpoint, templateId: string, pa
|
|
|
2568
2456
|
* Delete a template.
|
|
2569
2457
|
*
|
|
2570
2458
|
* ```typescript
|
|
2571
|
-
* import {
|
|
2459
|
+
* import {deleteTemplate} from '@verdocs/js-sdk/Templates';
|
|
2572
2460
|
*
|
|
2573
|
-
* await
|
|
2461
|
+
* await deleteTemplate((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
2574
2462
|
* ```
|
|
2575
2463
|
*/
|
|
2576
2464
|
declare const deleteTemplate: (endpoint: VerdocsEndpoint, templateId: string) => Promise<any>;
|
|
2577
|
-
/**
|
|
2578
|
-
* Search for templates matching various criteria.
|
|
2579
|
-
*
|
|
2580
|
-
* ```typescript
|
|
2581
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2582
|
-
*
|
|
2583
|
-
* const {result, page, total} = await Templates.search((VerdocsEndpoint.getDefault(), { ... });
|
|
2584
|
-
* ```
|
|
2585
|
-
*/
|
|
2586
|
-
declare const searchTemplates: (endpoint: VerdocsEndpoint, params: ITemplateSearchParams) => Promise<ITemplateSearchResult>;
|
|
2587
|
-
interface ISearchTimeRange {
|
|
2588
|
-
start_time: string;
|
|
2589
|
-
end_time: string;
|
|
2590
|
-
}
|
|
2591
|
-
type IGetTemplateSummarySortBy = "created_at" | "updated_at" | "name" | "last_used_at" | "counter" | "star_counter";
|
|
2592
|
-
interface IGetTemplateSummaryParams {
|
|
2593
|
-
id?: string;
|
|
2594
|
-
name?: string;
|
|
2595
|
-
sender?: string;
|
|
2596
|
-
profile_id?: string;
|
|
2597
|
-
organization_id?: string;
|
|
2598
|
-
description?: string;
|
|
2599
|
-
created_at?: ISearchTimeRange;
|
|
2600
|
-
updated_at?: ISearchTimeRange;
|
|
2601
|
-
last_used_at?: ISearchTimeRange;
|
|
2602
|
-
is_personal?: boolean;
|
|
2603
|
-
is_public?: boolean;
|
|
2604
|
-
is_starred?: boolean;
|
|
2605
|
-
sort_by?: IGetTemplateSummarySortBy;
|
|
2606
|
-
ascending?: boolean;
|
|
2607
|
-
row?: number;
|
|
2608
|
-
page?: number;
|
|
2609
|
-
}
|
|
2610
|
-
interface ITemplateListParams {
|
|
2611
|
-
status?: string[];
|
|
2612
|
-
q?: string;
|
|
2613
|
-
created_at?: ITimePeriod;
|
|
2614
|
-
is_personal?: boolean;
|
|
2615
|
-
is_public?: boolean;
|
|
2616
|
-
sort_by?: TSortTemplateBy;
|
|
2617
|
-
ascending?: boolean;
|
|
2618
|
-
rows?: number;
|
|
2619
|
-
page?: number;
|
|
2620
|
-
}
|
|
2621
|
-
/**
|
|
2622
|
-
* List templates.
|
|
2623
|
-
*
|
|
2624
|
-
* ```typescript
|
|
2625
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2626
|
-
*
|
|
2627
|
-
* const {totals, templates} = await Templates.listTemplates((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' }); * ```
|
|
2628
|
-
*/
|
|
2629
|
-
declare const listTemplates: (endpoint: VerdocsEndpoint, params?: ITemplateListParams) => Promise<{
|
|
2630
|
-
total: number;
|
|
2631
|
-
rows: number;
|
|
2632
|
-
page: number;
|
|
2633
|
-
templates: ITemplate[];
|
|
2634
|
-
}>;
|
|
2635
2465
|
/**
|
|
2636
2466
|
* Get all the Template Documents associated to a particular Template.
|
|
2637
2467
|
*
|
|
@@ -2710,4 +2540,105 @@ declare const isValidEmail: (email: string | undefined) => boolean;
|
|
|
2710
2540
|
declare const isValidPhone: (phone: string | undefined) => boolean;
|
|
2711
2541
|
declare const isValidRoleName: (value: string, roles: IRole[]) => boolean;
|
|
2712
2542
|
declare const isValidTag: (value: string, tags: string[]) => boolean;
|
|
2713
|
-
|
|
2543
|
+
/**
|
|
2544
|
+
* Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
|
|
2545
|
+
*/
|
|
2546
|
+
declare function getRGB(rgba: string): string;
|
|
2547
|
+
/**
|
|
2548
|
+
* Given a signer role index, return the color code for that signer.
|
|
2549
|
+
*/
|
|
2550
|
+
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)";
|
|
2551
|
+
/**
|
|
2552
|
+
* Given a role name, return a color code for it. This works by computing a hash code so the specific color returned
|
|
2553
|
+
* is not specified explicitly, but will be the same for every call with the same input value.
|
|
2554
|
+
*/
|
|
2555
|
+
declare function nameToRGBA(str: string): string | undefined;
|
|
2556
|
+
/**
|
|
2557
|
+
* Helper function to obtain a color code given a role name given various possible inputs.
|
|
2558
|
+
*/
|
|
2559
|
+
declare function getRoleColor(name: string, roles: TRole[], index?: number): string | undefined;
|
|
2560
|
+
declare const formatShortTimeAgo: (val: any) => string;
|
|
2561
|
+
declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
|
|
2562
|
+
declare function getRLeft(x: number, ratio: number): number;
|
|
2563
|
+
declare function getRValue(y: number, ratio: number): number;
|
|
2564
|
+
declare function blobToBase64(image: Blob): Promise<unknown>;
|
|
2565
|
+
declare function rescale(r: number, n: number): number;
|
|
2566
|
+
interface IFileWithData {
|
|
2567
|
+
lastModified: number;
|
|
2568
|
+
size: number;
|
|
2569
|
+
type: string;
|
|
2570
|
+
name: string;
|
|
2571
|
+
data: string;
|
|
2572
|
+
}
|
|
2573
|
+
interface ICountry {
|
|
2574
|
+
code: string;
|
|
2575
|
+
name: string;
|
|
2576
|
+
value: string;
|
|
2577
|
+
}
|
|
2578
|
+
/**
|
|
2579
|
+
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
2580
|
+
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
2581
|
+
*/
|
|
2582
|
+
declare const fileToDataUrl: (file: File) => Promise<IFileWithData>;
|
|
2583
|
+
/**
|
|
2584
|
+
* Trigger a download dialog to save a blob as a file on disk.
|
|
2585
|
+
*/
|
|
2586
|
+
declare const downloadBlob: (blob: Blob, name?: string) => void;
|
|
2587
|
+
declare const Countries: ICountry[];
|
|
2588
|
+
declare function getCountryByCode(code: string): ICountry | null;
|
|
2589
|
+
declare function isFrenchGuiana(code: string): boolean;
|
|
2590
|
+
declare function isGuadeloupe(code: string): boolean;
|
|
2591
|
+
declare function isMartinique(code: string): boolean;
|
|
2592
|
+
declare function isMayotte(code: string): boolean;
|
|
2593
|
+
declare function getPlusOneCountry(code: string): ICountry | null;
|
|
2594
|
+
declare function isCanada(code: string): boolean;
|
|
2595
|
+
declare function isAmericanSamoa(code: string): boolean;
|
|
2596
|
+
declare function isDominicanRepublic(code: string): boolean;
|
|
2597
|
+
declare function isPuertoRico(code: string): boolean;
|
|
2598
|
+
// need to finish
|
|
2599
|
+
declare function getMatchingCountry(code: string, substrings: number): number;
|
|
2600
|
+
/**
|
|
2601
|
+
* Create an array containing a sequence of integers, e.g. [START, START+1, START+2, ...] This is frequently useful
|
|
2602
|
+
* in rendering operations when there is no source array to .map() across.
|
|
2603
|
+
*/
|
|
2604
|
+
declare const integerSequence: (start: number, count: number) => number[];
|
|
2605
|
+
/**
|
|
2606
|
+
* Format a profile's full name
|
|
2607
|
+
*/
|
|
2608
|
+
declare const formatFullName: (profile?: IProfile) => string;
|
|
2609
|
+
/**
|
|
2610
|
+
* Format a profile's initials
|
|
2611
|
+
*/
|
|
2612
|
+
declare const formatInitials: (profile?: IProfile) => string;
|
|
2613
|
+
/**
|
|
2614
|
+
* Generate suggested initials for a full name, e.g. "John Doe" will yield "JD".
|
|
2615
|
+
*/
|
|
2616
|
+
declare const fullNameToInitials: (name: string) => string;
|
|
2617
|
+
/**
|
|
2618
|
+
* Capitalize the first letter of a string.
|
|
2619
|
+
*/
|
|
2620
|
+
declare const capitalize: (str: string) => string;
|
|
2621
|
+
/**
|
|
2622
|
+
* Convert a phone-number-like string to E164 format.
|
|
2623
|
+
* @see https://46elks.com/kb/e164
|
|
2624
|
+
*/
|
|
2625
|
+
declare const convertToE164: (input: string) => string;
|
|
2626
|
+
/**
|
|
2627
|
+
* Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
|
|
2628
|
+
* Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
|
|
2629
|
+
*/
|
|
2630
|
+
declare const AtoB: (str: string) => string;
|
|
2631
|
+
/**
|
|
2632
|
+
* Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
|
|
2633
|
+
* many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
|
|
2634
|
+
*/
|
|
2635
|
+
declare const decodeJWTBody: (token: string) => any;
|
|
2636
|
+
/**
|
|
2637
|
+
* Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
|
|
2638
|
+
* `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
|
|
2639
|
+
* will be removed. Note that user and signing sessions have different access token formats. The calling
|
|
2640
|
+
* application should distinguish between the two based on the context of the authenticated session, or by
|
|
2641
|
+
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
2642
|
+
*/
|
|
2643
|
+
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
2644
|
+
export { TRequestStatus, TTemplateSenderType, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_SETTINGS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IReminder, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelopesSummary, getEnvelopeRecipients, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, ISignerTokenResponse, getSigningSession, getSignerToken, getInPersonLink, sendDelegate, resendInvitation, createEnvelopeReminder, getEnvelopeReminder, updateEnvelopeReminder, deleteEnvelopeReminder, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IEnvelopesSummary, IDocumentSearchOptions, ICreateEnvelopeRole, IEnvelopeSummaries, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getGroups, getGroup, createGroup, addGroupMember, deleteGroupMember, updateGroup, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, updateOrganization, updateOrganizationLogo, updateOrganizationThumbnail, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, ICreateTemplateReminderRequest, createTemplateReminder, getTemplateReminder, updateTemplateReminder, deleteTemplateReminder, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|