docspring 4.0.0 → 4.2.0

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.
Files changed (116) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +13 -1
  3. package/dist/ApiClient.js +2 -2
  4. package/dist/RequestSchemas.js +1231 -9
  5. package/dist/WebhookSignature.js +86 -0
  6. package/dist/api/Client.js +620 -38
  7. package/dist/index.js +238 -0
  8. package/dist/model/AddTemplateFieldsRequest.js +132 -0
  9. package/dist/model/AuthenticationCheck.js +1 -1
  10. package/dist/model/CombinedPdf.js +3 -3
  11. package/dist/model/CombinedPdfFiles.js +1 -1
  12. package/dist/model/CombinedPdfList.js +1 -1
  13. package/dist/model/CombinedPdfSource.js +1 -1
  14. package/dist/model/CombinedPdfSourceInput.js +1 -1
  15. package/dist/model/CombinedPdfSourcePdf.js +1 -1
  16. package/dist/model/CopyTemplateRequest.js +1 -1
  17. package/dist/model/CreateCombinedPdfRequest.js +2 -2
  18. package/dist/model/CreateCustomFileFromUploadRequest.js +1 -1
  19. package/dist/model/CreateFolderRequest.js +1 -1
  20. package/dist/model/CreateSignatureRequestEventRequest.js +1 -1
  21. package/dist/model/CreateSignatureRequestTokenRequest.js +1 -1
  22. package/dist/model/CreateSubmissionBatchRequest.js +15 -1
  23. package/dist/model/CreateSubmissionRequest.js +17 -3
  24. package/dist/model/CreateTemplatePreviewRequest.js +112 -0
  25. package/dist/model/CreateTemplateRequest.js +81 -4
  26. package/dist/model/CreateWebhookRequest.js +1 -1
  27. package/dist/model/CustomFile.js +1 -1
  28. package/dist/model/CustomFileList.js +1 -1
  29. package/dist/model/CustomFileSourcePdf.js +1 -1
  30. package/dist/model/ErrorCode.js +11 -1
  31. package/dist/model/ErrorDetail.js +2 -2
  32. package/dist/model/ErrorInfo.js +6 -6
  33. package/dist/model/ErrorResponse.js +1 -1
  34. package/dist/model/Field.js +1230 -0
  35. package/dist/model/FieldComparisonCondition.js +1 -1
  36. package/dist/model/FieldDependency.js +154 -0
  37. package/dist/model/FieldDependencyInput.js +154 -0
  38. package/dist/model/FieldEqualsCondition.js +1 -1
  39. package/dist/model/FieldGroup.js +206 -0
  40. package/dist/model/FieldGroupInput.js +180 -0
  41. package/dist/model/FieldGroupType.js +59 -0
  42. package/dist/model/FieldInCondition.js +1 -1
  43. package/dist/model/FieldInput.js +1012 -0
  44. package/dist/model/FieldOverride.js +1 -1
  45. package/dist/model/FieldPresenceCondition.js +1 -1
  46. package/dist/model/FieldRangeCondition.js +1 -1
  47. package/dist/model/FieldType.js +124 -0
  48. package/dist/model/Folder.js +1 -1
  49. package/dist/model/FolderList.js +1 -1
  50. package/dist/model/GenerateFilesFormat.js +54 -0
  51. package/dist/model/GenerateSubmissionFilesRequest.js +115 -0
  52. package/dist/model/GeneratedFile.js +1 -1
  53. package/dist/model/HtmlEngineOptions.js +1 -1
  54. package/dist/model/HtmlEngineOptionsInput.js +1 -1
  55. package/dist/model/MoveFolderRequest.js +1 -1
  56. package/dist/model/MoveTemplateRequest.js +1 -1
  57. package/dist/model/OutputFormat.js +59 -0
  58. package/dist/model/PageImage.js +220 -0
  59. package/dist/model/PageImages.js +155 -0
  60. package/dist/model/PredefinedField.js +183 -0
  61. package/dist/model/PredefinedFieldInput.js +183 -0
  62. package/dist/model/PublishTemplateVersionRequest.js +1 -1
  63. package/dist/model/RemoveTemplateFieldsRequest.js +114 -0
  64. package/dist/model/RenameFolderRequest.js +1 -1
  65. package/dist/model/ReorderTemplateFieldsRequest.js +114 -0
  66. package/dist/model/RestoreTemplateVersionRequest.js +1 -1
  67. package/dist/model/SignatureRequest.js +1 -1
  68. package/dist/model/SignatureRequestEvent.js +1 -1
  69. package/dist/model/SignatureRequestInput.js +1 -1
  70. package/dist/model/SignatureRequestToken.js +1 -1
  71. package/dist/model/Submission.js +84 -68
  72. package/dist/model/SubmissionAction.js +1 -1
  73. package/dist/model/SubmissionBatch.js +1 -1
  74. package/dist/model/SubmissionFiles.js +10 -1
  75. package/dist/model/SubmissionInput.js +17 -3
  76. package/dist/model/SubmissionList.js +5 -5
  77. package/dist/model/SubmissionSourcePdf.js +1 -1
  78. package/dist/model/SubmissionSummary.js +343 -0
  79. package/dist/model/SubmissionValidation.js +151 -0
  80. package/dist/model/Template.js +129 -56
  81. package/dist/model/TemplateActor.js +3 -3
  82. package/dist/model/TemplateDefaults.js +1 -1
  83. package/dist/model/TemplateDefaultsInput.js +1 -1
  84. package/dist/model/TemplateDiff.js +206 -0
  85. package/dist/model/TemplateDiffSummary.js +165 -0
  86. package/dist/model/TemplateDocument.js +36 -36
  87. package/dist/model/TemplateDocumentState.js +11 -1
  88. package/dist/model/TemplateDocumentSummary.js +152 -0
  89. package/dist/model/TemplateFieldChange.js +146 -0
  90. package/dist/model/TemplateFieldChanges.js +196 -0
  91. package/dist/model/TemplateFieldDependency.js +3 -3
  92. package/dist/model/TemplateFieldDependencyCondition.js +1 -1
  93. package/dist/model/TemplateFieldDependencyConditionInput.js +1 -1
  94. package/dist/model/TemplateFieldDependencyInput.js +3 -3
  95. package/dist/model/TemplateFieldMove.js +132 -0
  96. package/dist/model/TemplateFields.js +147 -0
  97. package/dist/model/TemplateModelCode.js +1 -1
  98. package/dist/model/TemplatePageImages.js +158 -0
  99. package/dist/model/TemplatePageProcessingStatus.js +1 -1
  100. package/dist/model/TemplatePreview.js +211 -0
  101. package/dist/model/TemplatePreviewState.js +64 -0
  102. package/dist/model/TemplateSourcePdf.js +1 -1
  103. package/dist/model/TemplateSummary.js +14 -288
  104. package/dist/model/TemplateSummaryList.js +1 -1
  105. package/dist/model/TemplateVersion.js +1 -1
  106. package/dist/model/UpdateSignatureRequestRequest.js +1 -1
  107. package/dist/model/UpdateTemplateDocumentRequest.js +33 -30
  108. package/dist/model/UpdateTemplateFieldsRequest.js +132 -0
  109. package/dist/model/UpdateTemplateRequest.js +84 -2
  110. package/dist/model/UpdateWebhookRequest.js +1 -1
  111. package/dist/model/UploadPresign.js +1 -1
  112. package/dist/model/UrlSourcePdf.js +1 -1
  113. package/dist/model/ValidateSubmissionRequest.js +226 -0
  114. package/dist/model/Webhook.js +1 -1
  115. package/dist/model/WebhookList.js +1 -1
  116. package/package.json +3 -2
