// Generates a print-ready DRAFT will document from Wassiyah data — a // statutory-style layout (declaration/revocation, executor appointment, // bequest schedule, witness attestation blocks) that a lawyer can review and // finalize, not a document this app claims is legally executed on its own. // Deliberately watermarked and disclaimed throughout: a will only takes // legal effect once physically signed and witnessed per local law (in most // jurisdictions, two witnesses present simultaneously, neither a // beneficiary). No PDF library is added — the browser's own print-to-PDF // keeps this dependency-free and print-perfect, matching the app's existing // Blob-download pattern for execution packets. function esc(s) { return String(s || '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); } export const JURISDICTION_LABELS = { MY: 'Malaysia', SG: 'Singapore', UK: 'United Kingdom' }; // Execution requirements genuinely differ by jurisdiction — kept short and // factual (statute names, witness rules), not legal advice on how they // apply to any specific estate. export const JURISDICTION_NOTES = { MY: "Execution under the Wills Act 1959 applies to non-Muslims and to the discretionary Wassiyah portion for Muslims; the signature must be made or acknowledged in the presence of two witnesses present at the same time, who then also sign. The remainder of the estate is subject to Faraid under the relevant State Islamic law — requirements and the recognized process vary across Malaysia's states, so confirm the current position with a Wasiyyah provider or Syariah-qualified lawyer before relying on this draft.", SG: "Execution under the Wills Act 1838 (Cap. 352) requires the testator's signature made or acknowledged in the presence of two witnesses present at the same time, who then also sign in the testator's presence. For Muslims, the Administration of Muslim Law Act (AMLA) governs Faraid distribution of the remainder through the Syariah Court, while the Wassiyah (discretionary one-third) portion is still executed as a civil will under the Wills Act — have this draft reviewed by a Singapore-qualified lawyer before relying on it.", UK: "Execution under the Wills Act 1837 requires the testator's signature made or acknowledged in the presence of two witnesses present at the same time, who then also sign in the testator's presence. A UK Islamic will operates as an ordinary civil will for legal purposes — English/Scottish/Northern Irish succession law does not itself apply Faraid, so the Wassiyah structure here only takes effect through this document being properly executed. Have this draft reviewed by a UK-qualified solicitor before relying on it." }; export function buildWillDocumentHtml({ testatorName, email, jurisdiction, witness1, witness2, executorName, bequests, estateTotal, cap, generatedDate }) { const name = testatorName?.trim() || '[FULL LEGAL NAME NOT YET ENTERED]'; const exec = executorName?.trim() || '[EXECUTOR NOT YET NAMED]'; const w1 = witness1?.trim() || '[WITNESS 1 NOT YET NAMED]'; const w2 = witness2?.trim() || '[WITNESS 2 NOT YET NAMED]'; const bequestTotal = (bequests || []).reduce((s, b) => s + Number(b.value || 0), 0); const bequestRows = (bequests || []).map((b, i) => `
(Islamic Wassiyah — limited to one-third of the net estate per Shariah)
I, ${esc(name)}${email ? ` (${esc(email)})` : ''}, being of sound mind, declare this to be my Will, and I hereby revoke all previous wills and testamentary dispositions made by me. This document expresses my Wassiyah — the portion of my estate I direct outside the fixed Faraid distribution — and does not purport to override any Faraid share owed to my heirs.
This Will is intended to take effect under the laws of ${esc(JURISDICTION_LABELS[jurisdiction] || jurisdiction || '[JURISDICTION NOT YET ENTERED]')}, in accordance with Shariah principles governing Wassiyah.
${JURISDICTION_NOTES[jurisdiction] || 'Jurisdiction-specific execution requirements were not available for this selection — confirm requirements with a locally qualified lawyer before relying on this draft.'}
I appoint ${esc(exec)} as Executor of this Will, to administer my estate, settle my debts, and distribute both the Wassiyah bequests below and the remaining estate according to Faraid.
My net estate is recorded at approximately ${(estateTotal || 0).toLocaleString()}. The maximum permissible under Wassiyah (one-third) is approximately ${(cap || 0).toLocaleString()}. The bequests below total ${bequestTotal.toLocaleString()}${bequestTotal > (cap || 0) ? ' — THIS EXCEEDS THE ONE-THIRD CAP AND REQUIRES HEIR CONSENT TO STAND; REVIEW BEFORE EXECUTION.' : ', within the permitted limit.'} No bequest below is made to a Quranic fixed heir, who already receives a Faraid share.
| # | Recipient | Description | Value |
|---|
No bequests recorded.
'}The remainder of my estate, after debts, funeral expenses, and the bequests above, is to be distributed among my legal heirs according to Faraid, as determined at the time of my death.
This Will was signed by the testator in the presence of the two witnesses below, present at the same time, who then signed in the presence of the testator and each other. Neither witness should be a beneficiary under this Will.