@verdocs/web-sdk 2.3.86 → 2.3.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{utils-13f8ed3f.js → utils-e2bd04bf.js} +2 -4
- package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-attachment_15.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_8.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +56 -34
- package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-view.cjs.entry.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +55 -33
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +3 -3
- package/dist/collection/utils/utils.js +2 -4
- package/dist/components/utils.js +2 -4
- package/dist/components/verdocs-sign.js +55 -33
- package/dist/custom-elements.json +2147 -0
- package/dist/docs.json +1 -1
- package/dist/esm/{utils-a56ee5e9.js → utils-f35325fe.js} +2 -4
- package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm/verdocs-field-attachment_15.entry.js +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_8.entry.js +1 -1
- package/dist/esm/verdocs-settings-api-keys_4.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +56 -34
- package/dist/esm/verdocs-template-fields_4.entry.js +1 -1
- package/dist/esm/verdocs-view.entry.js +1 -1
- package/dist/esm-es5/{utils-a56ee5e9.js → utils-f35325fe.js} +1 -1
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_15.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_8.entry.js +1 -1
- package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-fields_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-view.entry.js +1 -1
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +1 -1
- package/dist/verdocs-web-sdk/{p-e63fe8b9.system.entry.js → p-078e5b77.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0ef04e14.system.entry.js → p-1a2d3a78.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-dd9dba09.entry.js → p-1acb7da0.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-2ad3ba4f.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-bb983c03.entry.js → p-2b874610.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-be7390d8.system.entry.js → p-33c284a7.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-964f83ef.entry.js → p-43bdeda7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5c67e9f6.system.entry.js → p-473926f1.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7f487279.entry.js → p-55e47f7d.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-69422d8f.system.entry.js → p-621549c9.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b72328af.js → p-632bdc29.js} +1 -1
- package/dist/verdocs-web-sdk/{p-3dc2013b.system.entry.js → p-64974b4f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-1fa5ef9a.entry.js → p-683e778c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-1823e8cd.entry.js → p-81acd17f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e1b527eb.entry.js → p-851737fb.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bb2b0122.entry.js → p-8a5ef117.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-21294863.system.entry.js → p-907de1bb.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-98c9b7d7.entry.js → p-9d8e63ea.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b55a122e.system.entry.js → p-a5499e42.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cf6a9502.entry.js → p-c0e43c7f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8de34628.system.entry.js → p-d0a110f1.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0cafdb16.system.js → p-e041e991.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-04bef805.system.entry.js → p-ee408daa.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-f04bf956.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-012d2533.system.entry.js → p-f461f285.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/verdocs-web-sdk/p-a5f94a3f.entry.js +0 -1
@@ -300,9 +300,8 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
300
300
|
break;
|
301
301
|
}
|
302
302
|
}
|
303
|
-
|
303
|
+
isFieldFilled(field) {
|
304
304
|
var _a, _b, _c, _d, _e, _f, _g;
|
305
|
-
const { required = false } = field;
|
306
305
|
const { result = '', value = '', base64 = '' } = field.settings || {};
|
307
306
|
switch (field.type) {
|
308
307
|
case 'textbox':
|
@@ -312,25 +311,25 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
312
311
|
case 'phone':
|
313
312
|
return isValidPhone(result);
|
314
313
|
default:
|
315
|
-
return
|
314
|
+
return result !== '';
|
316
315
|
}
|
317
316
|
case 'signature':
|
318
317
|
case 'initial':
|
319
|
-
return
|
318
|
+
return base64 !== '';
|
320
319
|
// Timestamp fields get automatically filled when the envelope is submitted.
|
321
320
|
case 'timestamp':
|
322
321
|
return true;
|
323
322
|
case 'textarea':
|
324
323
|
case 'date':
|
325
324
|
case 'attachment':
|
326
|
-
return
|
325
|
+
return result !== '';
|
327
326
|
case 'dropdown':
|
328
|
-
return
|
327
|
+
return value !== '';
|
329
328
|
case 'checkbox_group':
|
330
329
|
const checkedCount = (((_c = (_b = field.settings) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.filter(option => option.checked)) || []).length;
|
331
|
-
return
|
330
|
+
return checkedCount >= (((_d = field.settings) === null || _d === void 0 ? void 0 : _d.minimum_checked) || 0) && checkedCount <= (((_e = field.settings) === null || _e === void 0 ? void 0 : _e.maximum_checked) || 999);
|
332
331
|
case 'radio_button_group':
|
333
|
-
return
|
332
|
+
return (((_g = (_f = field.settings) === null || _f === void 0 ? void 0 : _f.options) === null || _g === void 0 ? void 0 : _g.filter(option => option.selected)) || []).length > 0;
|
334
333
|
// TODO
|
335
334
|
// case 'checkbox':
|
336
335
|
// return <verdocs-field-checkbox style={style} value={result || ''} id={id} />;
|
@@ -340,6 +339,28 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
340
339
|
return false;
|
341
340
|
}
|
342
341
|
}
|
342
|
+
isFieldValid(field) {
|
343
|
+
const { required = false } = field;
|
344
|
+
return !required || this.isFieldFilled(field);
|
345
|
+
}
|
346
|
+
getSortedFillableFields() {
|
347
|
+
const recipientFields = this.getRecipientFields().filter(field => field.type !== 'timestamp');
|
348
|
+
recipientFields.sort((a, b) => {
|
349
|
+
var _a, _b, _c, _d;
|
350
|
+
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
351
|
+
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
352
|
+
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
353
|
+
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
354
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
355
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
356
|
+
// the division is because no human makes perfect templates and frequently
|
357
|
+
// two fields on the "same line" will be slightly offset vertically.
|
358
|
+
const divaY = Math.floor(aY / 5);
|
359
|
+
const divbY = Math.floor(bY / 5);
|
360
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
361
|
+
});
|
362
|
+
return recipientFields;
|
363
|
+
}
|
343
364
|
async handleNext() {
|
344
365
|
var _a, _b;
|
345
366
|
if (this.nextSubmits) {
|
@@ -365,35 +386,39 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
365
386
|
this.submitting = false;
|
366
387
|
return;
|
367
388
|
}
|
368
|
-
// Find and focus the next incomplete
|
369
|
-
const
|
370
|
-
|
371
|
-
.filter(field => field.type !== 'timestamp');
|
372
|
-
requiredFields.sort((a, b) => {
|
389
|
+
// Find and focus the next incomplete` field (that is fillable)
|
390
|
+
const emptyFields = this.getSortedFillableFields().filter(field => !this.isFieldFilled(field));
|
391
|
+
emptyFields.sort((a, b) => {
|
373
392
|
var _a, _b, _c, _d;
|
374
393
|
const aX = ((_a = a.settings) === null || _a === void 0 ? void 0 : _a.x) || 0;
|
375
394
|
const aY = ((_b = a.settings) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
376
395
|
const bX = ((_c = b.settings) === null || _c === void 0 ? void 0 : _c.x) || 0;
|
377
396
|
const bY = ((_d = b.settings) === null || _d === void 0 ? void 0 : _d.y) || 0;
|
378
|
-
|
397
|
+
// NOTE: Logic looks a little strange X vs Y. It's because we go top down,
|
398
|
+
// left to right. But Y coordinates are inverted in PDFs. The reason for
|
399
|
+
// the division is because no human makes perfect templates and frequently
|
400
|
+
// two fields on the "same line" will be slightly offset vertically.
|
401
|
+
const divaY = Math.floor(aY / 5);
|
402
|
+
const divbY = Math.floor(bY / 5);
|
403
|
+
return divbY !== divaY ? divbY - divaY : aX - bX;
|
379
404
|
});
|
380
|
-
const focusedIndex =
|
405
|
+
const focusedIndex = emptyFields.findIndex(field => field.name === this.focusedField);
|
381
406
|
let nextFocusedIndex = focusedIndex + 1;
|
382
|
-
if (nextFocusedIndex >=
|
407
|
+
if (nextFocusedIndex >= emptyFields.length) {
|
383
408
|
nextFocusedIndex = 0;
|
384
409
|
}
|
385
|
-
let nextRequiredField =
|
410
|
+
let nextRequiredField = emptyFields[nextFocusedIndex];
|
386
411
|
// Skip signature and initial fields that are already filled in. We have to count our "skips" just in case, to avoid infinite loops.
|
387
412
|
let skips = 0;
|
388
|
-
if (skips <
|
413
|
+
if (skips < emptyFields.length && ['signature', 'initial'].includes(nextRequiredField.type) && ((_b = nextRequiredField.settings) === null || _b === void 0 ? void 0 : _b.result) === 'signed') {
|
389
414
|
skips++;
|
390
415
|
nextFocusedIndex++;
|
391
|
-
if (nextFocusedIndex >=
|
416
|
+
if (nextFocusedIndex >= emptyFields.length) {
|
392
417
|
nextFocusedIndex = 0;
|
393
418
|
}
|
394
|
-
nextRequiredField =
|
419
|
+
nextRequiredField = emptyFields[nextFocusedIndex];
|
395
420
|
}
|
396
|
-
if (skips >=
|
421
|
+
if (skips >= emptyFields.length) {
|
397
422
|
nextRequiredField = null;
|
398
423
|
}
|
399
424
|
if (nextRequiredField) {
|
@@ -457,22 +482,19 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
457
482
|
}
|
458
483
|
handlePageRendered(e) {
|
459
484
|
const pageInfo = e.detail;
|
460
|
-
//
|
461
|
-
//
|
462
|
-
|
463
|
-
//
|
464
|
-
// this.envelope.fields.filter(field => field.recipient_role === this.recipient.role_name),
|
465
|
-
// );
|
466
|
-
const recipientFields = this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
467
|
-
// console.log('[SIGN] Page rendered, updating fields', {pageInfo, roleIndex, recipientFields});
|
485
|
+
// NOTE: We don't filter on pageNumber here because we need the position in the
|
486
|
+
// entire list to set the tabIndex.
|
487
|
+
const recipientFields = this.getSortedFillableFields();
|
488
|
+
// this.getRecipientFields().filter(field => field.page === pageInfo.pageNumber);
|
468
489
|
// First render the fields for the signer
|
469
490
|
// Also show field placeholders for other signers who have yet to act
|
470
491
|
// In template list in Beta, show second date being sorted on
|
471
492
|
// Sign top to bottom left to right
|
472
|
-
recipientFields
|
473
|
-
|
474
|
-
|
475
|
-
|
493
|
+
recipientFields.forEach((field, tabIndex) => {
|
494
|
+
if (field.page !== pageInfo.pageNumber) {
|
495
|
+
return;
|
496
|
+
}
|
497
|
+
const el = renderDocumentField(field, pageInfo, { disabled: false, editable: false, draggable: false, done: this.isDone }, tabIndex);
|
476
498
|
if (!el) {
|
477
499
|
return;
|
478
500
|
}
|