@signsealer/sdk 1.10.0 → 1.13.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.
- package/CHANGELOG.md +150 -1
- package/README.md +105 -8
- package/dist/cjs/index.cjs +136 -31
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.d.ts +403 -40
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +136 -31
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -8
package/dist/esm/index.d.ts
CHANGED
|
@@ -123,14 +123,77 @@ export interface Account {
|
|
|
123
123
|
* Whether this business can text people (00458). Offer a "text me" box only
|
|
124
124
|
* when `available` is true, put `wording` beside it, and record exactly
|
|
125
125
|
* that wording with `recordSmsConsent` when it is ticked. `why_not` is
|
|
126
|
-
* `plan` (no texting on its plan)
|
|
126
|
+
* `plan` (no texting on its plan), `number` (waiting for its own verified
|
|
127
|
+
* texting number), `beta` (the beta does not text) or `test` (a sandbox)
|
|
128
|
+
* when it cannot.
|
|
127
129
|
*/
|
|
128
130
|
texting?: {
|
|
129
131
|
available: boolean;
|
|
130
|
-
why_not: "test" | "plan" | null;
|
|
132
|
+
why_not: "test" | "plan" | "number" | "beta" | null;
|
|
131
133
|
wording: string;
|
|
134
|
+
/** The business's own verified texting number (1.13.0), once it has one. */
|
|
135
|
+
number?: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* Where its application for one has got to (1.13.0); null when it has not
|
|
138
|
+
* applied. Each step is also sent as `texting.number_updated`.
|
|
139
|
+
*/
|
|
140
|
+
application?: TextingApplication | null;
|
|
132
141
|
};
|
|
133
142
|
}
|
|
143
|
+
/** Where a business's texting-number application has got to (1.13.0), as the account and `texting.number_updated` say. */
|
|
144
|
+
export interface TextingApplication {
|
|
145
|
+
/** `applied`, `submitted`, `in_review`, `needs_changes`, `verified`, `paused`, `failed`, and the steps of bringing a number. */
|
|
146
|
+
status: string;
|
|
147
|
+
kind: TextingNumberKind;
|
|
148
|
+
/** The number, once it is the business's: verified or paused. */
|
|
149
|
+
phone: string | null;
|
|
150
|
+
area_code: string | null;
|
|
151
|
+
/** What the carriers asked to change, or why it is held up; null otherwise. */
|
|
152
|
+
reason: string | null;
|
|
153
|
+
/** True for a number the business already had and is bringing. */
|
|
154
|
+
brought: boolean;
|
|
155
|
+
since: string;
|
|
156
|
+
}
|
|
157
|
+
export type TextingNumberKind = "toll_free" | "local" | "sole_proprietor";
|
|
158
|
+
/**
|
|
159
|
+
* What you already know about a business's texting-number application
|
|
160
|
+
* (1.13.0), in the application's own names. All optional; the owner reads
|
|
161
|
+
* each one before applying.
|
|
162
|
+
*/
|
|
163
|
+
export interface TextingNumberPrefill {
|
|
164
|
+
kind?: TextingNumberKind;
|
|
165
|
+
legal_name?: string;
|
|
166
|
+
entity_type?: string;
|
|
167
|
+
ein?: string;
|
|
168
|
+
website?: string;
|
|
169
|
+
address_line1?: string;
|
|
170
|
+
address_line2?: string;
|
|
171
|
+
city?: string;
|
|
172
|
+
state?: string;
|
|
173
|
+
postal_code?: string;
|
|
174
|
+
contact_first_name?: string;
|
|
175
|
+
contact_last_name?: string;
|
|
176
|
+
contact_email?: string;
|
|
177
|
+
contact_phone?: string;
|
|
178
|
+
volume?: string;
|
|
179
|
+
vertical?: string;
|
|
180
|
+
area_code?: string;
|
|
181
|
+
mobile?: string;
|
|
182
|
+
privacy_url?: string;
|
|
183
|
+
terms_url?: string;
|
|
184
|
+
opt_in_url?: string;
|
|
185
|
+
}
|
|
186
|
+
/** A link for the business's owner to apply for its texting number (1.13.0). */
|
|
187
|
+
export interface TextingNumberInvitation {
|
|
188
|
+
/** Show it to the business's owner. It opens after they sign in, on this business. */
|
|
189
|
+
url: string;
|
|
190
|
+
/** How the page names you: your app's name, or the key's label. */
|
|
191
|
+
from: string;
|
|
192
|
+
kind: TextingNumberKind | null;
|
|
193
|
+
/** The names you filled in. */
|
|
194
|
+
fields: string[];
|
|
195
|
+
expires_at: string;
|
|
196
|
+
}
|
|
134
197
|
/** What `recordSmsConsent` wrote, with the number as we normalised it. */
|
|
135
198
|
export interface SmsConsentRecorded {
|
|
136
199
|
/** E.164. One number written three ways is one record, and this is it. */
|
|
@@ -267,8 +330,9 @@ export interface Ask {
|
|
|
267
330
|
options?: string[];
|
|
268
331
|
hint?: string;
|
|
269
332
|
/**
|
|
270
|
-
* Ask it only when
|
|
271
|
-
*
|
|
333
|
+
* Ask it only when earlier questions were answered a certain way (00375):
|
|
334
|
+
* one rule, or several joined by all or any (00539). Only questions
|
|
335
|
+
* *above* it: a form is read top to bottom. A hidden
|
|
272
336
|
* question is not required, and changing the answer it depends on clears
|
|
273
337
|
* it, so the certificate never carries an answer to a question nobody saw.
|
|
274
338
|
*/
|
|
@@ -304,10 +368,49 @@ export type AnswerRule = {
|
|
|
304
368
|
} | {
|
|
305
369
|
answered: boolean;
|
|
306
370
|
};
|
|
307
|
-
/**
|
|
308
|
-
|
|
371
|
+
/**
|
|
372
|
+
* What a condition may also say about an earlier answer (00539), exactly one
|
|
373
|
+
* per rule: `not_equals` (answered, and none of these), `contains` (words in
|
|
374
|
+
* it), `not_contains` (answered, and without those words; 00545), `gt` / `lt`
|
|
375
|
+
* (a number above / below) for a `number`, and `age_under` / `age_at_least`
|
|
376
|
+
* (whole years today) for a `birthdate`, `date` or `datetime`.
|
|
377
|
+
*/
|
|
378
|
+
export type ConditionRule = AnswerRule | {
|
|
379
|
+
not_equals: string[];
|
|
380
|
+
} | {
|
|
381
|
+
contains: string;
|
|
382
|
+
} | {
|
|
383
|
+
not_contains: string;
|
|
384
|
+
} | {
|
|
385
|
+
gt: number;
|
|
386
|
+
} | {
|
|
387
|
+
lt: number;
|
|
388
|
+
} | {
|
|
389
|
+
age_under: number;
|
|
390
|
+
} | {
|
|
391
|
+
age_at_least: number;
|
|
392
|
+
};
|
|
393
|
+
/** One rule about an earlier question's answer, naming which question. */
|
|
394
|
+
export type ShowIfRule = ConditionRule & {
|
|
309
395
|
field: string;
|
|
310
396
|
};
|
|
397
|
+
/** 00545: two or more rules joined by their own `"all"` or `"any"`, standing as one part of a condition. */
|
|
398
|
+
export interface ShowIfGroup {
|
|
399
|
+
match?: "all" | "any";
|
|
400
|
+
rules: ShowIfRule[];
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* When a question is asked: one rule, or several joined by `"all"` (every
|
|
404
|
+
* one met) or `"any"` (one is enough) (00539), any of them a group of its
|
|
405
|
+
* own -- `(A and B) or C` -- with at most ten rules in all (00545). With
|
|
406
|
+
* `action: "hide"` it is the other way round: hidden when the condition
|
|
407
|
+
* holds. A rule about a question that was itself not asked is not met.
|
|
408
|
+
*/
|
|
409
|
+
export type ShowIf = ShowIfRule | {
|
|
410
|
+
action?: "show" | "hide";
|
|
411
|
+
match?: "all" | "any";
|
|
412
|
+
rules: Array<ShowIfRule | ShowIfGroup>;
|
|
413
|
+
};
|
|
311
414
|
/** What `createTemplate` takes. */
|
|
312
415
|
export interface TemplateInput {
|
|
313
416
|
/** Lower-case, starting with a letter: `rental-agreement`, `liability_waiver`. */
|
|
@@ -322,15 +425,39 @@ export interface TemplateInput {
|
|
|
322
425
|
/** Up to 50. Set here rather than in a second call — see `createTemplate`. */
|
|
323
426
|
fields?: Ask[];
|
|
324
427
|
}
|
|
325
|
-
/**
|
|
428
|
+
/**
|
|
429
|
+
* The brand an account shows its signers (00220). SignSealer's own without
|
|
430
|
+
* the white-label add-on.
|
|
431
|
+
*
|
|
432
|
+
* Named in camelCase because that is what `GET /v1/branding` answers -- the
|
|
433
|
+
* same object the tablet app themes itself with. Up to 1.10.0 this type
|
|
434
|
+
* declared `tenant_name`, `colour`, `has_logo`, `has_logo_dark` and
|
|
435
|
+
* `signing_host`, which the API has never sent: each read as undefined.
|
|
436
|
+
*/
|
|
326
437
|
export interface Branding {
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
438
|
+
businessName: string;
|
|
439
|
+
/** False on SignSealer's own brand: the colours are ours, not the business's. */
|
|
440
|
+
whiteLabelEnabled?: boolean;
|
|
441
|
+
/** Hex colours. */
|
|
442
|
+
primaryColor?: string | null;
|
|
443
|
+
accentColor?: string | null;
|
|
444
|
+
backgroundColor?: string | null;
|
|
445
|
+
textColor?: string | null;
|
|
446
|
+
buttonTextColor?: string | null;
|
|
447
|
+
hasLogo?: boolean;
|
|
448
|
+
hasDarkLogo?: boolean;
|
|
449
|
+
/** A picture the kiosk opens with (00338). */
|
|
450
|
+
hasOpening?: boolean;
|
|
451
|
+
openingType?: string | null;
|
|
452
|
+
openingUpdatedAt?: string | null;
|
|
332
453
|
/** The host this business's signing links use. */
|
|
333
|
-
|
|
454
|
+
signingHost?: string | null;
|
|
455
|
+
footerText?: string | null;
|
|
456
|
+
tenantId?: string;
|
|
457
|
+
/** Where to fetch each picture; null when there is none. */
|
|
458
|
+
logoUrl?: string | null;
|
|
459
|
+
logoDarkUrl?: string | null;
|
|
460
|
+
openingUrl?: string | null;
|
|
334
461
|
[key: string]: unknown;
|
|
335
462
|
}
|
|
336
463
|
/** Where a one-time code went. The address is masked; you are not told it. */
|
|
@@ -364,6 +491,8 @@ export interface TemplatePdf {
|
|
|
364
491
|
drawn?: number;
|
|
365
492
|
/** `drawn === page_count`. A PDF template cannot be published until it is. */
|
|
366
493
|
ready?: boolean;
|
|
494
|
+
/** Why SignSealer could not draw the pages from the file, when it could not (00474); null otherwise. */
|
|
495
|
+
drawing_failed?: string | null;
|
|
367
496
|
pages?: Array<{
|
|
368
497
|
n: number;
|
|
369
498
|
width: number;
|
|
@@ -467,11 +596,20 @@ export interface StartedWorkflow {
|
|
|
467
596
|
document_id: string;
|
|
468
597
|
title: string;
|
|
469
598
|
expires_at: string | null;
|
|
599
|
+
/** The published version the document was made from (00336). */
|
|
600
|
+
template_version?: number;
|
|
601
|
+
/** How many are in the booking's party, when everybody in it signs (00484); null otherwise. */
|
|
602
|
+
party_size?: number | null;
|
|
470
603
|
signers: SignerLink[];
|
|
604
|
+
/** 00541: the roles whose `show_if` these answers did not meet, by label; absent when every role signs. */
|
|
605
|
+
not_needed?: string[];
|
|
471
606
|
}
|
|
472
607
|
export interface PacketSummary {
|
|
473
608
|
packet_id: string;
|
|
474
609
|
code: string;
|
|
610
|
+
/** Items this build added, and items it dropped because the guest left. */
|
|
611
|
+
added?: number;
|
|
612
|
+
dropped?: number;
|
|
475
613
|
state: "open" | "ready" | "blocked" | "expired" | "void";
|
|
476
614
|
required: number;
|
|
477
615
|
completed: number;
|
|
@@ -496,11 +634,19 @@ export interface DocumentRow {
|
|
|
496
634
|
document_id: string;
|
|
497
635
|
title: string;
|
|
498
636
|
status: string;
|
|
637
|
+
template_code?: string | null;
|
|
638
|
+
template_version?: number | null;
|
|
639
|
+
subject_name?: string | null;
|
|
499
640
|
signers: number;
|
|
500
641
|
signed: number;
|
|
501
642
|
waiting_on: string | null;
|
|
643
|
+
sequential?: boolean;
|
|
644
|
+
expires_at?: string | null;
|
|
502
645
|
sent_at: string | null;
|
|
503
646
|
completed_at: string | null;
|
|
647
|
+
void_reason?: string | null;
|
|
648
|
+
/** False when a signature was made against different text than the document now holds. */
|
|
649
|
+
integrity_ok?: boolean;
|
|
504
650
|
/** Whether it is still good once signed, and until when (00406). */
|
|
505
651
|
standing?: Standing | null;
|
|
506
652
|
valid_until?: string | null;
|
|
@@ -572,13 +718,38 @@ export interface Workflow {
|
|
|
572
718
|
name: string;
|
|
573
719
|
kind: string;
|
|
574
720
|
active: boolean;
|
|
721
|
+
template_code?: string;
|
|
575
722
|
template_published: boolean;
|
|
723
|
+
public_slug?: string | null;
|
|
724
|
+
/** 00541: with what each question is, when it is not words, so a signer's condition can be about it. */
|
|
576
725
|
form_fields: Array<{
|
|
577
726
|
key: string;
|
|
578
727
|
label: string;
|
|
579
728
|
required?: boolean;
|
|
729
|
+
kind?: "text" | "email" | "phone" | "checkbox" | "choice" | "number" | "date" | "birthdate" | "time" | "datetime";
|
|
730
|
+
options?: string[];
|
|
731
|
+
}>;
|
|
732
|
+
/** Every blank a person starting it is asked (00478); `sender_fields` are the boxes whoever sends it fills. */
|
|
733
|
+
asked_fields?: Array<{
|
|
734
|
+
key: string;
|
|
735
|
+
label: string;
|
|
736
|
+
required?: boolean;
|
|
737
|
+
derived?: boolean;
|
|
738
|
+
}>;
|
|
739
|
+
sender_fields?: Array<{
|
|
740
|
+
key: string;
|
|
741
|
+
label: string;
|
|
742
|
+
kind: string;
|
|
743
|
+
required: boolean;
|
|
580
744
|
}>;
|
|
581
745
|
intro: string | null;
|
|
746
|
+
/** 00484: everybody in a booking's party signs, and how their ages are asked. */
|
|
747
|
+
each_person_signs?: boolean;
|
|
748
|
+
party_ages?: "tick" | "dob";
|
|
749
|
+
majority_age?: number;
|
|
750
|
+
minors_also_sign?: boolean;
|
|
751
|
+
/** 00476: the zone its documents' times are written in. */
|
|
752
|
+
time_zone?: string | null;
|
|
582
753
|
}
|
|
583
754
|
export interface ClientOptions {
|
|
584
755
|
/**
|
|
@@ -613,7 +784,6 @@ export declare class SignSealer {
|
|
|
613
784
|
*/
|
|
614
785
|
agreementsRemaining: number | null;
|
|
615
786
|
constructor(opts?: ClientOptions);
|
|
616
|
-
/** Prove the key works, and say whose account it is. */
|
|
617
787
|
/**
|
|
618
788
|
* The brand this account shows its signers.
|
|
619
789
|
*
|
|
@@ -623,6 +793,7 @@ export declare class SignSealer {
|
|
|
623
793
|
* moment somebody is deciding whether to trust the page.
|
|
624
794
|
*/
|
|
625
795
|
branding(): Promise<Branding>;
|
|
796
|
+
/** Prove the key works, and say whose account it is. */
|
|
626
797
|
account(): Promise<Account>;
|
|
627
798
|
/** Every version of every template, newest first; `code` narrows it to one template's versions. No text: `template(id)` has that. */
|
|
628
799
|
templates(filter?: {
|
|
@@ -694,14 +865,6 @@ export declare class SignSealer {
|
|
|
694
865
|
remind_days?: number | null;
|
|
695
866
|
resign?: boolean;
|
|
696
867
|
}): Promise<TemplateDetail>;
|
|
697
|
-
/**
|
|
698
|
-
* Whether a template is an uploaded PDF, and whether it is usable yet.
|
|
699
|
-
*
|
|
700
|
-
* `ready` is the one to check: a PDF template cannot be published until
|
|
701
|
-
* every page has a picture a signer can read. Uploading the file is a
|
|
702
|
-
* dashboard step — drawing those pictures needs a browser, which a server
|
|
703
|
-
* does not have — so this is read-only on purpose.
|
|
704
|
-
*/
|
|
705
868
|
/**
|
|
706
869
|
* Create a template. Version 1, as a draft.
|
|
707
870
|
*
|
|
@@ -718,6 +881,14 @@ export declare class SignSealer {
|
|
|
718
881
|
createTemplate(input: TemplateInput, idempotencyKey?: string): Promise<{
|
|
719
882
|
template_id: string;
|
|
720
883
|
}>;
|
|
884
|
+
/**
|
|
885
|
+
* Whether a template is an uploaded PDF, and whether it is usable yet.
|
|
886
|
+
*
|
|
887
|
+
* `ready` is the one to check: a PDF template cannot be published until
|
|
888
|
+
* SignSealer has drawn a picture of every page from the file itself
|
|
889
|
+
* (00474), which it does as the file is uploaded. Uploading the file is a
|
|
890
|
+
* dashboard step, where the boxes are placed; there is no API route for it.
|
|
891
|
+
*/
|
|
721
892
|
templatePdf(id: string): Promise<TemplatePdf>;
|
|
722
893
|
/**
|
|
723
894
|
* Record that you have consent to text a number.
|
|
@@ -731,9 +902,12 @@ export declare class SignSealer {
|
|
|
731
902
|
* `wording` is the field this method exists for. Send the exact words that
|
|
732
903
|
* were in front of the person, because it is kept verbatim and it is what a
|
|
733
904
|
* carrier asks for. It has to say that replying STOP opts out, that HELP
|
|
734
|
-
* gets help, that message and data rates may apply,
|
|
735
|
-
* frequency varies
|
|
736
|
-
*
|
|
905
|
+
* gets help, that message and data rates may apply, that message
|
|
906
|
+
* frequency varies, that consent is not a condition of purchase, and that
|
|
907
|
+
* the number is not shared or sold, and link the terms and the privacy
|
|
908
|
+
* policy; a disclosure missing any of those is refused with 422 naming
|
|
909
|
+
* which, and nothing is recorded. `account().texting.wording` is a
|
|
910
|
+
* sentence that passes.
|
|
737
911
|
*
|
|
738
912
|
* One call covers the link, the reminder and the confirmation. Somebody who
|
|
739
913
|
* agreed to those agreed to all three, and an API that made you post three
|
|
@@ -756,6 +930,22 @@ export declare class SignSealer {
|
|
|
756
930
|
* on the account.
|
|
757
931
|
*/
|
|
758
932
|
smsConsent(phone: string): Promise<SmsConsent>;
|
|
933
|
+
/**
|
|
934
|
+
* A link that takes the business's owner to apply for its own texting
|
|
935
|
+
* number, with what you know filled in (1.13.0).
|
|
936
|
+
*
|
|
937
|
+
* For when `account().texting.why_not` is `number`. The link opens the
|
|
938
|
+
* business's application on SignSealer after its owner signs in; it files
|
|
939
|
+
* nothing, and only an owner or an admin can apply. Fourteen days, used up
|
|
940
|
+
* when the business applies, twenty a day. Watch `texting.application` on
|
|
941
|
+
* the account, or `texting.number_updated`, for where it has got to. A
|
|
942
|
+
* test key is refused: a sandbox never texts.
|
|
943
|
+
*
|
|
944
|
+
* Sent once, never retried: each link is a new one and counts against the
|
|
945
|
+
* day's twenty, so a retry after a lost answer would spend one on a link
|
|
946
|
+
* nobody was handed. If the answer is lost, ask again when you need one.
|
|
947
|
+
*/
|
|
948
|
+
textingNumberInvitation(prefill?: TextingNumberPrefill): Promise<TextingNumberInvitation>;
|
|
759
949
|
/**
|
|
760
950
|
* Documents, filtered and paged.
|
|
761
951
|
*
|
|
@@ -810,8 +1000,13 @@ export declare class SignSealer {
|
|
|
810
1000
|
gateLink(documentId: string, signerId: string): Promise<GateLink>;
|
|
811
1001
|
/**
|
|
812
1002
|
* Send one signer a reminder with a fresh link (1.6.0); the one they had
|
|
813
|
-
* stops working. Refused inside an hour of their last reminder,
|
|
1003
|
+
* stops working. Refused (422) inside an hour of their last reminder, past
|
|
1004
|
+
* three to one signer or twenty-five for one document in a day, and for
|
|
814
1005
|
* somebody there is no way to reach -- with their link left as it was.
|
|
1006
|
+
* A signer is texted one reminder over the life of their link, because
|
|
1007
|
+
* that is what they agreed to (00507): after it, a reminder goes by email
|
|
1008
|
+
* alone (`by: "email"`), and one with no email address is refused (422).
|
|
1009
|
+
* `reminded: true` means it was queued: it is screened before it leaves.
|
|
815
1010
|
*/
|
|
816
1011
|
remind(documentId: string, signerId: string, idempotencyKey?: string): Promise<{
|
|
817
1012
|
document_id: string;
|
|
@@ -838,6 +1033,12 @@ export declare class SignSealer {
|
|
|
838
1033
|
metadata?: Record<string, string>;
|
|
839
1034
|
/** Where the signed page offers to take them: https, on a host the business has proven (1.6.0). */
|
|
840
1035
|
return_url?: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* The zone the document's times are in ("America/Denver"). A time blank given as
|
|
1038
|
+
* `14:30` or `2026-10-03T09:00` is written as "October 3, 2026 at 9:00 am MDT".
|
|
1039
|
+
* Without it, values go into the text as sent (00476).
|
|
1040
|
+
*/
|
|
1041
|
+
time_zone?: string;
|
|
841
1042
|
}, idempotencyKey?: string): Promise<{
|
|
842
1043
|
document_id: string;
|
|
843
1044
|
}>;
|
|
@@ -995,12 +1196,23 @@ export declare class SignSealer {
|
|
|
995
1196
|
id: string;
|
|
996
1197
|
secret: string;
|
|
997
1198
|
}>;
|
|
1199
|
+
/**
|
|
1200
|
+
* Change an endpoint. Turning one back on forgives its failures and sends
|
|
1201
|
+
* what it held: `resumed` says it was paused, `waiting` how many are now
|
|
1202
|
+
* on their way, and `dropped_while_paused` how many the hold could not
|
|
1203
|
+
* keep (00289). `events`, when given, replaces the list and is checked as
|
|
1204
|
+
* `addWebhook`'s is: a name that is not an event is refused (422), and the
|
|
1205
|
+
* error's `hint` lists every one there is (00507).
|
|
1206
|
+
*/
|
|
998
1207
|
setWebhook(id: string, input: {
|
|
999
1208
|
active?: boolean;
|
|
1000
1209
|
events?: string[];
|
|
1001
1210
|
label?: string;
|
|
1002
1211
|
}): Promise<{
|
|
1003
1212
|
updated: true;
|
|
1213
|
+
resumed?: boolean;
|
|
1214
|
+
waiting?: number;
|
|
1215
|
+
dropped_while_paused?: number;
|
|
1004
1216
|
}>;
|
|
1005
1217
|
removeWebhook(id: string, reason: string): Promise<{
|
|
1006
1218
|
deleted: true;
|
|
@@ -1085,6 +1297,8 @@ export declare class SignSealer {
|
|
|
1085
1297
|
setDevice(id: string, input: {
|
|
1086
1298
|
name?: string;
|
|
1087
1299
|
workflow_id?: string | null;
|
|
1300
|
+
/** Every form it runs, in the order its kiosk lists them (00420); the first becomes `workflow_id`, `[]` a staff tablet. */
|
|
1301
|
+
workflow_ids?: string[];
|
|
1088
1302
|
hand_off?: "walk_up" | "same_device" | "separate";
|
|
1089
1303
|
/** `own` (the default) or `account`: a link a tablet shows is one whoever holds it could open. */
|
|
1090
1304
|
gate?: "own" | "account";
|
|
@@ -1169,6 +1383,91 @@ export interface SigningLink {
|
|
|
1169
1383
|
* also exactly when a signature is accepted, so the two never disagree.
|
|
1170
1384
|
*/
|
|
1171
1385
|
document_after_questions?: boolean;
|
|
1386
|
+
/**
|
|
1387
|
+
* 00540: paragraphs of the text that are there only when the first
|
|
1388
|
+
* signer's answers say so. `body` has only the ones that apply as the link
|
|
1389
|
+
* is read; `sections` says which, in order. While they are this signer's
|
|
1390
|
+
* to decide (`decided_by_me`, not `settled`), `source` is the text with
|
|
1391
|
+
* its `[[show if ...]]` markers and `conditions` each paragraph's
|
|
1392
|
+
* condition, for a page that asks the questions itself; anybody else
|
|
1393
|
+
* `waiting` is refused a signature until the first signer has signed. Pass
|
|
1394
|
+
* `sections` back to `sign` as the paragraphs your page drew: while they
|
|
1395
|
+
* are undecided, a signature without them is refused. Absent for a text
|
|
1396
|
+
* with none.
|
|
1397
|
+
*/
|
|
1398
|
+
paragraphs?: {
|
|
1399
|
+
conditional: number;
|
|
1400
|
+
shown: number;
|
|
1401
|
+
sections: boolean[];
|
|
1402
|
+
decided_by: string | null;
|
|
1403
|
+
decided_by_me: boolean;
|
|
1404
|
+
settled: boolean;
|
|
1405
|
+
waiting: boolean;
|
|
1406
|
+
source?: string;
|
|
1407
|
+
conditions?: Array<ShowIf | null>;
|
|
1408
|
+
/**
|
|
1409
|
+
* To the first signer, while undecided: for each paragraph, whether each
|
|
1410
|
+
* of its rules is met on the answers given so far, in the order of
|
|
1411
|
+
* `conditions`. For a rule about a question your page does not ask.
|
|
1412
|
+
*/
|
|
1413
|
+
rules_at_start?: boolean[][];
|
|
1414
|
+
} | null;
|
|
1415
|
+
/** 00476: the zone the document's times are written in ("America/Denver"), or null when none was given. */
|
|
1416
|
+
time_zone?: string | null;
|
|
1417
|
+
/**
|
|
1418
|
+
* 00540: the zone whose calendar day a condition is read on, so an age
|
|
1419
|
+
* ("under 18") means the same day to your page as to the engine: the
|
|
1420
|
+
* document's own zone, else the business's signing zone.
|
|
1421
|
+
*/
|
|
1422
|
+
condition_zone?: string | null;
|
|
1423
|
+
/**
|
|
1424
|
+
* 00484: everybody in a booking's party signs. For the person it was
|
|
1425
|
+
* started for (`lead`), how many they still add before they can sign and
|
|
1426
|
+
* each one added; for somebody they added, who added them.
|
|
1427
|
+
*/
|
|
1428
|
+
party?: {
|
|
1429
|
+
size: number;
|
|
1430
|
+
lead: boolean;
|
|
1431
|
+
/** The person it was started for, by name. */
|
|
1432
|
+
lead_name?: string | null;
|
|
1433
|
+
added_by: string | null;
|
|
1434
|
+
/** Whether the lead has said who is in the party yet. */
|
|
1435
|
+
described?: boolean;
|
|
1436
|
+
still_to_add: number;
|
|
1437
|
+
/**
|
|
1438
|
+
* Whether this person may add the others now. Adding them is done on
|
|
1439
|
+
* the signing page (`/s/<token>`), not over the API: send a lead there.
|
|
1440
|
+
*/
|
|
1441
|
+
may_add: boolean;
|
|
1442
|
+
/** How a child is told apart (`tick`: a tick for "under 18"; `dob`: a date of birth), the age of majority, and whether minors sign too. */
|
|
1443
|
+
ages?: "tick" | "dob";
|
|
1444
|
+
majority_age?: number;
|
|
1445
|
+
minors_also_sign?: boolean;
|
|
1446
|
+
/**
|
|
1447
|
+
* For the lead: each person added. `open` is a place kept open for
|
|
1448
|
+
* somebody to take, `claimed` one somebody took from the party link,
|
|
1449
|
+
* `opened` whether their link has been opened (00491).
|
|
1450
|
+
*/
|
|
1451
|
+
others: Array<{
|
|
1452
|
+
signer_id: string;
|
|
1453
|
+
full_name: string;
|
|
1454
|
+
email: string | null;
|
|
1455
|
+
phone: string | null;
|
|
1456
|
+
status: string;
|
|
1457
|
+
signed_at: string | null;
|
|
1458
|
+
open?: boolean;
|
|
1459
|
+
unnamed?: boolean;
|
|
1460
|
+
claimed?: boolean;
|
|
1461
|
+
opened?: boolean;
|
|
1462
|
+
}>;
|
|
1463
|
+
/** For the lead: each child in the party and the adult who signs for them. */
|
|
1464
|
+
minors?: Array<{
|
|
1465
|
+
full_name: string;
|
|
1466
|
+
guardian: string | null;
|
|
1467
|
+
}>;
|
|
1468
|
+
/** The children this person signs for. */
|
|
1469
|
+
signing_for?: string[];
|
|
1470
|
+
} | null;
|
|
1172
1471
|
signer_id?: string | null;
|
|
1173
1472
|
signed_at?: string | null;
|
|
1174
1473
|
/** False when the business bought white label (00213): the page wears their name, not ours. */
|
|
@@ -1263,6 +1562,13 @@ export interface SigningField {
|
|
|
1263
1562
|
* so a page that follows it can never be refused for a question it hid.
|
|
1264
1563
|
*/
|
|
1265
1564
|
visible?: boolean;
|
|
1565
|
+
/**
|
|
1566
|
+
* 00540: each rule of `show_if`, met or not on the answers given so far, in
|
|
1567
|
+
* order. For a page that asks some questions itself and not others: put a
|
|
1568
|
+
* rule about a question it does not ask together with the ones it decides.
|
|
1569
|
+
* Null when there is no condition.
|
|
1570
|
+
*/
|
|
1571
|
+
rules_at_start?: boolean[] | null;
|
|
1266
1572
|
/**
|
|
1267
1573
|
* 00399: the signer has been past it -- answered it, or left an optional
|
|
1268
1574
|
* one blank. A passed question is done for a page's purposes; only
|
|
@@ -1367,7 +1673,14 @@ export interface BundleQuestion {
|
|
|
1367
1673
|
required: boolean;
|
|
1368
1674
|
hint: string | null;
|
|
1369
1675
|
options: string[] | null;
|
|
1370
|
-
|
|
1676
|
+
/** One rule (00375), or null when the condition is several (00539) or none. */
|
|
1677
|
+
show_if: ShowIfRule | null;
|
|
1678
|
+
/**
|
|
1679
|
+
* A condition of several rules (00539), here rather than in `show_if` so an
|
|
1680
|
+
* app that reads only one rule asks the question every time instead of
|
|
1681
|
+
* hiding it.
|
|
1682
|
+
*/
|
|
1683
|
+
show_if_rules?: ShowIf | null;
|
|
1371
1684
|
block: string | null;
|
|
1372
1685
|
block_label: string | null;
|
|
1373
1686
|
block_intro: string | null;
|
|
@@ -1403,6 +1716,10 @@ export interface WorkflowBundle {
|
|
|
1403
1716
|
body_sha256: string;
|
|
1404
1717
|
/** 00364: `markdown` is drawn as headings and lists, not as marks. */
|
|
1405
1718
|
body_format?: "text" | "markdown";
|
|
1719
|
+
/** 00540: each paragraph of `body` that depends on an answer, in order, with its condition. */
|
|
1720
|
+
sections?: Array<{
|
|
1721
|
+
condition: ShowIf | null;
|
|
1722
|
+
}>;
|
|
1406
1723
|
};
|
|
1407
1724
|
consent: {
|
|
1408
1725
|
text: string;
|
|
@@ -1440,6 +1757,8 @@ export interface WorkflowBundle {
|
|
|
1440
1757
|
questions?: BundleQuestion[];
|
|
1441
1758
|
/** 00393, 00398: ask the questions first and show the document after them. */
|
|
1442
1759
|
document_after_questions?: boolean;
|
|
1760
|
+
/** 00540: the zone whose calendar day a document started from this form reads its conditions on. */
|
|
1761
|
+
condition_zone?: string;
|
|
1443
1762
|
fetched_at: string;
|
|
1444
1763
|
}
|
|
1445
1764
|
/** A tablet as the account sees it. Never carries a pairing code. */
|
|
@@ -1463,6 +1782,21 @@ export interface Device {
|
|
|
1463
1782
|
hand_off?: "walk_up" | "same_device" | "separate";
|
|
1464
1783
|
/** Whose documents its Gate screen may show a signing link for (00409): its own and its form's, or every open one. */
|
|
1465
1784
|
gate?: "own" | "account";
|
|
1785
|
+
/** Every form it runs, in the order its kiosk lists them (00420). */
|
|
1786
|
+
workflows?: Array<{
|
|
1787
|
+
id: string;
|
|
1788
|
+
name: string;
|
|
1789
|
+
kind: string;
|
|
1790
|
+
active: boolean;
|
|
1791
|
+
}>;
|
|
1792
|
+
/** 00337, 00341: against the version rules, and the queue's shape from its last heartbeat. */
|
|
1793
|
+
below_minimum?: boolean;
|
|
1794
|
+
below_recommended?: boolean;
|
|
1795
|
+
queue_waiting?: number;
|
|
1796
|
+
queue_refused?: number;
|
|
1797
|
+
last_synced_at?: string | null;
|
|
1798
|
+
last_problem_code?: string | null;
|
|
1799
|
+
last_problem_at?: string | null;
|
|
1466
1800
|
}
|
|
1467
1801
|
export interface Captured {
|
|
1468
1802
|
offline?: boolean;
|
|
@@ -1481,12 +1815,22 @@ export interface Captured {
|
|
|
1481
1815
|
*
|
|
1482
1816
|
* Use this to build your own signing page. If you want ours, send the signer
|
|
1483
1817
|
* to `https://api.signsealer.com/s/<token>` and skip all of it.
|
|
1818
|
+
*
|
|
1819
|
+
* The one exception is a paired tablet's own credential, `deviceKey` (1.11.0),
|
|
1820
|
+
* sent on one call only: a signature that carries `captured`. The server keeps
|
|
1821
|
+
* an offline signature's claim about when it was taken only from a paired
|
|
1822
|
+
* tablet of the business the link belongs to, because that day is the day the
|
|
1823
|
+
* document says it was signed, and it asks for the tablet's credential to know
|
|
1824
|
+
* it is one. Without it the claim is dropped -- silently, not refused -- and the
|
|
1825
|
+
* signature is dated when it arrives. Nothing else here ever sends it.
|
|
1484
1826
|
*/
|
|
1485
1827
|
export declare class SignSealerSigning {
|
|
1486
1828
|
#private;
|
|
1487
1829
|
constructor(opts?: {
|
|
1488
1830
|
baseUrl?: string;
|
|
1489
1831
|
fetch?: typeof globalThis.fetch;
|
|
1832
|
+
/** A paired tablet's credential, from `pairDevice`. Sent only with `sign` when it carries `captured`. */
|
|
1833
|
+
deviceKey?: string;
|
|
1490
1834
|
});
|
|
1491
1835
|
/**
|
|
1492
1836
|
* Everything the page needs from one token.
|
|
@@ -1547,6 +1891,12 @@ export declare class SignSealerSigning {
|
|
|
1547
1891
|
* kind `photo`, shrunk on the server, kept encrypted with the document
|
|
1548
1892
|
* for as long as the document is kept; the field carries its hash. A
|
|
1549
1893
|
* second photograph replaces the first.
|
|
1894
|
+
*
|
|
1895
|
+
* When the server is reading other photos, or another from this link, it
|
|
1896
|
+
* is refused with a 429 `busy` and nothing is kept: the error's
|
|
1897
|
+
* `retryable` is true and `retryAfter` says how many seconds to wait
|
|
1898
|
+
* (thirty). Show the person its message and send the same photo again
|
|
1899
|
+
* then; this client does not wait that long inside a call for you.
|
|
1550
1900
|
*/
|
|
1551
1901
|
supplyPhoto(token: string, key: string, image: {
|
|
1552
1902
|
contentType: string;
|
|
@@ -1594,7 +1944,8 @@ export declare class SignSealerSigning {
|
|
|
1594
1944
|
/**
|
|
1595
1945
|
* A photo of the ID, or of the person, when the business asked (00339).
|
|
1596
1946
|
* Kept encrypted for thirty days, the hash on the trail. Refused when
|
|
1597
|
-
* the business did not ask
|
|
1947
|
+
* the business did not ask; refused as busy, to be sent again after
|
|
1948
|
+
* `retryAfter` seconds, as `supplyPhoto` is.
|
|
1598
1949
|
*/
|
|
1599
1950
|
captureIdEvidence(token: string, kind: "id" | "selfie", image: {
|
|
1600
1951
|
contentType: string;
|
|
@@ -1604,7 +1955,18 @@ export declare class SignSealerSigning {
|
|
|
1604
1955
|
kind: string;
|
|
1605
1956
|
sha256: string;
|
|
1606
1957
|
}>;
|
|
1607
|
-
|
|
1958
|
+
/**
|
|
1959
|
+
* Sign. `captured` is for a signature a paired tablet took with no
|
|
1960
|
+
* network, and is kept only when the client was built with that tablet's
|
|
1961
|
+
* `deviceKey`, which goes with this call and no other; see the class.
|
|
1962
|
+
*
|
|
1963
|
+
* `paragraphs` (00540) is which of the text's conditional paragraphs your
|
|
1964
|
+
* page drew, in order. Required while the first signer's answers still
|
|
1965
|
+
* decide them (refused with 422 without it), and refused with 409
|
|
1966
|
+
* `paragraphs_changed` when the answers now call for others, so nobody
|
|
1967
|
+
* signs a paragraph they were not shown. Kept with the signature.
|
|
1968
|
+
*/
|
|
1969
|
+
sign(token: string, method: "typed" | "drawn" | "clicked" | "uploaded", value: string, captured?: Captured, paragraphs?: boolean[]): Promise<{
|
|
1608
1970
|
event_id: string;
|
|
1609
1971
|
}>;
|
|
1610
1972
|
decline(token: string, reason: string): Promise<{
|
|
@@ -1826,18 +2188,19 @@ export type WebhookHeaders = Headers | Record<string, string | string[] | undefi
|
|
|
1826
2188
|
* signed bytes again with a different id on them, and a receiver keyed on the
|
|
1827
2189
|
* id will treat the replay as a new event.
|
|
1828
2190
|
*
|
|
1829
|
-
*
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
1833
|
-
*
|
|
1834
|
-
*
|
|
1835
|
-
*
|
|
1836
|
-
* the
|
|
2191
|
+
* A key derived from `timestamp.body` is authenticated but is *not* stable
|
|
2192
|
+
* across retries, because the sender signs a fresh timestamp on every attempt;
|
|
2193
|
+
* this SDK briefly returned one, which deduplicated replays and broke ordinary
|
|
2194
|
+
* retries, which is the worse failure of the two. A SHA-256 of the body alone
|
|
2195
|
+
* is both: the signature covers the body, and a delivery's body is built once
|
|
2196
|
+
* and sent unchanged on every retry. That is what the WordPress plugin keys on
|
|
2197
|
+
* (1.14.4). What it cannot tell apart is a replay a person asked for
|
|
2198
|
+
* (`replayWebhookDelivery`), which sends the same body under a new id. The
|
|
2199
|
+
* whole fix is to bring the id inside the signature under a `v2=` scheme,
|
|
2200
|
+
* and that is a change to the wire rather than to this file.
|
|
1837
2201
|
*
|
|
1838
|
-
* Until then: deduplicate on `eventId`,
|
|
1839
|
-
* window would be harmful to your system
|
|
1840
|
-
* against your records before acting on it.
|
|
2202
|
+
* Until then: deduplicate on `eventId`, or on a hash of the raw body when a
|
|
2203
|
+
* replay inside a five-minute window would be harmful to your system.
|
|
1841
2204
|
*/
|
|
1842
2205
|
export declare function verifyWebhookRequest(opts: {
|
|
1843
2206
|
secret: string;
|