@tensile-tools/auth-client 0.0.0-stage → 0.3.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.
Files changed (44) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +62 -2
  3. package/dist/client.d.ts +569 -0
  4. package/dist/client.js +637 -0
  5. package/dist/devtools.d.ts +12 -0
  6. package/dist/devtools.js +44 -0
  7. package/dist/elements/account.d.ts +63 -0
  8. package/dist/elements/account.js +331 -0
  9. package/dist/elements/approvals.d.ts +61 -0
  10. package/dist/elements/approvals.js +252 -0
  11. package/dist/elements/auth.d.ts +48 -0
  12. package/dist/elements/auth.js +238 -0
  13. package/dist/elements/base.d.ts +176 -0
  14. package/dist/elements/base.js +540 -0
  15. package/dist/elements/config.d.ts +70 -0
  16. package/dist/elements/config.js +119 -0
  17. package/dist/elements/format.d.ts +32 -0
  18. package/dist/elements/format.js +67 -0
  19. package/dist/elements/index.d.ts +21 -0
  20. package/dist/elements/index.js +31 -0
  21. package/dist/elements/qr.d.ts +9 -0
  22. package/dist/elements/qr.js +302 -0
  23. package/dist/elements/returnto.d.ts +17 -0
  24. package/dist/elements/returnto.js +63 -0
  25. package/dist/elements/setup.d.ts +70 -0
  26. package/dist/elements/setup.js +316 -0
  27. package/dist/elements/styles.d.ts +3 -0
  28. package/dist/elements/styles.js +194 -0
  29. package/dist/elements/text.d.ts +21 -0
  30. package/dist/elements/text.js +302 -0
  31. package/dist/fonts/OFL-geist-mono.txt +93 -0
  32. package/dist/fonts/OFL-geist.txt +93 -0
  33. package/dist/fonts/OFL-inter.txt +93 -0
  34. package/dist/fonts/README.md +18 -0
  35. package/dist/fonts/geist-mono.woff2 +0 -0
  36. package/dist/fonts/geist.woff2 +0 -0
  37. package/dist/fonts/inter.woff2 +0 -0
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.js +5 -0
  40. package/dist/problem.d.ts +54 -0
  41. package/dist/problem.js +40 -0
  42. package/dist/webauthn.d.ts +46 -0
  43. package/dist/webauthn.js +102 -0
  44. package/package.json +51 -4
