@verdocs/js-sdk 4.2.80 → 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
@@ -49,6 +49,39 @@ const WEBHOOK_EVENTS = [
49
49
  'template_deleted',
50
50
  'template_used',
51
51
  ];
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',
59
+ 'template:creator:create:public',
60
+ 'template:creator:create:org',
61
+ 'template:creator:create:personal',
62
+ 'template:creator:delete',
63
+ 'template:creator:visibility',
64
+ 'template:member:read',
65
+ 'template:member:write',
66
+ 'template:member:delete',
67
+ 'template:member:visibility',
68
+ 'owner:add',
69
+ 'owner:remove',
70
+ 'admin:add',
71
+ 'admin:remove',
72
+ 'member:view',
73
+ 'member:add',
74
+ 'member:remove',
75
+ 'org:create',
76
+ 'org:view',
77
+ 'org:update',
78
+ 'org:delete',
79
+ 'org:transfer',
80
+ 'org:list',
81
+ 'envelope:create',
82
+ 'envelope:cancel',
83
+ 'envelope:view',
84
+ ];
52
85
 
53
86
  /**
54
87
  * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
@@ -1939,12 +1972,13 @@ const updateOrganizationContact = (endpoint, profileId, params) => endpoint.api
1939
1972
  * @module
1940
1973
  */
1941
1974
  /**
1942
- * 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.
1943
1977
  *
1944
1978
  * ```typescript
1945
1979
  * import {getGroups} from '@verdocs/js-sdk';
1946
1980
  *
1947
- * const groups = await getGroups(ORGID);
1981
+ * const groups = await getGroups();
1948
1982
  * ```
1949
1983
  */
1950
1984
  const getGroups = (endpoint) => endpoint.api //
@@ -1956,24 +1990,72 @@ const getGroups = (endpoint) => endpoint.api //
1956
1990
  * ```typescript
1957
1991
  * import {getGroup} from '@verdocs/js-sdk/v2/organization-groups';
1958
1992
  *
1959
- * const groups = await getGroup(GROUPID);
1993
+ * const group = await getGroup(GROUPID);
1960
1994
  * ```
1961
1995
  */
1962
1996
  const getGroup = (endpoint, groupId) => endpoint.api //
1963
1997
  .get(`/v2/organization-groups/${groupId}`)
1964
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
+ */
1965
2008
  const createGroup = (endpoint, params) => endpoint.api //
1966
2009
  .post('/v2/organization-groups', params)
1967
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
+ */
1968
2044
  const addGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
1969
2045
  .post(`/v2/organization-groups/${groupId}/members`, { profile_id })
1970
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
+ */
1971
2056
  const deleteGroupMember = (endpoint, groupId, profile_id) => endpoint.api //
1972
2057
  .delete(`/v2/organization-groups/${groupId}/members/${profile_id}`)
1973
2058
  .then((r) => r.data);
1974
- const updateGroup = (endpoint, groupId, params) => endpoint.api //
1975
- .patch(`/v2/organization-groups/${groupId}`, params)
1976
- .then((r) => r.data);
1977
2059
 
1978
2060
  /**
1979
2061
  * An invitation represents an opportunity for a Member to join an Organization.
@@ -2892,5 +2974,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
2892
2974
  const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
2893
2975
  const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
2894
2976
 
2895
- export { 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 };
2896
2978
  //# sourceMappingURL=index.mjs.map