@@ -7,7 +7,9 @@ exports["default"] = void 0;
7
7
  var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
8
  var _AiFieldNamingLanguage = _interopRequireDefault(require("./AiFieldNamingLanguage"));
9
9
  var _ExpirationInterval = _interopRequireDefault(require("./ExpirationInterval"));
10
+ var _FieldGroup = _interopRequireDefault(require("./FieldGroup"));
10
11
  var _HtmlEngineOptions = _interopRequireDefault(require("./HtmlEngineOptions"));
12
+ var _PredefinedField = _interopRequireDefault(require("./PredefinedField"));
11
13
  var _TemplateActor = _interopRequireDefault(require("./TemplateActor"));
12
14
  var _TemplateDefaults = _interopRequireDefault(require("./TemplateDefaults"));
13
15
  var _TemplateDocument = _interopRequireDefault(require("./TemplateDocument"));
@@ -39,7 +41,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
39
41
  /**
40
42
  * The Template model module.
41
43
  * @module model/Template
42
- * @version 4.0.0
44
+ * @version 4.2.0
43
45
  */
44
46
  var Template = /*#__PURE__*/function () {
45
47
  /**
@@ -51,21 +53,24 @@ var Template = /*#__PURE__*/function () {
51
53
  * @param name {String} The template's name.
52
54
  * @param description {String} Shown under the template's name at the top of its hosted forms, and used as their meta description. Not shown on embedded forms or signature requests.
53
55
  * @param template_type {module:model/TemplateType} `pdf`: fields placed on an uploaded PDF. `html`: a PDF rendered from HTML and SCSS. It can't be changed after the template is created.
54
- * @param ready {Boolean} Whether the template can generate PDFs. HTML templates are always ready. A PDF template is ready once its document has been processed (`document.state` is `processed`).
56
+ * @param ready {Boolean} Whether the template can generate PDFs. HTML templates are always ready. A PDF template is ready once DocSpring has stored its PDF, made an image of each page and finished looking for fields on each page, which can be after `document.state` becomes `processed`. A PDF template with no PDF (`document` is null) isn't ready.
55
57
  * @param document {module:model/TemplateDocument} The PDF of a PDF template. Null for HTML templates, and for a PDF template that has no PDF yet.
56
58
  * @param parent_folder_id {String} The ID of the folder the template is in. Null for a template at the root. Setting it moves the template and all of its published versions.
57
59
  * @param path {String} The path of the folder the template is in, such as `/Contracts`. `/` for a template at the root.
58
- * @param version {String} The published version this is, such as `1.2.0`. Null for the draft.
59
60
  * @param latest_version {String} The template's latest published version. Null if no version has been published.
60
61
  * @param version_published_at {Date} When this version was published. Null for the draft.
61
62
  * @param locked {Boolean} A locked template can't be changed or deleted until it's unlocked (`locked` can always be changed).
63
+ * @param last_changed_at {Date} When the draft was last changed.
64
+ * @param created_at {Date} When the template was created.
65
+ * @param updated_at {Date} When the template was last updated.
66
+ * @param version {String} The published version this is, such as `1.2.0`. Null for the draft.
62
67
  * @param add_signature_request_submission_id_footers {Boolean} Print the submission ID in the footer of each page of PDFs signed through signature requests.
63
68
  * @param ai_field_naming_language {module:model/AiFieldNamingLanguage} The language AI field setup names fields in: `auto` uses the form's language when it's written in the Latin alphabet without accents, and English otherwise; `english` always uses English; `form_language` uses the form's language and script. New templates take it from your account's template settings. Null for HTML templates.
64
69
  * @param allow_additional_properties {Boolean} Accept submission data with properties that aren't fields of the template.
65
70
  * @param allow_skipping_optional_fields {Boolean} Visual forms and signature request forms show the Continue button as soon as the required fields are filled in, without visiting each optional field. The `allowSkippingOptionalFields` embed option overrides it.
66
71
  * @param default_form_mode {module:model/TemplateFormMode} The hosted form that /templates/{template_id}/form shows when its URL has no `mode` parameter: `web` (the web form), `visual` (the visual form, where fields are filled in on the PDF) or `dual` (both, in tabs). HTML templates have no visual form, so `web` is the only value they accept.
67
72
  * @param editable_submissions {Boolean} Generate PDFs whose text and check fields stay fillable ("Generate Editable PDFs"). A submission's `editable` overrides it.
68
- * @param embed_domains {Array.<String>} The sites where the template's signature requests, forms and embedded template editor can be loaded: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). When it's empty, live signature requests don't load on any site, and the embedded template editor loads on every site.
73
+ * @param embed_domains {Array.<String>} The sites that can embed the template's live signature requests and its embedded template editor: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). Browsers open a live signature request in a frame only on these sites (and DocSpring's), so with an empty list it can't be embedded anywhere; a test signature request can be embedded on any site. The embedded template editor loads only for a page on one of these sites (by its Referer or Origin header), and on any site when the list is empty. Forms embedded on a page (Visual Forms JS and the simple form) aren't restricted.
69
74
  * @param embed_edit_allow_settings {Boolean} Allow the embedded template editor to change sensitive template settings (webhooks, redirect URL, encryption, public access, expiration and so on).
70
75
  * @param embed_edit_allow_versioning {Boolean} Allow the embedded template editor to publish, restore, compare and delete published versions.
71
76
  * @param embed_edit_allow_document_replacement {Boolean} Allow the embedded template editor to replace the template's PDF.
@@ -80,23 +85,24 @@ var Template = /*#__PURE__*/function () {
80
85
  * @param public_web_form {Boolean} Allow anyone to fill in the template's web form.
81
86
  * @param redirect_url {String} Where the web form sends people after they submit it.
82
87
  * @param has_slack_webhook_url {Boolean} Whether `slack_webhook_url` is set.
83
- * @param last_changed_at {Date} When the draft was last changed.
84
88
  * @param last_changed_by {module:model/TemplateActor} Who last changed the draft: a user in your account, an API token, or someone using the embedded template editor. Null if no change has been recorded.
85
- * @param created_at {Date} When the template was created.
86
- * @param updated_at {Date} When the template was last updated.
87
89
  * @param defaults {module:model/TemplateDefaults}
88
90
  * @param field_dependencies {Array.<module:model/TemplateFieldDependency>} Conditional logic: each rule shows or hides its target fields, or makes them required, depending on the values of other fields.
91
+ * @param field_groups {Array.<module:model/FieldGroup>} The groups of the template's fields, with their settings. A field's name puts it in groups: `address/city` is in the group `address`, and `items/0/price` is in the list `items` and its items' group `items/~`.
92
+ * @param predefined_fields {Array.<module:model/PredefinedField>} The field names that people using the embedded template editor choose from, each with the data type and settings a field gets when it's given that name. Setting it replaces the whole list; an empty list turns them off.
93
+ * @param predefined_fields_sample_data {Object.<String, Object>} Sample submission data that sets `predefined_fields`: each value becomes a predefined field, with a type that fits it (`string`, `number`, `boolean`, `date`, `email` or `url`) and `required_in_template` true. Nested objects and arrays become names with `/`, such as `customer/email`. Without `predefined_fields` in the same request, it replaces them; with them, it adds to them and sets the types of the ones it has values for.
89
94
  * @param html {String} The HTML of an HTML template, as a Liquid template. Null for PDF templates.
90
95
  * @param scss {String} The SCSS of an HTML template.
91
96
  * @param header_html {String} The HTML printed at the top of each page of an HTML template.
92
97
  * @param footer_html {String} The HTML printed at the bottom of each page of an HTML template.
93
98
  * @param html_engine_options {module:model/HtmlEngineOptions} How an HTML template's PDFs are printed. Null for PDF templates. Setting it replaces the whole object: options left out use their defaults.
99
+ * @param html_escape_data {Boolean} Whether an HTML template HTML-escapes the values it prints. When true, `{{ value }}` prints a value as text, so a `<` or `&` in it is printed as that character, and `{{ value | raw }}` prints a value as HTML. New HTML templates default to true. Templates created before October 2026, or with API v1, default to false, which prints every value as HTML. Null for PDF templates.
94
100
  * @param embed_edit_token {String} The token that opens the template in the embedded template editor.
95
101
  * @param versions {Array.<module:model/TemplateVersion>} The template's published versions, newest first (up to 100).
96
102
  */
97
- function Template(id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions) {
103
+ function Template(id, name, description, template_type, ready, document, parent_folder_id, path, latest_version, version_published_at, locked, last_changed_at, created_at, updated_at, version, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_by, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data, embed_edit_token, versions) {
98
104
  _classCallCheck(this, Template);
99
- Template.initialize(this, id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions);
105
+ Template.initialize(this, id, name, description, template_type, ready, document, parent_folder_id, path, latest_version, version_published_at, locked, last_changed_at, created_at, updated_at, version, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_by, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data, embed_edit_token, versions);
100
106
  }
101
107
 
102
108
  /**
@@ -106,7 +112,7 @@ var Template = /*#__PURE__*/function () {
106
112
  */
107
113
  return _createClass(Template, null, [{
108
114
  key: "initialize",
109
- value: function initialize(obj, id, name, description, template_type, ready, document, parent_folder_id, path, version, latest_version, version_published_at, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_at, last_changed_by, created_at, updated_at, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, embed_edit_token, versions) {
115
+ value: function initialize(obj, id, name, description, template_type, ready, document, parent_folder_id, path, latest_version, version_published_at, locked, last_changed_at, created_at, updated_at, version, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, has_encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, has_slack_webhook_url, last_changed_by, defaults, field_dependencies, field_groups, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data, embed_edit_token, versions) {
110
116
  obj['id'] = id;
111
117
  obj['name'] = name;
112
118
  obj['description'] = description;
@@ -115,10 +121,13 @@ var Template = /*#__PURE__*/function () {
115
121
  obj['document'] = document;
116
122
  obj['parent_folder_id'] = parent_folder_id;
117
123
  obj['path'] = path;
118
- obj['version'] = version;
119
124
  obj['latest_version'] = latest_version;
120
125
  obj['version_published_at'] = version_published_at;
121
126
  obj['locked'] = locked;
127
+ obj['last_changed_at'] = last_changed_at;
128
+ obj['created_at'] = created_at;
129
+ obj['updated_at'] = updated_at;
130
+ obj['version'] = version;
122
131
  obj['add_signature_request_submission_id_footers'] = add_signature_request_submission_id_footers;
123
132
  obj['ai_field_naming_language'] = ai_field_naming_language;
124
133
  obj['allow_additional_properties'] = allow_additional_properties;
@@ -140,17 +149,18 @@ var Template = /*#__PURE__*/function () {
140
149
  obj['public_web_form'] = public_web_form;
141
150
  obj['redirect_url'] = redirect_url;
142
151
  obj['has_slack_webhook_url'] = has_slack_webhook_url;
143
- obj['last_changed_at'] = last_changed_at;
144
152
  obj['last_changed_by'] = last_changed_by;
145
- obj['created_at'] = created_at;
146
- obj['updated_at'] = updated_at;
147
153
  obj['defaults'] = defaults;
148
154
  obj['field_dependencies'] = field_dependencies;
155
+ obj['field_groups'] = field_groups;
156
+ obj['predefined_fields'] = predefined_fields;
157
+ obj['predefined_fields_sample_data'] = predefined_fields_sample_data;
149
158
  obj['html'] = html;
150
159
  obj['scss'] = scss;
151
160
  obj['header_html'] = header_html;
152
161
  obj['footer_html'] = footer_html;
153
162
  obj['html_engine_options'] = html_engine_options;
163
+ obj['html_escape_data'] = html_escape_data;
154
164
  obj['embed_edit_token'] = embed_edit_token;
155
165
  obj['versions'] = versions;
156
166
  }
@@ -192,9 +202,6 @@ var Template = /*#__PURE__*/function () {
192
202
  if (data.hasOwnProperty('path')) {
193
203
  obj['path'] = _ApiClient["default"].convertToType(data['path'], 'String');
194
204
  }
195
- if (data.hasOwnProperty('version')) {
196
- obj['version'] = _ApiClient["default"].convertToType(data['version'], 'String');
197
- }
198
205
  if (data.hasOwnProperty('latest_version')) {
199
206
  obj['latest_version'] = _ApiClient["default"].convertToType(data['latest_version'], 'String');
200
207
  }
@@ -204,6 +211,18 @@ var Template = /*#__PURE__*/function () {
204
211
  if (data.hasOwnProperty('locked')) {
205
212
  obj['locked'] = _ApiClient["default"].convertToType(data['locked'], 'Boolean');
206
213
  }
214
+ if (data.hasOwnProperty('last_changed_at')) {
215
+ obj['last_changed_at'] = _ApiClient["default"].convertToType(data['last_changed_at'], 'Date');
216
+ }
217
+ if (data.hasOwnProperty('created_at')) {
218
+ obj['created_at'] = _ApiClient["default"].convertToType(data['created_at'], 'Date');
219
+ }
220
+ if (data.hasOwnProperty('updated_at')) {
221
+ obj['updated_at'] = _ApiClient["default"].convertToType(data['updated_at'], 'Date');
222
+ }
223
+ if (data.hasOwnProperty('version')) {
224
+ obj['version'] = _ApiClient["default"].convertToType(data['version'], 'String');
225
+ }
207
226
  if (data.hasOwnProperty('add_signature_request_submission_id_footers')) {
208
227
  obj['add_signature_request_submission_id_footers'] = _ApiClient["default"].convertToType(data['add_signature_request_submission_id_footers'], 'Boolean');
209
228
  }
@@ -267,24 +286,26 @@ var Template = /*#__PURE__*/function () {
267
286
  if (data.hasOwnProperty('has_slack_webhook_url')) {
268
287
  obj['has_slack_webhook_url'] = _ApiClient["default"].convertToType(data['has_slack_webhook_url'], 'Boolean');
269
288
  }
270
- if (data.hasOwnProperty('last_changed_at')) {
271
- obj['last_changed_at'] = _ApiClient["default"].convertToType(data['last_changed_at'], 'Date');
272
- }
273
289
  if (data.hasOwnProperty('last_changed_by')) {
274
290
  obj['last_changed_by'] = _ApiClient["default"].convertToType(data['last_changed_by'], _TemplateActor["default"]);
275
291
  }
276
- if (data.hasOwnProperty('created_at')) {
277
- obj['created_at'] = _ApiClient["default"].convertToType(data['created_at'], 'Date');
278
- }
279
- if (data.hasOwnProperty('updated_at')) {
280
- obj['updated_at'] = _ApiClient["default"].convertToType(data['updated_at'], 'Date');
281
- }
282
292
  if (data.hasOwnProperty('defaults')) {
283
293
  obj['defaults'] = data['defaults'] === null ? null : _TemplateDefaults["default"].constructFromObject(data['defaults']);
284
294
  }
285
295
  if (data.hasOwnProperty('field_dependencies')) {
286
296
  obj['field_dependencies'] = _ApiClient["default"].convertToType(data['field_dependencies'], [_TemplateFieldDependency["default"]]);
287
297
  }
298
+ if (data.hasOwnProperty('field_groups')) {
299
+ obj['field_groups'] = _ApiClient["default"].convertToType(data['field_groups'], [_FieldGroup["default"]]);
300
+ }
301
+ if (data.hasOwnProperty('predefined_fields')) {
302
+ obj['predefined_fields'] = _ApiClient["default"].convertToType(data['predefined_fields'], [_PredefinedField["default"]]);
303
+ }
304
+ if (data.hasOwnProperty('predefined_fields_sample_data')) {
305
+ obj['predefined_fields_sample_data'] = _ApiClient["default"].convertToType(data['predefined_fields_sample_data'], {
306
+ 'String': Object
307
+ });
308
+ }
288
309
  if (data.hasOwnProperty('html')) {
289
310
  obj['html'] = _ApiClient["default"].convertToType(data['html'], 'String');
290
311
  }
@@ -300,6 +321,9 @@ var Template = /*#__PURE__*/function () {
300
321
  if (data.hasOwnProperty('html_engine_options')) {
301
322
  obj['html_engine_options'] = _ApiClient["default"].convertToType(data['html_engine_options'], _HtmlEngineOptions["default"]);
302
323
  }
324
+ if (data.hasOwnProperty('html_escape_data')) {
325
+ obj['html_escape_data'] = _ApiClient["default"].convertToType(data['html_escape_data'], 'Boolean');
326
+ }
303
327
  if (data.hasOwnProperty('embed_edit_token')) {
304
328
  obj['embed_edit_token'] = _ApiClient["default"].convertToType(data['embed_edit_token'], 'String');
305
329
  }
@@ -359,13 +383,13 @@ var Template = /*#__PURE__*/function () {
359
383
  throw new Error("Expected the field `path` to be a primitive type in the JSON string but got " + data['path']);
360
384
  }
361
385
  // ensure the json data is a string
362
- if (data['version'] && !(typeof data['version'] === 'string' || data['version'] instanceof String)) {
363
- throw new Error("Expected the field `version` to be a primitive type in the JSON string but got " + data['version']);
364
- }
365
- // ensure the json data is a string
366
386
  if (data['latest_version'] && !(typeof data['latest_version'] === 'string' || data['latest_version'] instanceof String)) {
367
387
  throw new Error("Expected the field `latest_version` to be a primitive type in the JSON string but got " + data['latest_version']);
368
388
  }
389
+ // ensure the json data is a string
390
+ if (data['version'] && !(typeof data['version'] === 'string' || data['version'] instanceof String)) {
391
+ throw new Error("Expected the field `version` to be a primitive type in the JSON string but got " + data['version']);
392
+ }
369
393
  // ensure the json data is an array
370
394
  if (!Array.isArray(data['embed_domains'])) {
371
395
  throw new Error("Expected the field `embed_domains` to be an array in the JSON data but got " + data['embed_domains']);
@@ -383,6 +407,31 @@ var Template = /*#__PURE__*/function () {
383
407
  if (!Array.isArray(data['field_dependencies'])) {
384
408
  throw new Error("Expected the field `field_dependencies` to be an array in the JSON data but got " + data['field_dependencies']);
385
409
  }
410
+ // ensure the json data is an array
411
+ if (!Array.isArray(data['field_groups'])) {
412
+ throw new Error("Expected the field `field_groups` to be an array in the JSON data but got " + data['field_groups']);
413
+ }
414
+ if (data['predefined_fields']) {
415
+ // data not null
416
+ // ensure the json data is an array
417
+ if (!Array.isArray(data['predefined_fields'])) {
418
+ throw new Error("Expected the field `predefined_fields` to be an array in the JSON data but got " + data['predefined_fields']);
419
+ }
420
+ // validate the optional field `predefined_fields` (array)
421
+ var _iterator2 = _createForOfIteratorHelper(data['predefined_fields']),
422
+ _step2;
423
+ try {
424
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
425
+ var item = _step2.value;
426
+ _PredefinedField["default"].validateJSON(item);
427
+ }
428
+ } catch (err) {
429
+ _iterator2.e(err);
430
+ } finally {
431
+ _iterator2.f();
432
+ }
433
+ ;
434
+ }
386
435
  // ensure the json data is a string
387
436
  if (data['html'] && !(typeof data['html'] === 'string' || data['html'] instanceof String)) {
388
437
  throw new Error("Expected the field `html` to be a primitive type in the JSON string but got " + data['html']);
@@ -416,7 +465,7 @@ var Template = /*#__PURE__*/function () {
416
465
  }
417
466
  }]);
418
467
  }();
419
- Template.RequiredProperties = ["id", "name", "description", "template_type", "ready", "document", "parent_folder_id", "path", "version", "latest_version", "version_published_at", "locked", "add_signature_request_submission_id_footers", "ai_field_naming_language", "allow_additional_properties", "allow_skipping_optional_fields", "default_form_mode", "editable_submissions", "embed_domains", "embed_edit_allow_settings", "embed_edit_allow_versioning", "embed_edit_allow_document_replacement", "encrypt_pdfs", "has_encrypt_pdfs_password", "expire_submissions", "expire_after", "expiration_interval", "merge_audit_trail_pdf", "parse_dates_using_template_date_format", "public_submissions", "public_web_form", "redirect_url", "has_slack_webhook_url", "last_changed_at", "last_changed_by", "created_at", "updated_at", "defaults", "field_dependencies", "html", "scss", "header_html", "footer_html", "html_engine_options", "embed_edit_token", "versions"];
468
+ Template.RequiredProperties = ["id", "name", "description", "template_type", "ready", "document", "parent_folder_id", "path", "latest_version", "version_published_at", "locked", "last_changed_at", "created_at", "updated_at", "version", "add_signature_request_submission_id_footers", "ai_field_naming_language", "allow_additional_properties", "allow_skipping_optional_fields", "default_form_mode", "editable_submissions", "embed_domains", "embed_edit_allow_settings", "embed_edit_allow_versioning", "embed_edit_allow_document_replacement", "encrypt_pdfs", "has_encrypt_pdfs_password", "expire_submissions", "expire_after", "expiration_interval", "merge_audit_trail_pdf", "parse_dates_using_template_date_format", "public_submissions", "public_web_form", "redirect_url", "has_slack_webhook_url", "last_changed_by", "defaults", "field_dependencies", "field_groups", "predefined_fields", "predefined_fields_sample_data", "html", "scss", "header_html", "footer_html", "html_engine_options", "html_escape_data", "embed_edit_token", "versions"];
420
469
 
421
470
  /**
422
471
  * The template's ID.
@@ -443,7 +492,7 @@ Template.prototype['description'] = undefined;
443
492
  Template.prototype['template_type'] = undefined;
444
493
 
445
494
  /**
446
- * Whether the template can generate PDFs. HTML templates are always ready. A PDF template is ready once its document has been processed (`document.state` is `processed`).
495
+ * Whether the template can generate PDFs. HTML templates are always ready. A PDF template is ready once DocSpring has stored its PDF, made an image of each page and finished looking for fields on each page, which can be after `document.state` becomes `processed`. A PDF template with no PDF (`document` is null) isn't ready.
447
496
  * @member {Boolean} ready
448
497
  */
449
498
  Template.prototype['ready'] = undefined;
@@ -466,12 +515,6 @@ Template.prototype['parent_folder_id'] = undefined;
466
515
  */
467
516
  Template.prototype['path'] = undefined;
468
517
 
469
- /**
470
- * The published version this is, such as `1.2.0`. Null for the draft.
471
- * @member {String} version
472
- */
473
- Template.prototype['version'] = undefined;
474
-
475
518
  /**
476
519
  * The template's latest published version. Null if no version has been published.
477
520
  * @member {String} latest_version
@@ -490,6 +533,30 @@ Template.prototype['version_published_at'] = undefined;
490
533
  */
491
534
  Template.prototype['locked'] = undefined;
492
535
 
536
+ /**
537
+ * When the draft was last changed.
538
+ * @member {Date} last_changed_at
539
+ */
540
+ Template.prototype['last_changed_at'] = undefined;
541
+
542
+ /**
543
+ * When the template was created.
544
+ * @member {Date} created_at
545
+ */
546
+ Template.prototype['created_at'] = undefined;
547
+
548
+ /**
549
+ * When the template was last updated.
550
+ * @member {Date} updated_at
551
+ */
552
+ Template.prototype['updated_at'] = undefined;
553
+
554
+ /**
555
+ * The published version this is, such as `1.2.0`. Null for the draft.
556
+ * @member {String} version
557
+ */
558
+ Template.prototype['version'] = undefined;
559
+
493
560
  /**
494
561
  * Print the submission ID in the footer of each page of PDFs signed through signature requests.
495
562
  * @member {Boolean} add_signature_request_submission_id_footers
@@ -527,7 +594,7 @@ Template.prototype['default_form_mode'] = undefined;
527
594
  Template.prototype['editable_submissions'] = undefined;
528
595
 
529
596
  /**
530
- * The sites where the template's signature requests, forms and embedded template editor can be loaded: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). When it's empty, live signature requests don't load on any site, and the embedded template editor loads on every site.
597
+ * The sites that can embed the template's live signature requests and its embedded template editor: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). Browsers open a live signature request in a frame only on these sites (and DocSpring's), so with an empty list it can't be embedded anywhere; a test signature request can be embedded on any site. The embedded template editor loads only for a page on one of these sites (by its Referer or Origin header), and on any site when the list is empty. Forms embedded on a page (Visual Forms JS and the simple form) aren't restricted.
531
598
  * @member {Array.<String>} embed_domains
532
599
  */
533
600
  Template.prototype['embed_domains'] = undefined;
@@ -616,12 +683,6 @@ Template.prototype['redirect_url'] = undefined;
616
683
  */
617
684
  Template.prototype['has_slack_webhook_url'] = undefined;
618
685
 
619
- /**
620
- * When the draft was last changed.
621
- * @member {Date} last_changed_at
622
- */
623
- Template.prototype['last_changed_at'] = undefined;
624
-
625
686
  /**
626
687
  * Who last changed the draft: a user in your account, an API token, or someone using the embedded template editor. Null if no change has been recorded.
627
688
  * @member {module:model/TemplateActor} last_changed_by
@@ -629,27 +690,33 @@ Template.prototype['last_changed_at'] = undefined;
629
690
  Template.prototype['last_changed_by'] = undefined;
630
691
 
631
692
  /**
632
- * When the template was created.
633
- * @member {Date} created_at
693
+ * @member {module:model/TemplateDefaults} defaults
634
694
  */
635
- Template.prototype['created_at'] = undefined;
695
+ Template.prototype['defaults'] = undefined;
636
696
 
637
697
  /**
638
- * When the template was last updated.
639
- * @member {Date} updated_at
698
+ * Conditional logic: each rule shows or hides its target fields, or makes them required, depending on the values of other fields.
699
+ * @member {Array.<module:model/TemplateFieldDependency>} field_dependencies
640
700
  */
641
- Template.prototype['updated_at'] = undefined;
701
+ Template.prototype['field_dependencies'] = undefined;
642
702
 
643
703
  /**
644
- * @member {module:model/TemplateDefaults} defaults
704
+ * The groups of the template's fields, with their settings. A field's name puts it in groups: `address/city` is in the group `address`, and `items/0/price` is in the list `items` and its items' group `items/~`.
705
+ * @member {Array.<module:model/FieldGroup>} field_groups
645
706
  */
646
- Template.prototype['defaults'] = undefined;
707
+ Template.prototype['field_groups'] = undefined;
647
708
 
648
709
  /**
649
- * Conditional logic: each rule shows or hides its target fields, or makes them required, depending on the values of other fields.
650
- * @member {Array.<module:model/TemplateFieldDependency>} field_dependencies
710
+ * The field names that people using the embedded template editor choose from, each with the data type and settings a field gets when it's given that name. Setting it replaces the whole list; an empty list turns them off.
711
+ * @member {Array.<module:model/PredefinedField>} predefined_fields
651
712
  */
652
- Template.prototype['field_dependencies'] = undefined;
713
+ Template.prototype['predefined_fields'] = undefined;
714
+
715
+ /**
716
+ * Sample submission data that sets `predefined_fields`: each value becomes a predefined field, with a type that fits it (`string`, `number`, `boolean`, `date`, `email` or `url`) and `required_in_template` true. Nested objects and arrays become names with `/`, such as `customer/email`. Without `predefined_fields` in the same request, it replaces them; with them, it adds to them and sets the types of the ones it has values for.
717
+ * @member {Object.<String, Object>} predefined_fields_sample_data
718
+ */
719
+ Template.prototype['predefined_fields_sample_data'] = undefined;
653
720
 
654
721
  /**
655
722
  * The HTML of an HTML template, as a Liquid template. Null for PDF templates.
@@ -681,6 +748,12 @@ Template.prototype['footer_html'] = undefined;
681
748
  */
682
749
  Template.prototype['html_engine_options'] = undefined;
683
750
 
751
+ /**
752
+ * Whether an HTML template HTML-escapes the values it prints. When true, `{{ value }}` prints a value as text, so a `<` or `&` in it is printed as that character, and `{{ value | raw }}` prints a value as HTML. New HTML templates default to true. Templates created before October 2026, or with API v1, default to false, which prints every value as HTML. Null for PDF templates.
753
+ * @member {Boolean} html_escape_data
754
+ */
755
+ Template.prototype['html_escape_data'] = undefined;
756
+
684
757
  /**
685
758
  * The token that opens the template in the embedded template editor.
686
759
  * @member {String} embed_edit_token
@@ -30,14 +30,14 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
30
30
  /**
31
31
  * The TemplateActor model module.
32
32
  * @module model/TemplateActor
33
- * @version 4.0.0
33
+ * @version 4.2.0
34
34
  */
35
35
  var TemplateActor = /*#__PURE__*/function () {
36
36
  /**
37
37
  * Constructs a new <code>TemplateActor</code>.
38
38
  * A user in your account, an API token, or someone using the embedded template editor.
39
39
  * @alias module:model/TemplateActor
40
- * @param type {module:model/TemplateActorType} `user`: a user in your account. `api`: an API token. `external_user`: someone using the embedded template editor, as identified by your app.
40
+ * @param type {module:model/TemplateActorType} `user`: a user in your account, also when they make the change with an app they connected (an OAuth access token). `api`: an API token. `external_user`: someone using the embedded template editor, as identified by your app.
41
41
  * @param user_id {String} The user's ID, for `user`.
42
42
  * @param external_id {String} The ID your app gave the embedded editor's user, for `external_user`.
43
43
  * @param name {String} The user's name, or the name your app gave the embedded editor's user.
@@ -140,7 +140,7 @@ var TemplateActor = /*#__PURE__*/function () {
140
140
  TemplateActor.RequiredProperties = ["type", "user_id", "external_id", "name", "email"];
141
141
 
142
142
  /**
143
- * `user`: a user in your account. `api`: an API token. `external_user`: someone using the embedded template editor, as identified by your app.
143
+ * `user`: a user in your account, also when they make the change with an app they connected (an OAuth access token). `api`: an API token. `external_user`: someone using the embedded template editor, as identified by your app.
144
144
  * @member {module:model/TemplateActorType} type
145
145
  */
146
146
  TemplateActor.prototype['type'] = undefined;
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
29
29
  /**
30
30
  * The TemplateDefaults model module.
31
31
  * @module model/TemplateDefaults
32
- * @version 4.0.0
32
+ * @version 4.2.0
33
33
  */
34
34
  var TemplateDefaults = /*#__PURE__*/function () {
35
35
  /**
@@ -29,7 +29,7 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
29
29
  /**
30
30
  * The TemplateDefaultsInput model module.
31
31
  * @module model/TemplateDefaultsInput
32
- * @version 4.0.0
32
+ * @version 4.2.0
33
33
  */
34
34
  var TemplateDefaultsInput = /*#__PURE__*/function () {
35
35
  /**