@verdocs/web-sdk 1.13.5 → 1.13.7

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 (140) hide show
  1. package/README.md +12 -0
  2. package/dist/cjs/{TemplateStore-01ff3237.js → TemplateStore-df478971.js} +1 -1
  3. package/dist/cjs/{Templates-e258cbd5.js → Templates-24580a13.js} +36 -4
  4. package/dist/cjs/{popper-11d5f714.js → popper-9def2535.js} +3 -4
  5. package/dist/cjs/verdocs-build.cjs.entry.js +2 -2
  6. package/dist/cjs/verdocs-button-panel_3.cjs.entry.js +3 -3
  7. package/dist/cjs/verdocs-checkbox_4.cjs.entry.js +1 -1
  8. package/dist/cjs/verdocs-dropdown_2.cjs.entry.js +1 -1
  9. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +4 -1
  10. package/dist/cjs/verdocs-preview.cjs.entry.js +2 -2
  11. package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-send.cjs.entry.js +2 -2
  13. package/dist/cjs/verdocs-status-indicator.cjs.entry.js +1 -1
  14. package/dist/cjs/verdocs-template-attachments.cjs.entry.js +2 -2
  15. package/dist/cjs/verdocs-template-create_3.cjs.entry.js +5 -9
  16. package/dist/cjs/verdocs-template-document-page.cjs.entry.js +52 -2
  17. package/dist/cjs/verdocs-template-name.cjs.entry.js +2 -2
  18. package/dist/cjs/verdocs-template-properties.cjs.entry.js +2 -2
  19. package/dist/cjs/verdocs-template-reminders.cjs.entry.js +2 -2
  20. package/dist/cjs/verdocs-template-role-properties_2.cjs.entry.js +2 -2
  21. package/dist/cjs/verdocs-template-visibility.cjs.entry.js +2 -2
  22. package/dist/cjs/verdocs-toolbar-icon.cjs.entry.js +1 -1
  23. package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +4 -1
  24. package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.js +4 -8
  25. package/dist/collection/utils/utils.js +9 -0
  26. package/dist/components/Templates.js +36 -4
  27. package/dist/components/popper.js +3 -4
  28. package/dist/components/verdocs-field-textbox.js +4 -1
  29. package/dist/components/verdocs-template-create2.js +4 -8
  30. package/dist/components/verdocs-template-document-page2.js +51 -1
  31. package/dist/docs.json +1 -1
  32. package/dist/esm/{TemplateStore-91a71f46.js → TemplateStore-373c72a8.js} +1 -1
  33. package/dist/esm/{Templates-ca52ef90.js → Templates-67172396.js} +36 -4
  34. package/dist/esm/{popper-f860750c.js → popper-bfa25c7f.js} +3 -4
  35. package/dist/esm/verdocs-build.entry.js +2 -2
  36. package/dist/esm/verdocs-button-panel_3.entry.js +3 -3
  37. package/dist/esm/verdocs-checkbox_4.entry.js +1 -1
  38. package/dist/esm/verdocs-dropdown_2.entry.js +1 -1
  39. package/dist/esm/verdocs-field-textbox.entry.js +4 -1
  40. package/dist/esm/verdocs-preview.entry.js +2 -2
  41. package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
  42. package/dist/esm/verdocs-send.entry.js +2 -2
  43. package/dist/esm/verdocs-status-indicator.entry.js +1 -1
  44. package/dist/esm/verdocs-template-attachments.entry.js +2 -2
  45. package/dist/esm/verdocs-template-create_3.entry.js +5 -9
  46. package/dist/esm/verdocs-template-document-page.entry.js +51 -1
  47. package/dist/esm/verdocs-template-name.entry.js +2 -2
  48. package/dist/esm/verdocs-template-properties.entry.js +2 -2
  49. package/dist/esm/verdocs-template-reminders.entry.js +2 -2
  50. package/dist/esm/verdocs-template-role-properties_2.entry.js +2 -2
  51. package/dist/esm/verdocs-template-visibility.entry.js +2 -2
  52. package/dist/esm/verdocs-toolbar-icon.entry.js +1 -1
  53. package/dist/esm-es5/{TemplateStore-91a71f46.js → TemplateStore-373c72a8.js} +1 -1
  54. package/dist/esm-es5/Templates-67172396.js +1 -0
  55. package/dist/esm-es5/popper-bfa25c7f.js +1 -0
  56. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  57. package/dist/esm-es5/verdocs-button-panel_3.entry.js +1 -1
  58. package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -1
  59. package/dist/esm-es5/verdocs-dropdown_2.entry.js +1 -1
  60. package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
  61. package/dist/esm-es5/verdocs-preview.entry.js +1 -1
  62. package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
  63. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  64. package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -1
  65. package/dist/esm-es5/verdocs-template-attachments.entry.js +1 -1
  66. package/dist/esm-es5/verdocs-template-create_3.entry.js +1 -1
  67. package/dist/esm-es5/verdocs-template-document-page.entry.js +1 -1
  68. package/dist/esm-es5/verdocs-template-name.entry.js +1 -1
  69. package/dist/esm-es5/verdocs-template-properties.entry.js +1 -1
  70. package/dist/esm-es5/verdocs-template-reminders.entry.js +1 -1
  71. package/dist/esm-es5/verdocs-template-role-properties_2.entry.js +1 -1
  72. package/dist/esm-es5/verdocs-template-visibility.entry.js +1 -1
  73. package/dist/esm-es5/verdocs-toolbar-icon.entry.js +1 -1
  74. package/dist/types/components/embeds/verdocs-build/utils.d.ts +2 -2
  75. package/dist/types/components/embeds/verdocs-sign/utils.d.ts +2 -2
  76. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +3 -3
  77. package/dist/types/utils/utils.d.ts +11 -7
  78. package/dist/typings.d.ts +4 -0
  79. package/dist/verdocs-web-sdk/{p-de4c38a1.entry.js → p-068e6212.entry.js} +1 -1
  80. package/dist/verdocs-web-sdk/p-126c0301.system.entry.js +1 -0
  81. package/dist/verdocs-web-sdk/{p-650b9205.system.entry.js → p-1db79af9.system.entry.js} +1 -1
  82. package/dist/verdocs-web-sdk/{p-71adad1c.entry.js → p-1fc2dcb7.entry.js} +1 -1
  83. package/dist/verdocs-web-sdk/{p-3b1b11a8.system.entry.js → p-2287f1bc.system.entry.js} +1 -1
  84. package/dist/verdocs-web-sdk/{p-2d39a000.entry.js → p-27332125.entry.js} +1 -1
  85. package/dist/verdocs-web-sdk/{p-c25d965d.js → p-2fc46a8b.js} +1 -1
  86. package/dist/verdocs-web-sdk/p-4ac861c9.system.js +1 -0
  87. package/dist/verdocs-web-sdk/{p-fccb4fec.system.entry.js → p-527f15bb.system.entry.js} +1 -1
  88. package/dist/verdocs-web-sdk/p-5bb80e03.system.entry.js +1 -0
  89. package/dist/verdocs-web-sdk/p-5e0c6e7c.system.js +1 -0
  90. package/dist/verdocs-web-sdk/{p-1a34942f.system.entry.js → p-5e3893ec.system.entry.js} +1 -1
  91. package/dist/verdocs-web-sdk/{p-32fb9679.entry.js → p-658c3ab7.entry.js} +1 -1
  92. package/dist/verdocs-web-sdk/{p-f1edfd5a.system.js → p-66c74103.system.js} +1 -1
  93. package/dist/verdocs-web-sdk/p-6caf1137.system.js +1 -1
  94. package/dist/verdocs-web-sdk/{p-4eb829ca.system.entry.js → p-6ea848fe.system.entry.js} +1 -1
  95. package/dist/verdocs-web-sdk/{p-36f78b1f.system.entry.js → p-71a1576a.system.entry.js} +1 -1
  96. package/dist/verdocs-web-sdk/{p-39e906e0.entry.js → p-756d5c24.entry.js} +1 -1
  97. package/dist/verdocs-web-sdk/p-7e8fe43e.entry.js +1 -0
  98. package/dist/verdocs-web-sdk/p-822ba467.js +1 -0
  99. package/dist/verdocs-web-sdk/{p-62e12e8f.system.entry.js → p-82512045.system.entry.js} +1 -1
  100. package/dist/verdocs-web-sdk/{p-c9705b22.entry.js → p-82854066.entry.js} +1 -1
  101. package/dist/verdocs-web-sdk/{p-1886b178.entry.js → p-86e507c1.entry.js} +1 -1
  102. package/dist/verdocs-web-sdk/{p-cc396cda.entry.js → p-879e9572.entry.js} +1 -1
  103. package/dist/verdocs-web-sdk/{p-e4b56475.entry.js → p-87f428fb.entry.js} +1 -1
  104. package/dist/verdocs-web-sdk/{p-b3bca701.entry.js → p-91f062a8.entry.js} +1 -1
  105. package/dist/verdocs-web-sdk/{p-f7cfaa04.system.entry.js → p-920fd6d9.system.entry.js} +1 -1
  106. package/dist/verdocs-web-sdk/{p-38d0af92.entry.js → p-97be89cf.entry.js} +1 -1
  107. package/dist/verdocs-web-sdk/p-9d707f6e.js +1 -0
  108. package/dist/verdocs-web-sdk/{p-13f91d03.system.entry.js → p-a3282274.system.entry.js} +1 -1
  109. package/dist/verdocs-web-sdk/{p-c8901fde.entry.js → p-a5a530fa.entry.js} +1 -1
  110. package/dist/verdocs-web-sdk/p-a5f3f29c.entry.js +1 -0
  111. package/dist/verdocs-web-sdk/{p-5b4dd6a0.entry.js → p-ba591e02.entry.js} +1 -1
  112. package/dist/verdocs-web-sdk/{p-2216464c.system.entry.js → p-bd35fd77.system.entry.js} +1 -1
  113. package/dist/verdocs-web-sdk/{p-ec81b1f2.entry.js → p-bd8ff2a6.entry.js} +1 -1
  114. package/dist/verdocs-web-sdk/{p-34d3d150.system.entry.js → p-c9ff6acb.system.entry.js} +1 -1
  115. package/dist/verdocs-web-sdk/p-d28acca1.entry.js +1 -0
  116. package/dist/verdocs-web-sdk/{p-d63fe7e9.system.entry.js → p-d67b2a26.system.entry.js} +1 -1
  117. package/dist/verdocs-web-sdk/{p-1b21b08d.system.entry.js → p-d714a804.system.entry.js} +1 -1
  118. package/dist/verdocs-web-sdk/{p-a3747387.system.entry.js → p-d936d293.system.entry.js} +1 -1
  119. package/dist/verdocs-web-sdk/{p-a6096629.system.entry.js → p-e59061aa.system.entry.js} +1 -1
  120. package/dist/verdocs-web-sdk/{p-8c9caa8a.system.entry.js → p-f0d1c6bd.system.entry.js} +1 -1
  121. package/dist/verdocs-web-sdk/{p-40bb871d.entry.js → p-fc67ddc9.entry.js} +1 -1
  122. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  123. package/package.json +8 -5
  124. package/dist/cjs/TemplateDocuments-1c6620b0.js +0 -78
  125. package/dist/components/TemplateDocuments.js +0 -75
  126. package/dist/esm/TemplateDocuments-618934d0.js +0 -75
  127. package/dist/esm-es5/TemplateDocuments-618934d0.js +0 -1
  128. package/dist/esm-es5/Templates-ca52ef90.js +0 -1
  129. package/dist/esm-es5/popper-f860750c.js +0 -1
  130. package/dist/verdocs-web-sdk/p-194a8f9c.system.entry.js +0 -1
  131. package/dist/verdocs-web-sdk/p-3751d683.entry.js +0 -1
  132. package/dist/verdocs-web-sdk/p-47714747.system.js +0 -1
  133. package/dist/verdocs-web-sdk/p-4cd5eb1f.js +0 -1
  134. package/dist/verdocs-web-sdk/p-63398dca.system.js +0 -1
  135. package/dist/verdocs-web-sdk/p-77e616b7.system.entry.js +0 -1
  136. package/dist/verdocs-web-sdk/p-923f56f3.entry.js +0 -1
  137. package/dist/verdocs-web-sdk/p-b86b362a.js +0 -1
  138. package/dist/verdocs-web-sdk/p-e12b7fbc.system.js +0 -1
  139. package/dist/verdocs-web-sdk/p-ec26fc38.js +0 -1
  140. package/dist/verdocs-web-sdk/p-f44f5d73.entry.js +0 -1
