@verdocs/web-sdk 1.4.7 → 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 (114) 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 +32 -19
  4. package/dist/cjs/verdocs-dropdown_12.cjs.entry.js +15 -11
  5. package/dist/cjs/verdocs-kba-dialog.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-quick-functions.cjs.entry.js +5 -0
  8. package/dist/cjs/verdocs-search-activity_2.cjs.entry.js +40 -35
  9. package/dist/cjs/verdocs-search.cjs.entry.js +6 -1
  10. package/dist/cjs/verdocs-sign.cjs.entry.js +26 -161
  11. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  12. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.css +1 -1
  13. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.css +1 -1
  14. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.js +31 -1
  15. package/dist/collection/components/elements/verdocs-search-activity/verdocs-search-activity.js +30 -6
  16. package/dist/collection/components/elements/verdocs-search-box/verdocs-search-box.js +26 -0
  17. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.css +1 -4
  18. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +35 -17
  19. package/dist/collection/components/embeds/verdocs-search/verdocs-search.js +36 -6
  20. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.css +27 -26
  21. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +40 -23
  22. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +2 -2
  23. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +26 -0
  24. package/dist/components/VerdocsEndpoint.js +4766 -0
  25. package/dist/components/verdocs-auth.js +33 -18
  26. package/dist/components/verdocs-kba-dialog.js +1 -1
  27. package/dist/components/verdocs-ok-dialog2.js +1 -1
  28. package/dist/components/verdocs-quick-functions.js +8 -1
  29. package/dist/components/verdocs-search-activity2.js +37 -34
  30. package/dist/components/verdocs-search-box2.js +6 -0
  31. package/dist/components/verdocs-search.js +9 -2
  32. package/dist/components/verdocs-sign.js +27 -162
  33. package/dist/components/verdocs-view2.js +6 -1
  34. package/dist/custom-elements.json +830 -0
  35. package/dist/docs.json +117 -3
  36. package/dist/esm/VerdocsEndpoint-30e1b6ec.js +4766 -0
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/esm/verdocs-auth.entry.js +32 -19
  39. package/dist/esm/verdocs-dropdown_12.entry.js +5 -1
  40. package/dist/esm/verdocs-kba-dialog.entry.js +1 -1
  41. package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
  42. package/dist/esm/verdocs-quick-functions.entry.js +5 -0
  43. package/dist/esm/verdocs-search-activity_2.entry.js +40 -35
  44. package/dist/esm/verdocs-search.entry.js +6 -1
  45. package/dist/esm/verdocs-sign.entry.js +26 -161
  46. package/dist/esm/verdocs-web-sdk.js +1 -1
  47. package/dist/esm-es5/VerdocsEndpoint-30e1b6ec.js +7 -0
  48. package/dist/esm-es5/loader.js +1 -1
  49. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  50. package/dist/esm-es5/verdocs-dropdown_12.entry.js +2 -2
  51. package/dist/esm-es5/verdocs-kba-dialog.entry.js +1 -1
  52. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  53. package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
  54. package/dist/esm-es5/verdocs-search-activity_2.entry.js +1 -1
  55. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  56. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  57. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  58. package/dist/types/components/elements/verdocs-quick-functions/verdocs-quick-functions.d.ts +5 -0
  59. package/dist/types/components/elements/verdocs-search-activity/verdocs-search-activity.d.ts +5 -0
  60. package/dist/types/components/elements/verdocs-search-box/verdocs-search-box.d.ts +5 -0
  61. package/dist/types/components/embeds/verdocs-auth/verdocs-auth.d.ts +7 -4
  62. package/dist/types/components/embeds/verdocs-search/verdocs-search.d.ts +5 -0
  63. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +6 -3
  64. package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +5 -0
  65. package/dist/types/components.d.ts +57 -0
  66. package/dist/verdocs-web-sdk/{p-ed5baeb4.entry.js → p-064453c3.entry.js} +1 -1
  67. package/dist/verdocs-web-sdk/p-06f38046.js +1 -0
  68. package/dist/verdocs-web-sdk/p-16d62a51.system.entry.js +1 -0
  69. package/dist/verdocs-web-sdk/p-1b4e04b7.system.entry.js +1 -0
  70. package/dist/verdocs-web-sdk/p-1ea3b9d3.entry.js +1 -0
  71. package/dist/verdocs-web-sdk/p-30cc8818.entry.js +1 -0
  72. package/dist/verdocs-web-sdk/{p-0353c423.entry.js → p-32ad1014.entry.js} +1 -1
  73. package/dist/verdocs-web-sdk/p-4d80d044.system.js +7 -0
  74. package/dist/verdocs-web-sdk/{p-432c3151.system.entry.js → p-81fc0196.system.entry.js} +1 -1
  75. package/dist/verdocs-web-sdk/p-8276345a.entry.js +1 -0
  76. package/dist/verdocs-web-sdk/p-88a300c5.system.js +1 -1
  77. package/dist/verdocs-web-sdk/p-9139a76d.system.entry.js +1 -0
  78. package/dist/verdocs-web-sdk/p-a87069d5.system.entry.js +1 -0
  79. package/dist/verdocs-web-sdk/p-aa9fc574.entry.js +1 -0
  80. package/dist/verdocs-web-sdk/p-c29c2cf8.entry.js +1 -0
  81. package/dist/verdocs-web-sdk/{p-4368df79.system.entry.js → p-c4d03ff9.system.entry.js} +2 -2
  82. package/dist/verdocs-web-sdk/{p-a1143ddb.entry.js → p-d522de7d.entry.js} +2 -2
  83. package/dist/verdocs-web-sdk/{p-e2e643c5.system.entry.js → p-e4ba14dc.system.entry.js} +1 -1
  84. package/dist/verdocs-web-sdk/p-f6a53928.system.entry.js +1 -0
  85. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  86. package/package.json +2 -2
  87. package/dist/cjs/Auth-4ec35ac7.js +0 -97
  88. package/dist/cjs/Token-ac80819a.js +0 -2331
  89. package/dist/cjs/buffer-es6-bc8199b1.js +0 -2018
  90. package/dist/components/Auth.js +0 -92
  91. package/dist/components/Token.js +0 -2325
  92. package/dist/components/buffer-es6.js +0 -2010
  93. package/dist/esm/Auth-15cd42a8.js +0 -92
  94. package/dist/esm/Token-ce37bd9d.js +0 -2325
  95. package/dist/esm/buffer-es6-136673c8.js +0 -2010
  96. package/dist/esm-es5/Auth-15cd42a8.js +0 -1
  97. package/dist/esm-es5/Token-ce37bd9d.js +0 -1
  98. package/dist/esm-es5/buffer-es6-136673c8.js +0 -7
  99. package/dist/verdocs-web-sdk/p-0c0b4a10.system.entry.js +0 -1
  100. package/dist/verdocs-web-sdk/p-2b57857d.system.entry.js +0 -1
  101. package/dist/verdocs-web-sdk/p-2c161242.system.entry.js +0 -1
  102. package/dist/verdocs-web-sdk/p-39633a02.entry.js +0 -1
  103. package/dist/verdocs-web-sdk/p-5dfd73f9.system.js +0 -7
  104. package/dist/verdocs-web-sdk/p-69ef22bd.entry.js +0 -1
  105. package/dist/verdocs-web-sdk/p-737b2e99.js +0 -1
  106. package/dist/verdocs-web-sdk/p-8730dc92.system.js +0 -1
  107. package/dist/verdocs-web-sdk/p-a7cfe6fc.entry.js +0 -1
  108. package/dist/verdocs-web-sdk/p-b9164c4b.system.entry.js +0 -1
  109. package/dist/verdocs-web-sdk/p-cec13589.system.js +0 -1
  110. package/dist/verdocs-web-sdk/p-e6e2894e.js +0 -1
  111. package/dist/verdocs-web-sdk/p-ea6d6dc7.entry.js +0 -1
  112. package/dist/verdocs-web-sdk/p-ef932a87.js +0 -1
  113. package/dist/verdocs-web-sdk/p-f0e6fde0.entry.js +0 -1
  114. package/dist/verdocs-web-sdk/p-fd853e54.system.entry.js +0 -1
