@verdocs/js-sdk 4.2.28 → 4.2.31
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 +128 -179
- package/dist/index.d.ts +128 -179
- package/dist/index.js +3 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -75
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -221,44 +221,6 @@ const formatShortTimeAgo = (val) => {
|
|
|
221
221
|
}
|
|
222
222
|
return `${timeDiff}S`;
|
|
223
223
|
};
|
|
224
|
-
function timePeriod(type) {
|
|
225
|
-
let endDate = new Date().getTime();
|
|
226
|
-
const today = new Date();
|
|
227
|
-
const month = today.getMonth();
|
|
228
|
-
const year = today.getFullYear();
|
|
229
|
-
let startDate = null;
|
|
230
|
-
switch (type) {
|
|
231
|
-
case '30d':
|
|
232
|
-
startDate = endDate - 60 * 60 * 24 * 30 * 1000;
|
|
233
|
-
break;
|
|
234
|
-
case '60d':
|
|
235
|
-
startDate = endDate - 60 * 60 * 24 * 60 * 1000;
|
|
236
|
-
break;
|
|
237
|
-
case '6m':
|
|
238
|
-
startDate = endDate - 60 * 60 * 24 * 30 * 6 * 1000;
|
|
239
|
-
break;
|
|
240
|
-
case 'this_month':
|
|
241
|
-
startDate = new Date(year, month, 1).getTime();
|
|
242
|
-
break;
|
|
243
|
-
case 'last_month':
|
|
244
|
-
startDate = new Date(year, month - 1, 1).getTime();
|
|
245
|
-
endDate = new Date(year, month, 0).getTime();
|
|
246
|
-
break;
|
|
247
|
-
case 'this_year':
|
|
248
|
-
startDate = new Date(year, 0, 1);
|
|
249
|
-
break;
|
|
250
|
-
case 'all_time':
|
|
251
|
-
default:
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
if (startDate === null && endDate === null) {
|
|
255
|
-
return null;
|
|
256
|
-
}
|
|
257
|
-
return {
|
|
258
|
-
start_time: new Date(startDate).toISOString(),
|
|
259
|
-
end_time: new Date(endDate).toISOString(),
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
224
|
|
|
263
225
|
function getRTop(y, fieldHeight, iTextHeight, yRatio) {
|
|
264
226
|
return iTextHeight - (y + fieldHeight) * yRatio;
|
|
@@ -2662,28 +2624,6 @@ const getAllTags = (endpoint) => endpoint.api //
|
|
|
2662
2624
|
const getTemplates = (endpoint, params) => endpoint.api //
|
|
2663
2625
|
.post('/v2/templates', { params })
|
|
2664
2626
|
.then((r) => r.data);
|
|
2665
|
-
// export interface IListTemplatesParams {
|
|
2666
|
-
// name?: string;
|
|
2667
|
-
// sharing?: 'all' | 'personal' | 'shared' | 'public';
|
|
2668
|
-
// starred?: 'all' | 'starred' | 'unstarred';
|
|
2669
|
-
// sort?: 'name' | 'created_at' | 'updated_at' | 'last_used_at' | 'counter' | 'star_counter';
|
|
2670
|
-
// direction?: 'asc' | 'desc';
|
|
2671
|
-
// page?: number;
|
|
2672
|
-
// rows?: number;
|
|
2673
|
-
// }
|
|
2674
|
-
/**
|
|
2675
|
-
* Lists all templates accessible by the caller, with optional filters.
|
|
2676
|
-
*
|
|
2677
|
-
* ```typescript
|
|
2678
|
-
* import {listTemplates} from '@verdocs/js-sdk/Templates';
|
|
2679
|
-
*
|
|
2680
|
-
* await listTemplates((VerdocsEndpoint.getDefault(), { sharing: 'personal', sort: 'last_used_at' });
|
|
2681
|
-
* ```
|
|
2682
|
-
*/
|
|
2683
|
-
// export const listTemplates = (endpoint: VerdocsEndpoint, params?: IListTemplatesParams) =>
|
|
2684
|
-
// endpoint.api //
|
|
2685
|
-
// .post<ITemplateSummaries>('/templates/list', params, {baseURL: endpoint.getBaseURLv2()})
|
|
2686
|
-
// .then((r) => r.data);
|
|
2687
2627
|
/**
|
|
2688
2628
|
* Get one template by its ID.
|
|
2689
2629
|
*
|
|
@@ -2774,7 +2714,7 @@ const createTemplateFromSharepoint = (endpoint, params) => {
|
|
|
2774
2714
|
const options = {
|
|
2775
2715
|
timeout: 120000,
|
|
2776
2716
|
};
|
|
2777
|
-
return endpoint.api.post('/templates/from-sharepoint', params, options).then((r) => r.data);
|
|
2717
|
+
return endpoint.api.post('/v2/templates/from-sharepoint', params, options).then((r) => r.data);
|
|
2778
2718
|
};
|
|
2779
2719
|
/**
|
|
2780
2720
|
* Update a template.
|
|
@@ -2786,7 +2726,7 @@ const createTemplateFromSharepoint = (endpoint, params) => {
|
|
|
2786
2726
|
* ```
|
|
2787
2727
|
*/
|
|
2788
2728
|
const updateTemplate = (endpoint, templateId, params) => endpoint.api //
|
|
2789
|
-
.put(`/templates/${templateId}`, params)
|
|
2729
|
+
.put(`/v2/templates/${templateId}`, params)
|
|
2790
2730
|
.then((r) => r.data);
|
|
2791
2731
|
/**
|
|
2792
2732
|
* Delete a template.
|
|
@@ -2798,18 +2738,7 @@ const updateTemplate = (endpoint, templateId, params) => endpoint.api //
|
|
|
2798
2738
|
* ```
|
|
2799
2739
|
*/
|
|
2800
2740
|
const deleteTemplate = (endpoint, templateId) => endpoint.api //
|
|
2801
|
-
.delete(`/templates/${templateId}`)
|
|
2802
|
-
.then((r) => r.data);
|
|
2803
|
-
/**
|
|
2804
|
-
* List
|
|
2805
|
-
*
|
|
2806
|
-
* ```typescript
|
|
2807
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2808
|
-
*
|
|
2809
|
-
* const {totals, templates} = await listTemplates((VerdocsEndpoint.getDefault(), { q: 'test', sort: 'created_at' }); * ```
|
|
2810
|
-
*/
|
|
2811
|
-
const listTemplates = async (endpoint, params = {}) => endpoint.api //
|
|
2812
|
-
.post('/templates/list', params)
|
|
2741
|
+
.delete(`/v2/templates/${templateId}`)
|
|
2813
2742
|
.then((r) => r.data);
|
|
2814
2743
|
|
|
2815
2744
|
/**
|
|
@@ -2924,5 +2853,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
|
|
|
2924
2853
|
const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
|
|
2925
2854
|
const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
|
|
2926
2855
|
|
|
2927
|
-
export { AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_SETTINGS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, 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,
|
|
2856
|
+
export { AtoB, Countries, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_SETTINGS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, 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, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, 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 };
|
|
2928
2857
|
//# sourceMappingURL=index.mjs.map
|