@verdocs/js-sdk 5.0.45 → 5.1.1
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.mts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -6
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -947,6 +947,7 @@ interface ITemplateFieldSetting {
|
|
|
947
947
|
options?: any[];
|
|
948
948
|
[key: string]: any;
|
|
949
949
|
}
|
|
950
|
+
type TOrganizationUsage = Record<string, Record<TUsageType, number>>;
|
|
950
951
|
type TRequestStatus = "OK" | "ERROR";
|
|
951
952
|
type TTemplateSender = "envelope_creator" | "template_owner";
|
|
952
953
|
type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
|
|
@@ -968,7 +969,7 @@ type TEventDetail = "in_app" | "mail" | "signer" | "sms" | "reminder" | "prepare
|
|
|
968
969
|
// Modification events have a string description
|
|
969
970
|
type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certificate" | "document" | "fields" | "profile">;
|
|
970
971
|
type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
|
|
971
|
-
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
|
|
972
|
+
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used" | "entitlement_used";
|
|
972
973
|
type TTemplateVisibility = "private" | "shared" | "public";
|
|
973
974
|
type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth" | "custom_disclaimer";
|
|
974
975
|
/**
|
|
@@ -980,6 +981,7 @@ type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kb
|
|
|
980
981
|
*/
|
|
981
982
|
type TRecipientAuthMethod = "kba" | "passcode" | "sms" | "email" | "id";
|
|
982
983
|
type TRecipientAuthStep = TRecipientAuthMethod | null;
|
|
984
|
+
type TUsageType = "envelope" | "envelope_canceled" | "sms_invite" | "template" | "auth_email" | "auth_sms" | "auth_kba" | "auth_id" | "auth_passcode";
|
|
983
985
|
declare const FIELD_TYPES: TFieldType[];
|
|
984
986
|
declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
|
|
985
987
|
declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
|
|
@@ -2684,6 +2686,26 @@ declare const getOrganization: (endpoint: VerdocsEndpoint, organizationId: strin
|
|
|
2684
2686
|
* @apiSuccess IOrganization[] . Any child organizations found.
|
|
2685
2687
|
*/
|
|
2686
2688
|
declare const getOrganizationChildren: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<IOrganization>;
|
|
2689
|
+
/**
|
|
2690
|
+
* Get an organization's usage data. If the organization is a parent, usage data for children
|
|
2691
|
+
* will be included as well. The response will be a nested object keyed by organization ID,
|
|
2692
|
+
* with each entry being a dictionary of usageType:count entries.
|
|
2693
|
+
*
|
|
2694
|
+
* ```typescript
|
|
2695
|
+
* import {getOrganizationUsage} from '@verdocs/js-sdk';
|
|
2696
|
+
*
|
|
2697
|
+
* const usage = await getOrganizationUsage(VerdocsEndpoint.getDefault(), 'ORGID');
|
|
2698
|
+
* ```
|
|
2699
|
+
*
|
|
2700
|
+
* @group Organizations
|
|
2701
|
+
* @api GET /v2/organizations/:organization_id/usage Get an organization's usage metrics
|
|
2702
|
+
* @apiSuccess TOrganizationUsage . Usage data grouped by organization ID
|
|
2703
|
+
*/
|
|
2704
|
+
declare const getOrganizationUsage: (endpoint: VerdocsEndpoint, organizationId: string, params?: {
|
|
2705
|
+
start_date?: string;
|
|
2706
|
+
end_date?: string;
|
|
2707
|
+
usage_type?: TUsageType;
|
|
2708
|
+
}) => Promise<TOrganizationUsage>;
|
|
2687
2709
|
/**
|
|
2688
2710
|
* Create an organization. The caller will be assigned an "Owner" profile in the new organization,
|
|
2689
2711
|
* and it will be set to "current" automatically. A new set of session tokens will be issued to
|
|
@@ -2707,7 +2729,9 @@ declare const getOrganizationChildren: (endpoint: VerdocsEndpoint, organizationI
|
|
|
2707
2729
|
* @apiBody string secondary_color? URL of a small-format (square is recommended) PNG logo
|
|
2708
2730
|
* @apiSuccess IAuthenticateResponse . Authentication credentials for user in the new organization. The user will be made an Owner automatically.
|
|
2709
2731
|
*/
|
|
2710
|
-
declare const createOrganization: (endpoint: VerdocsEndpoint, params:
|
|
2732
|
+
declare const createOrganization: (endpoint: VerdocsEndpoint, params: {
|
|
2733
|
+
name: string;
|
|
2734
|
+
} & Partial<Pick<IOrganization, "address" | "address2" | "phone" | "contact_email" | "url" | "full_logo_url" | "thumbnail_url" | "primary_color" | "secondary_color" | "parent_id">>) => Promise<IAuthenticateResponse & {
|
|
2711
2735
|
profile: IProfile;
|
|
2712
2736
|
organization: IOrganization;
|
|
2713
2737
|
}>;
|
|
@@ -3538,4 +3562,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3538
3562
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3539
3563
|
*/
|
|
3540
3564
|
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
3541
|
-
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, 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, ISigningSession, IUserSession, IIdToken, 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, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
|
3565
|
+
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, 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, ISigningSession, IUserSession, IIdToken, 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, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
package/dist/index.d.ts
CHANGED
|
@@ -947,6 +947,7 @@ interface ITemplateFieldSetting {
|
|
|
947
947
|
options?: any[];
|
|
948
948
|
[key: string]: any;
|
|
949
949
|
}
|
|
950
|
+
type TOrganizationUsage = Record<string, Record<TUsageType, number>>;
|
|
950
951
|
type TRequestStatus = "OK" | "ERROR";
|
|
951
952
|
type TTemplateSender = "envelope_creator" | "template_owner";
|
|
952
953
|
type TTemplateAction = "create_personal" | "create_org" | "create_public" | "read" | "write" | "delete" | "change_visibility_personal" | "change_visibility_org" | "change_visibility_public";
|
|
@@ -968,7 +969,7 @@ type TEventDetail = "in_app" | "mail" | "signer" | "sms" | "reminder" | "prepare
|
|
|
968
969
|
// Modification events have a string description
|
|
969
970
|
type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certificate" | "document" | "fields" | "profile">;
|
|
970
971
|
type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
|
|
971
|
-
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
|
|
972
|
+
type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used" | "entitlement_used";
|
|
972
973
|
type TTemplateVisibility = "private" | "shared" | "public";
|
|
973
974
|
type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth" | "custom_disclaimer";
|
|
974
975
|
/**
|
|
@@ -980,6 +981,7 @@ type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kb
|
|
|
980
981
|
*/
|
|
981
982
|
type TRecipientAuthMethod = "kba" | "passcode" | "sms" | "email" | "id";
|
|
982
983
|
type TRecipientAuthStep = TRecipientAuthMethod | null;
|
|
984
|
+
type TUsageType = "envelope" | "envelope_canceled" | "sms_invite" | "template" | "auth_email" | "auth_sms" | "auth_kba" | "auth_id" | "auth_passcode";
|
|
983
985
|
declare const FIELD_TYPES: TFieldType[];
|
|
984
986
|
declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
|
|
985
987
|
declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
|
|
@@ -2684,6 +2686,26 @@ declare const getOrganization: (endpoint: VerdocsEndpoint, organizationId: strin
|
|
|
2684
2686
|
* @apiSuccess IOrganization[] . Any child organizations found.
|
|
2685
2687
|
*/
|
|
2686
2688
|
declare const getOrganizationChildren: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<IOrganization>;
|
|
2689
|
+
/**
|
|
2690
|
+
* Get an organization's usage data. If the organization is a parent, usage data for children
|
|
2691
|
+
* will be included as well. The response will be a nested object keyed by organization ID,
|
|
2692
|
+
* with each entry being a dictionary of usageType:count entries.
|
|
2693
|
+
*
|
|
2694
|
+
* ```typescript
|
|
2695
|
+
* import {getOrganizationUsage} from '@verdocs/js-sdk';
|
|
2696
|
+
*
|
|
2697
|
+
* const usage = await getOrganizationUsage(VerdocsEndpoint.getDefault(), 'ORGID');
|
|
2698
|
+
* ```
|
|
2699
|
+
*
|
|
2700
|
+
* @group Organizations
|
|
2701
|
+
* @api GET /v2/organizations/:organization_id/usage Get an organization's usage metrics
|
|
2702
|
+
* @apiSuccess TOrganizationUsage . Usage data grouped by organization ID
|
|
2703
|
+
*/
|
|
2704
|
+
declare const getOrganizationUsage: (endpoint: VerdocsEndpoint, organizationId: string, params?: {
|
|
2705
|
+
start_date?: string;
|
|
2706
|
+
end_date?: string;
|
|
2707
|
+
usage_type?: TUsageType;
|
|
2708
|
+
}) => Promise<TOrganizationUsage>;
|
|
2687
2709
|
/**
|
|
2688
2710
|
* Create an organization. The caller will be assigned an "Owner" profile in the new organization,
|
|
2689
2711
|
* and it will be set to "current" automatically. A new set of session tokens will be issued to
|
|
@@ -2707,7 +2729,9 @@ declare const getOrganizationChildren: (endpoint: VerdocsEndpoint, organizationI
|
|
|
2707
2729
|
* @apiBody string secondary_color? URL of a small-format (square is recommended) PNG logo
|
|
2708
2730
|
* @apiSuccess IAuthenticateResponse . Authentication credentials for user in the new organization. The user will be made an Owner automatically.
|
|
2709
2731
|
*/
|
|
2710
|
-
declare const createOrganization: (endpoint: VerdocsEndpoint, params:
|
|
2732
|
+
declare const createOrganization: (endpoint: VerdocsEndpoint, params: {
|
|
2733
|
+
name: string;
|
|
2734
|
+
} & Partial<Pick<IOrganization, "address" | "address2" | "phone" | "contact_email" | "url" | "full_logo_url" | "thumbnail_url" | "primary_color" | "secondary_color" | "parent_id">>) => Promise<IAuthenticateResponse & {
|
|
2711
2735
|
profile: IProfile;
|
|
2712
2736
|
organization: IOrganization;
|
|
2713
2737
|
}>;
|
|
@@ -3538,4 +3562,4 @@ declare const decodeJWTBody: (token: string) => any;
|
|
|
3538
3562
|
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
3539
3563
|
*/
|
|
3540
3564
|
declare const decodeAccessTokenBody: (token: string) => TSession;
|
|
3541
|
-
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, 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, ISigningSession, IUserSession, IIdToken, 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, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
|
3565
|
+
export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, verifySigner, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, 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, ISigningSession, IUserSession, IIdToken, 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, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
|
package/dist/index.js
CHANGED
|
@@ -1205,7 +1205,7 @@ class VerdocsEndpoint {
|
|
|
1205
1205
|
environment = 'verdocs';
|
|
1206
1206
|
sessionType = 'user';
|
|
1207
1207
|
persist = true;
|
|
1208
|
-
baseURL = BETA_ORIGINS.includes(window
|
|
1208
|
+
baseURL = BETA_ORIGINS.includes(window?.location?.origin || '') ? 'https://stage-api.verdocs.com' : 'https://api.verdocs.com';
|
|
1209
1209
|
clientID = 'not-set';
|
|
1210
1210
|
timeout = 60000;
|
|
1211
1211
|
token = null;
|
|
@@ -1411,15 +1411,15 @@ class VerdocsEndpoint {
|
|
|
1411
1411
|
*/
|
|
1412
1412
|
setToken(token, sessionType = 'user') {
|
|
1413
1413
|
if (!token) {
|
|
1414
|
-
window
|
|
1414
|
+
window?.console?.log('[JS_SDK] Clearing token');
|
|
1415
1415
|
return this.clearSession();
|
|
1416
1416
|
}
|
|
1417
1417
|
const session = decodeAccessTokenBody(token);
|
|
1418
1418
|
if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
|
|
1419
|
-
window
|
|
1419
|
+
window?.console?.warn('[JS_SDK] Ignoring attempt to use expired session token');
|
|
1420
1420
|
return this.clearSession();
|
|
1421
1421
|
}
|
|
1422
|
-
window
|
|
1422
|
+
window?.console?.log('[JS_SDK] Setting token', sessionType);
|
|
1423
1423
|
this.token = token;
|
|
1424
1424
|
this.session = session;
|
|
1425
1425
|
this.sub = session.sub;
|
|
@@ -2598,6 +2598,24 @@ const getOrganization = (endpoint, organizationId) => endpoint.api //
|
|
|
2598
2598
|
const getOrganizationChildren = (endpoint, organizationId) => endpoint.api //
|
|
2599
2599
|
.get(`/v2/organizations/${organizationId}/children`)
|
|
2600
2600
|
.then((r) => r.data);
|
|
2601
|
+
/**
|
|
2602
|
+
* Get an organization's usage data. If the organization is a parent, usage data for children
|
|
2603
|
+
* will be included as well. The response will be a nested object keyed by organization ID,
|
|
2604
|
+
* with each entry being a dictionary of usageType:count entries.
|
|
2605
|
+
*
|
|
2606
|
+
* ```typescript
|
|
2607
|
+
* import {getOrganizationUsage} from '@verdocs/js-sdk';
|
|
2608
|
+
*
|
|
2609
|
+
* const usage = await getOrganizationUsage(VerdocsEndpoint.getDefault(), 'ORGID');
|
|
2610
|
+
* ```
|
|
2611
|
+
*
|
|
2612
|
+
* @group Organizations
|
|
2613
|
+
* @api GET /v2/organizations/:organization_id/usage Get an organization's usage metrics
|
|
2614
|
+
* @apiSuccess TOrganizationUsage . Usage data grouped by organization ID
|
|
2615
|
+
*/
|
|
2616
|
+
const getOrganizationUsage = (endpoint, organizationId, params) => endpoint.api //
|
|
2617
|
+
.get(`/v2/organizations/${organizationId}/children`, { params })
|
|
2618
|
+
.then((r) => r.data);
|
|
2601
2619
|
/**
|
|
2602
2620
|
* Create an organization. The caller will be assigned an "Owner" profile in the new organization,
|
|
2603
2621
|
* and it will be set to "current" automatically. A new set of session tokens will be issued to
|
|
@@ -3331,7 +3349,6 @@ const getTemplate = (endpoint, templateId) => {
|
|
|
3331
3349
|
.get(`/v2/templates/${templateId}`)
|
|
3332
3350
|
.then((r) => {
|
|
3333
3351
|
const template = r.data;
|
|
3334
|
-
window?.console?.log('[JS_SDK] Post-processing template', template);
|
|
3335
3352
|
// Post-process the template to upgrade to new data fields
|
|
3336
3353
|
if (!template.documents && template.template_documents) {
|
|
3337
3354
|
template.documents = template.template_documents;
|
|
@@ -3720,6 +3737,7 @@ exports.getOrganizationContacts = getOrganizationContacts;
|
|
|
3720
3737
|
exports.getOrganizationInvitation = getOrganizationInvitation;
|
|
3721
3738
|
exports.getOrganizationInvitations = getOrganizationInvitations;
|
|
3722
3739
|
exports.getOrganizationMembers = getOrganizationMembers;
|
|
3740
|
+
exports.getOrganizationUsage = getOrganizationUsage;
|
|
3723
3741
|
exports.getPlusOneCountry = getPlusOneCountry;
|
|
3724
3742
|
exports.getProfiles = getProfiles;
|
|
3725
3743
|
exports.getRGB = getRGB;
|