@@ -3,8 +3,16 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-589f3be8.js');
6
- const Token = require('./Token-ac80819a.js');
7
- const bufferEs6 = require('./buffer-es6-bc8199b1.js');
6
+ const VerdocsEndpoint = require('./VerdocsEndpoint-5e6dd8ef.js');
7
+
8
+ var e164Regex = new RegExp(/\+[1-9]\d{6,14}/g);
9
+ function simpleE164Validator(code) {
10
+ return (code !== null && code.length < 16 && code.length > 6 && e164Regex.test(code)) || code === '' || code === null;
11
+ }
12
+
13
+ var EmailRegEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
14
+ var isValidEmail = function (value) { return EmailRegEx.test(value); };
15
+ var isValidPhone = function (value) { return simpleE164Validator(value); };
8
16
 
9
17
  /**
10
18
  * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
@@ -43,153 +51,15 @@ function rescale(r, n) {
43
51
  return r * n;
44
52
  }
45
53
 
46
- var __assign = (undefined && undefined.__assign) || function () {
47
- __assign = Object.assign || function(t) {
48
- for (var s, i = 1, n = arguments.length; i < n; i++) {
49
- s = arguments[i];
50
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
51
- t[p] = s[p];
52
- }
53
- return t;
54
- };
55
- return __assign.apply(this, arguments);
56
- };
57
- var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
58
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59
- return new (P || (P = Promise))(function (resolve, reject) {
60
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
61
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
62
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
63
- step((generator = generator.apply(thisArg, _arguments || [])).next());
64
- });
65
- };
66
- var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
67
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
68
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
69
- function verb(n) { return function (v) { return step([n, v]); }; }
70
- function step(op) {
71
- if (f) throw new TypeError("Generator is already executing.");
72
- while (_) try {
73
- 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;
74
- if (y = 0, t) op = [op[0] & 2, t.value];
75
- switch (op[0]) {
76
- case 0: case 1: t = op; break;
77
- case 4: _.label++; return { value: op[1], done: false };
78
- case 5: _.label++; y = op[1]; op = [0]; continue;
79
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
80
- default:
81
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
82
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
83
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
84
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
85
- if (t[2]) _.ops.pop();
86
- _.trys.pop(); continue;
87
- }
88
- op = body.call(thisArg, _);
89
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
90
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
91
- }
92
- };
93
- var updateRecipientStatus = function (documentId, roleName, action, params) { return __awaiter$1(void 0, void 0, void 0, function () {
94
- return __generator$1(this, function (_a) {
95
- return [2 /*return*/, Token.getEndpoint()
96
- .api.put("/documents/".concat(documentId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
97
- .then(function (r) { return r.data; })];
98
- });
99
- }); };
54
+ const verdocsSignCss = "verdocs-sign{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:600px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}verdocs-sign.storybook{max-height:600px}verdocs-sign div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:\"\";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}verdocs-sign .page-controls{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:500}";
100
55
 
