@composable-os/client 0.1.0-beta.10 → 0.1.0-beta.13
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/account.d.ts +1461 -0
- package/dist/account.js +845 -0
- package/dist/agreements.d.ts +529 -0
- package/dist/agreements.js +518 -0
- package/dist/binding.d.ts +27 -0
- package/dist/binding.js +52 -9
- package/dist/client.d.ts +1 -0
- package/dist/client.js +7 -4
- package/dist/hooks.d.ts +50 -5
- package/dist/hooks.js +14 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/notes.d.ts +169 -0
- package/dist/notes.js +108 -0
- package/dist/owner.d.ts +686 -0
- package/dist/owner.js +197 -0
- package/dist/session.d.ts +13 -0
- package/dist/session.js +46 -1
- package/package.json +1 -1
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { type ClientHolding, type PackClient } from "./hooks.ts";
|
|
2
|
+
/** One question of a health form. */
|
|
3
|
+
export interface AgreementQuestion {
|
|
4
|
+
key: string;
|
|
5
|
+
text: string;
|
|
6
|
+
noteOnYes: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** A version as a person reads it before agreeing: the exact words recorded with their agreement. */
|
|
9
|
+
export interface AgreementVersion {
|
|
10
|
+
id: string;
|
|
11
|
+
documentId: string;
|
|
12
|
+
number: number;
|
|
13
|
+
kind: string;
|
|
14
|
+
title: string;
|
|
15
|
+
/** Rich text (ADR 0440), without pictures, embeds or buttons. */
|
|
16
|
+
body: unknown;
|
|
17
|
+
tickLabel: string;
|
|
18
|
+
questions: AgreementQuestion[] | null;
|
|
19
|
+
/** Tick and type a name, or type a name and draw a signature: the business's choice. */
|
|
20
|
+
how: "typed" | "drawn";
|
|
21
|
+
effectiveFrom: string;
|
|
22
|
+
hash: string;
|
|
23
|
+
}
|
|
24
|
+
/** Why a document is due: never agreed, "agree again", asked again after a while, or a guardian's. */
|
|
25
|
+
export type DueReason = "never" | "agree_again" | "ask_again" | "guardian";
|
|
26
|
+
export interface DueDocument {
|
|
27
|
+
documentId: string;
|
|
28
|
+
kind: string;
|
|
29
|
+
title: string;
|
|
30
|
+
reason: DueReason;
|
|
31
|
+
version: AgreementVersion;
|
|
32
|
+
}
|
|
33
|
+
/** The caller, or a child linked to them, and what they still have to agree to. */
|
|
34
|
+
export interface DuePerson {
|
|
35
|
+
personId: string;
|
|
36
|
+
name: string;
|
|
37
|
+
self: boolean;
|
|
38
|
+
/** False for a person a parent or guardian agrees for: the host refuses their own agreement. */
|
|
39
|
+
canAgree: boolean;
|
|
40
|
+
due: DueDocument[];
|
|
41
|
+
}
|
|
42
|
+
/** A drawn signature: integer points in a 1000 by 400 box (the host's format, ADR 0642). */
|
|
43
|
+
export interface Signature {
|
|
44
|
+
width: 1000;
|
|
45
|
+
height: 400;
|
|
46
|
+
strokes: [number, number][][];
|
|
47
|
+
}
|
|
48
|
+
export interface HealthAnswer {
|
|
49
|
+
key: string;
|
|
50
|
+
yes: boolean;
|
|
51
|
+
note?: string;
|
|
52
|
+
}
|
|
53
|
+
/** What agreeing to one version sends: the version shown, and what the person gave. */
|
|
54
|
+
export type AgreeInput = {
|
|
55
|
+
versionId: string;
|
|
56
|
+
typedName: string;
|
|
57
|
+
signature?: Signature;
|
|
58
|
+
answers?: HealthAnswer[];
|
|
59
|
+
};
|
|
60
|
+
export interface AcceptanceSummary {
|
|
61
|
+
id: string;
|
|
62
|
+
documentId: string;
|
|
63
|
+
title: string;
|
|
64
|
+
kind: string;
|
|
65
|
+
versionId: string;
|
|
66
|
+
versionNumber: number;
|
|
67
|
+
personId: string | null;
|
|
68
|
+
by: "self" | "guardian" | "guest" | "paper";
|
|
69
|
+
how: "typed" | "drawn" | "paper";
|
|
70
|
+
channel: "web" | "app" | "paper" | "desk";
|
|
71
|
+
acceptedAt: string;
|
|
72
|
+
/** The guardian who agreed, shown only to that guardian. */
|
|
73
|
+
agentPersonId: string | null;
|
|
74
|
+
recordedBy: string | null;
|
|
75
|
+
signedOn: string | null;
|
|
76
|
+
/** Whether it is the acceptance that counts for its document now. */
|
|
77
|
+
counts: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface AcceptanceDetail extends AcceptanceSummary {
|
|
80
|
+
version: AgreementVersion;
|
|
81
|
+
/** Shown only to whoever agreed. */
|
|
82
|
+
typedName: string | null;
|
|
83
|
+
signature: Signature | null;
|
|
84
|
+
answers: HealthAnswer[] | null;
|
|
85
|
+
}
|
|
86
|
+
export interface Accepted {
|
|
87
|
+
id: string;
|
|
88
|
+
documentId: string;
|
|
89
|
+
versionNumber: number;
|
|
90
|
+
acceptedAt: string;
|
|
91
|
+
/** The address the copy goes to, or null when none is sent. */
|
|
92
|
+
copyTo?: string | null;
|
|
93
|
+
}
|
|
94
|
+
/** The operations this entry calls, as the generated client types them. */
|
|
95
|
+
export type AgreementsOperations = {
|
|
96
|
+
"me.agreements.due": {
|
|
97
|
+
kind: "query";
|
|
98
|
+
input: Record<string, never>;
|
|
99
|
+
output: {
|
|
100
|
+
people: DuePerson[];
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
"me.agreements.list": {
|
|
104
|
+
kind: "query";
|
|
105
|
+
input: Record<string, never>;
|
|
106
|
+
output: {
|
|
107
|
+
items: AcceptanceSummary[];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
"me.agreements.get": {
|
|
111
|
+
kind: "query";
|
|
112
|
+
input: {
|
|
113
|
+
id: string;
|
|
114
|
+
};
|
|
115
|
+
output: AcceptanceDetail;
|
|
116
|
+
};
|
|
117
|
+
"me.agreements.accept": {
|
|
118
|
+
kind: "mutation";
|
|
119
|
+
input: AgreeInput & {
|
|
120
|
+
forPersonId?: string;
|
|
121
|
+
};
|
|
122
|
+
output: Accepted;
|
|
123
|
+
};
|
|
124
|
+
"agreement.guestVersions": {
|
|
125
|
+
kind: "query";
|
|
126
|
+
input: {
|
|
127
|
+
versionIds: string[];
|
|
128
|
+
};
|
|
129
|
+
output: {
|
|
130
|
+
versions: AgreementVersion[];
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export type AgreementsClient = PackClient<AgreementsOperations>;
|
|
135
|
+
/** A document a refusal names: its version to read, and whose it is (none for a visitor). */
|
|
136
|
+
export interface RefusedDocument {
|
|
137
|
+
documentId: string;
|
|
138
|
+
title: string;
|
|
139
|
+
versionId: string;
|
|
140
|
+
personId: string | null;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Why the host refused, as far as agreements go:
|
|
144
|
+
* - `due`: something must be agreed to first (the documents);
|
|
145
|
+
* - `minor_payer`: the person is a minor and the payer must agree: a parent or guardian buys it;
|
|
146
|
+
* - `changed`: what is due changed while the call was being made: ask again and try once more;
|
|
147
|
+
* - `read_again`: what was agreed to is not what is asked now (a visitor's agreements for an older
|
|
148
|
+
* version, or a version replaced while the person read it): read what is due again.
|
|
149
|
+
*/
|
|
150
|
+
export type AgreementRefusal = {
|
|
151
|
+
kind: "due";
|
|
152
|
+
message: string;
|
|
153
|
+
documents: RefusedDocument[];
|
|
154
|
+
} | {
|
|
155
|
+
kind: "minor_payer";
|
|
156
|
+
message: string;
|
|
157
|
+
documents: RefusedDocument[];
|
|
158
|
+
} | {
|
|
159
|
+
kind: "changed";
|
|
160
|
+
message: string;
|
|
161
|
+
} | {
|
|
162
|
+
kind: "read_again";
|
|
163
|
+
message: string;
|
|
164
|
+
};
|
|
165
|
+
export declare const MINOR_PAYER_WORDS = "A parent or guardian needs to buy this for you.";
|
|
166
|
+
/**
|
|
167
|
+
* Reads an error from a call that buys, subscribes or books (order.start, subscription.start, a
|
|
168
|
+
* pack's buy or book tool): the host's agreements refusal, or null when it is not one.
|
|
169
|
+
*/
|
|
170
|
+
export declare function agreementRefusal(error: unknown): AgreementRefusal | null;
|
|
171
|
+
/** Said where a screen that buys has no agreement step (a client app's own screen). */
|
|
172
|
+
export declare const NO_AGREEMENT_STEP_WORDS = "This needs an agreement that can't be given here yet. Ask the business how to agree to it first.";
|
|
173
|
+
/**
|
|
174
|
+
* For a screen that buys but cannot show the agreement step: the words for the host's refusal of
|
|
175
|
+
* what must be agreed to first (or for a minor, a parent or guardian buys it), or null when the
|
|
176
|
+
* error is something else.
|
|
177
|
+
*/
|
|
178
|
+
export declare function agreementBlockedWords(error: unknown): string | null;
|
|
179
|
+
/**
|
|
180
|
+
* Makes a mutation's call and then forgets it: the mutation's state (its variables: a name typed,
|
|
181
|
+
* a signature, health answers) is reset whether the call succeeded or failed, so the app's cache
|
|
182
|
+
* holds none of it once the call is over. What the person entered stays only in the screen's own
|
|
183
|
+
* state, for as long as the screen needs it.
|
|
184
|
+
*/
|
|
185
|
+
export declare function forgetAfter<I, O>(mutation: {
|
|
186
|
+
mutateAsync(input: I): Promise<O>;
|
|
187
|
+
reset?: () => void;
|
|
188
|
+
}, input: I): Promise<O>;
|
|
189
|
+
/**
|
|
190
|
+
* What to tell a person whose purchase or booking did not go through, as far as agreements and the
|
|
191
|
+
* connection go: null for anything else (the screen says its own words).
|
|
192
|
+
*/
|
|
193
|
+
export declare function purchaseErrorWords(error: unknown): string | null;
|
|
194
|
+
/** What a call made with what is due came to. */
|
|
195
|
+
export type AgreementsOutcome<T> = {
|
|
196
|
+
kind: "done";
|
|
197
|
+
value: T;
|
|
198
|
+
} | {
|
|
199
|
+
kind: "due";
|
|
200
|
+
documents: RefusedDocument[];
|
|
201
|
+
} | {
|
|
202
|
+
kind: "minor_payer";
|
|
203
|
+
message: string;
|
|
204
|
+
documents: RefusedDocument[];
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Makes a buying or booking call and reads the host's answer for agreements. When what is due
|
|
208
|
+
* changed while it was made (`changed`), or a visitor's agreements were for an older version
|
|
209
|
+
* (`read_again`), it calls once more, told why (a visitor drops what is stale on `read_again`);
|
|
210
|
+
* a second such refusal is thrown. Any other error is thrown as it is.
|
|
211
|
+
*/
|
|
212
|
+
export declare function withAgreements<T>(call: (previous: AgreementRefusal | null) => Promise<T>): Promise<AgreementsOutcome<T>>;
|
|
213
|
+
/**
|
|
214
|
+
* The documents a refusal named, matched to what `me.agreements.due` says for each person: what a
|
|
215
|
+
* signed-in member (or a guardian, for a child) reads and agrees to inline. A document no longer
|
|
216
|
+
* due is left out; a person who cannot agree themselves comes back with `canAgree: false`.
|
|
217
|
+
*/
|
|
218
|
+
export declare function dueForRefusal(people: readonly DuePerson[], documents: readonly RefusedDocument[]): {
|
|
219
|
+
person: DuePerson;
|
|
220
|
+
item: DueDocument;
|
|
221
|
+
}[];
|
|
222
|
+
/** "Before you go on": each due document in turn, the caller's first, then each child's. */
|
|
223
|
+
export declare function dueSteps(people: readonly DuePerson[]): {
|
|
224
|
+
person: DuePerson;
|
|
225
|
+
item: DueDocument;
|
|
226
|
+
}[];
|
|
227
|
+
/** Why a document is asked of a person, in words, or null for a first time. */
|
|
228
|
+
export declare function dueReasonWords(reason: DueReason): string | null;
|
|
229
|
+
/** How an acceptance was made, for the person or a guardian reading it ("Agreed by you"). */
|
|
230
|
+
export declare function agreedByWords(acceptance: AcceptanceSummary, me: string | null): string;
|
|
231
|
+
/** "A copy is on its way to …", or a plain confirmation when no copy is sent. */
|
|
232
|
+
export declare function copyWords(accepted: Pick<Accepted, "copyTo">): string;
|
|
233
|
+
/**
|
|
234
|
+
* What to tell a person whose agreeing did not go through: in plain words, never a value they
|
|
235
|
+
* gave (the host's messages name a rule only).
|
|
236
|
+
*/
|
|
237
|
+
export declare function agreeErrorWords(error: unknown): string;
|
|
238
|
+
/** A moment in the person's own zone, for display ("24 Nov 2026, 09:30"). */
|
|
239
|
+
export declare function agreementTime(iso: string, locale?: string): string;
|
|
240
|
+
/** Where a person's own signed PDF downloads from on the app's site (the host's route, ADR 0645). */
|
|
241
|
+
export declare function agreementPdfPath(acceptanceId: string): string;
|
|
242
|
+
/** One run of text, as rich text holds it (ADR 0440). */
|
|
243
|
+
export interface AgreementRun {
|
|
244
|
+
type: "text" | "break";
|
|
245
|
+
text?: string;
|
|
246
|
+
bold?: boolean;
|
|
247
|
+
italic?: boolean;
|
|
248
|
+
code?: boolean;
|
|
249
|
+
href?: string;
|
|
250
|
+
}
|
|
251
|
+
/** A block of a document's body that a person reads: everything a version may hold. */
|
|
252
|
+
export type AgreementBlock = {
|
|
253
|
+
type: "paragraph";
|
|
254
|
+
content: AgreementRun[];
|
|
255
|
+
} | {
|
|
256
|
+
type: "heading";
|
|
257
|
+
level: number;
|
|
258
|
+
content: AgreementRun[];
|
|
259
|
+
} | {
|
|
260
|
+
type: "list";
|
|
261
|
+
style: "bullet" | "ordered";
|
|
262
|
+
items: AgreementListItem[];
|
|
263
|
+
} | {
|
|
264
|
+
type: "quote";
|
|
265
|
+
content: AgreementRun[];
|
|
266
|
+
attribution?: string;
|
|
267
|
+
} | {
|
|
268
|
+
type: "callout";
|
|
269
|
+
tone: string;
|
|
270
|
+
content: AgreementRun[];
|
|
271
|
+
} | {
|
|
272
|
+
type: "divider";
|
|
273
|
+
};
|
|
274
|
+
export interface AgreementListItem {
|
|
275
|
+
content: AgreementRun[];
|
|
276
|
+
list?: {
|
|
277
|
+
style: "bullet" | "ordered";
|
|
278
|
+
items: AgreementListItem[];
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The blocks of a version's body a screen draws. A body holds no picture, embed or button (the
|
|
283
|
+
* host refuses them at publish); anything not known here is left out rather than guessed at.
|
|
284
|
+
*/
|
|
285
|
+
export declare function documentBlocks(body: unknown): AgreementBlock[];
|
|
286
|
+
/** A run's text: a link shows its address in full (the host allows only a link whose text it is). */
|
|
287
|
+
export declare function runText(run: AgreementRun): string;
|
|
288
|
+
/** What the person has given so far, before they agree. In memory only. */
|
|
289
|
+
export interface AgreeForm {
|
|
290
|
+
ticked: boolean;
|
|
291
|
+
typedName: string;
|
|
292
|
+
/** Each question's answer by key: yes, no, or not answered yet, and a note on a yes. */
|
|
293
|
+
answers: Record<string, {
|
|
294
|
+
yes: boolean | null;
|
|
295
|
+
note: string;
|
|
296
|
+
}>;
|
|
297
|
+
}
|
|
298
|
+
export declare function emptyAgreeForm(version: Pick<AgreementVersion, "questions">): AgreeForm;
|
|
299
|
+
/** A field the person still has to fill in: the box, the name, an answer, a note, the signature. */
|
|
300
|
+
export interface AgreeProblem {
|
|
301
|
+
field: string;
|
|
302
|
+
message: string;
|
|
303
|
+
}
|
|
304
|
+
/** The longest name and note the host takes (it checks again). */
|
|
305
|
+
export declare const TYPED_NAME_MAX = 200;
|
|
306
|
+
export declare const NOTE_MAX = 1000;
|
|
307
|
+
/** What is missing before agreeing, field by field, in the order the screen shows them. */
|
|
308
|
+
export declare function agreeProblems(version: Pick<AgreementVersion, "questions" | "how" | "tickLabel">, form: AgreeForm, signature: Signature | null): AgreeProblem[];
|
|
309
|
+
/** The call's input: the version the screen showed, and only what this version asks for. */
|
|
310
|
+
export declare function agreeInput(version: Pick<AgreementVersion, "id" | "questions" | "how">, form: AgreeForm, signature: Signature | null): AgreeInput;
|
|
311
|
+
/** The box a signature is drawn in, and the most it may hold (the host's limits, ADR 0642). */
|
|
312
|
+
export declare const SIGNATURE_BOX: {
|
|
313
|
+
readonly width: 1000;
|
|
314
|
+
readonly height: 400;
|
|
315
|
+
};
|
|
316
|
+
export declare const SIGNATURE_LIMITS: {
|
|
317
|
+
readonly strokes: 30;
|
|
318
|
+
readonly points: 5000;
|
|
319
|
+
readonly bytes: 32768;
|
|
320
|
+
/** The least ink, in box units, the host takes as a signature (not a dot or a tap). */
|
|
321
|
+
readonly minLength: 120;
|
|
322
|
+
};
|
|
323
|
+
/** The length of the lines a signature draws (a dot draws none). */
|
|
324
|
+
export declare function inkLength(strokes: readonly (readonly (readonly [number, number])[])[]): number;
|
|
325
|
+
/** Whether a signature has the ink the host takes as one (it checks again). */
|
|
326
|
+
export declare function signatureEnough(signature: Signature | null): boolean;
|
|
327
|
+
/**
|
|
328
|
+
* A point on the drawing area, in the signature's box: `x` and `y` are the pointer's position
|
|
329
|
+
* relative to the area's top-left corner, `width` and `height` the area's size on screen.
|
|
330
|
+
* Integer, and kept inside the box.
|
|
331
|
+
*/
|
|
332
|
+
export declare function boxPoint(x: number, y: number, width: number, height: number): [number, number];
|
|
333
|
+
/**
|
|
334
|
+
* Records a drawn signature as the host takes it: strokes of integer points in the box, within
|
|
335
|
+
* its limits on strokes, points and size. Drawing past a limit stops adding (`full`), so what is
|
|
336
|
+
* sent is never refused for its size. The web pad feeds it pointer events, the native one its
|
|
337
|
+
* touch responder's.
|
|
338
|
+
*/
|
|
339
|
+
export declare class StrokeRecorder {
|
|
340
|
+
private lines;
|
|
341
|
+
private points;
|
|
342
|
+
private bytes;
|
|
343
|
+
private drawing;
|
|
344
|
+
/** The pointer drawing the stroke now (a finger, a pen): others are ignored until it lifts. */
|
|
345
|
+
private active;
|
|
346
|
+
/** Drawing went past a limit: nothing more is added until it is cleared. */
|
|
347
|
+
full: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* A new stroke at `point` (a pen, a finger or the mouse button down). `pointer` names the
|
|
350
|
+
* pointer: while one is drawing, another (a second finger, a palm) starts nothing. False when
|
|
351
|
+
* nothing was started.
|
|
352
|
+
*/
|
|
353
|
+
begin(point: readonly [number, number], pointer?: number): boolean;
|
|
354
|
+
/** The stroke goes on to `point`. False when nothing was added (another pointer's move too). */
|
|
355
|
+
extend(point: readonly [number, number], pointer?: number): boolean;
|
|
356
|
+
/** The pen, finger or button is lifted (another pointer lifting ends nothing). */
|
|
357
|
+
end(pointer?: number): void;
|
|
358
|
+
/** Starts again, with nothing drawn. */
|
|
359
|
+
clear(): void;
|
|
360
|
+
/** The strokes so far (for drawing them on screen). */
|
|
361
|
+
get strokes(): readonly (readonly [number, number])[][];
|
|
362
|
+
/** The signature to send, or null when nothing is drawn. */
|
|
363
|
+
signature(): Signature | null;
|
|
364
|
+
}
|
|
365
|
+
/** An SVG path for one stroke, in the box's units ("M x y L x y …"; a dot is a short line). */
|
|
366
|
+
export declare function strokePath(stroke: readonly (readonly [number, number])[]): string;
|
|
367
|
+
/** The app's `useQuery`, as far as these hooks use it. */
|
|
368
|
+
export type AgreementsUseQuery = <T>(options: {
|
|
369
|
+
queryKey: readonly unknown[];
|
|
370
|
+
queryFn: () => Promise<T>;
|
|
371
|
+
enabled?: boolean;
|
|
372
|
+
gcTime?: number;
|
|
373
|
+
}) => {
|
|
374
|
+
data: T | undefined;
|
|
375
|
+
isPending: boolean;
|
|
376
|
+
error: unknown;
|
|
377
|
+
refetch?: () => unknown;
|
|
378
|
+
};
|
|
379
|
+
/** The app's `useMutation`, as far as these hooks use it. */
|
|
380
|
+
export type AgreementsUseMutation = <I, O>(options: {
|
|
381
|
+
mutationKey: readonly unknown[];
|
|
382
|
+
mutationFn: (input: I) => Promise<O>;
|
|
383
|
+
gcTime?: number;
|
|
384
|
+
}) => {
|
|
385
|
+
mutate(input: I): void;
|
|
386
|
+
mutateAsync(input: I): Promise<O>;
|
|
387
|
+
data: O | undefined;
|
|
388
|
+
isPending: boolean;
|
|
389
|
+
error: unknown;
|
|
390
|
+
reset?: () => void;
|
|
391
|
+
};
|
|
392
|
+
/** The operations each hook calls (ADR 0453). */
|
|
393
|
+
export declare const AGREEMENTS_HOOKS_CALL: {
|
|
394
|
+
readonly useDue: readonly ["me.agreements.due"];
|
|
395
|
+
readonly useMine: readonly ["me.agreements.list"];
|
|
396
|
+
readonly useAcceptance: readonly ["me.agreements.get"];
|
|
397
|
+
readonly useAccept: readonly ["me.agreements.accept"];
|
|
398
|
+
readonly useGuestVersions: readonly ["agreement.guestVersions"];
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* Hooks for a React or React Native app:
|
|
402
|
+
* `const agreements = createAgreementsHooks({ useQuery, useMutation }, api)`, with the customer's
|
|
403
|
+
* generated client. The hooks it cannot back are not there.
|
|
404
|
+
*/
|
|
405
|
+
export declare function createAgreementsHooks<C extends ClientHolding>(react: {
|
|
406
|
+
useQuery: AgreementsUseQuery;
|
|
407
|
+
useMutation: AgreementsUseMutation;
|
|
408
|
+
}, client: C): import("./hooks.ts").HooksFor<{
|
|
409
|
+
/** What the signed-in customer, and each child linked to them, still has to agree to. */
|
|
410
|
+
useDue(): {
|
|
411
|
+
data: {
|
|
412
|
+
people: DuePerson[];
|
|
413
|
+
} | undefined;
|
|
414
|
+
isPending: boolean;
|
|
415
|
+
error: unknown;
|
|
416
|
+
refetch?: () => unknown;
|
|
417
|
+
};
|
|
418
|
+
/** Their agreements and their children's, newest first. */
|
|
419
|
+
useMine(): {
|
|
420
|
+
data: {
|
|
421
|
+
items: AcceptanceSummary[];
|
|
422
|
+
} | undefined;
|
|
423
|
+
isPending: boolean;
|
|
424
|
+
error: unknown;
|
|
425
|
+
refetch?: () => unknown;
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* One acceptance, with what it holds (a name typed, a signature, health answers): kept in
|
|
429
|
+
* the app's cache no longer than it is on screen.
|
|
430
|
+
*/
|
|
431
|
+
useAcceptance(id: string | null): {
|
|
432
|
+
data: AcceptanceDetail | undefined;
|
|
433
|
+
isPending: boolean;
|
|
434
|
+
error: unknown;
|
|
435
|
+
refetch?: () => unknown;
|
|
436
|
+
};
|
|
437
|
+
/**
|
|
438
|
+
* Agree to a version, for themselves or a child (`forPersonId`). What was sent is not kept
|
|
439
|
+
* once the call is over.
|
|
440
|
+
*/
|
|
441
|
+
useAccept(): {
|
|
442
|
+
mutate(input: AgreeInput & {
|
|
443
|
+
forPersonId?: string;
|
|
444
|
+
}): void;
|
|
445
|
+
mutateAsync(input: AgreeInput & {
|
|
446
|
+
forPersonId?: string;
|
|
447
|
+
}): Promise<Accepted>;
|
|
448
|
+
data: Accepted | undefined;
|
|
449
|
+
isPending: boolean;
|
|
450
|
+
error: unknown;
|
|
451
|
+
reset?: () => void;
|
|
452
|
+
};
|
|
453
|
+
/** A visitor's: the words of the versions a buying call's refusal named. */
|
|
454
|
+
useGuestVersions(versionIds: readonly string[]): {
|
|
455
|
+
data: {
|
|
456
|
+
versions: AgreementVersion[];
|
|
457
|
+
} | undefined;
|
|
458
|
+
isPending: boolean;
|
|
459
|
+
error: unknown;
|
|
460
|
+
refetch?: () => unknown;
|
|
461
|
+
};
|
|
462
|
+
}, {
|
|
463
|
+
readonly useDue: readonly ["me.agreements.due"];
|
|
464
|
+
readonly useMine: readonly ["me.agreements.list"];
|
|
465
|
+
readonly useAcceptance: readonly ["me.agreements.get"];
|
|
466
|
+
readonly useAccept: readonly ["me.agreements.accept"];
|
|
467
|
+
readonly useGuestVersions: readonly ["agreement.guestVersions"];
|
|
468
|
+
}, import("./hooks.ts").OperationsOf<C>>;
|
|
469
|
+
declare function allAgreementsHooks(react: {
|
|
470
|
+
useQuery: AgreementsUseQuery;
|
|
471
|
+
useMutation: AgreementsUseMutation;
|
|
472
|
+
}, api: AgreementsClient): {
|
|
473
|
+
/** What the signed-in customer, and each child linked to them, still has to agree to. */
|
|
474
|
+
useDue(): {
|
|
475
|
+
data: {
|
|
476
|
+
people: DuePerson[];
|
|
477
|
+
} | undefined;
|
|
478
|
+
isPending: boolean;
|
|
479
|
+
error: unknown;
|
|
480
|
+
refetch?: () => unknown;
|
|
481
|
+
};
|
|
482
|
+
/** Their agreements and their children's, newest first. */
|
|
483
|
+
useMine(): {
|
|
484
|
+
data: {
|
|
485
|
+
items: AcceptanceSummary[];
|
|
486
|
+
} | undefined;
|
|
487
|
+
isPending: boolean;
|
|
488
|
+
error: unknown;
|
|
489
|
+
refetch?: () => unknown;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* One acceptance, with what it holds (a name typed, a signature, health answers): kept in
|
|
493
|
+
* the app's cache no longer than it is on screen.
|
|
494
|
+
*/
|
|
495
|
+
useAcceptance(id: string | null): {
|
|
496
|
+
data: AcceptanceDetail | undefined;
|
|
497
|
+
isPending: boolean;
|
|
498
|
+
error: unknown;
|
|
499
|
+
refetch?: () => unknown;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Agree to a version, for themselves or a child (`forPersonId`). What was sent is not kept
|
|
503
|
+
* once the call is over.
|
|
504
|
+
*/
|
|
505
|
+
useAccept(): {
|
|
506
|
+
mutate(input: AgreeInput & {
|
|
507
|
+
forPersonId?: string;
|
|
508
|
+
}): void;
|
|
509
|
+
mutateAsync(input: AgreeInput & {
|
|
510
|
+
forPersonId?: string;
|
|
511
|
+
}): Promise<Accepted>;
|
|
512
|
+
data: Accepted | undefined;
|
|
513
|
+
isPending: boolean;
|
|
514
|
+
error: unknown;
|
|
515
|
+
reset?: () => void;
|
|
516
|
+
};
|
|
517
|
+
/** A visitor's: the words of the versions a buying call's refusal named. */
|
|
518
|
+
useGuestVersions(versionIds: readonly string[]): {
|
|
519
|
+
data: {
|
|
520
|
+
versions: AgreementVersion[];
|
|
521
|
+
} | undefined;
|
|
522
|
+
isPending: boolean;
|
|
523
|
+
error: unknown;
|
|
524
|
+
refetch?: () => unknown;
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
/** Every hook of this entry. A block takes the ones it calls: `Pick<AgreementsHooks, "useDue">`. */
|
|
528
|
+
export type AgreementsHooks = ReturnType<typeof allAgreementsHooks>;
|
|
529
|
+
export {};
|