@verdocs/js-sdk 3.6.0 → 3.6.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.
@@ -8,6 +8,10 @@ export interface ICreateEnvelopeRequest {
8
8
  roles: ICreateEnvelopeRole[];
9
9
  name: string;
10
10
  environment?: string;
11
+ prepared_fields: {
12
+ name: string;
13
+ value: string;
14
+ }[];
11
15
  }
12
16
  /**
13
17
  * Create an envelope
@@ -142,22 +146,6 @@ export declare const getEnvelopeDocument: (endpoint: VerdocsEndpoint, envelopeId
142
146
  * Cancel an Envelope.
143
147
  */
144
148
  export declare const cancelEnvelope: (endpoint: VerdocsEndpoint, envelopeId: string) => Promise<TEnvelopeUpdateResult>;
145
- /**
146
- * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
147
- */
148
- export declare const recipientHasAction: (recipient: IRecipient) => boolean;
149
- /**
150
- * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
151
- */
152
- export declare const getRecipientsWithActions: (envelope: IEnvelope) => IRecipient[];
153
- /**
154
- * Returns true if the recipient can act.
155
- */
156
- export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IRecipient[]) => boolean;
157
- /**
158
- * Returns true if the user can act.
159
- */
160
- export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
161
149
  /**
162
150
  * Get (binary download) a file attached to an Envelope. It is important to use this method
163
151
  * rather than a direct A HREF or similar link to set the authorization headers for the
@@ -163,26 +163,6 @@ export var cancelEnvelope = function (endpoint, envelopeId) { return __awaiter(v
163
163
  .then(function (r) { return r.data; })];
164
164
  });
165
165
  }); };
166
- /**
167
- * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
168
- */
169
- export var recipientHasAction = function (recipient) { return !['submitted', 'canceled', 'declined'].includes(recipient.status); };
170
- /**
171
- * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
172
- */
173
- export var getRecipientsWithActions = function (envelope) { return ((envelope === null || envelope === void 0 ? void 0 : envelope.recipients) || []).filter(recipientHasAction); };
174
- /**
175
- * Returns true if the recipient can act.
176
- */
177
- export var recipientCanAct = function (recipient, recipientsWithActions) { var _a; return recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence); };
178
- /**
179
- * Returns true if the user can act.
180
- */
181
- export var userCanAct = function (email, recipientsWithActions) {
182
- var _a;
183
- var recipient = recipientsWithActions.find(function (r) { return r.email === email; });
184
- return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);
185
- };
186
166
  /**
187
167
  * Get (binary download) a file attached to an Envelope. It is important to use this method
188
168
  * rather than a direct A HREF or similar link to set the authorization headers for the
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { IEnvelope } from './Types';
6
+ import { IEnvelope, IRecipient } from './Types';
7
7
  import { TSession } from '../Sessions/Types';
8
8
  /**
9
9
  * Check to see if the user owns the envelope.
@@ -13,6 +13,14 @@ export declare const userIsEnvelopeOwner: (session: TSession, envelope: IEnvelop
13
13
  * Check to see if the user owns the envelope.
14
14
  */
15
15
  export declare const userIsEnvelopeRecipient: (session: TSession, envelope: IEnvelope) => boolean;
16
+ /**
17
+ * Check to see if the envelope has pending actions.
18
+ */
19
+ export declare const envelopeIsActive: (envelope: IEnvelope) => boolean;
20
+ /**
21
+ * Check to see if the envelope has been completed.
22
+ */
23
+ export declare const envelopeIsComplete: (envelope: IEnvelope) => boolean;
16
24
  /**
17
25
  * Check to see if the user owns the envelope.
18
26
  */
