@verdocs/js-sdk 4.2.0 → 4.2.2

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.ts CHANGED
@@ -1,8 +1,131 @@
1
1
  import { AxiosInstance } from "axios";
2
- type TTemplatePermission = "template:creator:create:public" | "template:creator:create:org" | "template:creator:create:personal" | "template:creator:delete" | "template:creator:visibility" | "template:member:read" | "template:member:write" | "template:member:delete" | "template:member:visibility";
3
- type TAccountPermission = "owner:add" | "owner:remove" | "admin:add" | "admin:remove" | "member:view" | "member:add" | "member:remove";
4
- type TOrgPermission = "org:create" | "org:view" | "org:update" | "org:delete" | "org:transfer" | "org:list";
5
- type TEnvelopePermission = "envelope:create" | "envelope:cancel" | "envelope:view";
2
+ /**
3
+ * Create public templates. Public templates are still owned and managed by the creator,
4
+ * but may be searched for and used to create envelopes by other users.
5
+ */
6
+ type TTemplatePermissionCreatePublic = "template:creator:create:public";
7
+ /**
8
+ * Create templates shared with other users of the same organization.
9
+ */
10
+ type TTemplatePermissionCreateOrg = "template:creator:create:org";
11
+ /**
12
+ * Create templates private to the creator.
13
+ */
14
+ type TTemplatePermissionCreatePersonal = "template:creator:create:personal";
15
+ /**
16
+ * Create templates private to the creator.
17
+ */
18
+ type TTemplatePermissionDelete = "template:creator:delete";
19
+ /**
20
+ * Alter the visiiblity settings on a template.
21
+ */
22
+ type TTemplatePermissionVisibility = "template:creator:visibility";
23
+ /**
24
+ * View templates shared by other members of the same organization. Those templates must also
25
+ * have `is_personal` set to false to be visible.
26
+ */
27
+ type TTemplateMemberRead = "template:member:read";
28
+ /**
29
+ * Edit templates shared by other members of the same organization. Those templates must also
30
+ * have `is_personal` set to false to be editable.
31
+ */
32
+ type TTemplateMemberWrite = "template:member:write";
33
+ /**
34
+ * Edit templates shared by other members of the same organization. Those templates must also
35
+ * have `is_personal` set to false to be editable.
36
+ */
37
+ type TTemplateMemberDelete = "template:member:delete";
38
+ /**
39
+ * Edit templates shared by other members of the same organization. Those templates must also
40
+ * have `is_personal` set to false to be editable.
41
+ */
42
+ type TTemplateMemberVisibility = "template:member:visibility";
43
+ type TTemplatePermission = TTemplatePermissionCreatePublic | TTemplatePermissionCreateOrg | TTemplatePermissionCreatePersonal | TTemplatePermissionDelete | TTemplatePermissionVisibility | TTemplateMemberRead | TTemplateMemberWrite | TTemplateMemberDelete | TTemplateMemberVisibility;
44
+ /**
45
+ * Grant the "owner" role to other organization members.
46
+ */
47
+ type TAccountPermissionOwnerAdd = "owner:add";
48
+ /**
49
+ * Remove the "owner" role from other organization members.
50
+ */
51
+ type TAccountPermissionOwnerRemove = "owner:remove";
52
+ /**
53
+ * Grant the "admin" role to other organization members.
54
+ */
55
+ type TAccountPermissionAdminAdd = "admin:add";
56
+ /**
57
+ * Remove the "admin" role from other organization members.
58
+ */
59
+ type TAccountPermissionAdminRemove = "admin:remove";
60
+ /**
61
+ * View the members of an organization.
62
+ */
63
+ type TAccountPermissionMemberView = "member:view";
64
+ /**
65
+ * Grant the "member" role to other organization members.
66
+ */
67
+ type TAccountPermissionMemberAdd = "member:add";
68
+ /**
69
+ * Remove the "member" role from other organization members.
70
+ */
71
+ type TAccountPermissionMemberRemove = "member:remove";
72
+ type TAccountPermission = TAccountPermissionOwnerAdd | TAccountPermissionOwnerRemove | TAccountPermissionAdminAdd | TAccountPermissionAdminRemove | TAccountPermissionMemberAdd | TAccountPermissionMemberRemove | TAccountPermissionMemberView;
73
+ /**
74
+ * Create a new organization.
75
+ * @deprecated This is a system-wide setting and organization owners cannot prevent their
76
+ * members from listing other organizations that they may have separate profiles in.
77
+ */
78
+ type TOrgPermissionCreate = "org:create";
79
+ /**
80
+ * View the organization.
81
+ */
82
+ type TOrgPermissionView = "org:view";
83
+ /**
84
+ * Update the organization.
85
+ */
86
+ type TOrgPermissionUpdate = "org:update";
87
+ /**
88
+ * Delete the organization.
89
+ */
90
+ type TOrgPermissionDelete = "org:delete";
91
+ /**
92
+ * Transfer ownership of the organization. This primarily allows the holder to remove his/her own
93
+ * Owner role or add new Owners even if the holder is not one themselves. This is primarily intended
94
+ * to be used for reseller scenarios.
95
+ */
96
+ type TOrgPermissionTransfer = "org:transfer";
97
+ /**
98
+ * List organizations.
99
+ * @deprecated This is a system-wide setting and organization owners cannot prevent their
100
+ * members from listing other organizations that they may have separate profiles in.
101
+ */
102
+ type TOrgPermissionList = "org:list";
103
+ type TOrgPermission = TOrgPermissionCreate | TOrgPermissionView | TOrgPermissionUpdate | TOrgPermissionDelete | TOrgPermissionTransfer | TOrgPermissionList;
104
+ /**
105
+ * Create envelopes.
106
+ */
107
+ type TEnvelopePermissionCreate = "envelope:create";
108
+ /**
109
+ * Cancel envelopes. This is a default permission for most users, but it may be removed for
110
+ * highly regulated environments where envelope activities must be audited, and should not
111
+ * be canceled.
112
+ */
113
+ type TEnvelopePermissionCancel = "envelope:cancel";
114
+ /**
115
+ * View envelopes. This is a default permission for most users, but it may be removed for
116
+ * highly regulated environments where once sent, envelopes may only be viewed by specific
117
+ * users.
118
+ */
119
+ type TEnvelopePermissionView = "envelope:view";
120
+ /**
121
+ * View envelopes created by other members of the same organization. By default, only templates
122
+ * having sharing settings controlled by their creators. Envelopes are usually private to the
123
+ * callers who created them. In some organizations it may be useful to have users who can see
124
+ * "all activity" by all organization members. This is particularly useful when applied to API
125
+ * keys to develop applications that can access all data across the organization.
126
+ */
127
+ type TEnvelopePermissionOrg = "envelope:org:view";
128
+ type TEnvelopePermission = TEnvelopePermissionCreate | TEnvelopePermissionCancel | TEnvelopePermissionView | TEnvelopePermissionOrg;
6
129
  /**
7
130
  * Operation within Verdocs that users may perform.
8
131
  */
