@verdocs/js-sdk 4.2.23 → 4.2.25

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.mjs CHANGED
@@ -881,7 +881,7 @@ const resendVerification = (endpoint, accessToken) => endpoint.api //
881
881
  * const result = await resendVerification();
882
882
  * ```
883
883
  */
884
- const verifyPassword = (endpoint, params) => endpoint.api //
884
+ const verifyEmail = (endpoint, params) => endpoint.api //
885
885
  .post('/v2/users/verify', params)
886
886
  .then((r) => r.data);
887
887
  const getMyUser = (endpoint) => endpoint.api //
@@ -1039,12 +1039,10 @@ const requestLogger = (r) => {
1039
1039
  class VerdocsEndpoint {
1040
1040
  environment = 'verdocs';
1041
1041
  sessionType = 'user';
1042
+ persist = true;
1042
1043
  baseURL = (window.location.origin === 'https://beta.verdocs.com' || window.location.origin === 'https://stage.verdocs.com'
1043
1044
  ? 'https://stage-api.verdocs.com'
1044
1045
  : 'https://api.verdocs.com');
1045
- baseURLv2 = (window.location.origin === 'https://beta.verdocs.com' || window.location.origin === 'https://stage.verdocs.com'
1046
- ? 'https://stage-api.verdocs.com/v2'
1047
- : 'https://api.verdocs.com/v2');
1048
1046
  clientID = 'not-set';
1049
1047
  timeout = 60000;
1050
1048
  token = null;
@@ -1079,6 +1077,7 @@ class VerdocsEndpoint {
1079
1077
  this.environment = options?.environment || this.environment;
1080
1078
  this.sessionType = options?.sessionType || this.sessionType;
1081
1079
  this.clientID = options?.clientID || this.clientID;
1080
+ this.persist = options?.persist || this.persist;
1082
1081
  this.api = axios.create({ baseURL: this.baseURL, timeout: this.timeout });
1083
1082
  }
1084
1083
  setDefault() {
@@ -1109,13 +1108,6 @@ class VerdocsEndpoint {
1109
1108
  getBaseURL() {
1110
1109
  return this.baseURL;
1111
1110
  }
1112
- /**
1113
- * Get the current base URL for the v2 APIs.
1114
- * This should rarely be anything other than 'https://api-v2.verdocs.com'.
1115
- */
1116
- getBaseURLv2() {
1117
- return this.baseURLv2;
1118
- }
1119
1111
  /**
1120
1112
  * Get the current client ID, if set.
1121
1113
  */
@@ -1183,21 +1175,6 @@ class VerdocsEndpoint {
1183
1175
  this.api.defaults.baseURL = url;
1184
1176
  return this;
1185
1177
  }
1186
- /**
1187
- * Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
1188
- *
1189
- * ```typescript
1190
- * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
1191
- *
1192
- * const endpoint = new VerdocsEndpoint();
1193
- * endpoint.setBaseURL('https://api.verdocs.com');
1194
- * ```
1195
- */
1196
- setBaseURLv2(url) {
1197
- this.baseURLv2 = url;
1198
- // NOTE: We do not set this on the Axios instance because v1 is still the standard.
1199
- return this;
1200
- }
1201
1178
  /**
1202
1179
  * Set the Client ID for Verdocs API calls.
1203
1180
  *
@@ -1281,7 +1258,9 @@ class VerdocsEndpoint {
1281
1258
  else {
1282
1259
  this.api.defaults.headers.common.signer = `Bearer ${token}`;
1283
1260
  }
1284
- localStorage.setItem(this.sessionStorageKey(), token);
1261
+ if (this.persist) {
1262
+ localStorage.setItem(this.sessionStorageKey(), token);
1263
+ }
1285
1264
  getCurrentProfile(this)
1286
1265
  .then((r) => {
1287
1266
  window?.console?.debug('[JS_SDK] Loaded profile', r);
@@ -1309,7 +1288,9 @@ class VerdocsEndpoint {
1309
1288
  * Clear the active session.
1310
1289
  */
1311
1290
  clearSession() {
1312
- localStorage.removeItem(this.sessionStorageKey());
1291
+ if (this.persist) {
1292
+ localStorage.removeItem(this.sessionStorageKey());
1293
+ }
1313
1294
  delete this.api.defaults.headers.common.Authorization;
1314
1295
  delete this.api.defaults.headers.common.signer;
1315
1296
  this.session = null;
@@ -1322,7 +1303,9 @@ class VerdocsEndpoint {
1322
1303
  * Clear the active signing session.
1323
1304
  */
1324
1305
  clearSignerSession() {
1325
- localStorage.removeItem(this.sessionStorageKey());
1306
+ if (this.persist) {
1307
+ localStorage.removeItem(this.sessionStorageKey());
1308
+ }
1326
1309
  delete this.api.defaults.headers.common.Authorization;
1327
1310
  this.session = null;
1328
1311
  this.profile = null;
@@ -1354,9 +1337,12 @@ class VerdocsEndpoint {
1354
1337
  }
1355
1338
  /**
1356
1339
  * Load a persisted session from localStorage. Typically called once after the endpoint is configured
1357
- * when the app or component starts.
1340
+ * when the app or component starts. Ignored if the endpoint is configured to not persist sessions.
1358
1341
  */
1359
1342
  loadSession() {
1343
+ if (!this.persist) {
1344
+ return this;
1345
+ }
1360
1346
  const token = localStorage.getItem(this.sessionStorageKey());
1361
1347
  if (!token) {
1362
1348
  return this.clearSession();
@@ -2856,5 +2842,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
2856
2842
  const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
2857
2843
  const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
2858
2844
 
2859
- export { AtoB, Countries, RolePermissions, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopes, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateReminder, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchTemplates, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyPassword };
2845
+ export { AtoB, Countries, RolePermissions, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopes, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateReminder, getTemplateTags, getTemplates, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchTemplates, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2860
2846
  //# sourceMappingURL=index.mjs.map