@@ -21,3 +29,23 @@ export declare const userCanCancelEnvelope: (session: TSession, envelope: IEnvel
21
29
  * Check to see if the user owns the envelope.
22
30
  */
23
31
  export declare const userCanFinishEnvelope: (session: TSession, envelope: IEnvelope) => boolean;
32
+ /**
33
+ * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
34
+ */
35
+ export declare const recipientHasAction: (recipient: IRecipient) => boolean;
36
+ /**
37
+ * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
38
+ */
39
+ export declare const getRecipientsWithActions: (envelope: IEnvelope) => IRecipient[];
40
+ /**
41
+ * Returns true if the recipient can act.
42
+ */
43
+ export declare const recipientCanAct: (recipient: IRecipient, recipientsWithActions: IRecipient[]) => boolean;
44
+ /**
45
+ * Returns true if the user can act.
46
+ */
47
+ export declare const userCanAct: (email: string, recipientsWithActions: IRecipient[]) => boolean | undefined;
48
+ /**
49
+ * Returns true if the user can act.
50
+ */
51
+ export declare const userCanSignNow: (session: TSession, envelope: IEnvelope) => boolean | undefined;
@@ -12,6 +12,16 @@ export var userIsEnvelopeOwner = function (session, envelope) { return envelope.
12
12
  * Check to see if the user owns the envelope.
13
13
  */
14
14
  export var userIsEnvelopeRecipient = function (session, envelope) { return envelope.profile_id === (session === null || session === void 0 ? void 0 : session.profile_id); };
15
+ /**
16
+ * Check to see if the envelope has pending actions.
17
+ */
18
+ export var envelopeIsActive = function (envelope) {
19
+ return envelope.status !== EnvelopeStates.COMPLETE && envelope.status !== EnvelopeStates.DECLINED && envelope.status !== EnvelopeStates.CANCELED;
20
+ };
21
+ /**
22
+ * Check to see if the envelope has been completed.
23
+ */
24
+ export var envelopeIsComplete = function (envelope) { return envelope.status !== EnvelopeStates.COMPLETE; };
15
25
  /**
16
26
  * Check to see if the user owns the envelope.
17
27
  */
@@ -31,3 +41,37 @@ export var userCanFinishEnvelope = function (session, envelope) {
31
41
  envelope.status !== EnvelopeStates.DECLINED &&
32
42
  envelope.status !== EnvelopeStates.CANCELED;
33
43
  };
44
+ /**
45
+ * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).
46
+ */
47
+ export var recipientHasAction = function (recipient) { return !['submitted', 'canceled', 'declined'].includes(recipient.status); };
48
+ /**
49
+ * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).
50
+ */
51
+ export var getRecipientsWithActions = function (envelope) { return ((envelope === null || envelope === void 0 ? void 0 : envelope.recipients) || []).filter(recipientHasAction); };
52
+ /**
53
+ * Returns true if the recipient can act.
54
+ */
55
+ export var recipientCanAct = function (recipient, recipientsWithActions) { var _a; return recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence); };
56
+ /**
57
+ * Returns true if the user can act.
58
+ */
59
+ export var userCanAct = function (email, recipientsWithActions) {
60
+ var _a;
61
+ var recipient = recipientsWithActions.find(function (r) { return r.email === email; });
62
+ return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);
63
+ };
64
+ /**
65
+ * Returns true if the user can act.
66
+ */
67
+ export var userCanSignNow = function (session, envelope) {
68
+ if (!session) {
69
+ return false;
70
+ }
71
+ var recipientsWithActions = getRecipientsWithActions(envelope);
72
+ var myRecipient = recipientsWithActions.find(function (r) { return r.profile_id === (session === null || session === void 0 ? void 0 : session.profile_id) || r.email === (session === null || session === void 0 ? void 0 : session.email); });
73
+ return (myRecipient &&
74
+ envelopeIsActive(envelope) &&
75
+ userIsEnvelopeRecipient(session, envelope) &&
76
+ recipientCanAct(myRecipient, recipientsWithActions));
77
+ };
@@ -1,4 +1,4 @@
1
- import { IEnvelope, IRecipient, IInPersonAccessKey } from './Types';
1
+ import { IEnvelope, IRecipient, IInPersonAccessKey, TAccessKey } from './Types';
2
2
  import { VerdocsEndpoint } from '../VerdocsEndpoint';
3
3
  export interface IUpdateRecipientSubmitParams {
4
4
  action: 'submit';
@@ -68,6 +68,12 @@ export interface ISignerTokenResponse {
68
68
  export declare const getSignerToken: (endpoint: VerdocsEndpoint, envelopeId: string, roleName: string) => Promise<ISignerTokenResponse>;
69
69
  export interface IInPersonLinkResponse {
70
70
  link: string;
71
+ envelope_id: string;
72
+ profile_id: string;
73
+ role_name: string;
74
+ access_key: string;
75
+ expiration_date: string;
76
+ type: TAccessKey;
71
77
  }
72
78
  /**
73
79
  * Get an in-person signing link.
@@ -15,6 +15,29 @@ export interface IInPersonAccessKey {
15
15
  first_used: string | null;
16
16
  last_used: string | null;
17
17
  }
18
+ export interface IEmailAccessKey {
19
+ id: string;
20
+ created_at: string;
21
+ recipient_name: string;
22
+ envelope_id: string;
23
+ type: 'email';
24
+ key: string;
25
+ expiration_date: string | null;
26
+ first_used: string | null;
27
+ last_used: string | null;
28
+ }
29
+ export interface ISMSAccessKey {
30
+ id: string;
31
+ created_at: string;
32
+ recipient_name: string;
33
+ envelope_id: string;
34
+ type: 'sms';
35
+ key: string;
36
+ expiration_date: string | null;
37
+ first_used: string | null;
38
+ last_used: string | null;
39
+ }
40
+ export type TAccessKey = IInPersonAccessKey | IEmailAccessKey | ISMSAccessKey;
18
41
  export declare enum RecipientActions {
19
42
  SUBMIT = "submit",
20
43
  DECLINE = "decline",
@@ -45,6 +45,10 @@ export interface IUserSession {
45
45
  */
46
46
  export type TSessionType = 'user' | 'signing';
47
47
  /**
48
- * An authenticated session within Verdocs, either for signing or regular user-based operations.
48
+ * Represents a possibly-authenticated session within Verdocs, either for signing or regular user-based operations.
49
49
  */
50
50
  export type TSession = IUserSession | ISigningSession | null;
51
+ /**
52
+ * An active authenticated session within Verdocs, either for signing or regular user-based operations.
53
+ */
54
+ export type TActiveSession = IUserSession | ISigningSession;
@@ -85,7 +85,8 @@ export interface ITemplateCreateParams {
85
85
  /**
86
86
  * Optional list of roles to create. Documents are required if roles or fields will also be specified. Files may
87
87
  * be attached via a number of methods (browser File object, remote URI reference, or Base64-encoded string) but
88
- * all entries must of of the same type.
88
+ * all entries must of of the same type. If browser File objects are provided, the request will use a FORM POST
89
+ * call, otherwise it will use traditional XHR.
89
90
  */
90
91
  documents?: File[] | IDocumentFromUri[] | IDocumentFromData[];
91
92
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "axios": "^1.3.4",
48
+ "axios": "^1.3.6",
49
49
  "axios-retry": "^3.4.0"
50
50
  },
51
51
  "peerDependencies": {