@@ -733,24 +856,6 @@ interface ITemplateFieldSetting {
733
856
  options?: any[];
734
857
  [key: string]: any;
735
858
  }
736
- interface IActivityEntry {
737
- id: string;
738
- name: string;
739
- canceled_at: string;
740
- created_at: string;
741
- updated_at: string;
742
- profile_id: string;
743
- status: TEnvelopeStatus;
744
- template_id: string;
745
- recipient: {
746
- claimed: boolean;
747
- email: string;
748
- name: string;
749
- profile_id: string;
750
- status: TRecipientStatus;
751
- type: TRecipientType;
752
- };
753
- }
754
859
  type TRequestStatus = "OK" | "ERROR";
755
860
  type TTemplateSenderType = "creator" | "organization_member" | "organization_member_as_creator" | "everyone" | "everyone_as_creator";
756
861
  type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
@@ -992,58 +1097,26 @@ declare class VerdocsEndpoint {
992
1097
  */
993
1098
  loadSession(): VerdocsEndpoint;
994
1099
  }
995
- /**
996
- * One entry in an envelope search result.
997
- * NOTE: Many of the fields here are undefined unless "summary=true" is included in the search terms
998
- */
999
- interface IEnvelopesSearchResultEntry {
1000
- id: string;
1001
- canceled_at: string;
1002
- certificate_document_id: string;
1003
- created_at: string;
1004
- histories: IEnvelopeHistory[];
1005
- indexed_at: string;
1006
- name: string;
1007
- no_contact: boolean;
1008
- organization_id: string;
1009
- profile_id: string;
1010
- recipients: IRecipient[];
1011
- reminder_id: string | null;
1012
- status: TEnvelopeStatus;
1013
- /** Defaults to 'private'. If set to 'shared', this envelope will be visible to other users in the same organization. Ignored for personal profiles. */
1014
- visibility: "private" | "shared";
1015
- next_recipient: {
1016
- claimed: boolean;
1017
- email: string;
1018
- name: string;
1019
- profile_id: string;
1020
- status: TRecipientStatus;
1021
- type: TRecipientType;
1022
- };
1023
- template_id: string;
1024
- total_count: number;
1025
- updated_at: string;
1026
- }
1027
1100
  interface IEnvelopesSearchResult {
1028
1101
  page: number;
1029
1102
  total: number;
1030
- result: IEnvelopesSearchResultEntry[];
1103
+ result: IEnvelope[];
1031
1104
  }
