@verdocs/js-sdk 6.2.0-beta.5 → 6.2.0-beta.8

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
@@ -2438,17 +2438,18 @@ const toggleTemplateStar = (endpoint, templateId) => endpoint.api //
2438
2438
  * ```typescript
2439
2439
  * import {TemplateDocument} from '@verdocs/js-sdk/Templates';
2440
2440
  *
2441
- * await TemplateDocument.createDocument((VerdocsEndpoint.getDefault(), templateID, params);
2441
+ * await TemplateDocument.createDocument(VerdocsEndpoint.getDefault(), templateID, params);
2442
2442
  * ```
2443
2443
  *
2444
2444
  * @group Template Documents
2445
2445
  * @api POST /v2/templates/:template_id/documents Attach a document to a template
2446
2446
  * @apiBody string(format:binary) file Document file to attach. The file name will automatically be used as the document name.
2447
+ * @apiBody string(format:uuid) template_id Template ID to attach the document to
2447
2448
  * @apiSuccess ITemplateDocument . Template document
2448
2449
  */
2449
2450
  const createTemplateDocument = (endpoint, template_id, file, onUploadProgress) => {
2450
2451
  const formData = new FormData();
2451
- formData.append('document', file, file.name);
2452
+ formData.append('file', file, file.name);
2452
2453
  formData.append('template_id', template_id);
2453
2454
  return endpoint.api //
2454
2455
  .post(`/v2/template-documents`, formData, {
@@ -2465,17 +2466,17 @@ const createTemplateDocument = (endpoint, template_id, file, onUploadProgress) =
2465
2466
  * Delete a specific Document.
2466
2467
  *
2467
2468
  * ```typescript
2468
- * import {TemplateDocument} from '@verdocs/js-sdk/Templates';
2469
+ * import {deleteTemplateDocument} from '@verdocs/js-sdk/Templates';
2469
2470
  *
2470
- * await TemplateDocument.deleteDocument((VerdocsEndpoint.getDefault(), templateID, documentID);
2471
+ * await deleteTemplateDocument(VerdocsEndpoint.getDefault(), documentID);
2471
2472
  * ```
2472
2473
  *
2473
2474
  * @group Template Documents
2474
- * @api DELETE /v2/templates/:temlate_id/documents/:document_id Delete a template document
2475
+ * @api DELETE /v2/template-documents/:document_id Delete a template document
2475
2476
  * @apiSuccess string . Success
2476
2477
  */
2477
- const deleteTemplateDocument = (endpoint, templateId, documentId) => endpoint.api //
2478
- .delete(`/v2/templates/${templateId}/documents/${documentId}`)
2478
+ const deleteTemplateDocument = (endpoint, documentId) => endpoint.api //
2479
+ .delete(`/v2/template-documents/${documentId}`)
2479
2480
  .then((r) => r.data);
2480
2481
  /**
2481
2482
  * Get all metadata for a template document. Note that when called by non-creators (e.g. Org Collaborators)
@@ -2608,6 +2609,7 @@ const isFieldFilled = (field, allRecipientFields) => {
2608
2609
  return false;
2609
2610
  }
2610
2611
  };
2612
+ // TODO: Only allow !required to bypass validation if the field is empty.
2611
2613
  const isFieldValid = (field, allRecipientFields) => {
2612
2614
  return !field.required || isFieldFilled(field, allRecipientFields);
2613
2615
  };