package/README.md CHANGED
@@ -7,3 +7,15 @@ For more information, please see one of the following for your specific framewor
7
7
 
8
8
  - [Verdocs Web for React](https://www.npmjs.com/package/@verdocs/web-sdk-react)
9
9
 
10
+
11
+ RTSP cameras, proprietary device from US Army
12
+ No access to physical hardware, need to build against spec and test remotely
13
+ Demo coming up, soft deadline
14
+ App will be separate module, not modifying their current code
15
+ Call documented APIs and Websocket
16
+ Good docs
17
+ Not a SBIR, soft deadlines but "soon" (May)
18
+ Possible Redis connection
19
+ RTSP streaming H.264 encoding, basic data from camera (pan/tilt/zoom/FOV)
20
+ Air Scout server
21
+ Python pref. C/C++ nice to have. Performance is P2
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index-67233b76.js');
4
- const Templates = require('./Templates-e258cbd5.js');
4
+ const Templates = require('./Templates-24580a13.js');
5
5
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
6
6
 
7
7
  const appendToMap = (map, propName, value) => {
@@ -37,6 +37,15 @@ var getTemplate = function (endpoint, templateId) {
37
37
  .get("/templates/".concat(templateId))
38
38
  .then(function (r) { return r.data; });
39
39
  };
40
+ var ALLOWED_CREATE_FIELDS = [
41
+ 'name',
42
+ 'is_personal',
43
+ 'is_public',
44
+ 'sender',
45
+ 'description',
46
+ 'roles',
47
+ 'fields',
48
+ ];
40
49
  /**
41
50
  * Create a template.
42
51
  *
@@ -46,10 +55,33 @@ var getTemplate = function (endpoint, templateId) {
46
55
  * const newTemplate = await Templates.createTemplate((VerdocsEndpoint.getDefault(), {...});
47
56
  * ```
48
57
  */
49
- var createTemplate = function (endpoint, params) {
50
- return endpoint.api //
51
- .post('/templates/', params)
52
- .then(function (r) { return r.data; });
58
+ var createTemplate = function (endpoint, params, onUploadProgress) {
59
+ var options = {
60
+ timeout: 120000,
61
+ onUploadProgress: function (event) {
62
+ var total = event.total || 1;
63
+ var loaded = event.loaded || 0;
64
+ onUploadProgress === null || onUploadProgress === void 0 ? void 0 : onUploadProgress(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
65
+ },
66
+ };
67
+ if (params.documents && params.documents[0] instanceof File) {
68
+ if (params.documents.length > 10) {
69
+ throw new Error('createTemplate() has a maximum of 10 documents that can be attached.');
70
+ }
71
+ var formData_1 = new FormData();
72
+ ALLOWED_CREATE_FIELDS.forEach(function (allowedKey) {
73
+ if (params[allowedKey] !== undefined) {
74
+ formData_1.append(allowedKey, params[allowedKey]);
75
+ }
76
+ });
77
+ params.documents.forEach(function (file) {
78
+ formData_1.append('documents', file, file.name);
79
+ });
80
+ return endpoint.api.post('/templates', formData_1, options).then(function (r) { return r.data; });
81
+ }
82
+ else {
83
+ return endpoint.api.post('/templates', params, options).then(function (r) { return r.data; });
84
+ }
53
85
  };
54
86
  /**
55
87
  * Update a template.
@@ -163,7 +163,7 @@ var round = Math.round;
163
163
  function getUAString() {
164
164
  var uaData = navigator.userAgentData;
165
165
 
166
- if (uaData != null && uaData.brands) {
166
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
167
167
  return uaData.brands.map(function (item) {
168
168
  return item.brand + "/" + item.version;
169
169
  }).join(' ');
@@ -482,10 +482,9 @@ var unsetSides = {
482
482
  // Zooming can change the DPR, but it seems to report a value that will
483
483
  // cleanly divide the values into the appropriate subpixels.
484
484
 
485
- function roundOffsetsByDPR(_ref) {
485
+ function roundOffsetsByDPR(_ref, win) {
486
486
  var x = _ref.x,
487
487
  y = _ref.y;
488
- var win = window;
489
488
  var dpr = win.devicePixelRatio || 1;
490
489
  return {
491
490
  x: round(x * dpr) / dpr || 0,
@@ -568,7 +567,7 @@ function mapToStyles(_ref2) {
568
567
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
569
568
  x: x,
570
569
  y: y
571
- }) : {
570
+ }, getWindow(popper)) : {
572
571
  x: x,
573
572
  y: y
574
573
  };
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
- const TemplateStore = require('./TemplateStore-01ff3237.js');
8
+ const TemplateStore = require('./TemplateStore-df478971.js');
9
9
  const errors = require('./errors-0396da3d.js');
10
- require('./Templates-e258cbd5.js');
10
+ require('./Templates-24580a13.js');
11
11
 
12
12
  const verdocsBuildCss = "verdocs-build{display:-ms-flexbox;display:flex;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}";
13
13
 
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
- const popper = require('./popper-11d5f714.js');
6
+ const popper = require('./popper-9def2535.js');
7
7
  const _commonjsHelpers = require('./_commonjsHelpers-0c557e26.js');
8
8
  require('./Types-f89f9116.js');
9
9
  const Fields = require('./Fields-705a2168.js');
10
10
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
11
- const TemplateStore = require('./TemplateStore-01ff3237.js');
11
+ const TemplateStore = require('./TemplateStore-df478971.js');
12
12
  const errors = require('./errors-0396da3d.js');
13
- require('./Templates-e258cbd5.js');
13
+ require('./Templates-24580a13.js');
14
14
 
15
15
  const verdocsButtonPanelCss = "verdocs-button-panel{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:inline-block}verdocs-button-panel .icon{display:inline-block;cursor:pointer;opacity:0.6}verdocs-button-panel .icon svg{fill:#707ae5}verdocs-button-panel .icon:hover{opacity:1}.verdocs-button-panel-content{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;display:none;background:#ffffff;color:#33364b;width:320px;font-weight:bold;padding:15px;font-size:14px;position:relative;border-radius:4px;z-index:10000}.verdocs-button-panel-content .arrow,.verdocs-button-panel-content .arrow::before{position:absolute;width:8px;height:8px;background:inherit}.verdocs-button-panel-content .arrow{visibility:hidden;top:-4px}.verdocs-button-panel-content .arrow::before{visibility:visible;content:\"\";-webkit-transform:rotate(45deg);transform:rotate(45deg)}.verdocs-button-panel-content[data-show]{display:block}.verdocs-button-panel-content[data-popper-placement^=top]>.arrow{bottom:-4px}.verdocs-button-panel-content[data-popper-placement^=bottom]>.arrow{top:-4px}.verdocs-button-panel-content[data-popper-placement^=left]>.arrow{right:-4px}.verdocs-button-panel-content[data-popper-placement^=right]>.arrow{left:-4px}.verdocs-button-panel-content h6{font-size:16px;font-weight:bold;margin:0 0 16px 0;color:#092c4c;border-bottom:1px solid #cccccc}";
16
16
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
- const popper = require('./popper-11d5f714.js');
6
+ const popper = require('./popper-9def2535.js');
7
7
 
8
8
  const verdocsCheckboxCss = "@charset \"UTF-8\";verdocs-checkbox{line-height:18px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-checkbox label>input[type=checkbox]{display:none}verdocs-checkbox label>input[type=checkbox]+*::before{content:\"\";width:1rem;height:1rem;-ms-flex-negative:0;flex-shrink:0;line-height:18px;border-radius:2px;border-style:solid;margin-right:0.5rem;border-width:0.1rem;display:inline-block;vertical-align:bottom;border-color:#aeb4bf}verdocs-checkbox label>input[type=checkbox]:checked+*{color:#55bc81}verdocs-checkbox label>input[type=checkbox]:checked+*::before{content:\"✓\";color:white;text-align:center;background:#55bc81;border-color:#55bc81}verdocs-checkbox.dark label>input[type=checkbox]+*::before{border-color:#ffffff}verdocs-checkbox.dark label>input[type=checkbox]:checked+*::before{background:#55bc81;border-color:#55bc81}";
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
- const popper = require('./popper-11d5f714.js');
6
+ const popper = require('./popper-9def2535.js');
7
7
  const Envelopes = require('./Envelopes-699531b7.js');
8
8
  require('./Types-f89f9116.js');
9
9
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
@@ -79,10 +79,13 @@ const VerdocsFieldTextbox = class {
79
79
  let disabled = (_b = (_a = this.disabled) !== null && _a !== void 0 ? _a : settings.disabled) !== null && _b !== void 0 ? _b : false;
80
80
  const backgroundColor = this.field['rgba'] || Colors.getRGBA(this.roleindex);
81
81
  const value = (settings === null || settings === void 0 ? void 0 : settings.result) || '';
82
+ const width = settings.width || 150;
83
+ // TODO: This is an antiquated technique from the old system. We should compute it.
84
+ const maxlength = width / 5;
82
85
  if (this.done) {
83
86
  return index.h(index.Host, { class: { done: this.done } }, value);
84
87
  }
85
- return (index.h(index.Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, index.h("input", { type: "text", name: this.field.name, placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el) }), this.editable && (index.h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, index.h("div", { class: "resizer-inner" }))), this.editable && (index.h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, index.h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
88
+ return (index.h(index.Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, index.h("input", { type: "text", name: this.field.name, placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el), maxlength: maxlength }), this.editable && (index.h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, index.h("div", { class: "resizer-inner" }))), this.editable && (index.h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, index.h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
86
89
  var _a;
87
90
  (_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
88
91
  return this.hideSettingsPanel();
@@ -6,13 +6,13 @@ const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
8
  const utils = require('./utils-c218d9c7.js');
9
- const TemplateStore = require('./TemplateStore-01ff3237.js');
9
+ const TemplateStore = require('./TemplateStore-df478971.js');
10
10
  const errors = require('./errors-0396da3d.js');
11
11
  require('./_commonjsHelpers-0c557e26.js');
12
12
  require('./Envelopes-699531b7.js');
13
13
  require('./Files-4bdc0c0f.js');
14
14
  require('./index-6528b430.js');
15
- require('./Templates-e258cbd5.js');
15
+ require('./Templates-24580a13.js');
16
16
 
17
17
  const verdocsPreviewCss = "verdocs-preview{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}";
18
18
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
- const Templates = require('./Templates-e258cbd5.js');
8
+ const Templates = require('./Templates-24580a13.js');
9
9
 
10
10
  /**
11
11
  * Verdocs provides a range of search functions to help find and retrieve content. This module provides generic functions intended
@@ -7,10 +7,10 @@ require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
8
  const Validators = require('./Validators-16e6d7d1.js');
9
9
  const Colors = require('./Colors-e809dcc9.js');
10
- const TemplateStore = require('./TemplateStore-01ff3237.js');
10
+ const TemplateStore = require('./TemplateStore-df478971.js');
11
11
  const utils = require('./utils-c218d9c7.js');
12
12
  const errors = require('./errors-0396da3d.js');
13
- require('./Templates-e258cbd5.js');
13
+ require('./Templates-24580a13.js');
14
14
  require('./_commonjsHelpers-0c557e26.js');
15
15
  require('./Envelopes-699531b7.js');
16
16
  require('./Files-4bdc0c0f.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
- const popper = require('./popper-11d5f714.js');
6
+ const popper = require('./popper-9def2535.js');
7
7
 
8
8
  const methods$1 = {};
9
9
  const names = [];
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
- const TemplateStore = require('./TemplateStore-01ff3237.js');
8
+ const TemplateStore = require('./TemplateStore-df478971.js');
9
9
  const errors = require('./errors-0396da3d.js');
10
- require('./Templates-e258cbd5.js');
10
+ require('./Templates-24580a13.js');
11
11
 
12
12
  const verdocsTemplateAttachmentsCss = "verdocs-template-attachments{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#4c56cb}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b;border:1px solid #cccccc}verdocs-template-attachments svg{width:24px;height:24px;fill:#5c6575;margin:2px 10px 0 0}";
13
13
 
@@ -4,14 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
- const Templates = require('./Templates-e258cbd5.js');
8
- const TemplateDocuments = require('./TemplateDocuments-1c6620b0.js');
7
+ const Templates = require('./Templates-24580a13.js');
9
8
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
10
9
  const errors = require('./errors-0396da3d.js');
11
10
  const interact_min = require('./interact.min-ba5cc513.js');
12
11
  const Fields = require('./Fields-705a2168.js');
13
12
  const utils = require('./utils-c218d9c7.js');
14
- const TemplateStore = require('./TemplateStore-01ff3237.js');
13
+ const TemplateStore = require('./TemplateStore-df478971.js');
15
14
  const Roles = require('./Roles-9b593b95.js');
16
15
  const Colors = require('./Colors-e809dcc9.js');
17
16
  require('./_commonjsHelpers-0c557e26.js');
@@ -65,9 +64,7 @@ const VerdocsTemplateCreate = class {
65
64
  this.creating = true;
66
65
  this.progressLabel = 'Uploading...';
67
66
  try {
68
- const template = await Templates.createTemplate(this.endpoint, { name: this.file.name });
69
- console.log('[CREATE] Created template', template);
70
- const template_document = await TemplateDocuments.createTemplateDocument(this.endpoint, template.id, this.file, percent => {
67
+ const template = await Templates.createTemplate(this.endpoint, { name: this.file.name, documents: [this.file] }, percent => {
71
68
  if (percent >= 99) {
72
69
  this.progressLabel = 'Processing...';
73
70
  this.progressPercent = 100;
@@ -76,9 +73,8 @@ const VerdocsTemplateCreate = class {
76
73
  this.progressPercent = percent;
77
74
  }
78
75
  });
79
- console.log('[CREATE] Created document', template_document);
80
- const finalTemplate = await Templates.getTemplate(this.endpoint, template.id);
81
- (_a = this.next) === null || _a === void 0 ? void 0 : _a.emit(finalTemplate);
76
+ console.log('[CREATE] Created template', template);
77
+ (_a = this.next) === null || _a === void 0 ? void 0 : _a.emit(template);
82
78
  this.creating = false;
83
79
  this.progressLabel = '';
84
80
  this.progressPercent = 0;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
- const TemplateDocuments = require('./TemplateDocuments-1c6620b0.js');
8
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
9
8
  const utils = require('./utils-c218d9c7.js');
10
9
  require('./_commonjsHelpers-0c557e26.js');
@@ -12,6 +11,57 @@ require('./Envelopes-699531b7.js');
12
11
  require('./Files-4bdc0c0f.js');
13
12
  require('./index-6528b430.js');
14
13
 
14
+ /**
15
+ * A TemplateDocument represents a PDF or other attachment in a Template.
16
+ *
17
+ * @module
18
+ */
19
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
20
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
+ return new (P || (P = Promise))(function (resolve, reject) {
22
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ });
27
+ };
28
+ var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
29
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
30
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
31
+ function verb(n) { return function (v) { return step([n, v]); }; }
32
+ function step(op) {
33
+ if (f) throw new TypeError("Generator is already executing.");
34
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
35
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
36
+ if (y = 0, t) op = [op[0] & 2, t.value];
37
+ switch (op[0]) {
38
+ case 0: case 1: t = op; break;
39
+ case 4: _.label++; return { value: op[1], done: false };
40
+ case 5: _.label++; y = op[1]; op = [0]; continue;
41
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
42
+ default:
43
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
44
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
45
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
46
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
47
+ if (t[2]) _.ops.pop();
48
+ _.trys.pop(); continue;
49
+ }
50
+ op = body.call(thisArg, _);
51
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
52
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
53
+ }
54
+ };
55
+ /**
56
+ * Get a display URI for a given page in a file attached to a template document. These pages are rendered server-side
57
+ * into PNG resources suitable for display in IMG tags although they may be used elsewhere. Note that these are intended
58
+ * for DISPLAY ONLY, are not legally binding documents, and do not contain any encoded metadata from participants. The
59
+ * original asset may be obtained by calling `getTemplateDocumentFile()` or similar.
60
+ */
61
+ var getTemplateDocumentPageDisplayUri = function (endpoint, templateId, documentId, page) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
62
+ return [2 /*return*/, endpoint.api.get("/templates/".concat(templateId, "/documents/").concat(documentId, "/pages/").concat(page, "/image")).then(function (r) { return r.data; })];
63
+ }); }); };
64
+
15
65
  const verdocsTemplateDocumentPageCss = "verdocs-template-document-page{width:100%;position:relative}verdocs-template-document-page .verdocs-template-document-page-layer{position:absolute;top:0;left:0;right:0;bottom:0;-webkit-box-shadow:0 0 10px 5px #0000000f;box-shadow:0 0 10px 5px #0000000f}verdocs-template-document-page .verdocs-template-document-page-layer.img{width:100%}";
