@verdocs/js-sdk 4.2.81 → 4.2.82

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
@@ -50,6 +50,12 @@ const WEBHOOK_EVENTS = [
50
50
  'template_used',
51
51
  ];
52
52
  const ALL_PERMISSIONS = [
53
+ // TODO: Are these permissions still relevant?
54
+ // 'member:view',
55
+ // 'org:create',
56
+ // 'org:view',
57
+ // 'org:list',
58
+ // 'org:transfer',
53
59
  'template:creator:create:public',
54
60
  'template:creator:create:org',
55
61
  'template:creator:create:personal',
@@ -1966,12 +1972,13 @@ const updateOrganizationContact = (endpoint, profileId, params) => endpoint.api
1966
1972
  * @module
1967
1973
  */
1968
1974
  /**
1969
- * Get a list of groups for a given organization. The caller must have admin access to the organization.
1975
+ * Get a list of groups for the caller's organization. NOTE: Any organization member may request
1976
+ * the list of groups, but only Owners and Admins may update them.
1970
1977
  *
1971
1978
  * ```typescript
1972
1979
  * import {getGroups} from '@verdocs/js-sdk';
1973
1980
  *
1974
- * const groups = await getGroups(ORGID);
1981
+ * const groups = await getGroups();
1975
1982
  * ```
1976
1983
  */
1977
1984
  const getGroups = (endpoint) => endpoint.api //
@@ -1983,24 +1990,72 @@ const getGroups = (endpoint) => endpoint.api //
1983
1990
  * ```typescript
1984
1991
  * import {getGroup} from '@verdocs/js-sdk/v2/organization-groups';
1985
1992
  *
1986
- * const groups = await getGroup(GROUPID);
1993
+ * const group = await getGroup(GROUPID);
1987
1994
  * ```
1988
1995
  */
1989
1996
  const getGroup = (endpoint, groupId) => endpoint.api //
1990
1997
  .get(`/v2/organization-groups/${groupId}`)
1991
1998
  .then((r) => r.data);
1999
+ /**
2000
+ * Create a group. Note that "everyone" is a reserved name and may not be created.
2001
+ *
2002
+ * ```typescript
2003
+ * import {createGroup} from '@verdocs/js-sdk';
2004
+ *
2005
+ * const group = await createGroup(VerdocsEndpoint.getDefault(), {name:'newgroup'});
2006
+ * ```
2007
+ */
1992
2008
  const createGroup = (endpoint, params) => endpoint.api //
1993
2009
  .post('/v2/organization-groups', params)
1994
2010
  .then((r) => r.data);
2011
+ /**
2012
+ * Update a group. Note that "everyone" is a reserved name and may not be changed.
2013
+ *
2014
+ * ```typescript
2015
+ * import {updateGroup} from '@verdocs/js-sdk';
2016
+ *
2017
+ * const updated = await updateGroup(VerdocsEndpoint.getDefault(), {name:'newname'});
2018
+ * ```
2019
+ */
2020
+ const updateGroup = (endpoint, groupId, params) => endpoint.api //
2021
+ .patch(`/v2/organization-groups/${groupId}`, params)
2022
+ .then((r) => r.data);
2023
+ /**
2024
+ * Get an organization by ID. Note that the "everyone" group cannot be deleted.
2025
+ *
2026
+ * ```typescript
2027
+ * import {deleteGroup} from '@verdocs/js-sdk';
2028
+ *
2029
+ * await deleteGroup(VerdocsEndpoint.getDefault(), 'ORGID');
2030
+ * ```
2031
+ */
2032
+ const deleteGroup = (endpoint, groupId) => endpoint.api //
2033
+ .delete(`/v2/organization-groups/${groupId}`)
2034
+ .then((r) => r.data);
2035
+ /**
2036
+ * Add a member to a group.
2037
+ *
2038
+ * ```typescript
2039
+ * import {addGroupMember} from '@verdocs/js-sdk';
2040
+ *
2041
+ * await addGroupMember(VerdocsEndpoint.getDefault(), 'GROUPID', 'PROFILEID');
2042
+ * ```
2043
+ */
1995
2044
  const addGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
1996
2045
  .post(`/v2/organization-groups/${groupId}/members`, { profile_id })
1997
2046
  .then((r) => r.data);
2047
+ /**
2048
+ * Remove a member from a group.
2049
+ *
2050
+ * ```typescript
2051
+ * import {deleteGroupMember} from '@verdocs/js-sdk';
2052
+ *
2053
+ * await deleteGroupMember(VerdocsEndpoint.getDefault(), 'GROUPID', 'PROFILEID');
2054
+ * ```
2055
+ */
1998
2056
  const deleteGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
1999
2057
  .delete(`/v2/organization-groups/${groupId}/members/${profile_id}`)
2000
2058
  .then((r) => r.data);
2001
- const updateGroup = (endpoint, groupId, params) => endpoint.api //
2002
- .patch(`/v2/organization-groups/${groupId}`, params)
2003
- .then((r) => r.data);
2004
2059
 
2005
2060
  /**
2006
2061
  * An invitation represents an opportunity for a Member to join an Organization.
@@ -2919,5 +2974,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
2919
2974
  const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
2920
2975
  const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
2921
2976
 
2922
- export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationContact, 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, getEnvelopeReminder, getEnvelopes, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, 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, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, sendDelegate, setWebhooks, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationContact, 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 };
2977
+ export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroup, deleteGroupMember, deleteOrganizationContact, 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, getEnvelopeReminder, getEnvelopes, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, 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, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, sendDelegate, setWebhooks, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationContact, 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 };
2923
2978
  //# sourceMappingURL=index.mjs.map