@verdocs/js-sdk 4.2.2 → 4.2.4
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 +144 -223
- package/dist/index.d.ts +144 -223
- package/dist/index.js +7 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -82
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1597,7 +1597,7 @@ const createInitials = (endpoint, name, initials) => {
|
|
|
1597
1597
|
* `recipient.kba_method` is set (not null), and `recipient.kba_completed` is false, this endpoint
|
|
1598
1598
|
* should be called to determine the next KBA step required.
|
|
1599
1599
|
*/
|
|
1600
|
-
const
|
|
1600
|
+
const getKbaStep = (endpoint, envelopeId, roleName) => endpoint.api //
|
|
1601
1601
|
.get(`/v2/kba/${envelopeId}/${encodeURIComponent(roleName)}`)
|
|
1602
1602
|
.then((r) => r.data);
|
|
1603
1603
|
/**
|
|
@@ -1613,7 +1613,8 @@ const submitKbaIdentity = (endpoint, envelopeId, roleName, identity) => endpoint
|
|
|
1613
1613
|
.post(`/v2/kba/identity`, { envelopeId, roleName, identity })
|
|
1614
1614
|
.then((r) => r.data);
|
|
1615
1615
|
/**
|
|
1616
|
-
* Submit an identity response to a KBA challenge.
|
|
1616
|
+
* Submit an identity response to a KBA challenge. Answers should be submitted in the same order as
|
|
1617
|
+
* the challenges were listed in `IRecipientKbaStepChallenge.questions`.
|
|
1617
1618
|
*/
|
|
1618
1619
|
const submitKbaChallengeResponse = (endpoint, envelopeId, roleName, response) => endpoint.api //
|
|
1619
1620
|
.post(`/v2/kba/response`, { envelopeId, roleName, response })
|
|
@@ -2565,7 +2566,7 @@ const getAllTags = (endpoint) => endpoint.api //
|
|
|
2565
2566
|
* ```
|
|
2566
2567
|
*/
|
|
2567
2568
|
const getTemplates = (endpoint, params) => endpoint.api //
|
|
2568
|
-
.post('/templates', { params })
|
|
2569
|
+
.post('/v2/templates', { params })
|
|
2569
2570
|
.then((r) => r.data);
|
|
2570
2571
|
// export interface IListTemplatesParams {
|
|
2571
2572
|
// name?: string;
|
|
@@ -2599,7 +2600,7 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
2599
2600
|
* ```
|
|
2600
2601
|
*/
|
|
2601
2602
|
const getTemplate = (endpoint, templateId) => endpoint.api //
|
|
2602
|
-
.get(`/templates/${templateId}`)
|
|
2603
|
+
.get(`/v2/templates/${templateId}`)
|
|
2603
2604
|
.then((r) => {
|
|
2604
2605
|
const template = r.data;
|
|
2605
2606
|
window?.console?.log('[JS_SDK] Post-processing template', template);
|
|
@@ -2622,18 +2623,6 @@ const getTemplate = (endpoint, templateId) => endpoint.api //
|
|
|
2622
2623
|
});
|
|
2623
2624
|
return template;
|
|
2624
2625
|
});
|
|
2625
|
-
/**
|
|
2626
|
-
* Get owner information for a template.
|
|
2627
|
-
*
|
|
2628
|
-
* ```typescript
|
|
2629
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2630
|
-
*
|
|
2631
|
-
* const template = await Templates.getTemplateOwnerInfo((VerdocsEndpoint.getDefault(), '83da3d70-7857-4392-b876-c4592a304bc9');
|
|
2632
|
-
* ```
|
|
2633
|
-
*/
|
|
2634
|
-
const getTemplateOwnerInfo = (endpoint, templateId) => endpoint.api //
|
|
2635
|
-
.get(`/templates/${templateId}`)
|
|
2636
|
-
.then((r) => r.data);
|
|
2637
2626
|
const ALLOWED_CREATE_FIELDS = [
|
|
2638
2627
|
'name',
|
|
2639
2628
|
'is_personal',
|
|
@@ -2643,43 +2632,6 @@ const ALLOWED_CREATE_FIELDS = [
|
|
|
2643
2632
|
'roles',
|
|
2644
2633
|
'fields',
|
|
2645
2634
|
];
|
|
2646
|
-
/**
|
|
2647
|
-
* Create a template.
|
|
2648
|
-
*
|
|
2649
|
-
* ```typescript
|
|
2650
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2651
|
-
*
|
|
2652
|
-
* const newTemplate = await Templates.createTemplate((VerdocsEndpoint.getDefault(), {...});
|
|
2653
|
-
* ```
|
|
2654
|
-
*/
|
|
2655
|
-
const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
2656
|
-
const options = {
|
|
2657
|
-
timeout: 120000,
|
|
2658
|
-
onUploadProgress: (event) => {
|
|
2659
|
-
const total = event.total || 1;
|
|
2660
|
-
const loaded = event.loaded || 0;
|
|
2661
|
-
onUploadProgress?.(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
|
|
2662
|
-
},
|
|
2663
|
-
};
|
|
2664
|
-
if (params.documents && params.documents[0] instanceof File) {
|
|
2665
|
-
if (params.documents.length > 10) {
|
|
2666
|
-
throw new Error('createTemplate() has a maximum of 10 documents that can be attached.');
|
|
2667
|
-
}
|
|
2668
|
-
const formData = new FormData();
|
|
2669
|
-
ALLOWED_CREATE_FIELDS.forEach((allowedKey) => {
|
|
2670
|
-
if (params[allowedKey] !== undefined) {
|
|
2671
|
-
formData.append(allowedKey, params[allowedKey]);
|
|
2672
|
-
}
|
|
2673
|
-
});
|
|
2674
|
-
params.documents.forEach((file) => {
|
|
2675
|
-
formData.append('documents', file, file.name);
|
|
2676
|
-
});
|
|
2677
|
-
return endpoint.api.post('/templates', formData, options).then((r) => r.data);
|
|
2678
|
-
}
|
|
2679
|
-
else {
|
|
2680
|
-
return endpoint.api.post('/templates', params, options).then((r) => r.data);
|
|
2681
|
-
}
|
|
2682
|
-
};
|
|
2683
2635
|
/**
|
|
2684
2636
|
* Create a template.
|
|
2685
2637
|
*
|
|
@@ -2689,7 +2641,7 @@ const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
|
2689
2641
|
* const newTemplate = await Templates.createTemplatev2((VerdocsEndpoint.getDefault(), {...});
|
|
2690
2642
|
* ```
|
|
2691
2643
|
*/
|
|
2692
|
-
const
|
|
2644
|
+
const createTemplate = (endpoint, params, onUploadProgress) => {
|
|
2693
2645
|
const options = {
|
|
2694
2646
|
timeout: 120000,
|
|
2695
2647
|
onUploadProgress: (event) => {
|
|
@@ -2765,33 +2717,6 @@ const deleteTemplate = (endpoint, templateId) => endpoint.api //
|
|
|
2765
2717
|
const searchTemplates = async (endpoint, params) => endpoint.api //
|
|
2766
2718
|
.post('/templates/search', params)
|
|
2767
2719
|
.then((r) => r.data);
|
|
2768
|
-
/**
|
|
2769
|
-
* Get a summary of template data, typically used to populate admin panel dashboard pages.
|
|
2770
|
-
*
|
|
2771
|
-
* ```typescript
|
|
2772
|
-
* import {Templates} from '@verdocs/js-sdk/Templates';
|
|
2773
|
-
*
|
|
2774
|
-
* const summary = await Templates.getSummary((VerdocsEndpoint.getDefault(), 0);
|
|
2775
|
-
* ```
|
|
2776
|
-
*/
|
|
2777
|
-
const getTemplatesSummary = async (endpoint, params = {}) => endpoint.api //
|
|
2778
|
-
.post('/templates/summary', params)
|
|
2779
|
-
.then((r) => r.data);
|
|
2780
|
-
const cachedTemplates = {};
|
|
2781
|
-
/**
|
|
2782
|
-
* Wrapper for `getTemplate()` that limits queries to one every 2 seconds per template ID.
|
|
2783
|
-
* This is intended for use in component hierarchies that all rely on the same template
|
|
2784
|
-
* to avoid unnecessary repeat server calls.
|
|
2785
|
-
*/
|
|
2786
|
-
const throttledGetTemplate = (endpoint, templateId) => {
|
|
2787
|
-
if (cachedTemplates[templateId] && cachedTemplates[templateId].loaded + 2000 < new Date().getTime()) {
|
|
2788
|
-
return cachedTemplates[templateId].template;
|
|
2789
|
-
}
|
|
2790
|
-
return getTemplate(endpoint, templateId).then((template) => {
|
|
2791
|
-
cachedTemplates[templateId] = { loaded: new Date().getTime(), template };
|
|
2792
|
-
return template;
|
|
2793
|
-
});
|
|
2794
|
-
};
|
|
2795
2720
|
/**
|
|
2796
2721
|
* List templates.
|
|
2797
2722
|
*
|
|
@@ -2945,7 +2870,6 @@ exports.createTemplateDocument = createTemplateDocument;
|
|
|
2945
2870
|
exports.createTemplateFromSharepoint = createTemplateFromSharepoint;
|
|
2946
2871
|
exports.createTemplateReminder = createTemplateReminder;
|
|
2947
2872
|
exports.createTemplateRole = createTemplateRole;
|
|
2948
|
-
exports.createTemplatev2 = createTemplatev2;
|
|
2949
2873
|
exports.declineOrganizationInvitation = declineOrganizationInvitation;
|
|
2950
2874
|
exports.decodeAccessTokenBody = decodeAccessTokenBody;
|
|
2951
2875
|
exports.decodeJWTBody = decodeJWTBody;
|
|
@@ -2996,7 +2920,7 @@ exports.getFieldsForRole = getFieldsForRole;
|
|
|
2996
2920
|
exports.getGroup = getGroup;
|
|
2997
2921
|
exports.getGroups = getGroups;
|
|
2998
2922
|
exports.getInPersonLink = getInPersonLink;
|
|
2999
|
-
exports.
|
|
2923
|
+
exports.getKbaStep = getKbaStep;
|
|
3000
2924
|
exports.getMatchingCountry = getMatchingCountry;
|
|
3001
2925
|
exports.getNextRecipient = getNextRecipient;
|
|
3002
2926
|
exports.getNotifications = getNotifications;
|
|
@@ -3026,14 +2950,12 @@ exports.getTemplateDocumentFile = getTemplateDocumentFile;
|
|
|
3026
2950
|
exports.getTemplateDocumentPageDisplayUri = getTemplateDocumentPageDisplayUri;
|
|
3027
2951
|
exports.getTemplateDocumentThumbnail = getTemplateDocumentThumbnail;
|
|
3028
2952
|
exports.getTemplateDocuments = getTemplateDocuments;
|
|
3029
|
-
exports.getTemplateOwnerInfo = getTemplateOwnerInfo;
|
|
3030
2953
|
exports.getTemplateReminder = getTemplateReminder;
|
|
3031
2954
|
exports.getTemplateRole = getTemplateRole;
|
|
3032
2955
|
exports.getTemplateRoleFields = getTemplateRoleFields;
|
|
3033
2956
|
exports.getTemplateRoles = getTemplateRoles;
|
|
3034
2957
|
exports.getTemplateTags = getTemplateTags;
|
|
3035
2958
|
exports.getTemplates = getTemplates;
|
|
3036
|
-
exports.getTemplatesSummary = getTemplatesSummary;
|
|
3037
2959
|
exports.getValidator = getValidator;
|
|
3038
2960
|
exports.getValidators = getValidators;
|
|
3039
2961
|
exports.getWebhooks = getWebhooks;
|
|
@@ -3069,7 +2991,6 @@ exports.submitKbaChallengeResponse = submitKbaChallengeResponse;
|
|
|
3069
2991
|
exports.submitKbaIdentity = submitKbaIdentity;
|
|
3070
2992
|
exports.submitKbaPin = submitKbaPin;
|
|
3071
2993
|
exports.switchProfile = switchProfile;
|
|
3072
|
-
exports.throttledGetTemplate = throttledGetTemplate;
|
|
3073
2994
|
exports.timePeriod = timePeriod;
|
|
3074
2995
|
exports.toggleStar = toggleStar;
|
|
3075
2996
|
exports.updateApiKey = updateApiKey;
|