16
66
 
17
67
  const VerdocsTemplateDocumentPage = class {
@@ -35,7 +85,7 @@ const VerdocsTemplateDocumentPage = class {
35
85
  this.pageDisplayUri = '';
36
86
  }
37
87
  async componentWillLoad() {
38
- this.pageDisplayUri = await TemplateDocuments.getTemplateDocumentPageDisplayUri(this.endpoint, this.templateId, this.documentId, this.pageNumber);
88
+ this.pageDisplayUri = await getTemplateDocumentPageDisplayUri(this.endpoint, this.templateId, this.documentId, this.pageNumber);
39
89
  }
40
90
  componentDidLoad() {
41
91
  this.resizeObserver = new ResizeObserver(utils.throttle(entries => {
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
- const Templates = require('./Templates-e258cbd5.js');
7
+ const Templates = require('./Templates-24580a13.js');
8
8
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
9
- const TemplateStore = require('./TemplateStore-01ff3237.js');
9
+ const TemplateStore = require('./TemplateStore-df478971.js');
10
10
  const errors = require('./errors-0396da3d.js');
11
11
 
12
12
  const verdocsTemplateNameCss = "verdocs-template-name{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-name.loading{min-height:300px;position:relative;display:block}verdocs-template-name.empty{display:none}verdocs-template-name form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-name form label{font-size:16px;font-weight:bold;color:#4c56cb;margin:0 0 20px 0}verdocs-template-name form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-name form input:focus{outline:none}verdocs-template-name .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-name ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-name ::-moz-placeholder{color:#aaaaaa}verdocs-template-name :-ms-input-placeholder{color:#aaaaaa}verdocs-template-name ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-name ::placeholder{color:#aaaaaa}";
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
- const TemplateStore = require('./TemplateStore-01ff3237.js');
8
+ const TemplateStore = require('./TemplateStore-df478971.js');
9
9
  const errors = require('./errors-0396da3d.js');
10
- require('./Templates-e258cbd5.js');
10
+ require('./Templates-24580a13.js');
11
11
 
12
12
  const verdocsTemplatePropertiesCss = "verdocs-template-properties{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-properties form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-properties form h5{font-size:14px;font-weight:400;margin:0 0 6px 0}verdocs-template-properties form .row{display:-ms-flexbox;display:flex;position:relative;margin:0 0 20px 0;-ms-flex-direction:column;flex-direction:column}verdocs-template-properties form fieldset{width:440px;border:none;max-width:100%;margin:0 0 20px 0;-webkit-box-sizing:border-box;box-sizing:border-box;padding:20px 20px 10px 20px;background-color:#ffffff;-webkit-box-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14);box-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14)}verdocs-template-properties form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-properties form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-properties form input:focus{outline:none}verdocs-template-properties form .input-row{display:-ms-flexbox;display:flex;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-properties form .input-row label{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-properties form .input-row verdocs-text-input{margin:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px}verdocs-template-properties form .input-row verdocs-text-input input{text-align:center}verdocs-template-properties form .input-row verdocs-checkbox{display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px;-ms-flex-pack:center;justify-content:center}verdocs-template-properties form .radio-row{display:-ms-flexbox;display:flex;position:relative;margin:0 0 10px 0;-ms-flex-direction:row;flex-direction:row}verdocs-template-properties form .radio-row verdocs-radio-button{display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px}verdocs-template-properties form .radio-row label{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-properties form .radio-row label .title{font-size:16px;font-weight:500}verdocs-template-properties form .radio-row label .description{font-size:14px;font-weight:400}verdocs-template-properties .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-properties .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-properties ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-properties ::-moz-placeholder{color:#aaaaaa}verdocs-template-properties :-ms-input-placeholder{color:#aaaaaa}verdocs-template-properties ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-properties ::placeholder{color:#aaaaaa}";
13
13
 
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
8
- const TemplateStore = require('./TemplateStore-01ff3237.js');
8
+ const TemplateStore = require('./TemplateStore-df478971.js');
9
9
  const errors = require('./errors-0396da3d.js');
10
- require('./Templates-e258cbd5.js');
10
+ require('./Templates-24580a13.js');
11
11
 
12
12
  var createReminder = function (endpoint, templateId, params) {
13
13
  return endpoint.api //
@@ -6,9 +6,9 @@ const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
7
  const Roles = require('./Roles-9b593b95.js');
8
8
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
9
- const TemplateStore = require('./TemplateStore-01ff3237.js');
9
+ const TemplateStore = require('./TemplateStore-df478971.js');
10
10
  const errors = require('./errors-0396da3d.js');
11
- const Templates = require('./Templates-e258cbd5.js');
11
+ const Templates = require('./Templates-24580a13.js');
12
12
 
13
13
  const verdocsTemplateRolePropertiesCss = "verdocs-template-role-properties{font-family:\"Barlow\", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:absolute;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}";
14
14
 
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
6
  require('./Types-f89f9116.js');
7
- const Templates = require('./Templates-e258cbd5.js');
7
+ const Templates = require('./Templates-24580a13.js');
8
8
  const VerdocsEndpoint = require('./VerdocsEndpoint-3e95f87f.js');
9
- const TemplateStore = require('./TemplateStore-01ff3237.js');
9
+ const TemplateStore = require('./TemplateStore-df478971.js');
10
10
  const errors = require('./errors-0396da3d.js');
11
11
 
12
12
  const verdocsTemplateVisibilityCss = "verdocs-template-visibility{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-visibility.loading{min-height:300px;position:relative;display:block}verdocs-template-visibility.empty{display:none}verdocs-template-visibility form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-visibility form .description{font-size:14px;text-align:justify;color:#5c6575}verdocs-template-visibility form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0}verdocs-template-visibility form label{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:16px;font-weight:500;margin:0 0 4px 0;color:#33364b}verdocs-template-visibility form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-visibility form input:focus{outline:none}verdocs-template-visibility form .input-row{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-visibility form .input-row verdocs-text-input{margin:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 40px;flex:0 0 40px}verdocs-template-visibility form .input-row verdocs-text-input input{text-align:center}verdocs-template-visibility form .input-row verdocs-checkbox{-ms-flex:0;flex:0;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}verdocs-template-visibility form .input-row verdocs-checkbox label>input[type=checkbox]+*::before{margin-right:0}verdocs-template-visibility .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:25px;-ms-flex-direction:row;flex-direction:row}verdocs-template-visibility ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::-moz-placeholder{color:#aaaaaa}verdocs-template-visibility :-ms-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-visibility ::placeholder{color:#aaaaaa}";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-67233b76.js');
6
- const popper = require('./popper-11d5f714.js');
6
+ const popper = require('./popper-9def2535.js');
7
7
 
8
8
  const verdocsToolbarIconCss = "verdocs-toolbar-icon{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:inline-block}verdocs-toolbar-icon .icon{display:inline-block;cursor:pointer}verdocs-toolbar-icon .icon svg{fill:#5c6575}verdocs-toolbar-icon .tooltip{display:none;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;padding:5px 10px;font-size:13px;position:relative;border-radius:4px;z-index:20000;white-space:nowrap}verdocs-toolbar-icon .tooltip .arrow,verdocs-toolbar-icon .tooltip .arrow::before{position:absolute;width:8px;height:8px;background:inherit}verdocs-toolbar-icon .tooltip .arrow{visibility:hidden;top:-4px}verdocs-toolbar-icon .tooltip .arrow::before{visibility:visible;content:\"\";-webkit-transform:rotate(45deg);transform:rotate(45deg)}verdocs-toolbar-icon .tooltip[data-show]{display:block}verdocs-toolbar-icon .tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]>.arrow{right:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=right]>.arrow{left:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]{padding:3px 10px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]>.arrow{right:-1px}";
9
9
 
@@ -67,10 +67,13 @@ export class VerdocsFieldTextbox {
67
67
  let disabled = (_b = (_a = this.disabled) !== null && _a !== void 0 ? _a : settings.disabled) !== null && _b !== void 0 ? _b : false;
68
68
  const backgroundColor = this.field['rgba'] || getRGBA(this.roleindex);
69
69
  const value = (settings === null || settings === void 0 ? void 0 : settings.result) || '';
70
+ const width = settings.width || 150;
71
+ // TODO: This is an antiquated technique from the old system. We should compute it.
72
+ const maxlength = width / 5;
70
73
  if (this.done) {
71
74
  return h(Host, { class: { done: this.done } }, value);
72
75
  }
73
- return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", name: this.field.name, placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el) }), this.editable && (h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, h("div", { class: "resizer-inner" }))), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
76
+ return (h(Host, { class: { required: (_c = this.field) === null || _c === void 0 ? void 0 : _c.required, disabled, done: this.done }, style: { backgroundColor } }, h("input", { type: "text", name: this.field.name, placeholder: settings === null || settings === void 0 ? void 0 : settings.placeholder, tabIndex: settings === null || settings === void 0 ? void 0 : settings.order, value: value, disabled: disabled, required: (_d = this.field) === null || _d === void 0 ? void 0 : _d.required, ref: el => (this.inputEl = el), maxlength: maxlength }), this.editable && (h("div", { class: "resizer", ref: el => (this.resizeHandle = el) }, h("div", { class: "resizer-inner" }))), this.editable && (h("verdocs-button-panel", { icon: settingsIcon, id: `verdocs-settings-panel-${this.field.name}` }, h("verdocs-template-field-properties", { templateId: this.templateid, fieldName: this.field.name, onClose: () => this.hideSettingsPanel(), onDelete: () => {
74
77
  var _a;
75
78
  (_a = this.deleted) === null || _a === void 0 ? void 0 : _a.emit({ fieldName: this.field.name });
76
79
  return this.hideSettingsPanel();
@@ -1,7 +1,6 @@
1
1
  import { VerdocsEndpoint } from '@verdocs/js-sdk';
2
+ import { createTemplate } from '@verdocs/js-sdk/Templates/Templates';
2
3
  import { h, Host } from '@stencil/core';
3
- import { createTemplateDocument } from '@verdocs/js-sdk/Templates/TemplateDocuments';
4
- import { createTemplate, getTemplate } from '@verdocs/js-sdk/Templates/Templates';
5
4
  import { SDKError } from '../../../utils/errors';
6
5
  const unicodeNBSP = ' ';
7
6
  const FileIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>';
@@ -47,9 +46,7 @@ export class VerdocsTemplateCreate {
47
46
  this.creating = true;
48
47
  this.progressLabel = 'Uploading...';
49
48
  try {
50
- const template = await createTemplate(this.endpoint, { name: this.file.name });
51
- console.log('[CREATE] Created template', template);
52
- const template_document = await createTemplateDocument(this.endpoint, template.id, this.file, percent => {
49
+ const template = await createTemplate(this.endpoint, { name: this.file.name, documents: [this.file] }, percent => {
53
50
  if (percent >= 99) {
54
51
  this.progressLabel = 'Processing...';
55
52
  this.progressPercent = 100;
@@ -58,9 +55,8 @@ export class VerdocsTemplateCreate {
58
55
  this.progressPercent = percent;
59
56
  }
60
57
  });
61
- console.log('[CREATE] Created document', template_document);
62
- const finalTemplate = await getTemplate(this.endpoint, template.id);
63
- (_a = this.next) === null || _a === void 0 ? void 0 : _a.emit(finalTemplate);
58
+ console.log('[CREATE] Created template', template);
59
+ (_a = this.next) === null || _a === void 0 ? void 0 : _a.emit(template);
64
60
  this.creating = false;
65
61
  this.progressLabel = '';
66
62
  this.progressPercent = 0;
@@ -327,3 +327,12 @@ export const throttle = (f, delay) => {
327
327
  timer = setTimeout(() => f.apply(this, args), delay);
328
328
  };
329
329
  };
330
+ /**
331
+ * Convert a browser File object's data into a base64-encoded string.
332
+ */
333
+ export const fileToBase64 = (file) => new Promise((resolve, reject) => {
334
+ const reader = new FileReader();
335
+ reader.readAsDataURL(file);
336
+ reader.onload = () => { var _a; return resolve(((_a = reader.result) === null || _a === void 0 ? void 0 : _a.toString()) || ''); };
337
+ reader.onerror = error => reject(error);
338
+ });
@@ -35,6 +35,15 @@ var getTemplate = function (endpoint, templateId) {
35
35
  .get("/templates/".concat(templateId))
36
36
  .then(function (r) { return r.data; });
37
37
  };
38
+ var ALLOWED_CREATE_FIELDS = [
39
+ 'name',
40
+ 'is_personal',
41
+ 'is_public',
42
+ 'sender',
43
+ 'description',
44
+ 'roles',
45
+ 'fields',
46
+ ];
38
47
  /**
39
48
  * Create a template.
40
49
  *
@@ -44,10 +53,33 @@ var getTemplate = function (endpoint, templateId) {
44
53
  * const newTemplate = await Templates.createTemplate((VerdocsEndpoint.getDefault(), {...});
45
54
  * ```
46
55
  */
47
- var createTemplate = function (endpoint, params) {
48
- return endpoint.api //
49
- .post('/templates/', params)
50
- .then(function (r) { return r.data; });
56
+ var createTemplate = function (endpoint, params, onUploadProgress) {
57
+ var options = {
58
+ timeout: 120000,
59
+ onUploadProgress: function (event) {
60
+ var total = event.total || 1;
61
+ var loaded = event.loaded || 0;
62
+ onUploadProgress === null || onUploadProgress === void 0 ? void 0 : onUploadProgress(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
63
+ },
64
+ };
65
+ if (params.documents && params.documents[0] instanceof File) {
66
+ if (params.documents.length > 10) {
67
+ throw new Error('createTemplate() has a maximum of 10 documents that can be attached.');
68
+ }
69
+ var formData_1 = new FormData();
70
+ ALLOWED_CREATE_FIELDS.forEach(function (allowedKey) {
71
+ if (params[allowedKey] !== undefined) {
72
+ formData_1.append(allowedKey, params[allowedKey]);
73
+ }
74
+ });
75
+ params.documents.forEach(function (file) {
76
+ formData_1.append('documents', file, file.name);
77
+ });
78
+ return endpoint.api.post('/templates', formData_1, options).then(function (r) { return r.data; });
79
+ }
80
+ else {
81
+ return endpoint.api.post('/templates', params, options).then(function (r) { return r.data; });
82
+ }
51
83
  };
52
84
  /**
53
85
  * Update a template.
@@ -161,7 +161,7 @@ var round = Math.round;
161
161
  function getUAString() {
162
162
  var uaData = navigator.userAgentData;
163
163
 
164
- if (uaData != null && uaData.brands) {
164
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
165
165
  return uaData.brands.map(function (item) {
166
166
  return item.brand + "/" + item.version;
167
167
  }).join(' ');
@@ -480,10 +480,9 @@ var unsetSides = {
480
480
  // Zooming can change the DPR, but it seems to report a value that will
481
481
  // cleanly divide the values into the appropriate subpixels.
482
482
 
483
- function roundOffsetsByDPR(_ref) {
483
+ function roundOffsetsByDPR(_ref, win) {
484
484
  var x = _ref.x,
485
485
  y = _ref.y;
486
- var win = window;
487
486
  var dpr = win.devicePixelRatio || 1;
488
487
  return {
489
488
  x: round(x * dpr) / dpr || 0,
@@ -566,7 +565,7 @@ function mapToStyles(_ref2) {
566
565
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
567
566
  x: x,
568
567
  y: y
569
- }) : {
568
+ }, getWindow(popper)) : {
570
569
  x: x,
571
570
  y: y
572
571
  };