@signsealer/sdk 1.0.0 → 1.4.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 +205 -0
- package/README.md +76 -0
- package/dist/cjs/index.cjs +205 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.d.ts +582 -25
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +171 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +26 -9
package/dist/esm/index.d.ts
CHANGED
|
@@ -88,7 +88,48 @@ export interface Ask {
|
|
|
88
88
|
supplied_by?: "adult" | "per_child" | "staff";
|
|
89
89
|
options?: string[];
|
|
90
90
|
hint?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Ask it only when an earlier question was answered a certain way (00375).
|
|
93
|
+
* Only a question *above* it: a form is read top to bottom. A hidden
|
|
94
|
+
* question is not required, and changing the answer it depends on clears
|
|
95
|
+
* it, so the certificate never carries an answer to a question nobody saw.
|
|
96
|
+
*/
|
|
97
|
+
show_if?: ShowIf | null;
|
|
98
|
+
/**
|
|
99
|
+
* Put the answer in front of a person when it matches (00373). Staff see
|
|
100
|
+
* the flag, in the dashboard and on `document`; the signer never does.
|
|
101
|
+
*/
|
|
102
|
+
flag_when?: AnswerRule | null;
|
|
103
|
+
/**
|
|
104
|
+
* A set of questions asked as one thing (00372) -- a safety declaration, a
|
|
105
|
+
* medical section. Name the same `block` on each; give `block_label` (and
|
|
106
|
+
* `block_intro`, if any) once, on whichever comes first.
|
|
107
|
+
*/
|
|
108
|
+
block?: string | null;
|
|
109
|
+
block_label?: string | null;
|
|
110
|
+
block_intro?: string | null;
|
|
111
|
+
/** The block gets a page of its own, with a Next button (00379). */
|
|
112
|
+
block_step?: boolean | null;
|
|
113
|
+
/** Where it is answered on an uploaded PDF's page (00243), in fractions of the page. */
|
|
114
|
+
place?: Place | null;
|
|
91
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* A rule about an answer, exactly one of these (00373, 00375): `equals` for a
|
|
118
|
+
* choice, `ticked` or `unticked` for a checkbox, `answered` for anything.
|
|
119
|
+
*/
|
|
120
|
+
export type AnswerRule = {
|
|
121
|
+
equals: string[];
|
|
122
|
+
} | {
|
|
123
|
+
ticked: boolean;
|
|
124
|
+
} | {
|
|
125
|
+
unticked: boolean;
|
|
126
|
+
} | {
|
|
127
|
+
answered: boolean;
|
|
128
|
+
};
|
|
129
|
+
/** A rule about an earlier question's answer, naming which question. */
|
|
130
|
+
export type ShowIf = AnswerRule & {
|
|
131
|
+
field: string;
|
|
132
|
+
};
|
|
92
133
|
/** What `createTemplate` takes. */
|
|
93
134
|
export interface TemplateInput {
|
|
94
135
|
/** Lower-case, starting with a letter: `rental-agreement`, `liability_waiver`. */
|
|
@@ -175,13 +216,61 @@ export interface SealSummary {
|
|
|
175
216
|
}
|
|
176
217
|
export interface SignerLink {
|
|
177
218
|
signer_id: string;
|
|
178
|
-
|
|
219
|
+
/** Null for a signer reachable only by text. */
|
|
220
|
+
email: string | null;
|
|
221
|
+
/** E.164, as the engine normalised it. Null unless a number was given. */
|
|
222
|
+
phone?: string | null;
|
|
179
223
|
full_name?: string;
|
|
180
224
|
role?: string;
|
|
181
225
|
participant?: boolean;
|
|
182
226
|
/** The signing URL. Returned once, and never again — only its hash is kept. */
|
|
183
227
|
token: string;
|
|
184
228
|
}
|
|
229
|
+
/** Who has signed one document (00340): names and states, nothing else. */
|
|
230
|
+
export interface DocumentSigners {
|
|
231
|
+
document_id: string;
|
|
232
|
+
title: string;
|
|
233
|
+
status: string;
|
|
234
|
+
sent_at: string | null;
|
|
235
|
+
completed_at: string | null;
|
|
236
|
+
signers: Array<{
|
|
237
|
+
signer_id: string;
|
|
238
|
+
full_name: string;
|
|
239
|
+
role: string;
|
|
240
|
+
sign_order: number;
|
|
241
|
+
status: string;
|
|
242
|
+
signed_at: string | null;
|
|
243
|
+
declined_at: string | null;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
/** A fresh signing link for a signer who has not signed, with a QR code to hold up (00340). */
|
|
247
|
+
export interface GateLink {
|
|
248
|
+
document_id: string;
|
|
249
|
+
signer_id: string;
|
|
250
|
+
url: string;
|
|
251
|
+
/** The QR code as SVG, drawn on the server. */
|
|
252
|
+
qr_svg: string;
|
|
253
|
+
}
|
|
254
|
+
/** What a signing code resolves to for a tablet (00321). */
|
|
255
|
+
export interface PacketLookup {
|
|
256
|
+
found: boolean;
|
|
257
|
+
why?: string;
|
|
258
|
+
packet_id?: string;
|
|
259
|
+
code?: string;
|
|
260
|
+
state?: string;
|
|
261
|
+
required?: number;
|
|
262
|
+
completed?: number;
|
|
263
|
+
outstanding?: number;
|
|
264
|
+
declined?: number;
|
|
265
|
+
expires_at?: string | null;
|
|
266
|
+
items?: Array<{
|
|
267
|
+
item_id: string;
|
|
268
|
+
who: string;
|
|
269
|
+
workflow: string;
|
|
270
|
+
required: boolean;
|
|
271
|
+
status: string;
|
|
272
|
+
}>;
|
|
273
|
+
}
|
|
185
274
|
export interface StartedWorkflow {
|
|
186
275
|
document_id: string;
|
|
187
276
|
title: string;
|
|
@@ -210,8 +299,89 @@ export interface Participant {
|
|
|
210
299
|
/** The `ref` of the adult who signs for this minor. */
|
|
211
300
|
guardian_ref?: string;
|
|
212
301
|
}
|
|
302
|
+
/** One row of `GET /v1/documents`: enough for a list, never the signers' addresses. */
|
|
303
|
+
export interface DocumentRow {
|
|
304
|
+
document_id: string;
|
|
305
|
+
title: string;
|
|
306
|
+
status: string;
|
|
307
|
+
signers: number;
|
|
308
|
+
signed: number;
|
|
309
|
+
waiting_on: string | null;
|
|
310
|
+
sent_at: string | null;
|
|
311
|
+
completed_at: string | null;
|
|
312
|
+
}
|
|
313
|
+
/** What `document` answers. The trail and the signers are as the API documents them. */
|
|
314
|
+
export interface DocumentDetail {
|
|
315
|
+
document_id: string;
|
|
316
|
+
title: string;
|
|
317
|
+
status: string;
|
|
318
|
+
body: string;
|
|
319
|
+
body_format?: "text" | "markdown";
|
|
320
|
+
body_sha256_hex?: string;
|
|
321
|
+
template_code: string | null;
|
|
322
|
+
template_version: number | null;
|
|
323
|
+
sent_at: string | null;
|
|
324
|
+
completed_at: string | null;
|
|
325
|
+
voided_at: string | null;
|
|
326
|
+
void_reason: string | null;
|
|
327
|
+
integrity_ok: boolean | null;
|
|
328
|
+
redacted_at?: string | null;
|
|
329
|
+
signers: Array<Record<string, unknown>>;
|
|
330
|
+
events: Array<Record<string, unknown>>;
|
|
331
|
+
/** Every question, in the form's order, with the signer it belongs to (00395). */
|
|
332
|
+
answers: DocumentAnswer[];
|
|
333
|
+
/** How many answers want a person to read them. */
|
|
334
|
+
flagged: number;
|
|
335
|
+
[key: string]: unknown;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* One answer on a document (00395).
|
|
339
|
+
*
|
|
340
|
+
* `asked` is whether the question was on the signer's page: a question its
|
|
341
|
+
* condition hid is `asked: false`, has no value and is never `flagged`. A
|
|
342
|
+
* sensitive answer is masked, as it is for the business's own staff. A
|
|
343
|
+
* redacted document keeps its questions and gives up every value.
|
|
344
|
+
*/
|
|
345
|
+
export interface DocumentAnswer {
|
|
346
|
+
signer_id: string;
|
|
347
|
+
key: string;
|
|
348
|
+
label: string;
|
|
349
|
+
kind: string;
|
|
350
|
+
block: {
|
|
351
|
+
key: string;
|
|
352
|
+
label: string | null;
|
|
353
|
+
} | null;
|
|
354
|
+
/** Whose answer, when one is asked per child. */
|
|
355
|
+
about: string | null;
|
|
356
|
+
required: boolean;
|
|
357
|
+
sensitive: boolean;
|
|
358
|
+
asked: boolean;
|
|
359
|
+
value: string | null;
|
|
360
|
+
supplied_at: string | null;
|
|
361
|
+
flagged: boolean;
|
|
362
|
+
}
|
|
363
|
+
/** One row of `GET /v1/workflows`: a public form, QR or kiosk workflow. */
|
|
364
|
+
export interface Workflow {
|
|
365
|
+
id: string;
|
|
366
|
+
code: string;
|
|
367
|
+
name: string;
|
|
368
|
+
kind: string;
|
|
369
|
+
active: boolean;
|
|
370
|
+
template_published: boolean;
|
|
371
|
+
form_fields: Array<{
|
|
372
|
+
key: string;
|
|
373
|
+
label: string;
|
|
374
|
+
required?: boolean;
|
|
375
|
+
}>;
|
|
376
|
+
intro: string | null;
|
|
377
|
+
}
|
|
213
378
|
export interface ClientOptions {
|
|
214
|
-
|
|
379
|
+
/**
|
|
380
|
+
* The key. Optional for one call only: `pairDevice`, where the pairing code
|
|
381
|
+
* is the credential. A client built without a key sends no authorization
|
|
382
|
+
* header and every other route refuses it, which is the right answer.
|
|
383
|
+
*/
|
|
384
|
+
apiKey?: string;
|
|
215
385
|
baseUrl?: string;
|
|
216
386
|
/** Total attempts for a retryable failure, the first included. */
|
|
217
387
|
maxAttempts?: number;
|
|
@@ -237,7 +407,7 @@ export declare class SignSealer {
|
|
|
237
407
|
* polling for it.
|
|
238
408
|
*/
|
|
239
409
|
agreementsRemaining: number | null;
|
|
240
|
-
constructor(opts
|
|
410
|
+
constructor(opts?: ClientOptions);
|
|
241
411
|
/** Prove the key works, and say whose account it is. */
|
|
242
412
|
/**
|
|
243
413
|
* The brand this account shows its signers.
|
|
@@ -312,14 +482,43 @@ export declare class SignSealer {
|
|
|
312
482
|
* on the account.
|
|
313
483
|
*/
|
|
314
484
|
smsConsent(phone: string): Promise<SmsConsent>;
|
|
485
|
+
/**
|
|
486
|
+
* Documents, filtered and paged.
|
|
487
|
+
*
|
|
488
|
+
* `limit` is 1–200 (50 by default); asking for more than 200 gets 200.
|
|
489
|
+
* `offset` was missing, so a business with more than two hundred documents
|
|
490
|
+
* had no way to reach the second page from this client at all — the API
|
|
491
|
+
* had always taken it.
|
|
492
|
+
*/
|
|
315
493
|
documents(filter?: {
|
|
316
494
|
status?: string;
|
|
317
495
|
q?: string;
|
|
318
496
|
limit?: number;
|
|
497
|
+
offset?: number;
|
|
319
498
|
}): Promise<{
|
|
320
|
-
documents:
|
|
499
|
+
documents: DocumentRow[];
|
|
500
|
+
total: number;
|
|
321
501
|
}>;
|
|
322
|
-
|
|
502
|
+
/**
|
|
503
|
+
* One document: its text, its signers, the whole trail, and every answer
|
|
504
|
+
* (00395). `flagged` counts the answers the template's rules say a person
|
|
505
|
+
* should read -- the question an integration usually wants answered first.
|
|
506
|
+
* Answers are here and deliberately not in webhooks.
|
|
507
|
+
*/
|
|
508
|
+
document(id: string): Promise<DocumentDetail>;
|
|
509
|
+
/**
|
|
510
|
+
* Who has signed one document (00340): each signer's name, role and state
|
|
511
|
+
* and nothing else -- no text, no addresses, no trail. The question a gate
|
|
512
|
+
* attendant asks; the route a paired tablet may read.
|
|
513
|
+
*/
|
|
514
|
+
documentSigners(id: string): Promise<DocumentSigners>;
|
|
515
|
+
/**
|
|
516
|
+
* A fresh signing link for a signer who has not signed, as a QR code to
|
|
517
|
+
* hold up (00340). The link they were sent stops working; the trail says
|
|
518
|
+
* a link was shown at the gate. Refused for a signer who has signed or
|
|
519
|
+
* declined, a copied recipient, or a document that is not open.
|
|
520
|
+
*/
|
|
521
|
+
gateLink(documentId: string, signerId: string): Promise<GateLink>;
|
|
323
522
|
prepareDocument(input: {
|
|
324
523
|
template_code: string;
|
|
325
524
|
title?: string;
|
|
@@ -329,8 +528,19 @@ export declare class SignSealer {
|
|
|
329
528
|
}, idempotencyKey?: string): Promise<{
|
|
330
529
|
document_id: string;
|
|
331
530
|
}>;
|
|
531
|
+
/**
|
|
532
|
+
* Send, and take the links back once.
|
|
533
|
+
*
|
|
534
|
+
* Each signer needs an `email`, a `phone`, or both; a `cc` may have neither.
|
|
535
|
+
* Given both, the same link goes out twice — by mail and by text — because a
|
|
536
|
+
* person who does not check one inbox checks the other. The text goes only
|
|
537
|
+
* where the business has consent on file for `signing.link`; where it does
|
|
538
|
+
* not, the email still goes and the reason is on the evidence trail.
|
|
539
|
+
*/
|
|
332
540
|
send(documentId: string, signers: Array<{
|
|
333
|
-
email
|
|
541
|
+
email?: string;
|
|
542
|
+
/** The signer's mobile. Any format; the engine normalises to E.164. */
|
|
543
|
+
phone?: string;
|
|
334
544
|
full_name: string;
|
|
335
545
|
role?: "signer" | "approver" | "witness" | "cc";
|
|
336
546
|
sign_order?: number;
|
|
@@ -364,7 +574,7 @@ export declare class SignSealer {
|
|
|
364
574
|
* The evidence bundle: the sealed PDF with the evidence package printed
|
|
365
575
|
* after the audit trail — every message, every webhook, the record's state
|
|
366
576
|
* — as one sealed file. Null before the document is executed, like `pdf`;
|
|
367
|
-
* `
|
|
577
|
+
* `document` has the answers and the trail before then.
|
|
368
578
|
*/
|
|
369
579
|
bundle(documentId: string): Promise<{
|
|
370
580
|
filename: string;
|
|
@@ -372,7 +582,7 @@ export declare class SignSealer {
|
|
|
372
582
|
seal: SealSummary | null;
|
|
373
583
|
} | null>;
|
|
374
584
|
workflows(): Promise<{
|
|
375
|
-
workflows:
|
|
585
|
+
workflows: Workflow[];
|
|
376
586
|
}>;
|
|
377
587
|
/** The QR code for a workflow's public form: its address, an SVG, and a 1024px PNG as base64. 404 with no public address. */
|
|
378
588
|
workflowQr(workflowId: string): Promise<{
|
|
@@ -389,6 +599,16 @@ export declare class SignSealer {
|
|
|
389
599
|
fields?: Record<string, string>;
|
|
390
600
|
values?: Record<string, string>;
|
|
391
601
|
external_ref?: string;
|
|
602
|
+
/** The template version the form was rendered from, for a start run with no network; 409 `template_changed` if it moved on. */
|
|
603
|
+
expected_template_version?: number;
|
|
604
|
+
/** The device's own clock and name, kept as a claim with the skew computed. */
|
|
605
|
+
captured?: {
|
|
606
|
+
offline: boolean;
|
|
607
|
+
at: string;
|
|
608
|
+
device: string;
|
|
609
|
+
};
|
|
610
|
+
/** Where the signed page sends the person afterwards: https, on a domain the business has proven (else 422). */
|
|
611
|
+
return_url?: string;
|
|
392
612
|
}, idempotencyKey?: string): Promise<StartedWorkflow>;
|
|
393
613
|
/**
|
|
394
614
|
* Import a reservation and its guests, and get back what is now required.
|
|
@@ -412,6 +632,13 @@ export declare class SignSealer {
|
|
|
412
632
|
packet: PacketSummary;
|
|
413
633
|
}>;
|
|
414
634
|
packet(packetId: string): Promise<unknown>;
|
|
635
|
+
/**
|
|
636
|
+
* A signing code from the receipt, resolved (00321): what is still owed,
|
|
637
|
+
* each item by first name and last initial. Only a paired tablet's own
|
|
638
|
+
* credential may ask; a code from another business, a code nobody holds
|
|
639
|
+
* and a malformed one answer `found: false` the same way.
|
|
640
|
+
*/
|
|
641
|
+
packetByCode(code: string): Promise<PacketLookup>;
|
|
415
642
|
startPacketItem(itemId: string, idempotencyKey?: string): Promise<StartedWorkflow>;
|
|
416
643
|
webhooks(): Promise<{
|
|
417
644
|
endpoints: unknown;
|
|
@@ -490,9 +717,51 @@ export declare class SignSealer {
|
|
|
490
717
|
platform?: "ios" | "android" | "other";
|
|
491
718
|
app_version?: string;
|
|
492
719
|
os_version?: string;
|
|
720
|
+
}): Promise<PairedDevice>;
|
|
721
|
+
/**
|
|
722
|
+
* Tablets, from your own software (00335).
|
|
723
|
+
*
|
|
724
|
+
* Everything the Apps & tablets page does: a platform that runs many
|
|
725
|
+
* businesses puts a tablet on each counter from its own back office. The
|
|
726
|
+
* key needs `signing:devices`. The pairing itself stays with `pairDevice`,
|
|
727
|
+
* which takes no key: the code is the credential.
|
|
728
|
+
*/
|
|
729
|
+
devices(): Promise<{
|
|
730
|
+
devices: Device[];
|
|
731
|
+
}>;
|
|
732
|
+
/** Add a tablet. The pairing code comes back once and never again. */
|
|
733
|
+
addDevice(input: {
|
|
734
|
+
name: string;
|
|
735
|
+
workflow_id?: string | null;
|
|
736
|
+
for_review?: boolean;
|
|
737
|
+
}): Promise<PairingCode>;
|
|
738
|
+
/** A new code for a tablet; any tablet paired to it stops the moment the code is made. */
|
|
739
|
+
newDeviceCode(id: string): Promise<PairingCode>;
|
|
740
|
+
/** Rename a tablet or change what it runs; `workflow_id: null` makes it a staff tablet. */
|
|
741
|
+
setDevice(id: string, input: {
|
|
742
|
+
name?: string;
|
|
743
|
+
workflow_id?: string | null;
|
|
493
744
|
}): Promise<{
|
|
494
|
-
|
|
495
|
-
|
|
745
|
+
updated: true;
|
|
746
|
+
}>;
|
|
747
|
+
/**
|
|
748
|
+
* Everything a tablet needs to run a workflow with no network (00336):
|
|
749
|
+
* the workflow, the published template with its version, the consent and
|
|
750
|
+
* intent wording with theirs, and the page list of an uploaded PDF. Keep
|
|
751
|
+
* it, render the form yourself when the connection is down, then start
|
|
752
|
+
* the workflow naming `expected_template_version`; a 409 `template_changed`
|
|
753
|
+
* means the form moved on and the customer signs again on the current one.
|
|
754
|
+
*/
|
|
755
|
+
workflowBundle(id: string): Promise<WorkflowBundle>;
|
|
756
|
+
/** One page of the workflow's PDF template as PNG bytes, for the same purpose. 404 for a text template. */
|
|
757
|
+
workflowPage(id: string, page: number): Promise<{
|
|
758
|
+
page: number;
|
|
759
|
+
contentType: string;
|
|
760
|
+
bytes: Uint8Array<ArrayBufferLike>;
|
|
761
|
+
}>;
|
|
762
|
+
/** Stop a tablet. Its credential stops with it; the reason goes on the audit trail. */
|
|
763
|
+
removeDevice(id: string, reason: string): Promise<{
|
|
764
|
+
revoked: true;
|
|
496
765
|
}>;
|
|
497
766
|
/**
|
|
498
767
|
* Say the device is still here, and read back what it should be running.
|
|
@@ -506,16 +775,72 @@ export declare class SignSealer {
|
|
|
506
775
|
deviceHeartbeat(input?: {
|
|
507
776
|
app_version?: string;
|
|
508
777
|
os_version?: string;
|
|
778
|
+
/** 00341: the queue's shape, so the fleet screen can say what is waiting on this tablet. */
|
|
779
|
+
queue_waiting?: number;
|
|
780
|
+
queue_refused?: number;
|
|
781
|
+
synced?: boolean;
|
|
509
782
|
}): Promise<Record<string, unknown>>;
|
|
783
|
+
/**
|
|
784
|
+
* A problem, as a tablet may state it (00341): names and numbers, never
|
|
785
|
+
* text. There is no field for a message, because a message is where a
|
|
786
|
+
* customer's name ends up. Thirty an hour per tablet.
|
|
787
|
+
*/
|
|
788
|
+
reportProblem(input: {
|
|
789
|
+
code: string;
|
|
790
|
+
screen?: string;
|
|
791
|
+
step?: string;
|
|
792
|
+
online?: boolean;
|
|
793
|
+
queue_waiting?: number;
|
|
794
|
+
http_status?: number;
|
|
795
|
+
app_version?: string;
|
|
796
|
+
os_version?: string;
|
|
797
|
+
}): Promise<{
|
|
798
|
+
report_id: string;
|
|
799
|
+
device_id: string;
|
|
800
|
+
}>;
|
|
510
801
|
}
|
|
511
802
|
export interface SigningLink {
|
|
512
803
|
ok: boolean;
|
|
513
804
|
/** Why it will not take a signature, in a sentence meant for a person. */
|
|
514
805
|
reason: string | null;
|
|
515
806
|
document_id: string | null;
|
|
807
|
+
document_status?: string | null;
|
|
516
808
|
title: string | null;
|
|
517
809
|
body: string | null;
|
|
810
|
+
/**
|
|
811
|
+
* How to draw `body` (00305). `markdown` uses headings, bold, italics and
|
|
812
|
+
* lists -- every starter template does -- and a page that prints it as
|
|
813
|
+
* text shows the signer `# Waiver` and `**What this covers.**`. The hash
|
|
814
|
+
* is over the text either way.
|
|
815
|
+
*/
|
|
816
|
+
body_format?: "text" | "markdown" | null;
|
|
518
817
|
body_sha256_hex: string | null;
|
|
818
|
+
/**
|
|
819
|
+
* The business asked for the questions first and the document after them
|
|
820
|
+
* (00393). Frozen onto the document when it was made. A page honouring it
|
|
821
|
+
* shows the document once no required visible question is left -- which is
|
|
822
|
+
* also exactly when a signature is accepted, so the two never disagree.
|
|
823
|
+
*/
|
|
824
|
+
document_after_questions?: boolean;
|
|
825
|
+
signer_id?: string | null;
|
|
826
|
+
signed_at?: string | null;
|
|
827
|
+
/** False when the business bought white label (00213): the page wears their name, not ours. */
|
|
828
|
+
powered_by?: boolean;
|
|
829
|
+
/** Their colours and logo when white label is on (00220); null otherwise. */
|
|
830
|
+
theme?: SigningTheme | null;
|
|
831
|
+
/** Their name and light logo (00264): it goes on the document, white label or not. */
|
|
832
|
+
mark?: {
|
|
833
|
+
tenant_id: string;
|
|
834
|
+
name: string;
|
|
835
|
+
logo: "svg" | "png" | null;
|
|
836
|
+
} | null;
|
|
837
|
+
/** Their address under the document (00265), when the template asks for it. */
|
|
838
|
+
footer?: {
|
|
839
|
+
name: string;
|
|
840
|
+
lines: string[];
|
|
841
|
+
} | null;
|
|
842
|
+
/** What the business asks for by way of ID evidence (00228); `idEvidence` reads it on its own. */
|
|
843
|
+
id_evidence?: Record<string, unknown> | null;
|
|
519
844
|
tenant_name: string | null;
|
|
520
845
|
full_name: string | null;
|
|
521
846
|
email: string | null;
|
|
@@ -550,21 +875,7 @@ export interface SigningLink {
|
|
|
550
875
|
code_sent_at?: string | null;
|
|
551
876
|
/** Everyone on the document — for "waiting on Dana", not for contacting them. */
|
|
552
877
|
signers?: unknown;
|
|
553
|
-
fields:
|
|
554
|
-
key: string;
|
|
555
|
-
label: string;
|
|
556
|
-
kind: string;
|
|
557
|
-
required: boolean;
|
|
558
|
-
about: string | null;
|
|
559
|
-
supplied: boolean;
|
|
560
|
-
/**
|
|
561
|
-
* Where this question sits on the document, when the template is an
|
|
562
|
-
* uploaded PDF. A fraction of the page a reader *sees*, origin top left,
|
|
563
|
-
* so it means the same thing at any image resolution and any screen
|
|
564
|
-
* width. Absent for a question asked underneath the document.
|
|
565
|
-
*/
|
|
566
|
-
place?: Place | null;
|
|
567
|
-
}>;
|
|
878
|
+
fields: SigningField[];
|
|
568
879
|
/**
|
|
569
880
|
* The pages of an uploaded PDF. Empty for a template that is words.
|
|
570
881
|
*
|
|
@@ -575,6 +886,64 @@ export interface SigningLink {
|
|
|
575
886
|
*/
|
|
576
887
|
pages?: Page[];
|
|
577
888
|
}
|
|
889
|
+
/** One question on a signing link, as the engine hands it to a page. */
|
|
890
|
+
export interface SigningField {
|
|
891
|
+
key: string;
|
|
892
|
+
label: string;
|
|
893
|
+
/** `text`, `paragraph`, `email`, `phone`, `address`, `number`, `date`, `birthdate`, `choice`, `checkbox`, `initials`, `signature`, `photo`. */
|
|
894
|
+
kind: string;
|
|
895
|
+
required: boolean;
|
|
896
|
+
about: string | null;
|
|
897
|
+
supplied: boolean;
|
|
898
|
+
hint?: string | null;
|
|
899
|
+
/** A choice's choices. */
|
|
900
|
+
options?: string[] | null;
|
|
901
|
+
sensitive?: boolean;
|
|
902
|
+
/**
|
|
903
|
+
* Where this question sits on the document, when the template is an
|
|
904
|
+
* uploaded PDF. A fraction of the page a reader *sees*, origin top left,
|
|
905
|
+
* so it means the same thing at any image resolution and any screen
|
|
906
|
+
* width. Absent for a question asked underneath the document.
|
|
907
|
+
*/
|
|
908
|
+
place?: Place | null;
|
|
909
|
+
/** The set of questions this one is asked with (00372), and whether it has a page of its own (00379). */
|
|
910
|
+
block?: FieldBlock | null;
|
|
911
|
+
/** The condition on an earlier answer (00375), for a page that wants to show why. */
|
|
912
|
+
show_if?: ShowIf | null;
|
|
913
|
+
/**
|
|
914
|
+
* The engine's own answer to `show_if`: draw only the visible questions. A
|
|
915
|
+
* hidden one is not required, and the signature gate reads this same value,
|
|
916
|
+
* so a page that follows it can never be refused for a question it hid.
|
|
917
|
+
*/
|
|
918
|
+
visible?: boolean;
|
|
919
|
+
/**
|
|
920
|
+
* 00399: the signer has been past it -- answered it, or left an optional
|
|
921
|
+
* one blank. A passed question is done for a page's purposes; only
|
|
922
|
+
* `supplied` says an answer was given. Absent from a server before it.
|
|
923
|
+
*/
|
|
924
|
+
passed?: boolean;
|
|
925
|
+
}
|
|
926
|
+
/** A set of questions asked as one thing, under one heading. */
|
|
927
|
+
export interface FieldBlock {
|
|
928
|
+
key: string;
|
|
929
|
+
label: string | null;
|
|
930
|
+
intro: string | null;
|
|
931
|
+
/** True when the block gets a page of its own, with a Next button. */
|
|
932
|
+
step: boolean | null;
|
|
933
|
+
}
|
|
934
|
+
/** A white-label business's colours and logo on its signing page (00220). */
|
|
935
|
+
export interface SigningTheme {
|
|
936
|
+
tenant_id: string;
|
|
937
|
+
name: string;
|
|
938
|
+
primary_color: string;
|
|
939
|
+
accent_color: string;
|
|
940
|
+
background_color: string;
|
|
941
|
+
text_color: string;
|
|
942
|
+
button_text_color: string;
|
|
943
|
+
logo: "svg" | "png" | null;
|
|
944
|
+
logo_dark: "svg" | "png" | null;
|
|
945
|
+
footer_text: string | null;
|
|
946
|
+
}
|
|
578
947
|
/** A rectangle on a page, in fractions of the page a reader sees. */
|
|
579
948
|
export interface Place {
|
|
580
949
|
page: number;
|
|
@@ -590,6 +959,132 @@ export interface Page {
|
|
|
590
959
|
height: number;
|
|
591
960
|
}
|
|
592
961
|
/** What a device says about when something happened, when it happened offline. */
|
|
962
|
+
/** What pairing hands back: the tablet's own credential, its name and its workflow. */
|
|
963
|
+
export interface PairedDevice {
|
|
964
|
+
device_id: string;
|
|
965
|
+
name: string;
|
|
966
|
+
key: string;
|
|
967
|
+
workflow_id: string | null;
|
|
968
|
+
workflow_name: string | null;
|
|
969
|
+
}
|
|
970
|
+
/** A pairing code, shown once. `review` codes last thirty days; the rest fifteen minutes. */
|
|
971
|
+
export interface PairingCode {
|
|
972
|
+
id: string;
|
|
973
|
+
code: string;
|
|
974
|
+
expires_at: string;
|
|
975
|
+
review: boolean;
|
|
976
|
+
}
|
|
977
|
+
/** Words a signer is shown and the engine records, by reference and fingerprint. */
|
|
978
|
+
export interface BundleDisclosure {
|
|
979
|
+
ref: string;
|
|
980
|
+
text: string;
|
|
981
|
+
sha256: string;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* A question as the form on a tablet carries it (00398), in the template's
|
|
985
|
+
* order. A section's heading, sentence and step are written as the template
|
|
986
|
+
* writes them: once, on whichever of its questions declares them first.
|
|
987
|
+
*/
|
|
988
|
+
export interface BundleQuestion {
|
|
989
|
+
key: string;
|
|
990
|
+
label: string;
|
|
991
|
+
kind: string;
|
|
992
|
+
required: boolean;
|
|
993
|
+
hint: string | null;
|
|
994
|
+
options: string[] | null;
|
|
995
|
+
show_if: ShowIf | null;
|
|
996
|
+
block: string | null;
|
|
997
|
+
block_label: string | null;
|
|
998
|
+
block_intro: string | null;
|
|
999
|
+
block_step: boolean | null;
|
|
1000
|
+
/** Placed on the document's pages (00399): answered with the document in view, so never asked before it. */
|
|
1001
|
+
placed: boolean;
|
|
1002
|
+
}
|
|
1003
|
+
/** What a tablet keeps to run a workflow offline (00336). */
|
|
1004
|
+
export interface WorkflowBundle {
|
|
1005
|
+
workflow: {
|
|
1006
|
+
id: string;
|
|
1007
|
+
code: string;
|
|
1008
|
+
name: string;
|
|
1009
|
+
kind: string;
|
|
1010
|
+
intro: string | null;
|
|
1011
|
+
form_fields: Array<{
|
|
1012
|
+
key: string;
|
|
1013
|
+
label: string;
|
|
1014
|
+
required?: boolean;
|
|
1015
|
+
}>;
|
|
1016
|
+
signer_roles: unknown[];
|
|
1017
|
+
sequential: boolean;
|
|
1018
|
+
countersign: boolean;
|
|
1019
|
+
};
|
|
1020
|
+
template: {
|
|
1021
|
+
id: string;
|
|
1022
|
+
code: string;
|
|
1023
|
+
name: string;
|
|
1024
|
+
kind: string;
|
|
1025
|
+
version: number;
|
|
1026
|
+
variables: string[];
|
|
1027
|
+
body: string | null;
|
|
1028
|
+
body_sha256: string;
|
|
1029
|
+
/** 00364: `markdown` is drawn as headings and lists, not as marks. */
|
|
1030
|
+
body_format?: "text" | "markdown";
|
|
1031
|
+
};
|
|
1032
|
+
consent: {
|
|
1033
|
+
text: string;
|
|
1034
|
+
version: string;
|
|
1035
|
+
};
|
|
1036
|
+
intent: {
|
|
1037
|
+
text: string;
|
|
1038
|
+
version: string;
|
|
1039
|
+
};
|
|
1040
|
+
/** 00339: what the counter offers by way of an ID photo, with the words for it. */
|
|
1041
|
+
id_evidence?: {
|
|
1042
|
+
offered: "off" | "id" | "id_selfie";
|
|
1043
|
+
id_disclosure: BundleDisclosure | null;
|
|
1044
|
+
selfie_disclosure: BundleDisclosure | null;
|
|
1045
|
+
};
|
|
1046
|
+
/** 00363: whether the counter asks where the customer is, with the words for it. */
|
|
1047
|
+
location?: {
|
|
1048
|
+
offered: "off" | "ask";
|
|
1049
|
+
disclosure: BundleDisclosure | null;
|
|
1050
|
+
};
|
|
1051
|
+
business_name: string;
|
|
1052
|
+
pages: Array<{
|
|
1053
|
+
n: number;
|
|
1054
|
+
width: number;
|
|
1055
|
+
height: number;
|
|
1056
|
+
}>;
|
|
1057
|
+
/** 00342: the photographs the template asks the signer at the counter for. */
|
|
1058
|
+
photos?: Array<{
|
|
1059
|
+
key: string;
|
|
1060
|
+
label: string;
|
|
1061
|
+
hint: string | null;
|
|
1062
|
+
required: boolean;
|
|
1063
|
+
}>;
|
|
1064
|
+
/** 00398: every question the template asks the signer at the counter, photographs included. */
|
|
1065
|
+
questions?: BundleQuestion[];
|
|
1066
|
+
/** 00393, 00398: ask the questions first and show the document after them. */
|
|
1067
|
+
document_after_questions?: boolean;
|
|
1068
|
+
fetched_at: string;
|
|
1069
|
+
}
|
|
1070
|
+
/** A tablet as the account sees it. Never carries a pairing code. */
|
|
1071
|
+
export interface Device {
|
|
1072
|
+
id: string;
|
|
1073
|
+
name: string;
|
|
1074
|
+
workflow_id: string | null;
|
|
1075
|
+
workflow_name: string | null;
|
|
1076
|
+
paired: boolean;
|
|
1077
|
+
paired_at: string | null;
|
|
1078
|
+
platform: "ios" | "android" | "other" | null;
|
|
1079
|
+
app_version: string | null;
|
|
1080
|
+
os_version: string | null;
|
|
1081
|
+
last_seen_at: string | null;
|
|
1082
|
+
revoked_at: string | null;
|
|
1083
|
+
revoke_reason: string | null;
|
|
1084
|
+
pairing_open: boolean;
|
|
1085
|
+
pair_expires_at: string | null;
|
|
1086
|
+
review?: boolean;
|
|
1087
|
+
}
|
|
593
1088
|
export interface Captured {
|
|
594
1089
|
offline?: boolean;
|
|
595
1090
|
/** ISO 8601. Recorded as a claim beside our own received time. */
|
|
@@ -668,6 +1163,68 @@ export declare class SignSealerSigning {
|
|
|
668
1163
|
supply(token: string, key: string, value: string, about?: string): Promise<{
|
|
669
1164
|
supplied: true;
|
|
670
1165
|
}>;
|
|
1166
|
+
/**
|
|
1167
|
+
* A photograph as a field's answer (00342): a JPEG or PNG for a field of
|
|
1168
|
+
* kind `photo`, shrunk on the server, kept encrypted with the document
|
|
1169
|
+
* for as long as the document is kept; the field carries its hash. A
|
|
1170
|
+
* second photograph replaces the first.
|
|
1171
|
+
*/
|
|
1172
|
+
supplyPhoto(token: string, key: string, image: {
|
|
1173
|
+
contentType: string;
|
|
1174
|
+
bytes: Uint8Array | string;
|
|
1175
|
+
}, options?: {
|
|
1176
|
+
about?: string;
|
|
1177
|
+
captured?: Captured;
|
|
1178
|
+
}): Promise<{
|
|
1179
|
+
supplied: true;
|
|
1180
|
+
key: string;
|
|
1181
|
+
sha256: string;
|
|
1182
|
+
}>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Whether the business asks where the signer is (00231), and the wording
|
|
1185
|
+
* the capture is taken under. `mode` is `off`, `ask` or `require`;
|
|
1186
|
+
* `require` means the signature is refused until an answer is on record.
|
|
1187
|
+
*
|
|
1188
|
+
* Show `disclosure.text` before you ask the device, not after.
|
|
1189
|
+
*/
|
|
1190
|
+
location(token: string): Promise<Record<string, unknown> | null>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Where the signer is, or that they would not say.
|
|
1193
|
+
*
|
|
1194
|
+
* Send the refusal too. Under `require` the engine waits for an *answer*,
|
|
1195
|
+
* and a decline is one — so a person who says no, or a device that cannot
|
|
1196
|
+
* get a fix, is told here rather than at the signature, which is the last
|
|
1197
|
+
* screen and the worst place to find out.
|
|
1198
|
+
*/
|
|
1199
|
+
recordLocation(token: string, position: {
|
|
1200
|
+
shared: false;
|
|
1201
|
+
} | {
|
|
1202
|
+
shared: true;
|
|
1203
|
+
lat: number;
|
|
1204
|
+
lon: number;
|
|
1205
|
+
accuracyM?: number;
|
|
1206
|
+
}): Promise<{
|
|
1207
|
+
shared: boolean;
|
|
1208
|
+
}>;
|
|
1209
|
+
/**
|
|
1210
|
+
* What the business asks the signer for by way of ID evidence (00228,
|
|
1211
|
+
* 00339): the mode, what is captured so far by hash, and the words each
|
|
1212
|
+
* capture is taken under. Never an identity check, and never the image.
|
|
1213
|
+
*/
|
|
1214
|
+
idEvidence(token: string): Promise<Record<string, unknown> | null>;
|
|
1215
|
+
/**
|
|
1216
|
+
* A photo of the ID, or of the person, when the business asked (00339).
|
|
1217
|
+
* Kept encrypted for thirty days, the hash on the trail. Refused when
|
|
1218
|
+
* the business did not ask.
|
|
1219
|
+
*/
|
|
1220
|
+
captureIdEvidence(token: string, kind: "id" | "selfie", image: {
|
|
1221
|
+
contentType: string;
|
|
1222
|
+
bytes: Uint8Array | string;
|
|
1223
|
+
}, captured?: Captured): Promise<{
|
|
1224
|
+
captured: true;
|
|
1225
|
+
kind: string;
|
|
1226
|
+
sha256: string;
|
|
1227
|
+
}>;
|
|
671
1228
|
sign(token: string, method: "typed" | "drawn" | "clicked" | "uploaded", value: string, captured?: Captured): Promise<{
|
|
672
1229
|
event_id: string;
|
|
673
1230
|
}>;
|