1032
1105
  interface IEnvelopesSummary {
1033
1106
  action_required: {
1034
1107
  page: number;
1035
1108
  total: number;
1036
- result: IActivityEntry[];
1109
+ result: IEnvelope[];
1037
1110
  };
1038
1111
  completed: {
1039
1112
  page: number;
1040
1113
  total: number;
1041
- result: IActivityEntry[];
1114
+ result: IEnvelope[];
1042
1115
  };
1043
1116
  waiting_others: {
1044
1117
  page: number;
1045
1118
  total: number;
1046
- result: IActivityEntry[];
1119
+ result: IEnvelope[];
1047
1120
  };
1048
1121
  }
1049
1122
  interface IDocumentSearchOptions {
@@ -1085,30 +1158,11 @@ interface ICreateEnvelopeRole {
1085
1158
  /** A custom message to include in the email or SMS invitation. May be left blank for a default message. */
1086
1159
  message: string;
1087
1160
  }
1088
- interface IEnvelopeSummary {
1089
- id: string;
1090
- profile_id: string;
1091
- organization_id: string | null;
1092
- name: string;
1093
- status: TEnvelopeStatus;
1094
- template_id: string;
1095
- created_at: string;
1096
- updated_at: string;
1097
- canceled_at: string;
1098
- envelope_document_id: string;
1099
- certificate_document_id: string | null;
1100
- reminder_id: string | null;
1101
- no_contact: boolean;
1102
- visibility: "private" | "shared";
1103
- documents: IEnvelopeDocument[];
1104
- recipients: IRecipient[];
1105
- fields: IEnvelopeField[];
1106
- }
1107
1161
  interface IEnvelopeSummaries {
1108
1162
  page: number;
1109
1163
  count: number;
1110
1164
  total: number;
1111
- records: IEnvelopeSummary[];
1165
+ records: IEnvelope[];
1112
1166
  }
1113
1167
  interface IInPersonLinkResponse {
1114
1168
  link: string;
@@ -1198,77 +1252,12 @@ declare const createEnvelope: (endpoint: VerdocsEndpoint, request: ICreateEnvelo
1198
1252
  * Get a summary of currently active envelopes.
1199
1253
  *
1200
1254
  * ```typescript
1201
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
1255
+ * import {getEnvelopesSummary} from '@verdocs/js-sdk/Envelopes';
1202
1256
  *
1203
- * const {action_required, completed, waiting_on_others} = await Envelopes.getSummary(VerdocsEndpoint.getDefault());
1257
+ * const {action_required, completed, waiting_on_others} = await getEnvelopesSummary(VerdocsEndpoint.getDefault());
1204
1258
  * ```
1205
1259
  */
1206
1260
  declare const getEnvelopesSummary: (endpoint: VerdocsEndpoint, page: number) => Promise<IEnvelopesSummary>;
1207
- interface IEnvelopeSearchParams {
1208
- /** The envelope must have been created via the specified template ID. */
1209
- template_id?: string;
1210
- /** The envelope must match one of the specified statuses. */
1211
- envelope_status?: TEnvelopeStatus[];
1212
- /** At least one of the recipients must match one of the specified statuses. */
1213
- recipient_status?: TRecipientStatus[];
1214
- /** The envelope's name (inherited from the template) must match the specified string. */
1215
- envelope_name?: string;
1216
- /** At least one of the envelope's recipients must match the specified name. */
1217
- recipient_name?: string;
1218
- /** At least one of the envelope's recipients must match the specified email address. */
1219
- recipient_email?: string;
1220
- /** Match against envelope_name, recipient_name, or recipient_email all at once. */
1221
- name?: string;
1222
- /** At least one of the envelope's recipients must match the specified ID. */
1223
- recipient_id?: string;
1224
- /** The date-range in which the envelope was created. Values should be specified in ISO8601 "UTC" format. */
1225
- created_at?: {
1226
- start_time: string;
1227
- end_time: string;
1228
- };
1229
- /**
1230
- * The date-range in which the envelope was last updated. Values should be specified in ISO8601 "UTC" format.
1231
- * Note that any operations that alter the envelope are considered "updates", including status changes (cancellation),
1232
- * recipient actions (opening/signing), etc.
1233
- */
1234
- updated_at?: {
1235
- start_time: string;
1236
- end_time: string;
1237
- };
1238
- /** The date-range in which the envelope was canceled. Values should be specified in ISO8601 "UTC" format. */
1239
- canceled_at?: {
1240
- start_time: string;
1241
- end_time: string;
1242
- };
1243
- /** Perform a "contains" search where any of the attached documents' fields contains the specified value. */
1244
- text_field_value?: string;
1245
- /** Set to true to retrieve only summary records (IEnvelopeSummary). */
1246
- summary?: boolean;
1247
- /** Set to true to retrieve only those envelopes owned by the caller. */
1248
- is_owner?: boolean;
1249
- /** Set to true to retrieve only those envelopes in which the caller is one of the recipients. */
1250
- is_recipient?: boolean;
1251
- /** Whether the recipient has "claimed" the envelope. */
1252
- recipient_claimed?: boolean;
1253
- /** The maximum number of records to return. Should be used in place of `row`. */
1254
- limit?: number;
1255
- /** The page number to return. Page numbers are 0-based. */
1256
- page?: number;
1257
- /** The field to sort the results by. */
1258
- sort_by?: "created_at" | "updated_at" | "envelope_name" | "canceled_at" | "envelope_status";
1259
- /** Whether to sort in ascending (default) or descending order. */
1260
- ascending?: boolean;
1261
- }
1262
- /**
1263
- * Search for envelopes matching various criteria.
1264
- *
1265
- * ```typescript
1266
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
1267
- *
1268
- * const {result, page, total} = await Envelopes.search(VerdocsEndpoint.getDefault(), { ... });
1269
- * ```
1270
- */
1271
- declare const searchEnvelopes: (endpoint: VerdocsEndpoint, params: IEnvelopeSearchParams) => Promise<IEnvelopesSearchResult>;
1272
1261
  interface ISigningSessionResult {
1273
1262
  recipient: IRecipient;
1274
1263
  session: ISigningSession;
@@ -1342,63 +1331,38 @@ declare const getFieldAttachment: (endpoint: VerdocsEndpoint, envelopeId: string
1342
1331
  * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants.
1343
1332
  */
1344
1333
  declare const getEnvelopeDocumentPageDisplayUri: (endpoint: VerdocsEndpoint, envelopeId: string, documentId: string, page: number, type?: "original" | "filled" | "certificate") => Promise<string>;
1345
- /**
1346
- * Wrapper for `getEnvelope()` that limits queries to one every 2 seconds per template ID.
1347
- * This is intended for use in component hierarchies that all rely on the same template
1348
- * to avoid unnecessary repeat server calls.
1349
- */
1350
- declare const throttledGetEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => IEnvelope | Promise<IEnvelope>;
1351
1334
  interface ITimeRange {
1352
1335
  start: string;
1353
1336
  end: string;
1354
1337
  }
1355
- // /**
1356
- // * Lists all templates accessible by the caller, with optional filters.
1357
- // *
1358
- // * ```typescript
1359
- // * import {Envelopes} from '@verdocs/js-sdk/Templates';
1360
- // *
1361
- // * await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { name: 'test', sort: 'updated_at' });
1362
- // * ```
1363
- // */
1364
- // export const listEnvelopes = (endpoint: VerdocsEndpoint, params?: IListEnvelopesParams) =>
1365
- // endpoint.api //
1366
- // .post<IEnvelopeSummaries>('/envelopes/list', params, {baseURL: endpoint.getBaseURLv2()})
1367
- // .then((r) => r.data);
1368
1338
  interface IListEnvelopesParams {
1369
- view?: "inbox" | "sent" | "action" | "waiting" | "completed";
1370
1339
  q?: string;
1371
- status?: string[];
1372
- created_at?: ITimeRange;
1373
- is_owner?: boolean;
1374
- sort_by?: "name" | "created_at" | "updated_at" | "canceled_at" | "status";
1340
+ view?: "inbox" | "sent" | "action" | "waiting" | "completed";
1341
+ status?: ("complete" | "pending" | "in progress" | "declined" | "canceled")[];
1342
+ include_org?: boolean;
1375
1343
  template_id?: string;
1344
+ created_before?: string;
1345
+ created_after?: string;
1346
+ sort_by?: "name" | "created_at" | "updated_at" | "canceled_at" | "status";
1376
1347
  ascending?: boolean;
1377
1348
  rows?: number;
1378
1349
  page?: number;
1379
1350
  }
1380
- /**a
1351
+ /**
1381
1352
  * Lists all envelopes accessible by the caller, with optional filters.
1382
1353
  *
1383
1354
  * ```typescript
1384
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
1355
+ * import {getEnvelopes} from '@verdocs/js-sdk/Envelopes';
1385
1356
  *
1386
- * const {totals, envelopes} = await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' });
1357
+ * const {count, envelopes} = await getEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test' });
1387
1358
  * ```
1388
1359
  */
1389
- declare const listEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesParams) => Promise<{
1390
- total: number;
1360
+ declare const getEnvelopes: (endpoint: VerdocsEndpoint, params?: IListEnvelopesParams) => Promise<{
1361
+ count: number;
1391
1362
  rows: number;
1392
1363
  page: number;
1393
1364
  envelopes: IEnvelope[];
1394
1365
  }>;
1395
- /**
1396
- * Get all of the envelopes that were sent using a given template.
1397
- * NOTE: This endpoint will be retired soon. Its response is not paginated and it is typically used only to retrieve
1398
- * "submitted data" for a template. A new endpoint will be introduced to provide this function more directly.
1399
- * @deprecated
1400
- */
1401
- declare const getEnvelopesByTemplateId: (endpoint: VerdocsEndpoint, templateId: string) => Promise<IEnvelope[]>;
1402
1366
  /**
1403
1367
  * Create an initials block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
1404
1368
  * an initials block to be used for all initials fields in the document. Thus, this is typically called one time to
@@ -1459,8 +1423,11 @@ interface IRecipientKbaChallengeRequired {
1459
1423
  kba_required: true;
1460
1424
  kba_completed: false;
1461
1425
  kba_method: "challenge";
1462
- message: string;
1463
- options: string[];
1426
+ challenges: {
1427
+ type: string;
1428
+ message: string;
1429
+ options: string[];
1430
+ }[];
1464
1431
  }
1465
1432
  /**
1466
1433
  * Identity verification has failed. The user should be shown the message included. No further
@@ -1472,7 +1439,7 @@ interface IRecipientKbaStatusFailed {
1472
1439
  kba_required: true;
1473
1440
  kba_completed: false;
1474
1441
  kba_method: "failed";
1475
- meesage: string;
1442
+ message: string;
1476
1443
  }
1477
1444
  type TRecipientKbaStatus = IRecipientKbaStatusNotRequired | IRecipientKbaStatusComplete | IRecipientKbaStatusPinRequired | IRecipientKbaStatusIdentityRequired | IRecipientKbaChallengeRequired | IRecipientKbaStatusFailed;
1478
1445
  /**
@@ -1575,27 +1542,27 @@ declare const deleteEnvelopeReminder: (endpoint: VerdocsEndpoint, envelopeId: st
1575
1542
  /**
1576
1543
  * Check to see if the user owns the envelope.
1577
1544
  */
1578
- declare const userIsEnvelopeOwner: (profile: IProfile | null | undefined, envelope: IEnvelope | IEnvelopeSummary) => boolean;
1545
+ declare const userIsEnvelopeOwner: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
1579
1546
  /**
1580
1547
  * Check to see if the user owns the envelope.
1581
1548
  */
1582
- declare const userIsEnvelopeRecipient: (profile: IProfile | null | undefined, envelope: IEnvelope | IEnvelopeSummary) => boolean;
1549
+ declare const userIsEnvelopeRecipient: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
1583
1550
  /**
1584
1551
  * Check to see if the envelope has pending actions.
1585
1552
  */
1586
- declare const envelopeIsActive: (envelope: IEnvelope | IEnvelopeSummary) => boolean;
1553
+ declare const envelopeIsActive: (envelope: IEnvelope) => boolean;
1587
1554
  /**
1588
1555
  * Check to see if the envelope has been completed.
1589
1556
  */
1590
- declare const envelopeIsComplete: (envelope: IEnvelope | IEnvelopeSummary) => boolean;
1557
+ declare const envelopeIsComplete: (envelope: IEnvelope) => boolean;
1591
1558
  /**
1592
1559
  * Check to see if the user owns the envelope.
1593
1560
  */
1594
- declare const userCanCancelEnvelope: (profile: IProfile | null | undefined, envelope: IEnvelope | IEnvelopeSummary) => boolean;
1561
+ declare const userCanCancelEnvelope: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
1595
1562
  /**
1596
1563
  * Check to see if the user owns the envelope.
1597
1564
  */
1598
- declare const userCanFinishEnvelope: (profile: IProfile | null | undefined, envelope: IEnvelope | IEnvelopeSummary) => boolean;
1565
+ declare const userCanFinishEnvelope: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean;
1599
1566
  /**
1600
1567
  * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
1601
1568
  */
@@ -1603,7 +1570,7 @@ declare const recipientHasAction: (recipient: IRecipient) => boolean;
1603
1570
  /**
1604
1571
  * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
1605
1572
  */
1606
- declare const getRecipientsWithActions: (envelope: IEnvelope | IEnvelopeSummary) => IRecipient[];
1573
+ declare const getRecipientsWithActions: (envelope: IEnvelope) => IRecipient[];
1607
1574
  /**
1608
1575
  * Returns true if the recipient can act.
1609
1576
  */
@@ -1615,8 +1582,8 @@ declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) =
1615
1582
  /**
1616
1583
  * Returns true if the user can act.
1617
1584
  */
1618
- declare const userCanSignNow: (profile: IProfile | null | undefined, envelope: IEnvelope | IEnvelopeSummary) => boolean | undefined;
1619
- declare const getNextRecipient: (envelope: IEnvelope | IEnvelopeSummary) => IRecipient;
1585
+ declare const userCanSignNow: (profile: IProfile | null | undefined, envelope: IEnvelope) => boolean | undefined;
1586
+ declare const getNextRecipient: (envelope: IEnvelope) => IRecipient;
1620
1587
  /**
1621
1588
  * Create a signature block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
1622
1589
  * a signature block to be used for all signature fields in the document. Thus, this is typically called one time to
@@ -2798,4 +2765,4 @@ declare const isValidEmail: (email: string | undefined) => boolean;
2798
2765
  declare const isValidPhone: (phone: string | undefined) => boolean;
2799
2766
  declare const isValidRoleName: (value: string, roles: IRole[]) => boolean;
2800
2767
  declare const isValidTag: (value: string, tags: string[]) => boolean;
2801
- export { TRequestStatus, TTemplateSenderType, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IReminder, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, IActivityEntry, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelopesSummary, IEnvelopeSearchParams, searchEnvelopes, ISigningSessionResult, getSigningSession, getEnvelopeRecipients, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, throttledGetEnvelope, ITimeRange, IListEnvelopesParams, listEnvelopes, getEnvelopesByTemplateId, createInitials, IRecipientKbaStatusNotRequired, IRecipientKbaStatusComplete, IRecipientKbaStatusPinRequired, IRecipientKbaStatusIdentityRequired, IRecipientKbaChallengeRequired, IRecipientKbaStatusFailed, TRecipientKbaStatus, getKbaStatus, submitKbaPin, IKbaIdentity, submitKbaIdentity, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, ISignerTokenResponse, getSignerToken, getInPersonLink, sendDelegate, resendInvitation, createEnvelopeReminder, getEnvelopeReminder, updateEnvelopeReminder, deleteEnvelopeReminder, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResultEntry, IEnvelopesSearchResult, IEnvelopesSummary, IDocumentSearchOptions, ICreateEnvelopeRole, IEnvelopeSummary, 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, TTemplatePermission, TAccountPermission, TOrgPermission, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSessionRequest, ISigningSession, IUserSession, 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, getTemplateRoles, getTemplateRole, updateTemplateRole, deleteTemplateRole, getTemplateRoleFields, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, IGetTemplatesParams, getTemplates, getTemplate, getTemplateOwnerInfo, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, createTemplatev2, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, searchTemplates, ISearchTimeRange, IGetTemplateSummarySortBy, IGetTemplateSummaryParams, getTemplatesSummary, throttledGetTemplate, ITemplateListParams, listTemplates, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateSummary, ITemplateSearchParams, ITemplateSummaries, ITemplateTag, ITag, IStar, ITemplateOwnerInfo, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, verifyEmail, resendVerification, getNotifications, getProfiles, getCurrentProfile, getProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, IUpdateProfileRequest, IAuthenticateResponse, IUpdatePasswordRequest, IUpdatePasswordResponse, ICreateAccountRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, timePeriod, 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, ITimePeriod };
2768
+ export { TRequestStatus, TTemplateSenderType, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, 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, ISigningSessionResult, getSigningSession, getEnvelopeRecipients, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStatusNotRequired, IRecipientKbaStatusComplete, IRecipientKbaStatusPinRequired, IRecipientKbaStatusIdentityRequired, IRecipientKbaChallengeRequired, IRecipientKbaStatusFailed, TRecipientKbaStatus, getKbaStatus, submitKbaPin, IKbaIdentity, submitKbaIdentity, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, ISignerTokenResponse, 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, ISigningSessionRequest, ISigningSession, IUserSession, 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, getTemplateRoles, getTemplateRole, updateTemplateRole, deleteTemplateRole, getTemplateRoleFields, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, IGetTemplatesParams, getTemplates, getTemplate, getTemplateOwnerInfo, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, createTemplatev2, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, searchTemplates, ISearchTimeRange, IGetTemplateSummarySortBy, IGetTemplateSummaryParams, getTemplatesSummary, throttledGetTemplate, ITemplateListParams, listTemplates, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateSummary, ITemplateSearchParams, ITemplateSummaries, ITemplateTag, ITag, IStar, ITemplateOwnerInfo, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, verifyEmail, resendVerification, getNotifications, getProfiles, getCurrentProfile, getProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, IUpdateProfileRequest, IAuthenticateResponse, IUpdatePasswordRequest, IUpdatePasswordResponse, ICreateAccountRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, timePeriod, 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, ITimePeriod };
package/dist/index.js CHANGED
@@ -1414,26 +1414,14 @@ const createEnvelope = async (endpoint, request) => endpoint.api //
1414
1414
  * Get a summary of currently active envelopes.
1415
1415
  *
1416
1416
  * ```typescript
1417
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
1417
+ * import {getEnvelopesSummary} from '@verdocs/js-sdk/Envelopes';
1418
1418
  *
1419
- * const {action_required, completed, waiting_on_others} = await Envelopes.getSummary(VerdocsEndpoint.getDefault());
1419
+ * const {action_required, completed, waiting_on_others} = await getEnvelopesSummary(VerdocsEndpoint.getDefault());
1420
1420
  * ```
1421
1421
  */
1422
1422
  const getEnvelopesSummary = async (endpoint, page) => endpoint.api //
1423
1423
  .post('/envelopes/summary', { page })
1424
1424
  .then((r) => r.data);
1425
- /**
1426
- * Search for envelopes matching various criteria.
1427
- *
1428
- * ```typescript
1429
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
1430
- *
1431
- * const {result, page, total} = await Envelopes.search(VerdocsEndpoint.getDefault(), { ... });
1432
- * ```
1433
- */
1434
- const searchEnvelopes = async (endpoint, params) => endpoint.api //
1435
- .post('/envelopes/search', params)
1436
- .then((r) => r.data);
1437
1425
  /**
1438
1426
  * Get a signing session for an Envelope.
1439
1427
  */
@@ -1575,41 +1563,17 @@ const getFieldAttachment = async (endpoint, envelopeId, fieldName) => endpoint.a
1575
1563
  const getEnvelopeDocumentPageDisplayUri = async (endpoint, envelopeId, documentId, page, type = 'original') => endpoint.api
1576
1564
  .get(`/envelopes/${envelopeId}/envelope_documents/${documentId}/pages/${page}/image?type=${type}`, { timeout: 20000 })
1577
1565
  .then((r) => r.data);
1578
- const cachedEnvelopes = {};
1579
1566
  /**
1580
- * Wrapper for `getEnvelope()` that limits queries to one every 2 seconds per template ID.
1581
- * This is intended for use in component hierarchies that all rely on the same template
1582
- * to avoid unnecessary repeat server calls.
1583
- */
1584
- const throttledGetEnvelope = (endpoint, envelopeId) => {
1585
- if (cachedEnvelopes[envelopeId] && cachedEnvelopes[envelopeId].loaded + 2000 < new Date().getTime()) {
1586
- return cachedEnvelopes[envelopeId].envelope;
1587
- }
1588
- return getEnvelope(endpoint, envelopeId).then((envelope) => {
1589
- cachedEnvelopes[envelopeId] = { loaded: new Date().getTime(), envelope };
1590
- return envelope;
1591
- });
1592
- };
1593
- /**a
1594
1567
  * Lists all envelopes accessible by the caller, with optional filters.
1595
1568
  *
1596
1569
  * ```typescript
1597
- * import {Envelopes} from '@verdocs/js-sdk/Envelopes';
1570
+ * import {getEnvelopes} from '@verdocs/js-sdk/Envelopes';
1598
1571
  *
1599
- * const {totals, envelopes} = await Envelopes.listEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' });
1572
+ * const {count, envelopes} = await getEnvelopes((VerdocsEndpoint.getDefault(), { q: 'test' });
1600
1573
  * ```
1601
1574
  */
1602
- const listEnvelopes = (endpoint, params) => endpoint.api //
1603
- .post('/envelopes/list', params)
1604
- .then((r) => r.data);
1605
- /**
1606
- * Get all of the envelopes that were sent using a given template.
1607
- * NOTE: This endpoint will be retired soon. Its response is not paginated and it is typically used only to retrieve
1608
- * "submitted data" for a template. A new endpoint will be introduced to provide this function more directly.
1609
- * @deprecated
1610
- */
1611
- const getEnvelopesByTemplateId = async (endpoint, templateId) => endpoint.api //
1612
- .get(`/envelopes?template_id=${templateId}`)
1575
+ const getEnvelopes = (endpoint, params) => endpoint.api //
1576
+ .get('/envelopes', { params })
1613
1577
  .then((r) => r.data);
1614
1578
 
1615
1579
  /**
@@ -3025,7 +2989,7 @@ exports.getEnvelopeDocumentPageDisplayUri = getEnvelopeDocumentPageDisplayUri;
3025
2989
  exports.getEnvelopeFile = getEnvelopeFile;
3026
2990
  exports.getEnvelopeRecipients = getEnvelopeRecipients;
3027
2991
  exports.getEnvelopeReminder = getEnvelopeReminder;
3028
- exports.getEnvelopesByTemplateId = getEnvelopesByTemplateId;
2992
+ exports.getEnvelopes = getEnvelopes;
3029
2993
  exports.getEnvelopesSummary = getEnvelopesSummary;
3030
2994
  exports.getFieldAttachment = getFieldAttachment;
3031
2995
  exports.getFieldsForRole = getFieldsForRole;
@@ -3087,7 +3051,6 @@ exports.isValidEmail = isValidEmail;
3087
3051
  exports.isValidPhone = isValidPhone;
3088
3052
  exports.isValidRoleName = isValidRoleName;
3089
3053
  exports.isValidTag = isValidTag;
3090
- exports.listEnvelopes = listEnvelopes;
3091
3054
  exports.listTemplates = listTemplates;
3092
3055
  exports.nameToRGBA = nameToRGBA;
3093
3056
  exports.recipientCanAct = recipientCanAct;
@@ -3099,7 +3062,6 @@ exports.resendOrganizationInvitation = resendOrganizationInvitation;
3099
3062
  exports.resendVerification = resendVerification;
3100
3063
  exports.resetPassword = resetPassword;
3101
3064
  exports.rotateApiKey = rotateApiKey;
3102
- exports.searchEnvelopes = searchEnvelopes;
3103
3065
  exports.searchTemplates = searchTemplates;
3104
3066
  exports.sendDelegate = sendDelegate;
3105
3067
  exports.setWebhooks = setWebhooks;
@@ -3107,7 +3069,6 @@ exports.submitKbaChallengeResponse = submitKbaChallengeResponse;
3107
3069
  exports.submitKbaIdentity = submitKbaIdentity;
3108
3070
  exports.submitKbaPin = submitKbaPin;
3109
3071
  exports.switchProfile = switchProfile;
3110
- exports.throttledGetEnvelope = throttledGetEnvelope;
3111
3072
  exports.throttledGetTemplate = throttledGetTemplate;
3112
3073
  exports.timePeriod = timePeriod;
3113
3074
  exports.toggleStar = toggleStar;