@@ -0,0 +1,44 @@
1
+ // The developer panel: a small box in the page that shows the session and
2
+ // offers development-only actions. It works only against a server with
3
+ // auth.WithDevTools, which refuses to start outside localhost.
4
+ /**
5
+ * Mounts the developer panel and returns a function that removes it. It
6
+ * shows the principal, its assurance, methods, and freshness, and buttons
7
+ * to make the session stale or switch to recovery mode, so step-up and
8
+ * recovery screens can be tried in seconds.
9
+ */
10
+ export function mountDevTools(client, opts = {}) {
11
+ const endpoint = opts.endpoint ?? '/auth/dev';
12
+ const box = document.createElement('details');
13
+ box.setAttribute('style', 'position:fixed;bottom:12px;right:12px;z-index:2147483647;max-width:360px;' +
14
+ 'font:12px/1.4 ui-monospace,monospace;background:#111;color:#eee;border-radius:8px;padding:8px 12px;opacity:.95');
15
+ const summary = document.createElement('summary');
16
+ summary.textContent = 'auth dev tools';
17
+ const state = document.createElement('pre');
18
+ state.setAttribute('style', 'white-space:pre-wrap;margin:8px 0');
19
+ const actions = document.createElement('div');
20
+ box.append(summary, state, actions);
21
+ const show = async (res) => {
22
+ state.textContent = res.ok ? JSON.stringify(await res.json(), null, 2) : `${res.status} ${res.statusText}`;
23
+ const fresh = client.freshUntil;
24
+ if (fresh)
25
+ state.textContent += `\nfresh until ${fresh.toLocaleTimeString()}`;
26
+ };
27
+ const button = (label, path) => {
28
+ const b = document.createElement('button');
29
+ b.textContent = label;
30
+ b.setAttribute('style', 'margin:0 6px 0 0;font:inherit');
31
+ b.onclick = async () => show(await fetch(endpoint + path, { method: 'POST', credentials: 'same-origin' }));
32
+ actions.append(b);
33
+ };
34
+ button('Make stale', '/stale');
35
+ button('Recovery mode', '/recovery');
36
+ const refresh = async () => show(await fetch(endpoint + '/state', { credentials: 'same-origin' }));
37
+ const off = client.onSessionChange(() => { void refresh(); });
38
+ void refresh();
39
+ document.body.append(box);
40
+ return () => {
41
+ off();
42
+ box.remove();
43
+ };
44
+ }
@@ -0,0 +1,63 @@
1
+ import { type Html, TensileElement } from './base.ts';
2
+ import type { Options } from './config.ts';
3
+ /**
4
+ * `<tensile-sessions>`: where the person is signed in, the agents under
5
+ * each device, Revoke on each, and "Sign out other devices". Turning
6
+ * `agents` off hides the agents.
7
+ *
8
+ * Events: `revoked` with `{id, kind}`, `signed-out-others` with
9
+ * `{revoked}`, `problem`.
10
+ */
11
+ export declare class Sessions extends TensileElement {
12
+ protected followsSession: boolean;
13
+ protected wide: boolean;
14
+ private data;
15
+ private gone;
16
+ private othersOut;
17
+ protected on(o: Options): boolean;
18
+ protected forget(): void;
19
+ protected load(): Promise<void>;
20
+ private name;
21
+ private mark;
22
+ private node;
23
+ protected body(o: Options): Html;
24
+ protected act(name: string, from: HTMLElement): Promise<void>;
25
+ }
26
+ /**
27
+ * `<tensile-wasnt-me>`: shows the latest sign-in with a recovery code that
28
+ * the person can still undo, and renders nothing when there is none.
29
+ * "That wasn't me" signs that session out and reverses what it changed.
30
+ *
31
+ * Events: `undone` with what was undone, `kept`, `new-codes` when the
32
+ * person asks for new recovery codes, `problem`.
33
+ */
34
+ export declare class WasntMe extends TensileElement {
35
+ protected followsSession: boolean;
36
+ private item;
37
+ private result;
38
+ protected on(o: Options): boolean;
39
+ protected forget(): void;
40
+ protected load(): Promise<void>;
41
+ connectedCallback(): void;
42
+ reload(): void;
43
+ protected body(o: Options): Html;
44
+ protected act(name: string): Promise<void>;
45
+ }
46
+ /**
47
+ * `<tensile-activity>`: the person's audit log, newest first, and whether
48
+ * every entry still matches its seal in the hash chain.
49
+ *
50
+ * Events: `checked` with the chain state, `problem`.
51
+ */
52
+ export declare class ActivityLog extends TensileElement {
53
+ protected followsSession: boolean;
54
+ protected wide: boolean;
55
+ private data;
56
+ private more;
57
+ protected on(o: Options): boolean;
58
+ protected forget(): void;
59
+ protected load(): Promise<void>;
60
+ private sentence;
61
+ protected body(o: Options): Html;
62
+ protected act(name: string): Promise<void>;
63
+ }
@@ -0,0 +1,331 @@
1
+ // The account elements: sessions and connected agents, "That wasn't me",
2
+ // and activity.
3
+ import { glyph, html, TensileElement } from "./base.js";
4
+ import { asAction, clock, lastUsed, when } from "./format.js";
5
+ /**
6
+ * `<tensile-sessions>`: where the person is signed in, the agents under
7
+ * each device, Revoke on each, and "Sign out other devices". Turning
8
+ * `agents` off hides the agents.
9
+ *
10
+ * Events: `revoked` with `{id, kind}`, `signed-out-others` with
11
+ * `{revoked}`, `problem`.
12
+ */
13
+ export class Sessions extends TensileElement {
14
+ followsSession = true;
15
+ wide = true;
16
+ data;
17
+ gone = new Set();
18
+ othersOut = false;
19
+ on(o) {
20
+ return o.sessions;
21
+ }
22
+ forget() {
23
+ this.data = undefined;
24
+ this.gone.clear();
25
+ this.othersOut = false;
26
+ }
27
+ async load() {
28
+ const g = this.generation;
29
+ const r = await this.client.sessions();
30
+ if (this.stale(g))
31
+ return;
32
+ if (r.outcome !== 'ok') {
33
+ this.error = this.explain(r);
34
+ return this.update();
35
+ }
36
+ this.data = r.data;
37
+ this.gone.clear();
38
+ this.othersOut = false;
39
+ this.error = '';
40
+ this.update();
41
+ }
42
+ name(s) {
43
+ switch (s.kind) {
44
+ case 'agent': return s.agent?.name || this.t('anAgent');
45
+ case 'token': return this.t('sessions.token', { name: s.name ?? '' });
46
+ case 'app': return this.t('sessions.app', { name: s.client ?? s.name ?? '' });
47
+ }
48
+ return s.device || this.t('sessions.browser');
49
+ }
50
+ mark(s) {
51
+ if (s.kind === 'agent')
52
+ return glyph.agent;
53
+ if (s.kind === 'token')
54
+ return glyph.token;
55
+ if (s.kind === 'app')
56
+ return glyph.app;
57
+ return /iPhone|Android|iPad|Mobile/i.test(`${s.device} ${s.userAgent}`) ? glyph.phone : glyph.laptop;
58
+ }
59
+ node(s, o, depth, now) {
60
+ if (depth > 0 && !o.agents)
61
+ return '';
62
+ const out = this.gone.has(s.id);
63
+ const here = s.id === this.data?.current;
64
+ const used = lastUsed(s.lastSeenAt || s.createdAt, now);
65
+ const name = this.name(s);
66
+ const kids = s.children.length && o.agents ? html `<ul>${s.children.map(c => this.node(c, o, depth + 1, now))}</ul>` : '';
67
+ const action = here
68
+ ? html `<span class="chip" part="chip">${this.t('sessions.thisDevice')}</span>`
69
+ : html `<button class="rv" type="button" part="link" data-do="revoke" data-id="${s.id}" data-key="r-${s.id}" aria-label="${this.t(out ? 'sessions.revokedLabel' : 'sessions.revokeLabel', { name })}"${out ? html ` aria-disabled="true"` : ''}>${this.t(out ? 'sessions.revoked' : 'sessions.revoke')}</button>`;
70
+ return html `<li class="node ${depth ? 'ag' : 'dev'}${out ? ' revoked' : ''}" part="row"><div class="row">${this.mark(s)}<span class="nm"><b>${name}</b><small>${this.t(used.key, used.vars)}</small></span>${action}</div>${kids}</li>`;
71
+ }
72
+ body(o) {
73
+ if (!this.data)
74
+ return this.loadingBody(o, this.t('sessions.title'));
75
+ const live = (s) => !this.gone.has(s.id);
76
+ const roots = this.data.items.filter(live);
77
+ let agents = 0;
78
+ const count = (ns) => ns.forEach(n => { if (n.kind === 'agent' && live(n))
79
+ agents++; count(n.children.filter(live)); });
80
+ count(roots);
81
+ const devices = this.t(roots.length === 1 ? 'sessions.deviceOne' : 'sessions.deviceMany', { count: roots.length });
82
+ const agentText = o.agents && agents ? this.t(agents === 1 ? 'sessions.agentOne' : 'sessions.agentMany', { count: agents }) : '';
83
+ const head = this.heading(o, this.r('sessions.headline', { devices: html `<span class="num">${devices}</span>`, agents: agentText }), this.t('sessions.title'), `${devices}. ${agentText}`);
84
+ const now = new Date();
85
+ const others = this.data.items.some(s => s.id !== this.data?.current && live(s));
86
+ return html `${head}<ul class="tree">${this.data.items.map(s => this.node(s, o, 0, now))}</ul>${this.err()}
87
+ <div class="acts"><button class="btn plain" type="button" part="button" data-do="others" data-key="others"${this.othersOut || !others ? html ` aria-disabled="true"` : ''}>${this.t(this.othersOut ? 'sessions.signedOutOthers' : 'sessions.signOutOthers')}</button></div>`;
88
+ }
89
+ async act(name, from) {
90
+ if (name === 'revoke') {
91
+ const id = from.dataset.id;
92
+ const r = await this.client.revokeSession(id);
93
+ if (r.outcome !== 'ok')
94
+ return this.failWith(r);
95
+ const find = (ns) => {
96
+ for (const n of ns)
97
+ if (n.id === id)
98
+ return n;
99
+ else {
100
+ const f = find(n.children);
101
+ if (f)
102
+ return f;
103
+ }
104
+ return undefined;
105
+ };
106
+ const s = find(this.data?.items ?? []);
107
+ const mark = (n) => { this.gone.add(n.id); n.children.forEach(mark); };
108
+ if (s)
109
+ mark(s);
110
+ this.error = '';
111
+ this.update();
112
+ if (s)
113
+ this.announce(`${this.t('sessions.revoked')}: ${this.name(s)}`);
114
+ this.emit('revoked', { id, kind: s?.kind });
115
+ return;
116
+ }
117
+ if (name === 'others') {
118
+ const r = await this.client.signOutOthers();
119
+ if (r.outcome !== 'ok')
120
+ return this.failWith(r);
121
+ for (const s of this.data?.items ?? []) {
122
+ const mark = (n) => { this.gone.add(n.id); n.children.forEach(mark); };
123
+ if (s.id !== this.data?.current)
124
+ mark(s);
125
+ }
126
+ this.othersOut = true;
127
+ this.error = '';
128
+ this.update();
129
+ this.announce(this.t('sessions.signedOutOthers'));
130
+ this.emit('signed-out-others', r.data);
131
+ }
132
+ }
133
+ }
134
+ /**
135
+ * `<tensile-wasnt-me>`: shows the latest sign-in with a recovery code that
136
+ * the person can still undo, and renders nothing when there is none.
137
+ * "That wasn't me" signs that session out and reverses what it changed.
138
+ *
139
+ * Events: `undone` with what was undone, `kept`, `new-codes` when the
140
+ * person asks for new recovery codes, `problem`.
141
+ */
142
+ export class WasntMe extends TensileElement {
143
+ followsSession = true;
144
+ item;
145
+ result;
146
+ on(o) {
147
+ return o.recoveryCodes && (this.item !== undefined || this.state !== 'start');
148
+ }
149
+ forget() {
150
+ this.item = undefined;
151
+ this.result = undefined;
152
+ }
153
+ async load() {
154
+ const g = this.generation;
155
+ const r = await this.client.recoverySignIns();
156
+ if (this.stale(g))
157
+ return;
158
+ if (r.outcome !== 'ok')
159
+ return;
160
+ this.item = r.data[0];
161
+ this.update();
162
+ }
163
+ connectedCallback() {
164
+ super.connectedCallback();
165
+ setTimeout(() => { if (this.isConnected && this.options.recoveryCodes && !this.item)
166
+ void this.load(); });
167
+ }
168
+ reload() {
169
+ if (this.isConnected && this.options.recoveryCodes)
170
+ void this.load();
171
+ }
172
+ body(o) {
173
+ const head = this.heading(o, this.r('wasntMe.headline'), this.t('wasntMe.title'), this.t('wasntMe.lead'));
174
+ const it = this.item;
175
+ if (this.state === 'undone') {
176
+ const r = this.result ?? {};
177
+ const lines = [];
178
+ if (Number(r.sessions))
179
+ lines.push(this.t(Number(r.sessions) === 1 ? 'undone.session' : 'undone.sessions', { count: Number(r.sessions) }));
180
+ if (Number(r.agents))
181
+ lines.push(this.t(Number(r.agents) === 1 ? 'undone.agent' : 'undone.agents', { count: Number(r.agents) }));
182
+ if (Number(r.passkeys))
183
+ lines.push(this.t(Number(r.passkeys) === 1 ? 'undone.passkey' : 'undone.passkeys', { count: Number(r.passkeys) }));
184
+ if (r.totp)
185
+ lines.push(this.t('undone.totp'));
186
+ if (r.password)
187
+ lines.push(this.t('undone.password'));
188
+ if (r.email)
189
+ lines.push(this.t('undone.email'));
190
+ lines.push(this.t('undone.codes'));
191
+ return html `${head}<div class="done"><span class="chip green" part="chip">${this.t('wasntMe.undoneChip')}</span><ul class="since ok">${lines.map(l => html `<li>${l}</li>`)}</ul>
192
+ <button class="btn plain" type="button" part="button" data-do="codes" data-autofocus>${this.t('wasntMe.newCodes')}</button></div>`;
193
+ }
194
+ if (this.state === 'kept')
195
+ return html `${head}${this.done(this.t('wasntMe.keptChip'), '', this.t('wasntMe.kept'))}`;
196
+ if (!it)
197
+ return html ``;
198
+ const at = when(it.at, new Date());
199
+ const changes = it.changes.map(k => this.t(`change.${k}`) === `change.${k}` ? this.t('change.other', { kind: k }) : this.t(`change.${k}`));
200
+ changes.push(this.t('wasntMe.hold', { time: clock(it.undoBy) }));
201
+ return html `${head}<div class="body"><div class="subject"><span class="nm"><b>${it.device || this.t('wasntMe.device')}</b><small>${this.t(at.key, at.vars)}</small></span></div>
202
+ <ul class="since">${changes.map(c => html `<li>${c}</li>`)}</ul>${this.err()}
203
+ <div class="acts"><button class="btn fill" type="button" part="button button-primary" data-do="undo">${this.t('wasntMe.undo')}</button>
204
+ <button class="btn plain" type="button" part="button" data-do="keep">${this.t('wasntMe.keep')}</button></div></div>`;
205
+ }
206
+ async act(name) {
207
+ const it = this.item;
208
+ if (name === 'codes') {
209
+ this.emit('new-codes');
210
+ return;
211
+ }
212
+ if (!it)
213
+ return;
214
+ if (name === 'keep') {
215
+ this.emit('kept', { session: it.session });
216
+ return this.go('kept');
217
+ }
218
+ const g = this.generation;
219
+ const r = await this.client.undoRecovery(it.session);
220
+ if (this.stale(g))
221
+ return;
222
+ if (r.outcome !== 'ok')
223
+ return this.failWith(r);
224
+ this.result = r.data;
225
+ this.emit('undone', r.data);
226
+ this.go('undone');
227
+ }
228
+ }
229
+ /**
230
+ * `<tensile-activity>`: the person's audit log, newest first, and whether
231
+ * every entry still matches its seal in the hash chain.
232
+ *
233
+ * Events: `checked` with the chain state, `problem`.
234
+ */
235
+ export class ActivityLog extends TensileElement {
236
+ followsSession = true;
237
+ wide = true;
238
+ data;
239
+ more = false;
240
+ on(o) {
241
+ return o.activity;
242
+ }
243
+ forget() {
244
+ this.data = undefined;
245
+ this.more = false;
246
+ }
247
+ async load() {
248
+ const g = this.generation;
249
+ const r = await this.client.activity();
250
+ if (this.stale(g))
251
+ return;
252
+ if (r.outcome !== 'ok') {
253
+ this.error = this.explain(r);
254
+ return this.update();
255
+ }
256
+ this.data = r.data;
257
+ this.more = r.data.items.length >= 50;
258
+ this.error = '';
259
+ this.update();
260
+ this.emit('checked', r.data.chain);
261
+ }
262
+ sentence(e) {
263
+ const agentName = e.agent?.name || this.t('anAgent');
264
+ const agent = html `<b class="agent">${agentName}</b>`;
265
+ const who = e.byAgent ? agent : html `<b>${this.t('you')}</b>`;
266
+ const key = `event.${e.kind}`;
267
+ const tpl = this.tpl(key) === key ? this.tpl('event.other') : this.tpl(key);
268
+ return this.rt(tpl, { who, agent, summary: e.summary ?? '', action: e.summary ? asAction(e.summary) : '', kind: e.kind.replace(/_/g, ' ') });
269
+ }
270
+ body(o) {
271
+ const d = this.data;
272
+ if (!d)
273
+ return this.loadingBody(o, this.t('activity.title'));
274
+ const c = d.chain;
275
+ const n = d.items.length;
276
+ const one = c.total === 1;
277
+ let key = 'activity.unknown';
278
+ if (n === 0)
279
+ key = 'activity.empty';
280
+ else if (c.state === 'tampered')
281
+ key = 'activity.tampered';
282
+ else if (c.state === 'unavailable')
283
+ key = 'activity.unavailable';
284
+ else if (c.state === 'verified' && c.sealed === c.total)
285
+ key = one ? 'activity.verifiedOne' : 'activity.verified';
286
+ else if (c.state === 'verified' && c.sealed === 0)
287
+ key = one ? 'activity.sealingOne' : 'activity.sealing';
288
+ else if (c.state === 'verified')
289
+ key = 'activity.partly';
290
+ const vars = { count: html `<span class="num">${c.total}</span>`, sealed: html `<span class="num">${c.sealed}</span>` };
291
+ const head = this.heading(o, this.r(key, vars), this.t('activity.title'), this.t(key, { count: c.total, sealed: c.sealed }));
292
+ const notes = [];
293
+ if (c.verified_at && c.sealed > 0)
294
+ notes.push(this.t('activity.verifiedAt', { time: clock(c.verified_at) }));
295
+ if (c.last_check_failed && c.checked_at)
296
+ notes.push(this.t('activity.failedAt', { time: clock(c.checked_at) }));
297
+ const now = new Date();
298
+ const rows = d.items.map(e => {
299
+ const w = when(e.at, now);
300
+ return html `<li class="ev" part="row"><span class="who">${e.byAgent ? glyph.agent : glyph.you}</span><p class="what">${this.sentence(e)}</p><time class="num" datetime="${e.at}" title="${new Date(e.at).toLocaleString()}">${this.t(w.key, w.vars)}</time>${e.seal ? html `<code class="seal" title="${this.t('activity.seal', { seal: e.seal })}">${e.seal.slice(0, 8)}</code>` : html `<span class="seal"></span>`}</li>`;
301
+ });
302
+ if (n === 0)
303
+ return html `${head}${this.err()}`;
304
+ return html `${head}<div class="vrow">${notes.length ? html `<span>${notes.join(' ')}</span>` : ''}<button class="lnk" type="button" part="link" data-do="check" data-key="check">${this.t('activity.checkAgain')}</button></div>${this.err()}
305
+ <ol class="log" reversed>${rows}</ol>
306
+ ${this.more ? html `<div class="acts"><button class="btn plain" type="button" part="button" data-do="more" data-key="more">${this.t('activity.more')}</button></div>` : ''}`;
307
+ }
308
+ async act(name) {
309
+ if (name === 'check') {
310
+ await this.load();
311
+ const c = this.data?.chain;
312
+ if (c)
313
+ this.announce(this.t(c.state === 'verified' ? 'activity.verifiedAt' : 'activity.unavailable', { time: clock(c.verified_at ?? new Date()) }));
314
+ return;
315
+ }
316
+ if (name === 'more' && this.data) {
317
+ const last = this.data.items[this.data.items.length - 1];
318
+ const g = this.generation;
319
+ const r = await this.client.activity({ before: last.seq });
320
+ if (this.stale(g))
321
+ return;
322
+ if (r.outcome !== 'ok')
323
+ return this.failWith(r);
324
+ this.data.items.push(...r.data.items);
325
+ this.data.chain.total += r.data.chain.total;
326
+ this.data.chain.sealed += r.data.chain.sealed;
327
+ this.more = r.data.items.length >= 50;
328
+ this.update();
329
+ }
330
+ }
331
+ }
@@ -0,0 +1,61 @@
1
+ import type { ApprovalView } from '../client.ts';
2
+ import { type Html, TensileElement } from './base.ts';
3
+ import type { Options } from './config.ts';
4
+ /**
5
+ * `<tensile-approval approval-id="apr_…">`: what an agent asks to do, and
6
+ * Approve, which runs a passkey ceremony whose signature covers the exact
7
+ * action, or Decline. An action whose params hold `amount` (a decimal),
8
+ * `currency` (ISO 4217, default USD), `payee`, and `for` shows as a
9
+ * payment, with the amount large.
10
+ *
11
+ * Signed out, it says "Sign in to review this request" and offers a
12
+ * passkey sign-in, then shows the request. With `sign-in-href`, it also
13
+ * links to that sign-in page, with this page as `return_to`.
14
+ *
15
+ * Events: `approved`, `declined`, `problem`.
16
+ */
17
+ export declare class Approval extends TensileElement {
18
+ protected followsSession: boolean;
19
+ static attrs: string[];
20
+ private item;
21
+ private decidedAt;
22
+ /** The approval to show, instead of loading `approval-id`. */
23
+ get approval(): ApprovalView | undefined;
24
+ set approval(a: ApprovalView | undefined);
25
+ protected on(o: Options): boolean;
26
+ protected load(): Promise<void>;
27
+ private sized;
28
+ protected rendered(): void;
29
+ /** Shrinks the amount until it fits its line. */
30
+ private fit;
31
+ disconnectedCallback(): void;
32
+ protected body(o: Options): Html;
33
+ protected forget(): void;
34
+ /** The signed-out state: sign in, then the request shows. */
35
+ protected signedOutBody(o: Options): Html;
36
+ private gone;
37
+ protected act(name: string): Promise<void>;
38
+ }
39
+ /**
40
+ * `<tensile-approvals>`: the person's inbox of requests from their agents,
41
+ * newest first, each with Approve and Decline. It checks for new requests
42
+ * every `refresh` seconds (default 15; 0 turns it off) while the page is
43
+ * visible.
44
+ *
45
+ * Events: `approved`, `declined`, `problem`, and `change` when the list
46
+ * changes, with the pending requests as its detail.
47
+ */
48
+ export declare class Approvals extends TensileElement {
49
+ protected followsSession: boolean;
50
+ static attrs: string[];
51
+ protected wide: boolean;
52
+ private items;
53
+ private timer;
54
+ protected on(o: Options): boolean;
55
+ connectedCallback(): void;
56
+ disconnectedCallback(): void;
57
+ protected forget(): void;
58
+ protected load(): Promise<void>;
59
+ protected body(o: Options): Html;
60
+ protected act(name: string, from: HTMLElement): Promise<void>;
61
+ }