101
- var e164Regex = new RegExp(/\+[1-9]\d{6,14}/g);
102
- function simpleE164Validator(code) {
103
- return (code !== null && code.length < 16 && code.length > 6 && e164Regex.test(code)) || code === '' || code === null;
104
- }
105
-
106
- var EmailRegEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
107
- var isValidEmail = function (value) { return EmailRegEx.test(value); };
108
- var isValidPhone = function (value) { return simpleE164Validator(value); };
109
-
110
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
111
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
112
- return new (P || (P = Promise))(function (resolve, reject) {
113
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
114
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
115
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
116
- step((generator = generator.apply(thisArg, _arguments || [])).next());
117
- });
118
- };
119
- var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
120
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
121
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
122
- function verb(n) { return function (v) { return step([n, v]); }; }
123
- function step(op) {
124
- if (f) throw new TypeError("Generator is already executing.");
125
- while (_) try {
126
- 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;
127
- if (y = 0, t) op = [op[0] & 2, t.value];
128
- switch (op[0]) {
129
- case 0: case 1: t = op; break;
130
- case 4: _.label++; return { value: op[1], done: false };
131
- case 5: _.label++; y = op[1]; op = [0]; continue;
132
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
133
- default:
134
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
135
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
136
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
137
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
138
- if (t[2]) _.ops.pop();
139
- _.trys.pop(); continue;
140
- }
141
- op = body.call(thisArg, _);
142
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
143
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
144
- }
145
- };
146
- /**
147
- * Get a signing session for a document.
148
- */
149
- var getSigningSession = function (params) { return __awaiter(void 0, void 0, void 0, function () {
150
- return __generator(this, function (_a) {
151
- return [2 /*return*/, Token.getEndpoint()
152
- .api.get("/documents/".concat(params.documentId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
153
- .then(function (r) {
154
- var _a, _b;
155
- // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library
156
- var signerToken = ((_a = r.headers) === null || _a === void 0 ? void 0 : _a.signer_token) || '';
157
- var session = Token.decodeAccessTokenBody(signerToken);
158
- Token.getEndpoint().setAuthorization((_b = r.headers) === null || _b === void 0 ? void 0 : _b.signer_token);
159
- return { recipient: r.data, session: session, signerToken: signerToken };
160
- })];
161
- });
162
- }); };
163
- var getDocument = function (documentId) { return __awaiter(void 0, void 0, void 0, function () {
164
- return __generator(this, function (_a) {
165
- return [2 /*return*/, Token.getEndpoint()
166
- .api.get("/documents/".concat(documentId))
167
- .then(function (r) { return r.data; })];
168
- });
169
- }); };
170
- var getDocumentFile = function (documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
171
- return __generator(this, function (_a) {
172
- return [2 /*return*/, Token.getEndpoint()
173
- .api.get("/documents/".concat(documentId, "/envelope_documents/").concat(envelopeDocumentId, "?file=true"), {
174
- responseType: 'arraybuffer',
175
- })
176
- .then(function (r) { return bufferEs6.Buffer.from(r.data, 'binary').toString('base64'); })];
177
- });
178
- }); };
179
- var updateDocumentField = function (documentId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
180
- return __generator(this, function (_a) {
181
- return [2 /*return*/, Token.getEndpoint()
182
- .api.put("/documents/".concat(documentId, "/fields/").concat(fieldName), value)
183
- .then(function (r) { return r.data; })];
184
- });
185
- }); };
186
-
187
- const verdocsSignCss = "verdocs-sign{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:600px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}verdocs-sign.storybook{max-height:600px}verdocs-sign div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 20px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree-checkbox{-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;background:#ffffff;position:relative;margin:0 10px 0 30px}verdocs-sign .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:\"\";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}verdocs-sign .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign.agreed .intro{display:none}verdocs-sign.agreed .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign.agreed .agree-checkbox{background:#ccc}verdocs-sign.agreed .agree-checkbox label{cursor:default}verdocs-sign .page-controls{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:500}";
188
-
189
- const BASE_URL = 'https://stage-api.verdocs.com';
190
56
  const VerdocsSign = class {
191
57
  constructor(hostRef) {
192
58
  index.registerInstance(this, hostRef);
59
+ /**
60
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
61
+ */
62
+ this.endpoint = VerdocsEndpoint.VerdocsEndpoint.getDefault();
193
63
  /**
194
64
  * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a
195
65
  * signing session.
@@ -205,7 +75,6 @@ const VerdocsSign = class {
205
75
  * signing session.
206
76
  */
207
77
  this.invitecode = null;
208
- this.endpoint = null;
209
78
  this.recipient = null;
210
79
  this.signerToken = null;
211
80
  this.pdfUrl = null;
@@ -216,14 +85,10 @@ const VerdocsSign = class {
216
85
  this.nextButtonLabel = 'Start';
217
86
  this.focusedField = '';
218
87
  }
219
- componentWillLoad() {
220
- const endpoint = new Token.VerdocsEndpoint().setBaseURL(BASE_URL);
221
- Token.setActiveEndpoint(endpoint);
222
- }
223
88
  async componentDidLoad() {
224
89
  try {
225
90
  console.log('[SIGN] Processing invite code', this.documentid, this.roleid, this.invitecode);
226
- const { session, recipient, signerToken } = await getSigningSession({
91
+ const { session, recipient, signerToken } = await VerdocsEndpoint.getSigningSession(this.endpoint, {
227
92
  documentId: this.documentid,
228
93
  roleId: this.roleid,
229
94
  inviteCode: this.invitecode,
@@ -232,14 +97,14 @@ const VerdocsSign = class {
232
97
  console.log('[SIGN] Recipient', recipient);
233
98
  this.recipient = recipient;
234
99
  this.signerToken = signerToken;
235
- Token.getEndpoint().setSigningAuthorization(signerToken);
100
+ this.endpoint.setToken(signerToken);
236
101
  if (this.recipient.agreed) {
237
102
  this.nextButtonLabel = 'Next';
238
103
  }
239
- const document = await getDocument(this.documentid);
104
+ const document = await VerdocsEndpoint.getDocument(this.endpoint, this.documentid);
240
105
  this.document = document;
241
106
  console.log('[SIGN] Document', document);
242
- this.pdfUrl = `${BASE_URL}/documents/${this.documentid}/envelope_documents/${document.envelope_document_id}?file=true`;
107
+ this.pdfUrl = `${this.endpoint.getBaseURL()}/documents/${this.documentid}/envelope_documents/${document.envelope_document_id}?file=true`;
243
108
  this.recipientIndex = this.document.recipients.findIndex(recipient => recipient.role_name == this.roleid);
244
109
  if (this.recipientIndex > -1) {
245
110
  console.log('Found recipient', this.document.recipients[this.recipientIndex]);
@@ -256,7 +121,7 @@ const VerdocsSign = class {
256
121
  }
257
122
  handleClickAgree() {
258
123
  console.log('agree clicked');
259
- updateRecipientStatus(this.documentid, this.roleid, 'update', { agreed: true })
124
+ VerdocsEndpoint.updateRecipientStatus(this.endpoint, this.documentid, this.roleid, 'update', { agreed: true })
260
125
  .then(r => {
261
126
  console.log('update result', r);
262
127
  this.nextButtonLabel = 'Next';
@@ -268,7 +133,7 @@ const VerdocsSign = class {
268
133
  }
269
134
  async savePDF() {
270
135
  const fileName = `${this.document.name} - ${this.document.updated_at.split('T')[0]}.pdf`;
271
- const data = await getDocumentFile(this.documentid, this.document.envelope_document_id);
136
+ const data = await VerdocsEndpoint.getDocumentFile(this.endpoint, this.documentid, this.document.envelope_document_id);
272
137
  // This is better in React than doing window.href= or similar to trigger a download. For a description of the technique
273
138
  // see https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image
274
139
  let xhr = new XMLHttpRequest();
@@ -310,23 +175,23 @@ const VerdocsSign = class {
310
175
  console.log('fieldChange', field, e.detail);
311
176
  switch (field.type) {
312
177
  case 'textbox':
313
- updateDocumentField(this.documentid, field.name, { prepared: false, value: e.detail })
178
+ VerdocsEndpoint.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: e.detail })
314
179
  .then(r => console.log('Update result', r))
315
180
  .catch(e => console.log('Error updating', e));
316
181
  break;
317
182
  case 'checkbox_group':
318
- updateDocumentField(this.documentid, field.name, { prepared: false, value: { options: [{ id: optionId, checked: e.detail }] } })
183
+ VerdocsEndpoint.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: { options: [{ id: optionId, checked: e.detail }] } })
319
184
  .then(r => console.log('Update result', r))
320
185
  .catch(e => console.log('Error updating', e));
321
186
  break;
322
187
  case 'radio_button_group':
323
188
  const options = field.settings.options.map(option => ({ id: option.id, selected: optionId === option.id }));
324
- updateDocumentField(this.documentid, field.name, { prepared: false, value: { options } })
189
+ VerdocsEndpoint.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: { options } })
325
190
  .then(r => console.log('Update result', r))
326
191
  .catch(e => console.log('Error updating', e));
327
192
  break;
328
193
  case 'dropdown':
329
- updateDocumentField(this.documentid, field.name, { prepared: false, value: e.detail })
194
+ VerdocsEndpoint.updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: e.detail })
330
195
  .then(r => console.log('Update result', r))
331
196
  .catch(e => console.log('Error updating', e));
332
197
  break;
@@ -480,7 +345,7 @@ const VerdocsSign = class {
480
345
  { id: 'print', label: 'Print Without Signing' },
481
346
  { id: 'download', label: 'Download' },
482
347
  ];
483
- return (index.h(index.Host, { class: { storybook: !!(window === null || window === void 0 ? void 0 : window['STORYBOOK_ENV']), agreed: (_a = this.recipient) === null || _a === void 0 ? void 0 : _a.agreed } }, index.h("div", { class: "header" }, index.h("div", { class: "intro" }, "Please review and act on these documents."), index.h("div", { class: "toolbar" }, index.h("div", { class: "tools" }, index.h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }), !((_b = this.recipient) === null || _b === void 0 ? void 0 : _b.agreed) ? (index.h("div", { style: { flex: '1', flexDirection: 'row', display: 'flex', alignItems: 'center' } }, index.h("div", { class: "agree-checkbox" }, index.h("input", { type: "checkbox", value: "None", id: "agree-checkbox-element", name: "agree", onChange: () => this.handleClickAgree() }), index.h("label", { htmlFor: "agree-checkbox-element" })), "I agree to use electronic records and signatures.")) : (index.h("div", { style: { flex: '1' } })), index.h("verdocs-button", { label: this.nextButtonLabel, disabled: !((_c = this.recipient) === null || _c === void 0 ? void 0 : _c.agreed), onClick: () => this.handleNext() })))), !((_d = this.recipient) === null || _d === void 0 ? void 0 : _d.agreed) ? index.h("div", { class: "cover" }) : index.h("div", { style: { display: 'none' } }), index.h("div", { class: "document" }, this.pdfUrl ? index.h("verdocs-view", { source: this.pdfUrl, token: this.signerToken, onDocumentRendered: e => this.handleDocumentRendered(e) }) : index.h("verdocs-loader", null), (((_e = this.pdfPageInfo) === null || _e === void 0 ? void 0 : _e.pages) || []).map(page => {
348
+ return (index.h(index.Host, { class: { storybook: !!(window === null || window === void 0 ? void 0 : window['STORYBOOK_ENV']), agreed: (_a = this.recipient) === null || _a === void 0 ? void 0 : _a.agreed } }, index.h("div", { class: "header" }, index.h("div", { class: "intro" }, "Please review and act on these documents."), index.h("div", { class: "toolbar" }, index.h("div", { class: "tools" }, index.h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }), !((_b = this.recipient) === null || _b === void 0 ? void 0 : _b.agreed) ? (index.h("div", { class: "agree" }, index.h("div", { class: "agree-checkbox" }, index.h("input", { type: "checkbox", value: "None", id: "agree-checkbox-element", name: "agree", onChange: () => this.handleClickAgree() }), index.h("label", { htmlFor: "agree-checkbox-element" })), index.h("span", null, "I agree to use electronic records and signatures."))) : (index.h("div", { style: { flex: '1' } })), index.h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !((_c = this.recipient) === null || _c === void 0 ? void 0 : _c.agreed), onClick: () => this.handleNext() })))), !((_d = this.recipient) === null || _d === void 0 ? void 0 : _d.agreed) ? index.h("div", { class: "cover" }) : index.h("div", { style: { display: 'none' } }), index.h("div", { class: "document" }, this.pdfUrl ? index.h("verdocs-view", { source: this.pdfUrl, token: this.signerToken, onDocumentRendered: e => this.handleDocumentRendered(e) }) : index.h("verdocs-loader", null), (((_e = this.pdfPageInfo) === null || _e === void 0 ? void 0 : _e.pages) || []).map(page => {
484
349
  var _a;
485
350
  return (index.h("div", { class: "page-controls", style: { height: `${page.height}px`, width: `${page.width}px`, top: `${page.canvasTop}px`, margin: '0 auto' } }, ((_a = this.pdfPageInfo) === null || _a === void 0 ? void 0 : _a.numRendered) > 0 ? (this.fields.filter(field => field.page === page.pageNumber).map((field, index) => this.renderField(field, index))) : (index.h("div", { style: { display: 'none' } }, "Waiting for PDF to render..."))));
486
351
  }))));
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["verdocs-sign.cjs",[[0,"verdocs-sign",{"documentid":[1],"roleid":[1],"invitecode":[1],"endpoint":[32],"recipient":[32],"signerToken":[32],"pdfUrl":[32],"recipientIndex":[32],"document":[32],"fields":[32],"pdfPageInfo":[32],"hasSignature":[32],"nextButtonLabel":[32],"focusedField":[32]}]]],["verdocs-auth.cjs",[[0,"verdocs-auth",{"visible":[4],"logo":[1],"debug":[4],"isAuthenticated":[32],"displayMode":[32],"username":[32],"password":[32],"loggingIn":[32],"activeSession":[32],"loginError":[32]}]]],["verdocs-search.cjs",[[0,"verdocs-search"]]],["verdocs-kba-dialog.cjs",[[0,"verdocs-kba-dialog",{"step":[2],"steps":[2],"helptitle":[1],"helptext":[1],"mode":[1],"label":[1],"placeholder":[1],"choices":[16],"open":[4],"response":[32]}]]],["verdocs-organization-card.cjs",[[0,"verdocs-organization-card",{"organization":[16]}]]],["verdocs-quick-functions.cjs",[[0,"verdocs-quick-functions"]]],["verdocs-search-tabs.cjs",[[0,"verdocs-search-tabs",{"selected":[32]}]]],["verdocs-status-indicator.cjs",[[0,"verdocs-status-indicator",{"size":[1],"theme":[1],"status":[1],"document":[16],"isOpen":[32],"recipientStatusIcons":[32]}]]],["verdocs-template-card.cjs",[[0,"verdocs-template-card",{"template":[16]}]]],["verdocs-template-tags.cjs",[[0,"verdocs-template-tags",{"tags":[16]}]]],["verdocs-toggle.cjs",[[0,"verdocs-toggle",{"options":[16],"theme":[1]},[[6,"click","handleClick"]]]]],["verdocs-button_2.cjs",[[0,"verdocs-text-input",{"value":[1],"label":[1],"placeholder":[1],"autocomplete":[1],"type":[1],"disabled":[4],"_value":[32]}],[0,"verdocs-button",{"label":[1],"startIcon":[1,"start-icon"],"endIcon":[1,"end-icon"],"size":[1],"type":[1],"variant":[1],"disabled":[4]}]]],["verdocs-ok-dialog.cjs",[[0,"verdocs-ok-dialog",{"heading":[1],"message":[1],"open":[4],"cancel":[4]}]]],["verdocs-initial-dialog.cjs",[[0,"verdocs-initial-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredInitials":[32],"mode":[32]}]]],["verdocs-signature-dialog.cjs",[[0,"verdocs-signature-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredName":[32],"mode":[32]}]]],["verdocs-upload-dialog.cjs",[[0,"verdocs-upload-dialog",{"open":[4],"draggingOver":[32],"decodedFiles":[32]}]]],["verdocs-search-activity_2.cjs",[[0,"verdocs-search-activity",{"type":[1],"options":[8],"emptyMessage":[32],"authFailure":[32],"title":[32],"recent":[32],"saved":[32],"starred":[32]}],[0,"verdocs-search-box",{"placeholder":[1],"type":[1],"query":[1]}]]],["verdocs-loader.cjs",[[0,"verdocs-loader"]]],["verdocs-dropdown_12.cjs",[[0,"verdocs-field-initial",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-signature",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-attachment",{"order":[2],"value":[1],"required":[4],"disabled":[4],"focusField":[64]}],[0,"verdocs-view",{"rotation":[2],"source":[1],"token":[1],"loadProgress":[32]}],[0,"verdocs-dropdown",{"options":[16],"open":[4],"isOpen":[32]}],[0,"verdocs-field-checkbox",{"order":[2],"value":[4],"required":[4],"disabled":[4]}],[0,"verdocs-field-date",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-dropdown",{"options":[16],"required":[4],"order":[2],"disabled":[4],"value":[1],"focused":[32],"focusField":[64]}],[0,"verdocs-field-payment",{"field":[16],"fields":[16],"pageNum":[2,"page-num"],"roleName":[1,"role-name"],"fieldId":[1,"field-id"],"recipients":[8],"selectedRoleName":[1,"selected-role-name"],"pdfPages":[16],"currentSignature":[1,"current-signature"],"currentSignatureId":[1,"current-signature-id"],"currentInitial":[1,"current-initial"],"currentInitialId":[1,"current-initial-id"],"focused":[4],"signed":[4],"preparedMessage":[32],"signatureUrl":[32]}],[0,"verdocs-field-radio-button",{"order":[2],"checked":[4],"value":[1],"name":[1],"required":[4],"disabled":[4]}],[0,"verdocs-field-textarea",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-textbox",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}]]]], options);
18
+ return index.bootstrapLazy([["verdocs-sign.cjs",[[0,"verdocs-sign",{"endpoint":[16],"documentid":[1],"roleid":[1],"invitecode":[1],"recipient":[32],"signerToken":[32],"pdfUrl":[32],"recipientIndex":[32],"document":[32],"fields":[32],"pdfPageInfo":[32],"hasSignature":[32],"nextButtonLabel":[32],"focusedField":[32]}]]],["verdocs-auth.cjs",[[0,"verdocs-auth",{"endpoint":[16],"visible":[4],"logo":[1],"debug":[4],"isAuthenticated":[32],"displayMode":[32],"username":[32],"password":[32],"loggingIn":[32],"activeSession":[32],"loginError":[32]}]]],["verdocs-search.cjs",[[0,"verdocs-search",{"endpoint":[16]}]]],["verdocs-kba-dialog.cjs",[[0,"verdocs-kba-dialog",{"step":[2],"steps":[2],"helptitle":[1],"helptext":[1],"mode":[1],"label":[1],"placeholder":[1],"choices":[16],"open":[4],"response":[32]}]]],["verdocs-organization-card.cjs",[[0,"verdocs-organization-card",{"organization":[16]}]]],["verdocs-quick-functions.cjs",[[0,"verdocs-quick-functions",{"endpoint":[16]}]]],["verdocs-search-tabs.cjs",[[0,"verdocs-search-tabs",{"selected":[32]}]]],["verdocs-status-indicator.cjs",[[0,"verdocs-status-indicator",{"size":[1],"theme":[1],"status":[1],"document":[16],"isOpen":[32],"recipientStatusIcons":[32]}]]],["verdocs-template-card.cjs",[[0,"verdocs-template-card",{"template":[16]}]]],["verdocs-template-tags.cjs",[[0,"verdocs-template-tags",{"tags":[16]}]]],["verdocs-toggle.cjs",[[0,"verdocs-toggle",{"options":[16],"theme":[1]},[[6,"click","handleClick"]]]]],["verdocs-button_2.cjs",[[0,"verdocs-text-input",{"value":[1],"label":[1],"placeholder":[1],"autocomplete":[1],"type":[1],"disabled":[4],"_value":[32]}],[0,"verdocs-button",{"label":[1],"startIcon":[1,"start-icon"],"endIcon":[1,"end-icon"],"size":[1],"type":[1],"variant":[1],"disabled":[4]}]]],["verdocs-ok-dialog.cjs",[[0,"verdocs-ok-dialog",{"heading":[1],"message":[1],"open":[4],"cancel":[4]}]]],["verdocs-initial-dialog.cjs",[[0,"verdocs-initial-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredInitials":[32],"mode":[32]}]]],["verdocs-signature-dialog.cjs",[[0,"verdocs-signature-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredName":[32],"mode":[32]}]]],["verdocs-upload-dialog.cjs",[[0,"verdocs-upload-dialog",{"open":[4],"draggingOver":[32],"decodedFiles":[32]}]]],["verdocs-search-activity_2.cjs",[[0,"verdocs-search-activity",{"endpoint":[16],"type":[1],"options":[8],"emptyMessage":[32],"authFailure":[32],"title":[32],"recent":[32],"saved":[32],"starred":[32]}],[0,"verdocs-search-box",{"endpoint":[16],"placeholder":[1],"type":[1],"query":[1]}]]],["verdocs-loader.cjs",[[0,"verdocs-loader"]]],["verdocs-dropdown_12.cjs",[[0,"verdocs-field-initial",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-signature",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-attachment",{"order":[2],"value":[1],"required":[4],"disabled":[4],"focusField":[64]}],[0,"verdocs-view",{"endpoint":[16],"rotation":[2],"source":[1],"token":[1],"loadProgress":[32]}],[0,"verdocs-dropdown",{"options":[16],"open":[4],"isOpen":[32]}],[0,"verdocs-field-checkbox",{"order":[2],"value":[4],"required":[4],"disabled":[4]}],[0,"verdocs-field-date",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-dropdown",{"options":[16],"required":[4],"order":[2],"disabled":[4],"value":[1],"focused":[32],"focusField":[64]}],[0,"verdocs-field-payment",{"field":[16],"fields":[16],"pageNum":[2,"page-num"],"roleName":[1,"role-name"],"fieldId":[1,"field-id"],"recipients":[8],"selectedRoleName":[1,"selected-role-name"],"pdfPages":[16],"currentSignature":[1,"current-signature"],"currentSignatureId":[1,"current-signature-id"],"currentInitial":[1,"current-initial"],"currentInitialId":[1,"current-initial-id"],"focused":[4],"signed":[4],"preparedMessage":[32],"signatureUrl":[32]}],[0,"verdocs-field-radio-button",{"order":[2],"checked":[4],"value":[1],"name":[1],"required":[4],"disabled":[4]}],[0,"verdocs-field-textarea",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-textbox",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}]]]], options);
19
19
  });
