@verdocs/js-sdk 4.1.0 → 4.1.2
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 +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -2
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1217,7 +1217,19 @@ const getEnvelopeRecipients = async (endpoint, envelopeId) => endpoint.api //
|
|
|
1217
1217
|
*/
|
|
1218
1218
|
const getEnvelope = async (endpoint, envelopeId) => endpoint.api //
|
|
1219
1219
|
.get(`/envelopes/${envelopeId}`)
|
|
1220
|
-
.then((r) =>
|
|
1220
|
+
.then((r) => {
|
|
1221
|
+
const envelope = r.data;
|
|
1222
|
+
// Post-process the envelope to upgrade to new data fields
|
|
1223
|
+
envelope.documents?.forEach((document) => {
|
|
1224
|
+
if (!document.order) {
|
|
1225
|
+
document.order = 0;
|
|
1226
|
+
}
|
|
1227
|
+
if (document.page_numbers) {
|
|
1228
|
+
document.pages = document.page_numbers;
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
return envelope;
|
|
1232
|
+
});
|
|
1221
1233
|
/**
|
|
1222
1234
|
* Get an Envelope Document
|
|
1223
1235
|
*/
|
|
@@ -2140,7 +2152,28 @@ const getTemplates = (endpoint, params) => endpoint.api //
|
|
|
2140
2152
|
*/
|
|
2141
2153
|
const getTemplate = (endpoint, templateId) => endpoint.api //
|
|
2142
2154
|
.get(`/templates/${templateId}`)
|
|
2143
|
-
.then((r) =>
|
|
2155
|
+
.then((r) => {
|
|
2156
|
+
const template = r.data;
|
|
2157
|
+
window?.console?.log('[JS_SDK] Post-processing template', template);
|
|
2158
|
+
// Post-process the template to upgrade to new data fields
|
|
2159
|
+
if (!template.documents && template.template_documents) {
|
|
2160
|
+
template.documents = template.template_documents;
|
|
2161
|
+
}
|
|
2162
|
+
template.documents?.forEach((document) => {
|
|
2163
|
+
if (!document.order) {
|
|
2164
|
+
document.order = 0;
|
|
2165
|
+
}
|
|
2166
|
+
if (document.page_numbers) {
|
|
2167
|
+
document.pages = document.page_numbers;
|
|
2168
|
+
}
|
|
2169
|
+
});
|
|
2170
|
+
template.fields?.forEach((field) => {
|
|
2171
|
+
if (field.setting) {
|
|
2172
|
+
field.settings = field.setting;
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
return template;
|
|
2176
|
+
});
|
|
2144
2177
|
/**
|
|
2145
2178
|
* Get owner information for a template.
|
|
2146
2179
|
*
|