@mccaskie-labs/workbench-agreements 0.2.0 → 0.3.1
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 +21 -0
- package/README.md +8 -0
- package/dist/agreements.d.ts +3 -3
- package/dist/agreements.js +126 -9
- package/dist/confirm.d.ts +60 -0
- package/dist/confirm.js +85 -0
- package/dist/errors.d.ts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/owner.d.ts +50 -0
- package/dist/owner.js +81 -0
- package/dist/page.d.ts +8 -1
- package/dist/page.js +31 -5
- package/dist/styles.js +8 -4
- package/dist/words.d.ts +32 -1
- package/dist/words.js +55 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @mccaskie-labs/workbench-agreements
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The page a signer sees after declining no longer says "We've told {business}" when the business has no address to be told at (the agreement has no `copyTo` and the agreements have no `replyTo`). It now says the business hasn't been emailed, so the signer can tell them. New word `declined.untold` (English and Tagalog; Taglish takes the Tagalog). `renderEndedPage` takes `businessTold`: `false` draws the new words, and leaving it out keeps the old ones.
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Declining asks "Are you sure?" first. On the signing page, "I don't want to sign" now only opens a question that names the agreement and the business, says it closes the agreement for everyone, can't be undone, and who will be emailed, with the optional reason for the business inside, "Yes, decline to sign" and "No, go back". It is a `<details>`, so it works with no script.
|
|
14
|
+
- **Breaking:** the signing route declines only when the post carries `confirm=yes` (the question's button sends it). A decline without it changes nothing and draws the page again with the question open and "Please confirm first. Nothing has changed." (409). A page that posts its own one-click decline must ask first and post `confirm=yes`.
|
|
15
|
+
- A decline now emails everyone: the business (its `copyTo`, or the `replyTo` address when the agreement has none; before, only `copyTo`), every other signer, including any who already signed, that the agreement is closed, and the signer who declined. The business's email lists who else was told. The reason goes only to the business, as the page says.
|
|
16
|
+
- When one of several signers signs, the business is emailed who has signed and who is still to sign.
|
|
17
|
+
- Withdraw: new `ownerAgreementAction(agreements, body, { account })` for the owner's posts (`void`: agreement, reason; it needs `confirm=yes` and refuses without it with the new failure `confirm_needed`, 409, "Please confirm first. Nothing has changed."; another account's agreement is answered as not found), and `renderVoidConfirm(agreement, { endpoint })`, the Withdraw button that asks first, names the agreement and who it went to, and needs a reason. `void()` itself is unchanged in what it takes and still callable without a flag; it now emails every signer, including those who already signed, that it was withdrawn, with the reason.
|
|
18
|
+
- When `tick()` finds an agreement has run out, it emails every signer and the business that it expired.
|
|
19
|
+
- A failed notice email never fails what it tells of. Every event the audit trail recorded before is still recorded; the notices add no events.
|
|
20
|
+
- `renderConfirm`, `confirmed` and `ConfirmOptions` are exported for an app's own pages, with `SigningFormState`, `OwnerOptions`, `VoidConfirmOptions` and `OwnerAgreementResult`. `SigningView` takes `formHref` and `declineTells`; `SigningFormState` takes `declineOpen`.
|
|
21
|
+
- New words `decline.question`, `decline.consequence`, `decline.tells`, `decline.no`, `problem.confirm_needed`, `void.ask`, `void.question`, `void.consequence`, `void.reason`, `void.yes`, `confirm.no`, `error.confirm_needed`, `error.reason`, `error.not_found`, `error.closed`, `error.failed`, `email.declined.others`, `email.declined_signer.*`, `email.declined_you.*`, `email.progress.*`, `email.voided.*`, `email.expired.*`, `email.expired_business.*` and `email.nobody`; `decline` now reads "Yes, decline to sign". New email templates `agreement.declined_signer`, `agreement.declined_you`, `agreement.progress`, `agreement.voided`, `agreement.expired` and `agreement.expired_business`.
|
|
22
|
+
- New classes `wb-agreement-confirm`, `-confirm-open`, `-confirm-ask`, `-confirm-keep`, `-confirm-form`, `-confirm-question`, `-confirm-consequence`, `-confirm-field`, `-confirm-label`, `-confirm-input`, `-confirm-yes` and `wb-agreement-void`, and the variables `--wb-agreement-on-danger` and `--wb-agreement-sunk`. **Breaking** for restyling: `wb-agreement-decline` is now a `<div>` round the question, `wb-agreement-decline-summary` is on the question's first button, and `wb-agreement-textarea` is gone (the reason is a `wb-agreement-confirm-input`).
|
|
23
|
+
|
|
3
24
|
## 0.2.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -22,6 +22,10 @@ const sent = await agreements.create({
|
|
|
22
22
|
copyTo: [business.email],
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
// Behind the owner's sign-in: Withdraw asks first, and the post needs confirm=yes and a reason
|
|
26
|
+
renderVoidConfirm(agreement, { endpoint: "/app/agreements" }) // nothing once it is closed
|
|
27
|
+
await ownerAgreementAction(agreements, fields, { account: business.id }) // void; emails every signer the reason
|
|
28
|
+
|
|
25
29
|
// scheduled(): hourly and daily
|
|
26
30
|
ctx.waitUntil(agreements.tick());
|
|
27
31
|
ctx.waitUntil(agreements.cleanup());
|
|
@@ -30,12 +34,16 @@ ctx.waitUntil(agreements.cleanup());
|
|
|
30
34
|
| Export | What it does |
|
|
31
35
|
| --- | --- |
|
|
32
36
|
| `createAgreements` | `create`, `invite`, `share` (a message and `wa.me` link for Messenger or WhatsApp), `get`, `list`, `void`, `file`, `verify`, `handle`, `tick`, `cleanup` |
|
|
37
|
+
| `ownerAgreementAction`, `renderVoidConfirm` | The owner's Withdraw: the button that asks "Are you sure?" first, and the post helper that refuses it without `confirm=yes` (`confirm_needed`) |
|
|
38
|
+
| `renderConfirm`, `confirmed` | The shared "Are you sure?" block, for an app's own pages |
|
|
33
39
|
| `agreementsMigration` | The three tables and their functions, service role only (`npx workbench-agreements migration`) |
|
|
34
40
|
| `buildSignedCopy`, `pdfPages` | The signed copy: original pages with a footer, then the signing certificate |
|
|
35
41
|
| `renderSigningPage`, `renderCodePage`, `renderDonePage`, `renderEndedPage` | The pages, every element with a `wb-agreement-*` class |
|
|
36
42
|
| `AGREEMENT_STYLES` (also `/styles`) | The classes and `--wb-agreement-*` variables with their defaults |
|
|
37
43
|
| `AGREEMENT_WORDS` | The words in English, Tagalog and Taglish (`ui.wbagreement.*`) |
|
|
38
44
|
|
|
45
|
+
Notices: a decline emails the business (`copyTo`, else `replyTo`), every other signer and the one who declined, and the signing page asks first (its decline post needs `confirm=yes`); one of several signing tells the business who is still to sign; `void()` emails every signer the reason; `tick()` emails the signers and the business when an agreement runs out.
|
|
46
|
+
|
|
39
47
|
Commands: `npx workbench-agreements init`, `generate [--check]`, `migration`.
|
|
40
48
|
|
|
41
49
|
## Size and Workers tests
|
package/dist/agreements.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface AgreementsOptions {
|
|
|
57
57
|
styles?: readonly string[];
|
|
58
58
|
/** For dates on the pages and the certificate. Default en-AU. */
|
|
59
59
|
locale?: string;
|
|
60
|
-
/** Where replies to the emails go: the business's own address. */
|
|
60
|
+
/** Where replies to the emails go: the business's own address. It also gets the business's notices (a decline, one of several signing, running out) when an agreement has no copyTo. */
|
|
61
61
|
replyTo?: string;
|
|
62
62
|
/** For tests. */
|
|
63
63
|
now?: () => Date;
|
|
@@ -164,7 +164,7 @@ export interface Agreements {
|
|
|
164
164
|
share(id: string): Promise<ShareLink[]>;
|
|
165
165
|
get(id: string): Promise<Agreement | null>;
|
|
166
166
|
list(account: string, limit?: number): Promise<Agreement[]>;
|
|
167
|
-
/** Withdraws an agreement nobody has finished. False when it is already closed. */
|
|
167
|
+
/** Withdraws an agreement nobody has finished, and emails everyone on it (including anyone who has signed) with the reason. False when it is already closed. */
|
|
168
168
|
void(id: string, reason: string): Promise<boolean>;
|
|
169
169
|
/** The original PDF, or the signed copy once complete. */
|
|
170
170
|
file(id: string, which: "original" | "signed"): Promise<Uint8Array | null>;
|
|
@@ -180,7 +180,7 @@ export interface Agreements {
|
|
|
180
180
|
handle(request: Request, ctx: {
|
|
181
181
|
waitUntil(p: Promise<unknown>): void;
|
|
182
182
|
}): Promise<Response | null>;
|
|
183
|
-
/** From the app's cron (hourly is plenty): expires, finishes, sends copies and reminders. */
|
|
183
|
+
/** From the app's cron (hourly is plenty): expires (emailing the signers and the business), finishes, sends copies and reminders. */
|
|
184
184
|
tick(): Promise<{
|
|
185
185
|
expired: number;
|
|
186
186
|
finished: number;
|
package/dist/agreements.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// or the downloads.
|
|
7
7
|
import { AGREEMENT_LANGUAGES, checkAgreementsConfig, MAX_SIGNERS, SIGNING_METHODS } from "./config.js";
|
|
8
8
|
import { buildSignedCopy, pdfPages } from "./certificate.js";
|
|
9
|
+
import { confirmed } from "./confirm.js";
|
|
9
10
|
import { AgreementsError } from "./errors.js";
|
|
10
11
|
import { renderCodePage, renderDonePage, renderEndedPage, renderSigningPage } from "./page.js";
|
|
11
12
|
import { signScriptHash } from "./script.js";
|
|
@@ -198,20 +199,124 @@ export function createAgreements(opts) {
|
|
|
198
199
|
await call("agreements_copies_sent", { p_id: a.id, p_at: now().toISOString(), p_count: to.length }, "recording the copies");
|
|
199
200
|
return true;
|
|
200
201
|
}
|
|
202
|
+
// The notices: a failed email never fails what it tells of, and each has its
|
|
203
|
+
// own idempotency key, so a retry never sends it twice.
|
|
204
|
+
const quietly = async (what, f) => {
|
|
205
|
+
try {
|
|
206
|
+
await f();
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
console.error(`workbench-agreements: ${what} wasn't sent`, e);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
// The business's own addresses: the agreement's copyTo, else the replyTo address.
|
|
213
|
+
const businessTo = (a) => (a.copy_to?.length ? a.copy_to : opts.replyTo ? [opts.replyTo] : []);
|
|
214
|
+
const names = (list) => (list.length ? list.map((x) => x.name).join(", ") : word("en", "email.nobody"));
|
|
215
|
+
const replyTo = opts.replyTo ? { replyTo: opts.replyTo } : {};
|
|
216
|
+
/** A decline closed it for everyone: tell the business, every other signer (including any who signed) and the signer who declined. */
|
|
201
217
|
async function notifyDeclined(id, signerId) {
|
|
202
218
|
const a = await raw(id);
|
|
203
219
|
const s = a?.signers.find((x) => x.id === signerId);
|
|
204
|
-
if (!a || !s
|
|
220
|
+
if (!a || !s)
|
|
221
|
+
return;
|
|
222
|
+
const others = a.signers.filter((x) => x.id !== s.id);
|
|
223
|
+
const to = businessTo(a);
|
|
224
|
+
if (to.length) {
|
|
225
|
+
const reason = s.decline_reason ? ` They said: "${s.decline_reason}"` : "";
|
|
226
|
+
await quietly("the decline email to the business", () => mailer.send({
|
|
227
|
+
to,
|
|
228
|
+
subject: word("en", "email.declined.subject", { title: a.title }),
|
|
229
|
+
text: word("en", "email.declined.text", { name: s.name, title: a.title, reason }) + (others.length ? `\n\n${word("en", "email.declined.others", { names: names(others) })}` : ""),
|
|
230
|
+
template: "agreement.declined",
|
|
231
|
+
idempotencyKey: `agreement-declined-${a.id}`,
|
|
232
|
+
}));
|
|
233
|
+
}
|
|
234
|
+
for (const o of others) {
|
|
235
|
+
const p = { name: o.name, who: s.name, title: a.title, business: a.business };
|
|
236
|
+
await quietly("a decline email to a signer", () => mailer.send({
|
|
237
|
+
to: o.email,
|
|
238
|
+
subject: word(a.language, "email.declined_signer.subject", p),
|
|
239
|
+
text: word(a.language, "email.declined_signer.text", p),
|
|
240
|
+
template: "agreement.declined_signer",
|
|
241
|
+
...replyTo,
|
|
242
|
+
idempotencyKey: `agreement-declined-${a.id}-${o.id}`,
|
|
243
|
+
}));
|
|
244
|
+
}
|
|
245
|
+
const p = { name: s.name, title: a.title, business: a.business };
|
|
246
|
+
await quietly("the decline email to the signer who declined", () => mailer.send({
|
|
247
|
+
to: s.email,
|
|
248
|
+
subject: word(a.language, "email.declined_you.subject", p),
|
|
249
|
+
text: word(a.language, "email.declined_you.text", p),
|
|
250
|
+
template: "agreement.declined_you",
|
|
251
|
+
...replyTo,
|
|
252
|
+
idempotencyKey: `agreement-declined-${a.id}-${s.id}`,
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
/** One of several has signed: tell the business who has and who is still to sign. */
|
|
256
|
+
async function notifySigned(id, signerId) {
|
|
257
|
+
const a = await raw(id);
|
|
258
|
+
const s = a?.signers.find((x) => x.id === signerId);
|
|
259
|
+
if (!a || !s || a.status !== "out" || a.signers.length < 2)
|
|
205
260
|
return;
|
|
206
|
-
const
|
|
261
|
+
const waiting = a.signers.filter((x) => x.status !== "signed");
|
|
262
|
+
const to = businessTo(a);
|
|
263
|
+
if (!waiting.length || !to.length)
|
|
264
|
+
return;
|
|
265
|
+
const p = { name: s.name, title: a.title, signed: names(a.signers.filter((x) => x.status === "signed")), waiting: names(waiting) };
|
|
207
266
|
await mailer.send({
|
|
208
|
-
to
|
|
209
|
-
subject: word("en", "email.
|
|
210
|
-
text: word("en", "email.
|
|
211
|
-
template: "agreement.
|
|
212
|
-
idempotencyKey: `agreement-
|
|
267
|
+
to,
|
|
268
|
+
subject: word("en", "email.progress.subject", p),
|
|
269
|
+
text: word("en", "email.progress.text", p),
|
|
270
|
+
template: "agreement.progress",
|
|
271
|
+
idempotencyKey: `agreement-progress-${s.id}`,
|
|
213
272
|
});
|
|
214
273
|
}
|
|
274
|
+
/** Withdrawn: tell every signer, including those who already signed, with the reason. */
|
|
275
|
+
async function notifyVoided(id, reason) {
|
|
276
|
+
const a = await raw(id);
|
|
277
|
+
if (!a || a.status !== "voided")
|
|
278
|
+
return;
|
|
279
|
+
for (const s of a.signers) {
|
|
280
|
+
const p = { name: s.name, title: a.title, business: a.business, reason };
|
|
281
|
+
await quietly("a withdrawn email", () => mailer.send({
|
|
282
|
+
to: s.email,
|
|
283
|
+
subject: word(a.language, "email.voided.subject", p),
|
|
284
|
+
text: word(a.language, "email.voided.text", p),
|
|
285
|
+
template: "agreement.voided",
|
|
286
|
+
...replyTo,
|
|
287
|
+
idempotencyKey: `agreement-voided-${a.id}-${s.id}`,
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/** Ran out: tell every signer and the business. */
|
|
292
|
+
async function notifyExpired(id) {
|
|
293
|
+
const a = await raw(id);
|
|
294
|
+
if (!a || a.status !== "expired")
|
|
295
|
+
return;
|
|
296
|
+
const date = dateLabel(a.expires_at);
|
|
297
|
+
for (const s of a.signers) {
|
|
298
|
+
const p = { name: s.name, title: a.title, business: a.business, date };
|
|
299
|
+
await quietly("an expired email", () => mailer.send({
|
|
300
|
+
to: s.email,
|
|
301
|
+
subject: word(a.language, "email.expired.subject", p),
|
|
302
|
+
text: word(a.language, "email.expired.text", p),
|
|
303
|
+
template: "agreement.expired",
|
|
304
|
+
...replyTo,
|
|
305
|
+
idempotencyKey: `agreement-expired-${a.id}-${s.id}`,
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
const to = businessTo(a);
|
|
309
|
+
if (!to.length)
|
|
310
|
+
return;
|
|
311
|
+
const p = { title: a.title, date, signed: names(a.signers.filter((x) => x.status === "signed")), waiting: names(a.signers.filter((x) => x.status !== "signed")) };
|
|
312
|
+
await quietly("the expired email to the business", () => mailer.send({
|
|
313
|
+
to,
|
|
314
|
+
subject: word("en", "email.expired_business.subject", p),
|
|
315
|
+
text: word("en", "email.expired_business.text", p),
|
|
316
|
+
template: "agreement.expired_business",
|
|
317
|
+
idempotencyKey: `agreement-expired-${a.id}`,
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
215
320
|
// ---- the route ----
|
|
216
321
|
const device = (request) => config.record_device ? { ip: request.headers.get("cf-connecting-ip")?.slice(0, 64) ?? null, ua: request.headers.get("user-agent")?.slice(0, 400) ?? null } : { ip: null, ua: null };
|
|
217
322
|
async function html(status, body, script, head) {
|
|
@@ -361,7 +466,10 @@ export function createAgreements(opts) {
|
|
|
361
466
|
throw new AgreementsError("invalid_request", "reason must be 1 to 500 characters");
|
|
362
467
|
if (!/^[0-9a-f-]{36}$/i.test(id))
|
|
363
468
|
return false;
|
|
364
|
-
|
|
469
|
+
const done = await call("agreements_void", { p_id: id, p_reason: reason.trim(), p_at: now().toISOString() }, "withdrawing the agreement");
|
|
470
|
+
if (done)
|
|
471
|
+
await quietly("the withdrawn emails", () => notifyVoided(id, reason.trim()));
|
|
472
|
+
return done;
|
|
365
473
|
},
|
|
366
474
|
async file(id, which) {
|
|
367
475
|
const a = await raw(id);
|
|
@@ -433,11 +541,13 @@ export function createAgreements(opts) {
|
|
|
433
541
|
expires: dateLabel(a.expires_at),
|
|
434
542
|
pages: a.pages,
|
|
435
543
|
documentHref: `${self}/document.pdf`,
|
|
544
|
+
formHref: self,
|
|
545
|
+
declineTells: [...a.signers.filter((x) => x.id !== s.id).map((x) => x.name), ...(businessTo(a).length ? [a.business] : [])],
|
|
436
546
|
};
|
|
437
547
|
const codeSent = !!s.code_expires_at && Date.parse(s.code_expires_at) > at.getTime();
|
|
438
548
|
if (method !== "POST") {
|
|
439
549
|
if (s.status === "declined")
|
|
440
|
-
return html(200, renderEndedPage("declined_by_you", { ...o, title: a.title, business: a.business }), false, head);
|
|
550
|
+
return html(200, renderEndedPage("declined_by_you", { ...o, title: a.title, business: a.business, businessTold: businessTo(a).length > 0 }), false, head);
|
|
441
551
|
if (s.status === "signed")
|
|
442
552
|
return html(200, renderDonePage(view, { ...o, signedAt: dateLabel(s.signed_at), completed: a.status === "completed", ...(a.status === "completed" ? { downloadHref: `${self}/signed.pdf` } : {}) }), false, head);
|
|
443
553
|
if (closed)
|
|
@@ -484,6 +594,9 @@ export function createAgreements(opts) {
|
|
|
484
594
|
if (action === "decline") {
|
|
485
595
|
if (needCode)
|
|
486
596
|
return redirect(self);
|
|
597
|
+
// Declining closes it for everyone and can't be undone: without the answer to "Are you sure?", ask again.
|
|
598
|
+
if (!confirmed({ confirm: form.get("confirm") }))
|
|
599
|
+
return html(409, renderSigningPage(view, config.methods, { ...o, problems: ["problem.confirm_needed"], declineOpen: true }), true, false);
|
|
487
600
|
const reason = (form.get("reason") ?? "").trim().slice(0, 500);
|
|
488
601
|
const r = await call("agreements_decline", { p_signer: s.id, p_at: at.toISOString(), p_reason: reason, p_ip: ip, p_ua: ua }, "declining");
|
|
489
602
|
if (r.ok)
|
|
@@ -527,6 +640,8 @@ export function createAgreements(opts) {
|
|
|
527
640
|
const r = await call("agreements_sign", { p_signer: s.id, p_at: now().toISOString(), p_method: chosen, p_typed_name: name, p_signature_key: signatureKey, p_consent: consent, p_ip: ip, p_ua: ua, p_require_verified: a.identity === "email_code" }, "signing");
|
|
528
641
|
if (!r.ok && signatureKey)
|
|
529
642
|
await files.delete(signatureKey).catch(() => { });
|
|
643
|
+
if (r.ok && !r.all_signed && a.signers.length > 1)
|
|
644
|
+
ctx.waitUntil(quietly("the signed-so-far email to the business", () => notifySigned(a.id, s.id)));
|
|
530
645
|
if (r.ok && r.all_signed) {
|
|
531
646
|
try {
|
|
532
647
|
if (await finish(a.id))
|
|
@@ -543,6 +658,8 @@ export function createAgreements(opts) {
|
|
|
543
658
|
const at = now();
|
|
544
659
|
const scan = await call("agreements_scan", { p_at: at.toISOString(), p_limit: 100 }, "scanning agreements");
|
|
545
660
|
out.expired = scan.expired.length;
|
|
661
|
+
for (const id of scan.expired)
|
|
662
|
+
await quietly(`${id}'s expired emails`, () => notifyExpired(id));
|
|
546
663
|
const attempt = async (what, f) => {
|
|
547
664
|
try {
|
|
548
665
|
return await f();
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface ConfirmOptions {
|
|
2
|
+
/** The tool's class prefix, without the trailing dash: "wb-booking". */
|
|
3
|
+
prefix: string;
|
|
4
|
+
/** Where the form posts. */
|
|
5
|
+
endpoint: string;
|
|
6
|
+
/** The hidden fields that say what to do: action, the thing's id or token. */
|
|
7
|
+
fields: Readonly<Record<string, string>>;
|
|
8
|
+
/** The first button's words: "Cancel". */
|
|
9
|
+
ask: string;
|
|
10
|
+
/** The first button's class, so it keeps the look it has in the tool's styles. */
|
|
11
|
+
askClass: string;
|
|
12
|
+
/** The question, naming the thing: "Cancel Sam's booking for Yoga on Monday 7 December at 6:00 pm?" */
|
|
13
|
+
question: string;
|
|
14
|
+
/** What happens next and who is told: "We'll email Sam to say it's cancelled." */
|
|
15
|
+
consequence?: string;
|
|
16
|
+
/** The button that does it, in its own words: "Yes, cancel this booking". */
|
|
17
|
+
yes: string;
|
|
18
|
+
/** The words that close the question again: "No, keep it". */
|
|
19
|
+
no: string;
|
|
20
|
+
/** A reason to send with it, when the action takes one. */
|
|
21
|
+
reason?: {
|
|
22
|
+
label: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
maxlength?: number;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** For deleting a lot at once: a word the person must type before the button works. */
|
|
28
|
+
type?: {
|
|
29
|
+
label: string;
|
|
30
|
+
word: string;
|
|
31
|
+
};
|
|
32
|
+
/** More fields for the question's form, as HTML the tool has already escaped (a second box, a choice). Drawn above the button. */
|
|
33
|
+
extra?: string;
|
|
34
|
+
/** Draw the question already showing: the page was drawn again to ask it. */
|
|
35
|
+
open?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** The button and its question. */
|
|
38
|
+
export declare function renderConfirm(o: ConfirmOptions): string;
|
|
39
|
+
/** Whether a post answered the question: confirm=yes and, where a word had to be typed, that word. */
|
|
40
|
+
export declare function confirmed(body: Readonly<Record<string, unknown>>, word?: string): boolean;
|
|
41
|
+
interface ConfirmStyle {
|
|
42
|
+
name: string;
|
|
43
|
+
element: string;
|
|
44
|
+
about: string;
|
|
45
|
+
css: string;
|
|
46
|
+
states?: readonly {
|
|
47
|
+
selector: string;
|
|
48
|
+
about: string;
|
|
49
|
+
css: string;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The question's classes with their default rules, for the tool's styles.
|
|
54
|
+
* `v` reads one of the tool's own variables (text, muted, line, sunk, surface,
|
|
55
|
+
* radius, danger, on-danger, focus).
|
|
56
|
+
*/
|
|
57
|
+
export declare function confirmStyles(prefix: string, v: (name: string) => string, o?: {
|
|
58
|
+
reason?: boolean;
|
|
59
|
+
}): ConfirmStyle[];
|
|
60
|
+
export {};
|
package/dist/confirm.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// "Are you sure?" for the actions that cancel, decline or delete
|
|
2
|
+
// (docs/critical-actions-audit.md, "The standard"). The button a person presses first only opens
|
|
3
|
+
// the question: what is about to happen, named in full, and who will be told.
|
|
4
|
+
// The second button does it. It is a <details>, so it works with no script,
|
|
5
|
+
// and the post carries confirm=yes, which the action helpers insist on: a page
|
|
6
|
+
// that draws its own one-click button is refused with `confirm_needed`.
|
|
7
|
+
//
|
|
8
|
+
// This file is the same in every tool that asks (only the prefix differs), so
|
|
9
|
+
// a project restyles each tool's question by that tool's own class names.
|
|
10
|
+
const esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
11
|
+
const pattern = (word) => word.replace(/[.*+?^${}()|[\]\\\/-]/g, "\\$&");
|
|
12
|
+
/** The button and its question. */
|
|
13
|
+
export function renderConfirm(o) {
|
|
14
|
+
const p = o.prefix;
|
|
15
|
+
const hidden = Object.entries({ ...o.fields, confirm: "yes" })
|
|
16
|
+
.map(([k, v]) => `<input type="hidden" name="${esc(k)}" value="${esc(v)}">`)
|
|
17
|
+
.join("");
|
|
18
|
+
const reason = o.reason
|
|
19
|
+
? `<label class="${p}-confirm-field"><span class="${p}-confirm-label">${esc(o.reason.label)}</span><input class="${p}-confirm-input" type="text" name="${esc(o.reason.name ?? "reason")}" maxlength="${o.reason.maxlength ?? 200}"${o.reason.required ? " required" : ""}></label>`
|
|
20
|
+
: "";
|
|
21
|
+
const type = o.type
|
|
22
|
+
? `<label class="${p}-confirm-field"><span class="${p}-confirm-label">${esc(o.type.label)}</span><input class="${p}-confirm-input" type="text" name="confirm_word" required pattern="${esc(pattern(o.type.word))}" autocomplete="off" autocapitalize="off" spellcheck="false"></label>`
|
|
23
|
+
: "";
|
|
24
|
+
return `<details class="${p}-confirm"${o.open ? " open" : ""}><summary class="${p}-confirm-open ${esc(o.askClass)}"><span class="${p}-confirm-ask">${esc(o.ask)}</span><span class="${p}-confirm-keep">${esc(o.no)}</span></summary><form class="${p}-confirm-form" method="post" action="${esc(o.endpoint)}">${hidden}<p class="${p}-confirm-question">${esc(o.question)}</p>${o.consequence ? `<p class="${p}-confirm-consequence">${esc(o.consequence)}</p>` : ""}${reason}${o.extra ?? ""}${type}<button class="${p}-confirm-yes" type="submit">${esc(o.yes)}</button></form></details>`;
|
|
25
|
+
}
|
|
26
|
+
/** Whether a post answered the question: confirm=yes and, where a word had to be typed, that word. */
|
|
27
|
+
export function confirmed(body, word) {
|
|
28
|
+
if (body.confirm !== "yes" && body.confirm !== true)
|
|
29
|
+
return false;
|
|
30
|
+
return word === undefined || (typeof body.confirm_word === "string" && body.confirm_word.trim() === word);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The question's classes with their default rules, for the tool's styles.
|
|
34
|
+
* `v` reads one of the tool's own variables (text, muted, line, sunk, surface,
|
|
35
|
+
* radius, danger, on-danger, focus).
|
|
36
|
+
*/
|
|
37
|
+
export function confirmStyles(prefix, v, o = {}) {
|
|
38
|
+
const focus = { selector: ":focus-visible", about: "Has focus", css: `outline:none;box-shadow:0 0 0 3px ${v("focus")}` };
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
name: `${prefix}-confirm`,
|
|
42
|
+
element: "details",
|
|
43
|
+
about: "A button that asks \"Are you sure?\" before it cancels, declines or deletes",
|
|
44
|
+
css: "display:block",
|
|
45
|
+
states: [
|
|
46
|
+
{ selector: `[open]`, about: "The question is showing", css: `display:flex;flex-direction:column;align-items:flex-start;gap:.75rem;box-sizing:border-box;width:100%;padding:1rem;background:${v("sunk")};border:1px solid ${v("line")};border-radius:${v("radius")}` },
|
|
47
|
+
{ selector: `[open] > summary`, about: "\"No, keep it\" sits under the button that does it", css: "order:2" },
|
|
48
|
+
{ selector: `[open] .${prefix}-confirm-ask`, about: "The first button's words, hidden while the question shows", css: "display:none" },
|
|
49
|
+
{ selector: `[open] .${prefix}-confirm-keep`, about: "\"No, keep it\", shown while the question shows", css: "display:inline" },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: `${prefix}-confirm-open`,
|
|
54
|
+
element: "summary",
|
|
55
|
+
about: "The first button: it only opens the question",
|
|
56
|
+
css: "list-style:none",
|
|
57
|
+
states: [{ selector: "::-webkit-details-marker", about: "No arrow beside the button", css: "display:none" }],
|
|
58
|
+
},
|
|
59
|
+
{ name: `${prefix}-confirm-ask`, element: "span", about: "The first button's words", css: "display:inline" },
|
|
60
|
+
{ name: `${prefix}-confirm-keep`, element: "span", about: "\"No, keep it\": closes the question", css: `display:none;color:${v("text")}` },
|
|
61
|
+
{ name: `${prefix}-confirm-form`, element: "form", about: "The question and the button that does it", css: "display:grid;gap:.75rem;justify-items:start;width:100%" },
|
|
62
|
+
{ name: `${prefix}-confirm-question`, element: "p", about: "What is about to happen, naming the thing", css: `margin:0;font-weight:600;color:${v("text")}` },
|
|
63
|
+
{ name: `${prefix}-confirm-consequence`, element: "p", about: "What happens next and who is told", css: `margin:0;color:${v("muted")}` },
|
|
64
|
+
...(o.reason
|
|
65
|
+
? [
|
|
66
|
+
{ name: `${prefix}-confirm-field`, element: "label", about: "The reason, or the word to type", css: "display:grid;gap:.25rem;width:100%" },
|
|
67
|
+
{ name: `${prefix}-confirm-label`, element: "span", about: "What to type there", css: `color:${v("muted")}` },
|
|
68
|
+
{
|
|
69
|
+
name: `${prefix}-confirm-input`,
|
|
70
|
+
element: "input",
|
|
71
|
+
about: "Where it is typed",
|
|
72
|
+
css: `box-sizing:border-box;width:100%;min-height:2.75rem;padding:.5rem .75rem;font:inherit;color:${v("text")};background:${v("surface")};border:1px solid ${v("line")};border-radius:${v("radius")}`,
|
|
73
|
+
states: [focus],
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
: []),
|
|
77
|
+
{
|
|
78
|
+
name: `${prefix}-confirm-yes`,
|
|
79
|
+
element: "button",
|
|
80
|
+
about: "The button that does it",
|
|
81
|
+
css: `display:inline-flex;align-items:center;justify-content:center;min-height:2.75rem;padding:0 1rem;font:inherit;font-weight:600;border-radius:${v("radius")};cursor:pointer;color:${v("on-danger")};background:${v("danger")};border:1px solid ${v("danger")}`,
|
|
82
|
+
states: [focus],
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export type AgreementsErrorCode = "invalid_config" | "invalid_request" | "not_found" | "not_allowed" | "conflict"
|
|
1
|
+
export type AgreementsErrorCode = "invalid_config" | "invalid_request" | "not_found" | "not_allowed" | "conflict"
|
|
2
|
+
/** A withdraw arrived without the answer to "Are you sure?" (confirm=yes). Nothing was changed. */
|
|
3
|
+
| "confirm_needed" | "database" | "storage" | "pdf";
|
|
2
4
|
/** Every failure workbench-agreements throws. `code` says whose it is: the project's config, the caller's request, the database, the file store or the PDF. */
|
|
3
5
|
export declare class AgreementsError extends Error {
|
|
4
6
|
readonly code: AgreementsErrorCode;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export { createAgreements, type Agreement, type AgreementEvent, type Agreements,
|
|
|
2
2
|
export { AGREEMENT_LANGUAGES, agreementsProblems, checkAgreementsConfig, IDENTITY_CHECKS, MAX_REMINDERS, MAX_SIGNERS, SIGNING_METHODS, STARTER_AGREEMENTS, type AgreementLanguage, type AgreementsConfig, type IdentityCheck, type SigningMethod, } from "./config.ts";
|
|
3
3
|
export { bothTimes, buildSignedCopy, pdfPages, type CertificateEvent, type CertificateInput, type CertificateSigner } from "./certificate.ts";
|
|
4
4
|
export { agreementsMigration } from "./migration.ts";
|
|
5
|
-
export { renderCodePage, renderDonePage, renderEndedPage, renderSigningPage, type EndedReason, type SigningView } from "./page.ts";
|
|
5
|
+
export { renderCodePage, renderDonePage, renderEndedPage, renderSigningPage, type EndedReason, type SigningFormState, type SigningView } from "./page.ts";
|
|
6
|
+
export { ownerAgreementAction, renderVoidConfirm, type OwnerAgreementResult, type OwnerOptions, type VoidConfirmOptions } from "./owner.ts";
|
|
7
|
+
export { confirmed, renderConfirm, type ConfirmOptions } from "./confirm.ts";
|
|
6
8
|
export { AGREEMENT_STYLES } from "./styles.ts";
|
|
7
9
|
export { AGREEMENT_WORD_KEYS, AGREEMENT_WORDS, agreementWord, type AgreementStrings, type AgreementWordKey } from "./words.ts";
|
|
8
10
|
export { AgreementsError, type AgreementsErrorCode } from "./errors.ts";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export { AGREEMENT_LANGUAGES, agreementsProblems, checkAgreementsConfig, IDENTIT
|
|
|
8
8
|
export { bothTimes, buildSignedCopy, pdfPages } from "./certificate.js";
|
|
9
9
|
export { agreementsMigration } from "./migration.js";
|
|
10
10
|
export { renderCodePage, renderDonePage, renderEndedPage, renderSigningPage } from "./page.js";
|
|
11
|
+
export { ownerAgreementAction, renderVoidConfirm } from "./owner.js";
|
|
12
|
+
export { confirmed, renderConfirm } from "./confirm.js";
|
|
11
13
|
export { AGREEMENT_STYLES } from "./styles.js";
|
|
12
14
|
export { AGREEMENT_WORD_KEYS, AGREEMENT_WORDS, agreementWord } from "./words.js";
|
|
13
15
|
export { AgreementsError } from "./errors.js";
|
package/dist/owner.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Agreement, Agreements } from "./agreements.ts";
|
|
2
|
+
import type { AgreementLanguage } from "./config.ts";
|
|
3
|
+
import { type AgreementsErrorCode } from "./errors.ts";
|
|
4
|
+
import { type AgreementStrings } from "./words.ts";
|
|
5
|
+
export interface OwnerOptions {
|
|
6
|
+
/** The owner's pages' language. Default en. */
|
|
7
|
+
language?: AgreementLanguage;
|
|
8
|
+
/** The project's strings (`ui.wbagreement.*`). */
|
|
9
|
+
t?: AgreementStrings;
|
|
10
|
+
}
|
|
11
|
+
export interface VoidConfirmOptions extends OwnerOptions {
|
|
12
|
+
/** Where the question's button posts: the owner's route behind their sign-in, which calls ownerAgreementAction. */
|
|
13
|
+
endpoint: string;
|
|
14
|
+
/** Hidden fields the app's route needs back. */
|
|
15
|
+
hidden?: Readonly<Record<string, string>>;
|
|
16
|
+
/** Draw the question already showing. */
|
|
17
|
+
open?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* "Withdraw" for an agreement that is still out: asks "Withdraw Venue hire
|
|
21
|
+
* agreement, sent to Maria Santos, Sam Lee?" first, with a reason that is
|
|
22
|
+
* needed. Nothing is drawn once the agreement is closed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderVoidConfirm(agreement: Agreement, o: VoidConfirmOptions): string;
|
|
25
|
+
export type OwnerAgreementResult = {
|
|
26
|
+
status: number;
|
|
27
|
+
body: {
|
|
28
|
+
ok: true;
|
|
29
|
+
action: "void";
|
|
30
|
+
agreement: Agreement | null;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
status: number;
|
|
34
|
+
body: {
|
|
35
|
+
ok: false;
|
|
36
|
+
error: AgreementsErrorCode;
|
|
37
|
+
text: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The owner's posts, behind the app's sign-in, with the signed-in owner's
|
|
42
|
+
* account: `void` (agreement, reason; needs confirm=yes) withdraws an
|
|
43
|
+
* agreement that is still out and emails everyone on it, including anyone
|
|
44
|
+
* who has already signed, with the reason. An agreement of another account is
|
|
45
|
+
* answered as not found. `text` is the line to show the owner when it didn't
|
|
46
|
+
* go through.
|
|
47
|
+
*/
|
|
48
|
+
export declare function ownerAgreementAction(agreements: Agreements, body: Record<string, unknown>, ctx: {
|
|
49
|
+
account: string;
|
|
50
|
+
} & OwnerOptions): Promise<OwnerAgreementResult>;
|
package/dist/owner.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// The owner's Withdraw (`void`) on the app's own pages, behind its sign-in
|
|
2
|
+
// (docs/critical-actions-audit.md, "Agreements"). renderVoidConfirm draws the
|
|
3
|
+
// button, which only opens "Are you sure?": it names the agreement and who it
|
|
4
|
+
// was sent to, says their links stop working and that everyone on it is
|
|
5
|
+
// emailed the reason, and takes the reason. ownerAgreementAction refuses a
|
|
6
|
+
// post without confirm=yes, so an app page that draws its own one-click
|
|
7
|
+
// button can't skip the question. Every element carries a wb-agreement-*
|
|
8
|
+
// class (AGREEMENT_STYLES).
|
|
9
|
+
import { confirmed, renderConfirm } from "./confirm.js";
|
|
10
|
+
import { AgreementsError } from "./errors.js";
|
|
11
|
+
import { agreementWord } from "./words.js";
|
|
12
|
+
const wordsFor = (o) => (key, params) => agreementWord(o.t, o.language ?? "en", key, params);
|
|
13
|
+
/**
|
|
14
|
+
* "Withdraw" for an agreement that is still out: asks "Withdraw Venue hire
|
|
15
|
+
* agreement, sent to Maria Santos, Sam Lee?" first, with a reason that is
|
|
16
|
+
* needed. Nothing is drawn once the agreement is closed.
|
|
17
|
+
*/
|
|
18
|
+
export function renderVoidConfirm(agreement, o) {
|
|
19
|
+
if (agreement.status !== "out")
|
|
20
|
+
return "";
|
|
21
|
+
const w = wordsFor(o);
|
|
22
|
+
return renderConfirm({
|
|
23
|
+
prefix: "wb-agreement",
|
|
24
|
+
endpoint: o.endpoint,
|
|
25
|
+
fields: { ...o.hidden, action: "void", agreement: agreement.id },
|
|
26
|
+
ask: w("void.ask"),
|
|
27
|
+
askClass: "wb-agreement-void",
|
|
28
|
+
question: w("void.question", { title: agreement.title, names: agreement.signers.map((s) => s.name).join(", ") }),
|
|
29
|
+
consequence: w("void.consequence"),
|
|
30
|
+
yes: w("void.yes"),
|
|
31
|
+
no: w("confirm.no"),
|
|
32
|
+
reason: { label: w("void.reason"), maxlength: 500, required: true },
|
|
33
|
+
...(o.open ? { open: true } : {}),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const STATUS = {
|
|
37
|
+
invalid_config: 500,
|
|
38
|
+
invalid_request: 400,
|
|
39
|
+
not_found: 404,
|
|
40
|
+
not_allowed: 403,
|
|
41
|
+
conflict: 409,
|
|
42
|
+
confirm_needed: 409,
|
|
43
|
+
database: 502,
|
|
44
|
+
storage: 502,
|
|
45
|
+
pdf: 400,
|
|
46
|
+
};
|
|
47
|
+
const str = (v) => (typeof v === "string" ? v : "");
|
|
48
|
+
/**
|
|
49
|
+
* The owner's posts, behind the app's sign-in, with the signed-in owner's
|
|
50
|
+
* account: `void` (agreement, reason; needs confirm=yes) withdraws an
|
|
51
|
+
* agreement that is still out and emails everyone on it, including anyone
|
|
52
|
+
* who has already signed, with the reason. An agreement of another account is
|
|
53
|
+
* answered as not found. `text` is the line to show the owner when it didn't
|
|
54
|
+
* go through.
|
|
55
|
+
*/
|
|
56
|
+
export async function ownerAgreementAction(agreements, body, ctx) {
|
|
57
|
+
const w = wordsFor(ctx);
|
|
58
|
+
try {
|
|
59
|
+
const action = str(body.action);
|
|
60
|
+
if (action !== "void")
|
|
61
|
+
return { status: 400, body: { ok: false, error: "invalid_request", text: w("error.failed") } };
|
|
62
|
+
if (!confirmed(body))
|
|
63
|
+
throw new AgreementsError("confirm_needed", "withdrawing can't be undone: ask the owner first and post confirm=yes");
|
|
64
|
+
const id = str(body.agreement);
|
|
65
|
+
const a = await agreements.get(id);
|
|
66
|
+
if (!a || a.account !== ctx.account)
|
|
67
|
+
throw new AgreementsError("not_found", "no such agreement");
|
|
68
|
+
const reason = str(body.reason).trim().slice(0, 500);
|
|
69
|
+
if (!reason)
|
|
70
|
+
throw new AgreementsError("invalid_request", "a reason is needed");
|
|
71
|
+
if (!(await agreements.void(a.id, reason)))
|
|
72
|
+
throw new AgreementsError("conflict", "the agreement is already closed");
|
|
73
|
+
return { status: 200, body: { ok: true, action: "void", agreement: await agreements.get(a.id) } };
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
if (!(e instanceof AgreementsError))
|
|
77
|
+
throw e;
|
|
78
|
+
const text = e.code === "confirm_needed" ? w("error.confirm_needed") : e.code === "not_found" ? w("error.not_found") : e.code === "conflict" ? w("error.closed") : e.code === "invalid_request" ? w("error.reason") : w("error.failed");
|
|
79
|
+
return { status: STATUS[e.code], body: { ok: false, error: e.code, text } };
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/page.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export interface SigningView {
|
|
|
17
17
|
pages: number;
|
|
18
18
|
/** The PDF's address, relative to the page. */
|
|
19
19
|
documentHref: string;
|
|
20
|
+
/** Where the page's forms post: the signing link's own path. Default: documentHref without its /document.pdf. */
|
|
21
|
+
formHref?: string;
|
|
22
|
+
/** Who is emailed if this signer declines (the other signers, and the business when it has an address). Default: the other signers. */
|
|
23
|
+
declineTells?: readonly string[];
|
|
20
24
|
}
|
|
21
25
|
export interface SigningFormState {
|
|
22
26
|
problems?: readonly AgreementWordKey[];
|
|
@@ -24,8 +28,10 @@ export interface SigningFormState {
|
|
|
24
28
|
method?: SigningMethod;
|
|
25
29
|
consentRead?: boolean;
|
|
26
30
|
consentEsign?: boolean;
|
|
31
|
+
/** Draw "Are you sure?" for declining already open: a decline came without its answer. */
|
|
32
|
+
declineOpen?: boolean;
|
|
27
33
|
}
|
|
28
|
-
/** The signing page: read, tick, name, sign; and a fold to decline. */
|
|
34
|
+
/** The signing page: read, tick, name, sign; and a fold to decline, which asks first. */
|
|
29
35
|
export declare function renderSigningPage(v: SigningView, methods: readonly SigningMethod[], o: PageCommon & SigningFormState): string;
|
|
30
36
|
/** The email code check, before the agreement opens. */
|
|
31
37
|
export declare function renderCodePage(v: Pick<SigningView, "title" | "business" | "signerEmail">, o: PageCommon & {
|
|
@@ -43,4 +49,5 @@ export type EndedReason = "declined_by_you" | "voided" | "expired" | "declined";
|
|
|
43
49
|
export declare function renderEndedPage(reason: EndedReason | "not_found", o: PageCommon & {
|
|
44
50
|
title?: string;
|
|
45
51
|
business?: string;
|
|
52
|
+
businessTold?: boolean;
|
|
46
53
|
}): string;
|
package/dist/page.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// every element (AGREEMENT_STYLES): the signing page, the email code check,
|
|
3
3
|
// and the done, declined, ended and not-found pages. The signing page works
|
|
4
4
|
// without its script for a typed signature; drawing needs the script.
|
|
5
|
+
import { renderConfirm } from "./confirm.js";
|
|
5
6
|
import { SIGN_SCRIPT } from "./script.js";
|
|
6
7
|
import { agreementWord } from "./words.js";
|
|
7
8
|
const DEFAULT_STYLESHEETS = ["/styles/workbench.css", "/styles/project.css"];
|
|
@@ -45,7 +46,30 @@ function headerHtml(o, v) {
|
|
|
45
46
|
].join("\n");
|
|
46
47
|
}
|
|
47
48
|
const hidden = (name, value) => `<input class="wb-agreement-data" type="hidden" name="${name}" value="${esc(value)}">`;
|
|
48
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Decline to sign: the first button only opens "Are you sure?", which says it
|
|
51
|
+
* closes the agreement for everyone, can't be undone, and who is emailed, with
|
|
52
|
+
* an optional reason for the business. Its button posts confirm=yes, without
|
|
53
|
+
* which the route doesn't decline.
|
|
54
|
+
*/
|
|
55
|
+
function declineHtml(v, o) {
|
|
56
|
+
const say = (key, params) => agreementWord(o.t, o.language, key, params);
|
|
57
|
+
const tells = v.declineTells ?? v.others;
|
|
58
|
+
return `<div class="wb-agreement-decline">${renderConfirm({
|
|
59
|
+
prefix: "wb-agreement",
|
|
60
|
+
endpoint: v.formHref ?? v.documentHref.replace(/\/document\.pdf$/, ""),
|
|
61
|
+
fields: { action: "decline" },
|
|
62
|
+
ask: say("decline.open"),
|
|
63
|
+
askClass: "wb-agreement-decline-summary",
|
|
64
|
+
question: say("decline.question", { title: v.title, business: v.business }),
|
|
65
|
+
consequence: [say("decline.consequence", { business: v.business }), ...(tells.length ? [say("decline.tells", { names: tells.join(", ") })] : [])].join(" "),
|
|
66
|
+
yes: say("decline"),
|
|
67
|
+
no: say("decline.no"),
|
|
68
|
+
reason: { label: say("decline.reason", { business: v.business }), maxlength: 500 },
|
|
69
|
+
...(o.declineOpen ? { open: true } : {}),
|
|
70
|
+
})}</div>`;
|
|
71
|
+
}
|
|
72
|
+
/** The signing page: read, tick, name, sign; and a fold to decline, which asks first. */
|
|
49
73
|
export function renderSigningPage(v, methods, o) {
|
|
50
74
|
const method = o.method && methods.includes(o.method) ? o.method : methods[0];
|
|
51
75
|
const check = (name, key, on) => `<label class="wb-agreement-check"><input class="wb-agreement-check-input" type="checkbox" name="${name}" value="yes" required${on ? " checked" : ""}><span>${w(o, key)}</span></label>`;
|
|
@@ -72,9 +96,7 @@ export function renderSigningPage(v, methods, o) {
|
|
|
72
96
|
`<button class="wb-agreement-sign" type="submit">${w(o, "sign")}</button>`,
|
|
73
97
|
`<p class="wb-agreement-hint">${w(o, "sign_hint", { name: o.name ?? v.signerName })}</p>`,
|
|
74
98
|
"</form>",
|
|
75
|
-
|
|
76
|
-
`<form class="wb-agreement-form" method="post">${hidden("action", "decline")}<div class="wb-agreement-field"><label class="wb-agreement-label" for="wb-agreement-reason">${w(o, "decline.reason", { business: v.business })}</label><textarea class="wb-agreement-textarea" id="wb-agreement-reason" name="reason" maxlength="500"></textarea></div><button class="wb-agreement-decline-button" type="submit">${w(o, "decline")}</button></form>`,
|
|
77
|
-
"</details>",
|
|
99
|
+
declineHtml(v, o),
|
|
78
100
|
];
|
|
79
101
|
return shell(o, v.title, parts.filter(Boolean).join("\n"), true);
|
|
80
102
|
}
|
|
@@ -108,7 +130,11 @@ export function renderDonePage(v, o) {
|
|
|
108
130
|
/** A closed agreement, or a link that leads nowhere. */
|
|
109
131
|
export function renderEndedPage(reason, o) {
|
|
110
132
|
const business = o.business ?? "";
|
|
111
|
-
const [title, text] = reason === "not_found"
|
|
133
|
+
const [title, text] = reason === "not_found"
|
|
134
|
+
? ["not_found.title", "not_found.text"]
|
|
135
|
+
: reason === "declined_by_you"
|
|
136
|
+
? ["declined.title", o.businessTold === false ? "declined.untold" : "declined.text"]
|
|
137
|
+
: ["ended.title", `ended.${reason}`];
|
|
112
138
|
const body = [
|
|
113
139
|
`<h1 class="wb-agreement-title">${w(o, title)}</h1>`,
|
|
114
140
|
...(o.title ? [`<p class="wb-agreement-meta">${esc(o.title)}</p>`] : []),
|
package/dist/styles.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// public/styles/workbench.css. The names are public: renaming one is a
|
|
7
7
|
// breaking change. Signers are mostly on a phone, so it starts light, with
|
|
8
8
|
// 48 px buttons.
|
|
9
|
+
import { confirmStyles } from "./confirm.js";
|
|
9
10
|
const v = (name) => `var(--wb-agreement-${name})`;
|
|
10
11
|
const button = `display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;min-height:48px;padding:0 1.25rem;border-radius:${v("radius")};font:inherit;font-weight:600;text-decoration:none;cursor:pointer`;
|
|
11
12
|
const focus = { selector: ":focus-visible", about: "Has focus", css: `outline:none;box-shadow:0 0 0 3px ${v("focus")}` };
|
|
@@ -28,6 +29,8 @@ export const AGREEMENT_STYLES = {
|
|
|
28
29
|
{ name: "--wb-agreement-danger-soft", value: "var(--wb-danger-bg, #f9eded)", about: "Background of the problem box" },
|
|
29
30
|
{ name: "--wb-agreement-focus", value: "var(--wb-focus, rgba(37,99,235,0.4))", about: "The ring round whatever has focus" },
|
|
30
31
|
{ name: "--wb-agreement-radius", value: "var(--wb-radius, 8px)", about: "Corner rounding of fields, buttons and the signature box" },
|
|
32
|
+
{ name: "--wb-agreement-on-danger", value: "#ffffff", about: "Text on the button that declines or withdraws after \"Are you sure?\"" },
|
|
33
|
+
{ name: "--wb-agreement-sunk", value: "color-mix(in srgb, var(--wb-background, #ffffff), var(--wb-text, #1f2937) 3%)", about: "Background of the \"Are you sure?\" question" },
|
|
31
34
|
{ name: "--wb-agreement-width", value: "36rem", about: "Widest the page grows" },
|
|
32
35
|
{ name: "--wb-agreement-signature-font", value: '"Segoe Script","Brush Script MT","Snell Roundhand",cursive', about: "The typed signature's handwriting font" },
|
|
33
36
|
],
|
|
@@ -58,11 +61,12 @@ export const AGREEMENT_STYLES = {
|
|
|
58
61
|
{ name: "wb-agreement-clear", element: "button", about: "Clears the drawn signature", css: `align-self:flex-end;min-height:40px;padding:0 1rem;border:1px solid ${v("line")};border-radius:${v("radius")};background:transparent;color:${v("text")};font:inherit;cursor:pointer`, states: [focus] },
|
|
59
62
|
{ name: "wb-agreement-data", element: "input", about: "A hidden field the form sends (which action, the drawn signature)", css: "display:none" },
|
|
60
63
|
{ name: "wb-agreement-sign", element: "button", about: "The Sign button, and the code form's buttons", css: `${button};border:0;color:${v("on-accent")};background:${v("accent")}`, states: [focus, { selector: ":disabled", about: "While the form is sending", css: "opacity:.6;cursor:wait" }] },
|
|
61
|
-
{ name: "wb-agreement-decline", element: "
|
|
62
|
-
{ name: "wb-agreement-decline-summary", element: "summary", about: "
|
|
63
|
-
{ name: "wb-agreement-
|
|
64
|
-
{ name: "wb-agreement-
|
|
64
|
+
{ name: "wb-agreement-decline", element: "div", about: "The way to decline, under the signing form", css: "margin:1.5rem 0 0" },
|
|
65
|
+
{ name: "wb-agreement-decline-summary", element: "summary", about: "I don't want to sign: opens \"Are you sure?\"", css: `color:${v("muted")};cursor:pointer`, states: [focus] },
|
|
66
|
+
{ name: "wb-agreement-decline-button", element: "button", about: "The code page's quieter button (send a new code)", css: `${button};border:1px solid ${v("danger")};color:${v("danger")};background:transparent`, states: [focus] },
|
|
67
|
+
{ name: "wb-agreement-void", element: "summary", about: "The owner's Withdraw, on the app's own page: opens \"Are you sure?\"", css: `display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:0 1.25rem;border-radius:${v("radius")};font:inherit;font-weight:600;cursor:pointer;border:1px solid ${v("danger")};color:${v("danger")};background:transparent`, states: [focus] },
|
|
65
68
|
{ name: "wb-agreement-text", element: "p", about: "A paragraph on the done, declined, ended and code pages", css: "margin:.5rem 0 0" },
|
|
66
69
|
{ name: "wb-agreement-download", element: "a", about: "Downloads the signed copy", css: `${button};margin:1.25rem 0 0;border:0;color:${v("on-accent")};background:${v("accent")}`, states: [focus] },
|
|
70
|
+
...confirmStyles("wb-agreement", v, { reason: true }),
|
|
67
71
|
],
|
|
68
72
|
};
|
package/dist/words.d.ts
CHANGED
|
@@ -24,8 +24,13 @@ declare const EN: {
|
|
|
24
24
|
readonly sign_hint: "By tapping Sign agreement you sign it as {name}.";
|
|
25
25
|
readonly "decline.open": "I don't want to sign";
|
|
26
26
|
readonly "decline.reason": "Tell {business} why (optional)";
|
|
27
|
-
readonly decline: "
|
|
27
|
+
readonly decline: "Yes, decline to sign";
|
|
28
|
+
readonly "decline.question": "Decline to sign {title} from {business}?";
|
|
29
|
+
readonly "decline.consequence": "This closes the agreement for everyone: nobody else can sign it, and it can't be undone. {business} would have to send a new one.";
|
|
30
|
+
readonly "decline.tells": "We'll email {names} to say you declined.";
|
|
31
|
+
readonly "decline.no": "No, go back";
|
|
28
32
|
readonly "problem.title": "Please fix this first";
|
|
33
|
+
readonly "problem.confirm_needed": "Please confirm first. Nothing has changed.";
|
|
29
34
|
readonly "problem.consent_read": "Tick the box to say you have read the agreement.";
|
|
30
35
|
readonly "problem.consent_esign": "Tick the box to agree to sign electronically.";
|
|
31
36
|
readonly "problem.name": "Type your full name (2 to 120 characters).";
|
|
@@ -47,6 +52,7 @@ declare const EN: {
|
|
|
47
52
|
readonly "done.download": "Download the signed copy";
|
|
48
53
|
readonly "declined.title": "You declined to sign";
|
|
49
54
|
readonly "declined.text": "We've told {business}. If that was a mistake, ask them to send it again.";
|
|
55
|
+
readonly "declined.untold": "{business} hasn't been emailed about it, so tell them yourself if you need to. If that was a mistake, ask them to send it again.";
|
|
50
56
|
readonly "ended.title": "This agreement is closed";
|
|
51
57
|
readonly "ended.voided": "{business} has withdrawn this agreement. Ask them if you were expecting to sign it.";
|
|
52
58
|
readonly "ended.expired": "The time to sign this agreement has passed. Ask {business} to send it again.";
|
|
@@ -63,6 +69,31 @@ declare const EN: {
|
|
|
63
69
|
readonly "email.signed.text": "Hi,\n\nEveryone has signed {title}. The signed copy is attached, with a signing certificate on its last page.\n\nAgreement {id}\nSigned copy SHA-256: {sha256}\n\nKeep this email for your records.";
|
|
64
70
|
readonly "email.declined.subject": "Declined: {title}";
|
|
65
71
|
readonly "email.declined.text": "{name} declined to sign {title}.{reason}\n\nThe agreement is now closed.";
|
|
72
|
+
readonly "email.declined.others": "We've emailed the others on it to say it's closed: {names}.";
|
|
73
|
+
readonly "email.declined_signer.subject": "Closed: {title}";
|
|
74
|
+
readonly "email.declined_signer.text": "Hi {name},\n\n{who} has declined to sign {title} from {business}, so the agreement is closed and won't go ahead. Nobody else can sign it.\n\nYou don't need to do anything. Ask {business} if you have questions.";
|
|
75
|
+
readonly "email.declined_you.subject": "You declined: {title}";
|
|
76
|
+
readonly "email.declined_you.text": "Hi {name},\n\nYou declined to sign {title} from {business}, so the agreement is closed for everyone and won't go ahead.\n\nIf that was a mistake, ask {business} to send it again.";
|
|
77
|
+
readonly "email.progress.subject": "{name} has signed {title}";
|
|
78
|
+
readonly "email.progress.text": "{name} has signed {title}.\n\nSigned so far: {signed}\nStill to sign: {waiting}\n\nOnce the last person signs, everyone gets the signed copy by email.";
|
|
79
|
+
readonly "email.voided.subject": "Withdrawn: {title}";
|
|
80
|
+
readonly "email.voided.text": "Hi {name},\n\n{business} has withdrawn {title}, so it won't go ahead and the signing link no longer works. This includes anyone who has already signed it.\n\nTheir reason: {reason}\n\nYou don't need to do anything. Ask {business} if you have questions.";
|
|
81
|
+
readonly "email.expired.subject": "Expired: {title}";
|
|
82
|
+
readonly "email.expired.text": "Hi {name},\n\nThe time to sign {title} from {business} ran out on {date} before everyone had signed, so it is closed and won't go ahead.\n\nIf you still want to go ahead, ask {business} to send it again.";
|
|
83
|
+
readonly "email.expired_business.subject": "Expired: {title}";
|
|
84
|
+
readonly "email.expired_business.text": "The time to sign {title} ran out on {date} before everyone had signed, so it is closed and won't go ahead. We've emailed everyone on it.\n\nSigned: {signed}\nNot signed: {waiting}\n\nTo go ahead, send it again.";
|
|
85
|
+
readonly "email.nobody": "nobody";
|
|
86
|
+
readonly "void.ask": "Withdraw";
|
|
87
|
+
readonly "void.question": "Withdraw {title}, sent to {names}?";
|
|
88
|
+
readonly "void.consequence": "Their signing links stop working and nobody can sign it. We'll email everyone on it, including anyone who has already signed, with your reason. This can't be undone: to go ahead later, send a new agreement.";
|
|
89
|
+
readonly "void.reason": "Reason (emailed to everyone on it)";
|
|
90
|
+
readonly "void.yes": "Yes, withdraw this agreement";
|
|
91
|
+
readonly "confirm.no": "No, keep it";
|
|
92
|
+
readonly "error.confirm_needed": "Please confirm first. Nothing has changed.";
|
|
93
|
+
readonly "error.reason": "Please give a reason. It is emailed to everyone on the agreement.";
|
|
94
|
+
readonly "error.not_found": "We couldn't find that agreement.";
|
|
95
|
+
readonly "error.closed": "This agreement is already closed, so there is nothing to withdraw.";
|
|
96
|
+
readonly "error.failed": "Something went wrong on our side. Please try again.";
|
|
66
97
|
readonly "share.text": "Hi {name}, please read and sign {title} here: {url}";
|
|
67
98
|
};
|
|
68
99
|
export type AgreementWordKey = keyof typeof EN;
|
package/dist/words.js
CHANGED
|
@@ -28,8 +28,13 @@ const EN = {
|
|
|
28
28
|
"sign_hint": "By tapping Sign agreement you sign it as {name}.",
|
|
29
29
|
"decline.open": "I don't want to sign",
|
|
30
30
|
"decline.reason": "Tell {business} why (optional)",
|
|
31
|
-
"decline": "
|
|
31
|
+
"decline": "Yes, decline to sign",
|
|
32
|
+
"decline.question": "Decline to sign {title} from {business}?",
|
|
33
|
+
"decline.consequence": "This closes the agreement for everyone: nobody else can sign it, and it can't be undone. {business} would have to send a new one.",
|
|
34
|
+
"decline.tells": "We'll email {names} to say you declined.",
|
|
35
|
+
"decline.no": "No, go back",
|
|
32
36
|
"problem.title": "Please fix this first",
|
|
37
|
+
"problem.confirm_needed": "Please confirm first. Nothing has changed.",
|
|
33
38
|
"problem.consent_read": "Tick the box to say you have read the agreement.",
|
|
34
39
|
"problem.consent_esign": "Tick the box to agree to sign electronically.",
|
|
35
40
|
"problem.name": "Type your full name (2 to 120 characters).",
|
|
@@ -51,6 +56,7 @@ const EN = {
|
|
|
51
56
|
"done.download": "Download the signed copy",
|
|
52
57
|
"declined.title": "You declined to sign",
|
|
53
58
|
"declined.text": "We've told {business}. If that was a mistake, ask them to send it again.",
|
|
59
|
+
"declined.untold": "{business} hasn't been emailed about it, so tell them yourself if you need to. If that was a mistake, ask them to send it again.",
|
|
54
60
|
"ended.title": "This agreement is closed",
|
|
55
61
|
"ended.voided": "{business} has withdrawn this agreement. Ask them if you were expecting to sign it.",
|
|
56
62
|
"ended.expired": "The time to sign this agreement has passed. Ask {business} to send it again.",
|
|
@@ -67,6 +73,31 @@ const EN = {
|
|
|
67
73
|
"email.signed.text": "Hi,\n\nEveryone has signed {title}. The signed copy is attached, with a signing certificate on its last page.\n\nAgreement {id}\nSigned copy SHA-256: {sha256}\n\nKeep this email for your records.",
|
|
68
74
|
"email.declined.subject": "Declined: {title}",
|
|
69
75
|
"email.declined.text": "{name} declined to sign {title}.{reason}\n\nThe agreement is now closed.",
|
|
76
|
+
"email.declined.others": "We've emailed the others on it to say it's closed: {names}.",
|
|
77
|
+
"email.declined_signer.subject": "Closed: {title}",
|
|
78
|
+
"email.declined_signer.text": "Hi {name},\n\n{who} has declined to sign {title} from {business}, so the agreement is closed and won't go ahead. Nobody else can sign it.\n\nYou don't need to do anything. Ask {business} if you have questions.",
|
|
79
|
+
"email.declined_you.subject": "You declined: {title}",
|
|
80
|
+
"email.declined_you.text": "Hi {name},\n\nYou declined to sign {title} from {business}, so the agreement is closed for everyone and won't go ahead.\n\nIf that was a mistake, ask {business} to send it again.",
|
|
81
|
+
"email.progress.subject": "{name} has signed {title}",
|
|
82
|
+
"email.progress.text": "{name} has signed {title}.\n\nSigned so far: {signed}\nStill to sign: {waiting}\n\nOnce the last person signs, everyone gets the signed copy by email.",
|
|
83
|
+
"email.voided.subject": "Withdrawn: {title}",
|
|
84
|
+
"email.voided.text": "Hi {name},\n\n{business} has withdrawn {title}, so it won't go ahead and the signing link no longer works. This includes anyone who has already signed it.\n\nTheir reason: {reason}\n\nYou don't need to do anything. Ask {business} if you have questions.",
|
|
85
|
+
"email.expired.subject": "Expired: {title}",
|
|
86
|
+
"email.expired.text": "Hi {name},\n\nThe time to sign {title} from {business} ran out on {date} before everyone had signed, so it is closed and won't go ahead.\n\nIf you still want to go ahead, ask {business} to send it again.",
|
|
87
|
+
"email.expired_business.subject": "Expired: {title}",
|
|
88
|
+
"email.expired_business.text": "The time to sign {title} ran out on {date} before everyone had signed, so it is closed and won't go ahead. We've emailed everyone on it.\n\nSigned: {signed}\nNot signed: {waiting}\n\nTo go ahead, send it again.",
|
|
89
|
+
"email.nobody": "nobody",
|
|
90
|
+
"void.ask": "Withdraw",
|
|
91
|
+
"void.question": "Withdraw {title}, sent to {names}?",
|
|
92
|
+
"void.consequence": "Their signing links stop working and nobody can sign it. We'll email everyone on it, including anyone who has already signed, with your reason. This can't be undone: to go ahead later, send a new agreement.",
|
|
93
|
+
"void.reason": "Reason (emailed to everyone on it)",
|
|
94
|
+
"void.yes": "Yes, withdraw this agreement",
|
|
95
|
+
"confirm.no": "No, keep it",
|
|
96
|
+
"error.confirm_needed": "Please confirm first. Nothing has changed.",
|
|
97
|
+
"error.reason": "Please give a reason. It is emailed to everyone on the agreement.",
|
|
98
|
+
"error.not_found": "We couldn't find that agreement.",
|
|
99
|
+
"error.closed": "This agreement is already closed, so there is nothing to withdraw.",
|
|
100
|
+
"error.failed": "Something went wrong on our side. Please try again.",
|
|
70
101
|
"share.text": "Hi {name}, please read and sign {title} here: {url}",
|
|
71
102
|
};
|
|
72
103
|
export const AGREEMENT_WORD_KEYS = Object.keys(EN);
|
|
@@ -94,8 +125,13 @@ const TL = {
|
|
|
94
125
|
"sign_hint": "Sa pag-tap ng Pirmahan, pumipirma ka bilang {name}.",
|
|
95
126
|
"decline.open": "Ayokong pumirma",
|
|
96
127
|
"decline.reason": "Sabihin kay {business} kung bakit (hindi kailangan)",
|
|
97
|
-
"decline": "
|
|
128
|
+
"decline": "Oo, tatanggi akong pumirma",
|
|
129
|
+
"decline.question": "Tatanggi kang pumirma sa {title} mula kay {business}?",
|
|
130
|
+
"decline.consequence": "Isasara nito ang kasunduan para sa lahat: wala nang ibang makakapirma, at hindi na ito maibabalik. Kailangang magpadala si {business} ng bago.",
|
|
131
|
+
"decline.tells": "Ie-email namin sila para sabihing tumanggi ka: {names}.",
|
|
132
|
+
"decline.no": "Hindi, bumalik",
|
|
98
133
|
"problem.title": "Pakiayos muna ito",
|
|
134
|
+
"problem.confirm_needed": "Pakikumpirma muna. Walang nabago.",
|
|
99
135
|
"problem.consent_read": "Lagyan ng tsek para sabihing nabasa mo ang kasunduan.",
|
|
100
136
|
"problem.consent_esign": "Lagyan ng tsek para pumayag na pumirma nang electronic.",
|
|
101
137
|
"problem.name": "I-type ang buong pangalan mo (2 hanggang 120 titik).",
|
|
@@ -117,6 +153,7 @@ const TL = {
|
|
|
117
153
|
"done.download": "I-download ang pirmadong kopya",
|
|
118
154
|
"declined.title": "Tinanggihan mong pumirma",
|
|
119
155
|
"declined.text": "Sinabihan na namin si {business}. Kung nagkamali ka, pakiusapan silang ipadala ulit.",
|
|
156
|
+
"declined.untold": "Hindi na-email si {business} tungkol dito, kaya sabihan mo sila kung kailangan. Kung nagkamali ka, pakiusapan silang ipadala ulit.",
|
|
120
157
|
"ended.title": "Sarado na ang kasunduang ito",
|
|
121
158
|
"ended.voided": "Binawi na ni {business} ang kasunduang ito. Tanungin sila kung inaasahan mong pumirma.",
|
|
122
159
|
"ended.expired": "Lumipas na ang oras para pumirma. Pakiusapan si {business} na ipadala ulit.",
|
|
@@ -124,6 +161,17 @@ const TL = {
|
|
|
124
161
|
"not_found.title": "Hindi namin makita ang kasunduang ito",
|
|
125
162
|
"not_found.text": "Pakitingnan ang link na pinadala sa inyo, o humingi ng bago sa nagpadala.",
|
|
126
163
|
"share.text": "Hi {name}, pakibasa at pakipirmahan ang {title} dito: {url}",
|
|
164
|
+
"void.ask": "Bawiin",
|
|
165
|
+
"void.question": "Bawiin ang {title}, na para sa {names}?",
|
|
166
|
+
"void.consequence": "Hindi na gagana ang mga signing link nila at wala nang makakapirma. Ie-email namin ang lahat ng nasa kasunduan, kasama ang mga nakapirma na, kasama ang dahilan mo. Hindi na ito maibabalik: kung itutuloy mo, magpadala ng bagong kasunduan.",
|
|
167
|
+
"void.reason": "Dahilan (ie-email sa lahat ng nasa kasunduan)",
|
|
168
|
+
"void.yes": "Oo, bawiin ang kasunduang ito",
|
|
169
|
+
"confirm.no": "Hindi, panatilihin",
|
|
170
|
+
"error.confirm_needed": "Pakikumpirma muna. Walang nabago.",
|
|
171
|
+
"error.reason": "Pakilagay ang dahilan. Ie-email ito sa lahat ng nasa kasunduan.",
|
|
172
|
+
"error.not_found": "Hindi namin makita ang kasunduang iyon.",
|
|
173
|
+
"error.closed": "Sarado na ang kasunduang ito, kaya wala nang babawiin.",
|
|
174
|
+
"error.failed": "May nagkaproblema sa amin. Pakisubukan ulit.",
|
|
127
175
|
};
|
|
128
176
|
const TAGLISH = {
|
|
129
177
|
"page.read": "Basahin po ang agreement",
|
|
@@ -139,7 +187,11 @@ const TAGLISH = {
|
|
|
139
187
|
"sign": "I-sign ang agreement",
|
|
140
188
|
"sign_hint": "Pag-tap mo po ng I-sign, nagsa-sign ka bilang {name}.",
|
|
141
189
|
"decline.open": "Ayoko pong mag-sign",
|
|
142
|
-
"decline": "
|
|
190
|
+
"decline": "Yes, i-decline ko po",
|
|
191
|
+
"decline.question": "I-decline mo po ba ang {title} from {business}?",
|
|
192
|
+
"decline.consequence": "Masasara po ang agreement para sa lahat: wala nang ibang makakapag-sign, at hindi na ito ma-undo. Kailangang magpadala ulit si {business} ng bago.",
|
|
193
|
+
"decline.tells": "I-email po namin sila na nag-decline ka: {names}.",
|
|
194
|
+
"decline.no": "Hindi po, bumalik",
|
|
143
195
|
"done.title": "Signed na po. Salamat!",
|
|
144
196
|
"done.text": "Na-sign mo po ito noong {date}. Na-email na namin ang signed copy sa lahat.",
|
|
145
197
|
"done.waiting": "Na-sign mo po ito noong {date}. Pag naka-sign na lahat, i-email namin sa inyo ang signed copy.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mccaskie-labs/workbench-agreements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Agreements and e-signing for Workbench apps: send a branded PDF agreement, let each person sign it online with a typed or drawn signature, keep a timestamped audit trail, and email the signed copy, with a signing certificate, to everyone. Runs in the app's own Worker, database and R2 bucket.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|