@@ -70,7 +70,7 @@ verdocs-kba-dialog .choices {
70
70
  margin: 0 0 15px 0;
71
71
  }
72
72
  verdocs-kba-dialog .choice {
73
- border: #707ae5;
73
+ border: 1px solid #707ae5;
74
74
  border-radius: 5px;
75
75
  display: flex;
76
76
  height: 60px;
@@ -31,7 +31,7 @@ verdocs-ok-dialog .heading {
31
31
  color: #ffffff;
32
32
  }
33
33
  verdocs-ok-dialog .content {
34
- font-size: 14px;
34
+ font-size: 16px;
35
35
  background: #ffffff;
36
36
  padding: 20px;
37
37
  }
@@ -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,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,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,7 +1,5 @@
1
1
  verdocs-auth {
2
2
  font-family: "Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
3
- background-color: #4c56cb;
4
- padding: 40px;
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,9 +1,6 @@
1
1
  import { Auth } from '@verdocs/js-sdk/Users';
2
- import { Transport, VerdocsEndpoint } from '@verdocs/js-sdk/HTTP';
3
- import { endSession, 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
@@ -34,6 +31,10 @@ const SOURCE = 'verdocs-stage';
34
31
  */
35
32
  export class VerdocsAuth {
36
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();
37
38
  /**
38
39
  * Normally, if the user has a valid session, this embed will be invisible, otherwise it will display
39
40
  * login / signup forms. If this is set to false, this embed will be invisible in both cases. Apps may
@@ -60,16 +61,12 @@ export class VerdocsAuth {
60
61
  this.activeSession = null;
61
62
  this.loginError = null;
62
63
  }
63
- componentWillLoad() {
64
- const staging = new VerdocsEndpoint().setBaseURL(BASE_URL);
65
- Transport.setActiveEndpoint(staging);
66
- }
67
64
  componentDidLoad() {
68
- const session = loadSession(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,13 +78,13 @@ 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
- const session = setSession(SOURCE, r.accessToken, true);
88
- this.activeSession = session;
84
+ this.endpoint.setToken(r.accessToken);
85
+ this.activeSession = this.endpoint.session;
89
86
  this.isAuthenticated = true;
90
- this.authenticated.emit({ authenticated: true, session });
87
+ this.authenticated.emit({ authenticated: true, session: this.endpoint.session });
91
88
  })
92
89
  .catch(e => {
93
90
  var _a;
@@ -101,7 +98,7 @@ export class VerdocsAuth {
101
98
  });
102
99
  }
103
100
  handleLogout() {
104
- endSession(SOURCE);
101
+ this.endpoint.clearSession();
105
102
  this.isAuthenticated = false;
106
103
  this.authenticated.emit({ authenticated: false, session: null });
107
104
  }
@@ -152,6 +149,27 @@ export class VerdocsAuth {
152
149
  "$": ["verdocs-auth.css"]
153
150
  }; }
154
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
+ },
155
173
  "visible": {
156
174
  "type": "boolean",
157
175
  "mutable": false,