@verdocs/web-sdk 1.4.2 → 1.5.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 (158) hide show
  1. package/dist/cjs/VerdocsEndpoint-5e6dd8ef.js +4780 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/verdocs-auth.cjs.entry.js +33 -24
  4. package/dist/cjs/verdocs-button_2.cjs.entry.js +1 -2
  5. package/dist/cjs/verdocs-dropdown_12.cjs.entry.js +26 -22
  6. package/dist/cjs/verdocs-kba-dialog.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
  8. package/dist/cjs/verdocs-quick-functions.cjs.entry.js +6 -1
  9. package/dist/cjs/verdocs-search-activity_2.cjs.entry.js +42 -37
  10. package/dist/cjs/verdocs-search-tabs.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-search.cjs.entry.js +7 -2
  12. package/dist/cjs/verdocs-sign.cjs.entry.js +26 -161
  13. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  14. package/dist/collection/components/controls/verdocs-button/verdocs-button.css +1 -1
  15. package/dist/collection/components/controls/verdocs-button/verdocs-button.js +0 -1
  16. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.css +1 -1
  17. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.css +1 -1
  18. package/dist/collection/components/elements/verdocs-field-attachment/verdocs-field-attachment.css +1 -1
  19. package/dist/collection/components/elements/verdocs-field-checkbox-group/verdocs-field-checkbox.css +1 -1
  20. package/dist/collection/components/elements/verdocs-field-date/verdocs-field-date.css +1 -1
  21. package/dist/collection/components/elements/verdocs-field-dropdown/verdocs-field-dropdown.css +1 -1
  22. package/dist/collection/components/elements/verdocs-field-initial/verdocs-field-initial.css +1 -1
  23. package/dist/collection/components/elements/verdocs-field-payment/verdocs-field-payment.css +1 -1
  24. package/dist/collection/components/elements/verdocs-field-radio-button-group/verdocs-field-radio-button.css +1 -1
  25. package/dist/collection/components/elements/verdocs-field-signature/verdocs-field-signature.css +1 -1
  26. package/dist/collection/components/elements/verdocs-field-textarea/verdocs-field-textarea.css +1 -1
  27. package/dist/collection/components/elements/verdocs-field-textbox/verdocs-field-textbox.css +1 -1
  28. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.css +1 -1
  29. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.js +31 -1
  30. package/dist/collection/components/elements/verdocs-search-activity/verdocs-search-activity.css +1 -1
  31. package/dist/collection/components/elements/verdocs-search-activity/verdocs-search-activity.js +30 -6
  32. package/dist/collection/components/elements/verdocs-search-box/verdocs-search-box.css +1 -1
  33. package/dist/collection/components/elements/verdocs-search-box/verdocs-search-box.js +26 -0
  34. package/dist/collection/components/elements/verdocs-search-tabs/verdocs-search-tabs.css +1 -1
  35. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.css +2 -5
  36. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +40 -24
  37. package/dist/collection/components/embeds/verdocs-search/verdocs-search.css +1 -1
  38. package/dist/collection/components/embeds/verdocs-search/verdocs-search.js +36 -6
  39. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.css +28 -27
  40. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +40 -23
  41. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +2 -2
  42. package/dist/collection/components/embeds/verdocs-view/verdocs-view.css +1 -1
  43. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +26 -0
  44. package/dist/components/VerdocsEndpoint.js +4766 -0
  45. package/dist/components/verdocs-auth.js +34 -23
  46. package/dist/components/verdocs-button2.js +1 -2
  47. package/dist/components/verdocs-field-attachment2.js +1 -1
  48. package/dist/components/verdocs-field-checkbox2.js +1 -1
  49. package/dist/components/verdocs-field-date2.js +1 -1
  50. package/dist/components/verdocs-field-dropdown2.js +1 -1
  51. package/dist/components/verdocs-field-initial2.js +1 -1
  52. package/dist/components/verdocs-field-payment2.js +1 -1
  53. package/dist/components/verdocs-field-radio-button2.js +1 -1
  54. package/dist/components/verdocs-field-signature2.js +1 -1
  55. package/dist/components/verdocs-field-textarea2.js +1 -1
  56. package/dist/components/verdocs-field-textbox2.js +1 -1
  57. package/dist/components/verdocs-kba-dialog.js +1 -1
  58. package/dist/components/verdocs-ok-dialog2.js +1 -1
  59. package/dist/components/verdocs-quick-functions.js +9 -2
  60. package/dist/components/verdocs-search-activity2.js +38 -35
  61. package/dist/components/verdocs-search-box2.js +7 -1
  62. package/dist/components/verdocs-search-tabs.js +1 -1
  63. package/dist/components/verdocs-search.js +10 -3
  64. package/dist/components/verdocs-sign.js +27 -162
  65. package/dist/components/verdocs-view2.js +7 -2
  66. package/dist/custom-elements.json +830 -0
  67. package/dist/docs.json +118 -4
  68. package/dist/esm/VerdocsEndpoint-30e1b6ec.js +4766 -0
  69. package/dist/esm/loader.js +1 -1
  70. package/dist/esm/verdocs-auth.entry.js +33 -24
  71. package/dist/esm/verdocs-button_2.entry.js +1 -2
  72. package/dist/esm/verdocs-dropdown_12.entry.js +16 -12
  73. package/dist/esm/verdocs-kba-dialog.entry.js +1 -1
  74. package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
  75. package/dist/esm/verdocs-quick-functions.entry.js +6 -1
  76. package/dist/esm/verdocs-search-activity_2.entry.js +42 -37
  77. package/dist/esm/verdocs-search-tabs.entry.js +1 -1
  78. package/dist/esm/verdocs-search.entry.js +7 -2
  79. package/dist/esm/verdocs-sign.entry.js +26 -161
  80. package/dist/esm/verdocs-web-sdk.js +1 -1
  81. package/dist/esm-es5/VerdocsEndpoint-30e1b6ec.js +7 -0
  82. package/dist/esm-es5/loader.js +1 -1
  83. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  84. package/dist/esm-es5/verdocs-button_2.entry.js +1 -1
  85. package/dist/esm-es5/verdocs-dropdown_12.entry.js +2 -2
  86. package/dist/esm-es5/verdocs-kba-dialog.entry.js +1 -1
  87. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  88. package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
  89. package/dist/esm-es5/verdocs-search-activity_2.entry.js +1 -1
  90. package/dist/esm-es5/verdocs-search-tabs.entry.js +1 -1
  91. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  92. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  93. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  94. package/dist/types/components/elements/verdocs-quick-functions/verdocs-quick-functions.d.ts +5 -0
  95. package/dist/types/components/elements/verdocs-search-activity/verdocs-search-activity.d.ts +5 -0
  96. package/dist/types/components/elements/verdocs-search-box/verdocs-search-box.d.ts +5 -0
  97. package/dist/types/components/embeds/verdocs-auth/verdocs-auth.d.ts +11 -6
  98. package/dist/types/components/embeds/verdocs-search/verdocs-search.d.ts +5 -0
  99. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +6 -3
  100. package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +5 -0
  101. package/dist/types/components.d.ts +57 -0
  102. package/dist/verdocs-web-sdk/{p-ed5baeb4.entry.js → p-064453c3.entry.js} +1 -1
  103. package/dist/verdocs-web-sdk/p-06f38046.js +1 -0
  104. package/dist/verdocs-web-sdk/p-16d62a51.system.entry.js +1 -0
  105. package/dist/verdocs-web-sdk/p-1b4e04b7.system.entry.js +1 -0
  106. package/dist/verdocs-web-sdk/p-1ea3b9d3.entry.js +1 -0
  107. package/dist/verdocs-web-sdk/p-30cc8818.entry.js +1 -0
  108. package/dist/verdocs-web-sdk/{p-0353c423.entry.js → p-32ad1014.entry.js} +1 -1
  109. package/dist/verdocs-web-sdk/p-4d80d044.system.js +7 -0
  110. package/dist/verdocs-web-sdk/{p-432c3151.system.entry.js → p-81fc0196.system.entry.js} +1 -1
  111. package/dist/verdocs-web-sdk/p-8276345a.entry.js +1 -0
  112. package/dist/verdocs-web-sdk/p-88a300c5.system.js +1 -1
  113. package/dist/verdocs-web-sdk/p-9139a76d.system.entry.js +1 -0
  114. package/dist/verdocs-web-sdk/p-9d8d8c78.entry.js +1 -0
  115. package/dist/verdocs-web-sdk/p-a87069d5.system.entry.js +1 -0
  116. package/dist/verdocs-web-sdk/p-aa9fc574.entry.js +1 -0
  117. package/dist/verdocs-web-sdk/p-c29c2cf8.entry.js +1 -0
  118. package/dist/verdocs-web-sdk/{p-98d72550.system.entry.js → p-c4d03ff9.system.entry.js} +2 -2
  119. package/dist/verdocs-web-sdk/p-cd6a2c40.system.entry.js +1 -0
  120. package/dist/verdocs-web-sdk/p-d14a6057.system.entry.js +1 -0
  121. package/dist/verdocs-web-sdk/{p-a1fcf0c4.entry.js → p-d522de7d.entry.js} +2 -2
  122. package/dist/verdocs-web-sdk/{p-e2e643c5.system.entry.js → p-e4ba14dc.system.entry.js} +1 -1
  123. package/dist/verdocs-web-sdk/p-f4219236.entry.js +1 -0
  124. package/dist/verdocs-web-sdk/p-f6a53928.system.entry.js +1 -0
  125. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  126. package/package.json +2 -2
  127. package/dist/cjs/Auth-adc80bd4.js +0 -68
  128. package/dist/cjs/Token-1ec62bd3.js +0 -2330
  129. package/dist/cjs/buffer-es6-bc8199b1.js +0 -2018
  130. package/dist/components/Auth.js +0 -64
  131. package/dist/components/Token.js +0 -2325
  132. package/dist/components/buffer-es6.js +0 -2010
  133. package/dist/esm/Auth-ff6040be.js +0 -64
  134. package/dist/esm/Token-a587e3ad.js +0 -2325
  135. package/dist/esm/buffer-es6-136673c8.js +0 -2010
  136. package/dist/esm-es5/Auth-ff6040be.js +0 -1
  137. package/dist/esm-es5/Token-a587e3ad.js +0 -1
  138. package/dist/esm-es5/buffer-es6-136673c8.js +0 -7
  139. package/dist/verdocs-web-sdk/p-11bc03a5.js +0 -1
  140. package/dist/verdocs-web-sdk/p-34bb9854.system.entry.js +0 -1
  141. package/dist/verdocs-web-sdk/p-3d1eb63d.system.entry.js +0 -1
  142. package/dist/verdocs-web-sdk/p-3f437456.system.entry.js +0 -1
  143. package/dist/verdocs-web-sdk/p-466cf9bf.system.entry.js +0 -1
  144. package/dist/verdocs-web-sdk/p-5dfd73f9.system.js +0 -7
  145. package/dist/verdocs-web-sdk/p-6348272c.js +0 -1
  146. package/dist/verdocs-web-sdk/p-6ac9e6f8.entry.js +0 -1
  147. package/dist/verdocs-web-sdk/p-6d65d54e.system.entry.js +0 -1
  148. package/dist/verdocs-web-sdk/p-8795dbe8.entry.js +0 -1
  149. package/dist/verdocs-web-sdk/p-8c6db319.entry.js +0 -1
  150. package/dist/verdocs-web-sdk/p-8c6e29a5.entry.js +0 -1
  151. package/dist/verdocs-web-sdk/p-92632d8e.system.entry.js +0 -1
  152. package/dist/verdocs-web-sdk/p-9fbb3fc2.entry.js +0 -1
  153. package/dist/verdocs-web-sdk/p-b1cd24f7.entry.js +0 -1
  154. package/dist/verdocs-web-sdk/p-cd6d1fe5.system.entry.js +0 -1
  155. package/dist/verdocs-web-sdk/p-e3659c64.system.js +0 -1
  156. package/dist/verdocs-web-sdk/p-e609b2ee.system.js +0 -1
  157. package/dist/verdocs-web-sdk/p-ef932a87.js +0 -1
  158. package/dist/verdocs-web-sdk/p-f9d431ef.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  verdocs-field-textbox {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  width: 150px;
4
4
  height: 15px;
5
5
  display: block;
@@ -1,5 +1,5 @@
1
1
  verdocs-quick-functions {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  }
4
4
  verdocs-quick-functions .container {
5
5
  display: flex;
@@ -1,4 +1,5 @@
1
- import { Component, h, Event } from '@stencil/core';
1
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
2
+ import { Component, h, Event, Prop } from '@stencil/core';
2
3
  import TemplateIcon from './template-icon.svg';
3
4
  import DocumentIcon from './document-icon.svg';
4
5
  /**
@@ -8,6 +9,12 @@ import DocumentIcon from './document-icon.svg';
8
9
  * embed. This Element will reuse the same session produced by logging in via that Embed.
9
10
  */
10
11
  export class VerdocsQuickFunctions {
12
+ constructor() {
13
+ /**
14
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
15
+ */
16
+ this.endpoint = VerdocsEndpoint.getDefault();
17
+ }
11
18
  handleCreateTemplate() {
12
19
  this.createTemplate.emit();
13
20
  }
@@ -27,6 +34,29 @@ export class VerdocsQuickFunctions {
27
34
  static get styleUrls() { return {
28
35
  "$": ["verdocs-quick-functions.css"]
29
36
  }; }
37
+ static get properties() { return {
38
+ "endpoint": {
39
+ "type": "unknown",
40
+ "mutable": false,
41
+ "complexType": {
42
+ "original": "VerdocsEndpoint",
43
+ "resolved": "VerdocsEndpoint",
44
+ "references": {
45
+ "VerdocsEndpoint": {
46
+ "location": "import",
47
+ "path": "@verdocs/js-sdk"
48
+ }
49
+ }
50
+ },
51
+ "required": false,
52
+ "optional": false,
53
+ "docs": {
54
+ "tags": [],
55
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
56
+ },
57
+ "defaultValue": "VerdocsEndpoint.getDefault()"
58
+ }
59
+ }; }
30
60
  static get events() { return [{
31
61
  "method": "createTemplate",
32
62
  "name": "createTemplate",
@@ -1,5 +1,5 @@
1
1
  verdocs-search-activity {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  }
4
4
  verdocs-search-activity .container {
5
5
  display: flex;
@@ -1,9 +1,8 @@
1
- import { loadSession } from '@verdocs/js-sdk/Users/Auth';
2
1
  import { getSearchHistory } from '@verdocs/js-sdk/Search/Content';
3
2
  import { getTemplates } from '@verdocs/js-sdk/Templates/Templates';
4
3
  import { Component, h, Prop, Event, State } from '@stencil/core';
4
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
5
5
  import DocumentIcon from './document-icon.svg';
6
- const SOURCE = 'verdocs-stage';
7
6
  /**
8
7
  * Display a list of starred items.
9
8
  *
@@ -12,6 +11,10 @@ const SOURCE = 'verdocs-stage';
12
11
  */
13
12
  export class VerdocsSearchActivity {
14
13
  constructor() {
14
+ /**
15
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
16
+ */
17
+ this.endpoint = VerdocsEndpoint.getDefault();
15
18
  this.type = 'recent';
16
19
  this.emptyMessage = 'You do not have any starred searches.';
17
20
  this.authFailure = false;
@@ -21,7 +24,7 @@ export class VerdocsSearchActivity {
21
24
  this.starred = [];
22
25
  }
23
26
  componentWillLoad() {
24
- loadSession(SOURCE);
27
+ this.endpoint.loadSession();
25
28
  const errorHandler = e => {
26
29
  var _a;
27
30
  console.warn('[Verdocs/search-activity] Error getting search data', e);
@@ -33,21 +36,21 @@ export class VerdocsSearchActivity {
33
36
  case 'recent':
34
37
  this.title = 'Recent Searches';
35
38
  this.emptyMessage = 'You do not have any recent searches.';
36
- getSearchHistory()
39
+ getSearchHistory(this.endpoint)
37
40
  .then(r => (this.recent = r.recent))
38
41
  .catch(errorHandler);
39
42
  break;
40
43
  case 'saved':
41
44
  this.title = 'Saved Searches';
42
45
  this.emptyMessage = 'You do not have any saved searches.';
43
- getSearchHistory()
46
+ getSearchHistory(this.endpoint)
44
47
  .then(r => (this.saved = r.saved))
45
48
  .catch(errorHandler);
46
49
  break;
47
50
  case 'starred':
48
51
  this.title = 'My Starred items';
49
52
  this.emptyMessage = 'You do not have any starred templates.';
50
- getTemplates({ is_starred: true })
53
+ getTemplates(this.endpoint, { is_starred: true })
51
54
  .then(r => (this.starred = r))
52
55
  .catch(errorHandler);
53
56
  break;
@@ -100,6 +103,27 @@ export class VerdocsSearchActivity {
100
103
  "$": ["verdocs-search-activity.css"]
101
104
  }; }
102
105
  static get properties() { return {
106
+ "endpoint": {
107
+ "type": "unknown",
108
+ "mutable": false,
109
+ "complexType": {
110
+ "original": "VerdocsEndpoint",
111
+ "resolved": "VerdocsEndpoint",
112
+ "references": {
113
+ "VerdocsEndpoint": {
114
+ "location": "import",
115
+ "path": "@verdocs/js-sdk"
116
+ }
117
+ }
118
+ },
119
+ "required": false,
120
+ "optional": false,
121
+ "docs": {
122
+ "tags": [],
123
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
124
+ },
125
+ "defaultValue": "VerdocsEndpoint.getDefault()"
126
+ },
103
127
  "type": {
104
128
  "type": "string",
105
129
  "mutable": false,
@@ -1,5 +1,5 @@
1
1
  verdocs-search-box {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  }
4
4
  verdocs-search-box form {
5
5
  display: flex;
@@ -1,3 +1,4 @@
1
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
1
2
  import { Component, h, Event, Prop } from '@stencil/core';
2
3
  import SearchIcon from './search.svg';
3
4
  import CloseIcon from './close.svg';
@@ -9,6 +10,10 @@ import CloseIcon from './close.svg';
9
10
  */
10
11
  export class VerdocsSearchBox {
11
12
  constructor() {
13
+ /**
14
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
15
+ */
16
+ this.endpoint = VerdocsEndpoint.getDefault();
12
17
  /**
13
18
  * The placeholder to display in the input field.
14
19
  */
@@ -57,6 +62,27 @@ export class VerdocsSearchBox {
57
62
  "$": ["verdocs-search-box.css"]
58
63
  }; }
59
64
  static get properties() { return {
65
+ "endpoint": {
66
+ "type": "unknown",
67
+ "mutable": false,
68
+ "complexType": {
69
+ "original": "VerdocsEndpoint",
70
+ "resolved": "VerdocsEndpoint",
71
+ "references": {
72
+ "VerdocsEndpoint": {
73
+ "location": "import",
74
+ "path": "@verdocs/js-sdk"
75
+ }
76
+ }
77
+ },
78
+ "required": false,
79
+ "optional": false,
80
+ "docs": {
81
+ "tags": [],
82
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
83
+ },
84
+ "defaultValue": "VerdocsEndpoint.getDefault()"
85
+ },
60
86
  "placeholder": {
61
87
  "type": "string",
62
88
  "mutable": false,
@@ -1,4 +1,4 @@
1
1
  verdocs-search-tabs {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  display: block;
4
4
  }
@@ -1,7 +1,5 @@
1
1
  verdocs-auth {
2
- font-family: "Barlow", sans-serif;
3
- background-color: #4c56cb;
4
- padding: 40px;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
5
3
  display: flex;
6
4
  flex-direction: column;
7
5
  align-items: center;
@@ -9,10 +7,9 @@ verdocs-auth {
9
7
  }
10
8
  verdocs-auth .login-form,
11
9
  verdocs-auth .signup-form {
12
- background: #f5f5fa;
10
+ background: #ffffff;
13
11
  align-items: center;
14
12
  justify-content: center;
15
- border-radius: 8px;
16
13
  flex-direction: column;
17
14
  display: flex;
18
15
  padding: 20px;
@@ -1,14 +1,13 @@
1
1
  import { Auth } from '@verdocs/js-sdk/Users';
2
- import { Transport, VerdocsEndpoint } from '@verdocs/js-sdk/HTTP';
3
- import { loadSession, setSession } from '@verdocs/js-sdk/Users/Auth';
4
2
  import { Component, Prop, State, h, Event } from '@stencil/core';
5
- const BASE_URL = 'https://stage-api.verdocs.com/';
6
- const SOURCE = 'verdocs-stage';
3
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
7
4
  /**
8
5
  * Display an authentication dialog that allows the user to login or sign up. Callbacks are provided for events that
9
6
  * occur during the process (especially successful completion). The success callback will be fired immediately if the
10
- * user is already authenticated with a valid session, so this component may not always display visibly. To simplify
11
- * some types of authentication flows, a visibility flag can force this component to never display.
7
+ * user is already authenticated with a valid session, so this component may not always display visibly.
8
+ *
9
+ * To simplify some types of authentication flows, a visibility flag can force this component to never display. This
10
+ * allows you to susbcribe to notifications from the
12
11
  *
13
12
  * This embed is responsive / mobile-friendly, but the calling application should provide at least a 300px wide
14
13
  * container to allow sufficient space for the required forms.
@@ -32,6 +31,10 @@ const SOURCE = 'verdocs-stage';
32
31
  */
33
32
  export class VerdocsAuth {
34
33
  constructor() {
34
+ /**
35
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
36
+ */
37
+ this.endpoint = VerdocsEndpoint.getDefault();
35
38
  /**
36
39
  * Normally, if the user has a valid session, this embed will be invisible, otherwise it will display
37
40
  * login / signup forms. If this is set to false, this embed will be invisible in both cases. Apps may
@@ -58,18 +61,12 @@ export class VerdocsAuth {
58
61
  this.activeSession = null;
59
62
  this.loginError = null;
60
63
  }
61
- componentWillLoad() {
62
- const staging = new VerdocsEndpoint().setBaseURL(BASE_URL);
63
- Transport.setActiveEndpoint(staging);
64
- console.log('Set active endpoint', Transport.getEndpoint());
65
- }
66
64
  componentDidLoad() {
67
- const session = loadSession(SOURCE);
68
- console.log('loaded session', session, SOURCE);
69
- if (session !== null) {
65
+ this.endpoint.loadSession();
66
+ if (this.endpoint.session !== null) {
70
67
  this.isAuthenticated = true;
71
- this.activeSession = session;
72
- this.authenticated.emit({ authenticated: true, session });
68
+ this.activeSession = this.endpoint.session;
69
+ this.authenticated.emit({ authenticated: true, session: this.endpoint.session });
73
70
  }
74
71
  else {
75
72
  this.authenticated.emit({ authenticated: false, session: null });
@@ -81,19 +78,17 @@ export class VerdocsAuth {
81
78
  // }
82
79
  handleLogin() {
83
80
  this.loggingIn = true;
84
- Auth.authenticateUser({ username: this.username, password: this.password })
81
+ Auth.authenticateUser(this.endpoint, { username: this.username, password: this.password })
85
82
  .then(r => {
86
83
  this.loggingIn = false;
87
- console.log('Login result', r.accessToken);
88
- const session = setSession(SOURCE, r.accessToken, true);
89
- this.activeSession = session;
84
+ this.endpoint.setToken(r.accessToken);
85
+ this.activeSession = this.endpoint.session;
90
86
  this.isAuthenticated = true;
91
- console.log('set session', session);
92
- this.authenticated.emit({ authenticated: true, session });
87
+ this.authenticated.emit({ authenticated: true, session: this.endpoint.session });
93
88
  })
94
89
  .catch(e => {
95
90
  var _a;
96
- console.log('Login error', e.response, JSON.stringify(e));
91
+ console.log('[VERDOCS] Login error', e.response, JSON.stringify(e));
97
92
  this.loggingIn = false;
98
93
  this.activeSession = null;
99
94
  this.authenticated.emit({ authenticated: false, session: null });
@@ -103,7 +98,7 @@ export class VerdocsAuth {
103
98
  });
104
99
  }
105
100
  handleLogout() {
106
- // endSession(SOURCE);
101
+ this.endpoint.clearSession();
107
102
  this.isAuthenticated = false;
108
103
  this.authenticated.emit({ authenticated: false, session: null });
109
104
  }
@@ -154,6 +149,27 @@ export class VerdocsAuth {
154
149
  "$": ["verdocs-auth.css"]
155
150
  }; }
156
151
  static get properties() { return {
152
+ "endpoint": {
153
+ "type": "unknown",
154
+ "mutable": false,
155
+ "complexType": {
156
+ "original": "VerdocsEndpoint",
157
+ "resolved": "VerdocsEndpoint",
158
+ "references": {
159
+ "VerdocsEndpoint": {
160
+ "location": "import",
161
+ "path": "@verdocs/js-sdk"
162
+ }
163
+ }
164
+ },
165
+ "required": false,
166
+ "optional": false,
167
+ "docs": {
168
+ "tags": [],
169
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
170
+ },
171
+ "defaultValue": "VerdocsEndpoint.getDefault()"
172
+ },
157
173
  "visible": {
158
174
  "type": "boolean",
159
175
  "mutable": false,
@@ -1,5 +1,5 @@
1
1
  verdocs-search {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  display: flex;
4
4
  background-color: #1e2031;
5
5
  }
@@ -1,13 +1,20 @@
1
- import { Component, h } from '@stencil/core';
1
+ import { Component, h, Prop } from '@stencil/core';
2
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
2
3
  export class VerdocsSearch {
4
+ constructor() {
5
+ /**
6
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
7
+ */
8
+ this.endpoint = VerdocsEndpoint.getDefault();
9
+ }
3
10
  render() {
4
11
  return (h("div", { class: "container" },
5
- h("verdocs-search-box", null),
12
+ h("verdocs-search-box", { endpoint: this.endpoint }),
6
13
  h("div", { class: "boxes" },
7
- h("verdocs-search-activity", { type: "recent" }),
8
- h("verdocs-search-activity", { type: "saved" }),
9
- h("verdocs-search-activity", { type: "starred" }),
10
- h("search-quick-functions", null))));
14
+ h("verdocs-search-activity", { type: "recent", endpoint: this.endpoint }),
15
+ h("verdocs-search-activity", { type: "saved", endpoint: this.endpoint }),
16
+ h("verdocs-search-activity", { type: "starred", endpoint: this.endpoint }),
17
+ h("search-quick-functions", { endpoint: this.endpoint }))));
11
18
  }
12
19
  static get is() { return "verdocs-search"; }
13
20
  static get originalStyleUrls() { return {
@@ -16,4 +23,27 @@ export class VerdocsSearch {
16
23
  static get styleUrls() { return {
17
24
  "$": ["verdocs-search.css"]
18
25
  }; }
26
+ static get properties() { return {
27
+ "endpoint": {
28
+ "type": "unknown",
29
+ "mutable": false,
30
+ "complexType": {
31
+ "original": "VerdocsEndpoint",
32
+ "resolved": "VerdocsEndpoint",
33
+ "references": {
34
+ "VerdocsEndpoint": {
35
+ "location": "import",
36
+ "path": "@verdocs/js-sdk"
37
+ }
38
+ }
39
+ },
40
+ "required": false,
41
+ "optional": false,
42
+ "docs": {
43
+ "tags": [],
44
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
45
+ },
46
+ "defaultValue": "VerdocsEndpoint.getDefault()"
47
+ }
48
+ }; }
19
49
  }
@@ -1,5 +1,5 @@
1
1
  verdocs-sign {
2
- font-family: "Barlow", sans-serif;
2
+ font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
3
  position: relative;
4
4
  display: flex;
5
5
  flex-direction: column;
@@ -31,7 +31,7 @@ verdocs-sign .intro {
31
31
  verdocs-sign .toolbar {
32
32
  width: 100%;
33
33
  margin: 0 auto;
34
- padding: 0 20px;
34
+ padding: 0 14px;
35
35
  max-width: 1028px;
36
36
  position: relative;
37
37
  }
@@ -61,17 +61,34 @@ verdocs-sign .document {
61
61
  position: relative;
62
62
  overflow-y: scroll;
63
63
  }
64
- verdocs-sign .agree-checkbox {
64
+ verdocs-sign .agree {
65
+ flex: 1;
66
+ flex-direction: row;
67
+ display: flex;
68
+ align-items: center;
69
+ margin-right: 10px;
70
+ }
71
+ verdocs-sign .agree .intro {
72
+ display: none;
73
+ }
74
+ verdocs-sign .agree .header {
75
+ flex: 0 0 56px;
76
+ }
77
+ verdocs-sign .agree .agree-checkbox {
78
+ background: #ccc;
65
79
  flex: 0 0 20px;
66
80
  display: flex;
67
81
  width: 20px;
68
82
  height: 20px;
69
83
  border-radius: 3px;
70
- background: #ffffff;
71
84
  position: relative;
72
- margin: 0 10px 0 30px;
85
+ margin: 0 10px 0 14px;
73
86
  }
74
- verdocs-sign .agree-checkbox label {
87
+ verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked + label:after {
88
+ filter: alpha(opacity=100);
89
+ opacity: 1;
90
+ }
91
+ verdocs-sign .agree .agree-checkbox label {
75
92
  left: 2px;
76
93
  top: 2px;
77
94
  width: 16px;
@@ -81,7 +98,11 @@ verdocs-sign .agree-checkbox label {
81
98
  background: #33354c;
82
99
  box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.8);
83
100
  }
84
- verdocs-sign .agree-checkbox label:after {
101
+ verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after {
102
+ filter: alpha(opacity=30);
103
+ opacity: 0.3;
104
+ }
105
+ verdocs-sign .agree .agree-checkbox label:after {
85
106
  top: 2px;
86
107
  left: 3px;
87
108
  width: 8px;
@@ -96,26 +117,6 @@ verdocs-sign .agree-checkbox label:after {
96
117
  border-top: none;
97
118
  border-right: none;
98
119
  }
99
- verdocs-sign .agree-checkbox label:hover::after {
100
- filter: alpha(opacity=30);
101
- opacity: 0.3;
102
- }
103
- verdocs-sign .agree-checkbox input[type=checkbox]:checked + label:after {
104
- filter: alpha(opacity=100);
105
- opacity: 1;
106
- }
107
- verdocs-sign.agreed .intro {
108
- display: none;
109
- }
110
- verdocs-sign.agreed .header {
111
- flex: 0 0 56px;
112
- }
113
- verdocs-sign.agreed .agree-checkbox {
114
- background: #ccc;
115
- }
116
- verdocs-sign.agreed .agree-checkbox label {
117
- cursor: default;
118
- }
119
120
  verdocs-sign .page-controls {
120
121
  position: absolute;
121
122
  left: 50%;
@@ -1,18 +1,20 @@
1
1
  import { Host } from '@stencil/core';
2
+ import { VerdocsEndpoint } from '@verdocs/js-sdk';
3
+ import { Documents } from '@verdocs/js-sdk/Documents';
2
4
  import { getRGBA } from '@verdocs/js-sdk/Utils/Colors';
3
5
  import { rescale } from '@verdocs/js-sdk/Utils/Fields';
4
- import { VerdocsEndpoint } from '@verdocs/js-sdk/HTTP';
5
6
  import { Component, Prop, State, h } from '@stencil/core';
6
7
  import { updateRecipientStatus } from '@verdocs/js-sdk/Documents/Recipients';
7
- import { getEndpoint, setActiveEndpoint } from '@verdocs/js-sdk/HTTP/Transport';
8
8
  import { isValidEmail, isValidPhone } from '@verdocs/js-sdk/Templates/Validators';
9
- import { getSigningSession, getDocument, getDocumentFile, updateDocumentField } from '@verdocs/js-sdk/Documents/Documents';
10
- const BASE_URL = 'https://stage-api.verdocs.com';
11
9
  /**
12
10
  * Display a document signing experience.
13
11
  */
14
12
  export class VerdocsSign {
15
13
  constructor() {
14
+ /**
15
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
16
+ */
17
+ this.endpoint = VerdocsEndpoint.getDefault();
16
18
  /**
17
19
  * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a
18
20
  * signing session.
@@ -28,7 +30,6 @@ export class VerdocsSign {
28
30
  * signing session.
29
31
  */
30
32
  this.invitecode = null;
31
- this.endpoint = null;
32
33
  this.recipient = null;
33
34
  this.signerToken = null;
34
35
  this.pdfUrl = null;
@@ -39,14 +40,10 @@ export class VerdocsSign {
39
40
  this.nextButtonLabel = 'Start';
40
41
  this.focusedField = '';
41
42
  }
42
- componentWillLoad() {
43
- const endpoint = new VerdocsEndpoint().setBaseURL(BASE_URL);
44
- setActiveEndpoint(endpoint);
45
- }
46
43
  async componentDidLoad() {
47
44
  try {
48
45
  console.log('[SIGN] Processing invite code', this.documentid, this.roleid, this.invitecode);
49
- const { session, recipient, signerToken } = await getSigningSession({
46
+ const { session, recipient, signerToken } = await Documents.getSigningSession(this.endpoint, {
50
47
  documentId: this.documentid,
51
48
  roleId: this.roleid,
52
49
  inviteCode: this.invitecode,
@@ -55,14 +52,14 @@ export class VerdocsSign {
55
52
  console.log('[SIGN] Recipient', recipient);
56
53
  this.recipient = recipient;
57
54
  this.signerToken = signerToken;
58
- getEndpoint().setSigningAuthorization(signerToken);
55
+ this.endpoint.setToken(signerToken);
59
56
  if (this.recipient.agreed) {
60
57
  this.nextButtonLabel = 'Next';
61
58
  }
62
- const document = await getDocument(this.documentid);
59
+ const document = await Documents.getDocument(this.endpoint, this.documentid);
63
60
  this.document = document;
64
61
  console.log('[SIGN] Document', document);
65
- this.pdfUrl = `${BASE_URL}/documents/${this.documentid}/envelope_documents/${document.envelope_document_id}?file=true`;
62
+ this.pdfUrl = `${this.endpoint.getBaseURL()}/documents/${this.documentid}/envelope_documents/${document.envelope_document_id}?file=true`;
66
63
  this.recipientIndex = this.document.recipients.findIndex(recipient => recipient.role_name == this.roleid);
67
64
  if (this.recipientIndex > -1) {
68
65
  console.log('Found recipient', this.document.recipients[this.recipientIndex]);
@@ -79,7 +76,7 @@ export class VerdocsSign {
79
76
  }
80
77
  handleClickAgree() {
81
78
  console.log('agree clicked');
82
- updateRecipientStatus(this.documentid, this.roleid, 'update', { agreed: true })
79
+ updateRecipientStatus(this.endpoint, this.documentid, this.roleid, 'update', { agreed: true })
83
80
  .then(r => {
84
81
  console.log('update result', r);
85
82
  this.nextButtonLabel = 'Next';
@@ -91,7 +88,7 @@ export class VerdocsSign {
91
88
  }
92
89
  async savePDF() {
93
90
  const fileName = `${this.document.name} - ${this.document.updated_at.split('T')[0]}.pdf`;
94
- const data = await getDocumentFile(this.documentid, this.document.envelope_document_id);
91
+ const data = await Documents.getDocumentFile(this.endpoint, this.documentid, this.document.envelope_document_id);
95
92
  // This is better in React than doing window.href= or similar to trigger a download. For a description of the technique
96
93
  // see https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image
97
94
  let xhr = new XMLHttpRequest();
@@ -133,23 +130,23 @@ export class VerdocsSign {
133
130
  console.log('fieldChange', field, e.detail);
134
131
  switch (field.type) {
135
132
  case 'textbox':
136
- updateDocumentField(this.documentid, field.name, { prepared: false, value: e.detail })
133
+ Documents.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: e.detail })
137
134
  .then(r => console.log('Update result', r))
138
135
  .catch(e => console.log('Error updating', e));
139
136
  break;
140
137
  case 'checkbox_group':
141
- updateDocumentField(this.documentid, field.name, { prepared: false, value: { options: [{ id: optionId, checked: e.detail }] } })
138
+ Documents.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: { options: [{ id: optionId, checked: e.detail }] } })
142
139
  .then(r => console.log('Update result', r))
143
140
  .catch(e => console.log('Error updating', e));
144
141
  break;
145
142
  case 'radio_button_group':
146
143
  const options = field.settings.options.map(option => ({ id: option.id, selected: optionId === option.id }));
147
- updateDocumentField(this.documentid, field.name, { prepared: false, value: { options } })
144
+ Documents.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: { options } })
148
145
  .then(r => console.log('Update result', r))
149
146
  .catch(e => console.log('Error updating', e));
150
147
  break;
151
148
  case 'dropdown':
152
- updateDocumentField(this.documentid, field.name, { prepared: false, value: e.detail })
149
+ Documents.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: e.detail })
153
150
  .then(r => console.log('Update result', r))
154
151
  .catch(e => console.log('Error updating', e));
155
152
  break;
@@ -312,12 +309,12 @@ export class VerdocsSign {
312
309
  h("div", { class: "toolbar" },
313
310
  h("div", { class: "tools" },
314
311
  h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }),
315
- !((_b = this.recipient) === null || _b === void 0 ? void 0 : _b.agreed) ? (h("div", { style: { flex: '1', flexDirection: 'row', display: 'flex', alignItems: 'center' } },
312
+ !((_b = this.recipient) === null || _b === void 0 ? void 0 : _b.agreed) ? (h("div", { class: "agree" },
316
313
  h("div", { class: "agree-checkbox" },
317
314
  h("input", { type: "checkbox", value: "None", id: "agree-checkbox-element", name: "agree", onChange: () => this.handleClickAgree() }),
318
315
  h("label", { htmlFor: "agree-checkbox-element" })),
319
- "I agree to use electronic records and signatures.")) : (h("div", { style: { flex: '1' } })),
320
- h("verdocs-button", { label: this.nextButtonLabel, disabled: !((_c = this.recipient) === null || _c === void 0 ? void 0 : _c.agreed), onClick: () => this.handleNext() })))),
316
+ h("span", null, "I agree to use electronic records and signatures."))) : (h("div", { style: { flex: '1' } })),
317
+ h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !((_c = this.recipient) === null || _c === void 0 ? void 0 : _c.agreed), onClick: () => this.handleNext() })))),
321
318
  !((_d = this.recipient) === null || _d === void 0 ? void 0 : _d.agreed) ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }),
322
319
  h("div", { class: "document" },
323
320
  this.pdfUrl ? h("verdocs-view", { source: this.pdfUrl, token: this.signerToken, onDocumentRendered: e => this.handleDocumentRendered(e) }) : h("verdocs-loader", null),
@@ -334,6 +331,27 @@ export class VerdocsSign {
334
331
  "$": ["verdocs-sign.css"]
335
332
  }; }
336
333
  static get properties() { return {
334
+ "endpoint": {
335
+ "type": "unknown",
336
+ "mutable": false,
337
+ "complexType": {
338
+ "original": "VerdocsEndpoint",
339
+ "resolved": "VerdocsEndpoint",
340
+ "references": {
341
+ "VerdocsEndpoint": {
342
+ "location": "import",
343
+ "path": "@verdocs/js-sdk"
344
+ }
345
+ }
346
+ },
347
+ "required": false,
348
+ "optional": false,
349
+ "docs": {
350
+ "tags": [],
351
+ "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
352
+ },
353
+ "defaultValue": "VerdocsEndpoint.getDefault()"
354
+ },
337
355
  "documentid": {
338
356
  "type": "string",
339
357
  "mutable": false,
@@ -390,7 +408,6 @@ export class VerdocsSign {
390
408
  }
391
409
  }; }
392
410
  static get states() { return {
393
- "endpoint": {},
394
411
  "recipient": {},
395
412
  "signerToken": {},
396
413
  "pdfUrl": {},