@verdocs/web-sdk 6.5.0-beta.23 → 6.5.0-beta.24

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.
@@ -942,18 +942,33 @@ const VerdocsSign$1 = /*@__PURE__*/ proxyCustomElement(class VerdocsSign extends
942
942
  filledFields: recipientFields.filter(f => isFilled(f)).map(f => ({ name: f.name, type: f.type, val: f.value })),
943
943
  });
944
944
  let mode = 'start';
945
- // We only consider the user to have started "signing" if they have filled out at least one *fillable* field.
946
- // Readonly fields do not count.
947
- const anyFieldFilled = requiredRemaining < requiredFields.length || optionalRemaining < optionalFields.length;
945
+ // We need a way to know if the user has started signing. But after trying two
946
+ // obvious ways (has the user adopted a signature? are any fields filled in yet?)
947
+ // they both had flaws (we could be carrying over a sig from a previous session,
948
+ // and things like defaults and auto-filled fields make the filled-field approach
949
+ // tricky to maintain).
950
+ // This is sort of a Hail Mary but it works well for now. We just keep a variable
951
+ // in localStorage that tracks the last 10 envelopes the user has "started".
952
+ // We never get a chance to clean them up but 10 GUIDs is tiny compared to what
953
+ // many apps store in a user's browser.
954
+ const startedEnvelopes = JSON.parse(localStorage.getItem('startedEnvelopes') || '[]');
955
+ const hasStarted = startedEnvelopes.includes(this.envelopeId);
948
956
  if (this.nextSubmits) {
949
957
  mode = 'completed';
950
958
  }
951
- else if (anyFieldFilled) {
959
+ else if (hasStarted) {
952
960
  mode = 'signing';
953
961
  }
954
962
  return (h("verdocs-signing-progress", { mode: mode, current: Math.max(1, currentIndex), total: totalFields, remainingFields: remainingFields, progress: progress, fieldLabel: getFieldLabel(focusedFieldObj), fieldCompleted: focusedFieldObj ? !!isFilled(focusedFieldObj) : false, onStarted: () => {
955
963
  this.adoptingSignature = true;
956
- // this.handleNext();
964
+ const startedEnvelopes = JSON.parse(localStorage.getItem('startedEnvelopes') || '[]');
965
+ if (!startedEnvelopes.includes(this.envelopeId)) {
966
+ startedEnvelopes.push(this.envelopeId);
967
+ while (startedEnvelopes.length > 10) {
968
+ startedEnvelopes.shift();
969
+ }
970
+ localStorage.setItem('startedEnvelopes', JSON.stringify(startedEnvelopes));
971
+ }
957
972
  }, onNext: () => this.handleNext(), onPrevious: () => this.handlePrev(), onExit: () => this.handleNext() }));
958
973
  })(), h("div", { class: `document signed-document-container zoom-${this.zoomLevel}` }, (this.envelope.documents || []).map(envelopeDocument => {
959
974
  const pageNumbers = integerSequence(1, envelopeDocument.pages);