Spaces:
Running
Running
Deploy pitchsprig to the hub
Browse files- .gitattributes +1 -0
- pitchsprig/app.js +542 -0
- pitchsprig/icon-192.png +0 -0
- pitchsprig/icon-512.png +0 -0
- pitchsprig/icon.svg +9 -0
- pitchsprig/index.html +265 -0
- pitchsprig/lib/core.js +603 -0
- pitchsprig/lib/pdf.js +448 -0
- pitchsprig/manifest.webmanifest +17 -0
- pitchsprig/og.png +3 -0
- pitchsprig/pro.js +139 -0
- pitchsprig/robots.txt +3 -0
- pitchsprig/sitemap.xml +2 -0
- pitchsprig/style.css +254 -0
- pitchsprig/sw.js +33 -0
.gitattributes
CHANGED
|
@@ -619,3 +619,4 @@ brand/pitchsprig/image-1-shot.png filter=lfs diff=lfs merge=lfs -text
|
|
| 619 |
brand/pitchsprig/image-2-shot.png filter=lfs diff=lfs merge=lfs -text
|
| 620 |
brand/pitchsprig/image-3-output.png filter=lfs diff=lfs merge=lfs -text
|
| 621 |
brand/pitchsprig/image-4-inside.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 619 |
brand/pitchsprig/image-2-shot.png filter=lfs diff=lfs merge=lfs -text
|
| 620 |
brand/pitchsprig/image-3-output.png filter=lfs diff=lfs merge=lfs -text
|
| 621 |
brand/pitchsprig/image-4-inside.png filter=lfs diff=lfs merge=lfs -text
|
| 622 |
+
pitchsprig/og.png filter=lfs diff=lfs merge=lfs -text
|
pitchsprig/app.js
ADDED
|
@@ -0,0 +1,542 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Pitchsprig app: proposal editor, live preview, PDF / print / HTML / email text, Pro features. Everything stays in this browser.
|
| 2 |
+
* © 2026 CyberMax. All rights reserved. */
|
| 3 |
+
(function () {
|
| 4 |
+
"use strict";
|
| 5 |
+
var C = window.PS, P = window.PSPDF, X = window.CMXPro;
|
| 6 |
+
var KEY = "pitchsprig:v1";
|
| 7 |
+
var HUB = "https://cybermax-tools-cybermax.static.hf.space/pitchsprig/index.html?utm_source=pdf-credit";
|
| 8 |
+
var FREE_PDFS = 3;
|
| 9 |
+
var $ = function (id) { return document.getElementById(id); };
|
| 10 |
+
var form = $("editor");
|
| 11 |
+
|
| 12 |
+
/* ---------- state ---------- */
|
| 13 |
+
function fresh() { return { doc: null, profile: null, clients: [], library: [], saved: [], logo: null, accent: "", results: 0 }; }
|
| 14 |
+
function load() {
|
| 15 |
+
var s = null;
|
| 16 |
+
try { s = JSON.parse(localStorage.getItem(KEY) || "null"); } catch (e) { s = null; }
|
| 17 |
+
var f = fresh();
|
| 18 |
+
if (!s || typeof s !== "object") return f;
|
| 19 |
+
Object.keys(f).forEach(function (k) { if (s[k] == null) s[k] = f[k]; });
|
| 20 |
+
return s;
|
| 21 |
+
}
|
| 22 |
+
var S = load();
|
| 23 |
+
var saveT = null;
|
| 24 |
+
function save() {
|
| 25 |
+
clearTimeout(saveT);
|
| 26 |
+
saveT = setTimeout(saveNow, 200);
|
| 27 |
+
}
|
| 28 |
+
function saveNow() { clearTimeout(saveT); try { localStorage.setItem(KEY, JSON.stringify(S)); } catch (e) { toast("Could not save in this browser (storage full or private mode)."); } }
|
| 29 |
+
function pro() { return X.isPro(); }
|
| 30 |
+
function toast(m) { X.toast(m); }
|
| 31 |
+
var esc = C.esc;
|
| 32 |
+
function get(o, path) { return path.split(".").reduce(function (a, k) { return a == null ? a : a[k]; }, o); }
|
| 33 |
+
function set(o, path, v) { var ks = path.split("."), last = ks.pop(); ks.forEach(function (k) { if (!o[k] || typeof o[k] !== "object") o[k] = {}; o = o[k]; }); o[last] = v; }
|
| 34 |
+
function upsell(msg, from) { X.upsell(msg || "That is a Pitchsprig Pro feature.", from); }
|
| 35 |
+
function isFreeTpl(id) { return !!(C.TEMPLATES[id] && C.TEMPLATES[id].free); }
|
| 36 |
+
|
| 37 |
+
if (!S.doc) S.doc = C.fromTemplate("web-design", true);
|
| 38 |
+
var doc = S.doc;
|
| 39 |
+
|
| 40 |
+
/* ---------- template + example pickers ---------- */
|
| 41 |
+
function fillPickers() {
|
| 42 |
+
$("example-kind").innerHTML = C.TEMPLATE_ORDER.map(function (id) {
|
| 43 |
+
var t = C.TEMPLATES[id];
|
| 44 |
+
return '<option value="' + id + '">' + esc(t.label) + " (" + esc(t.currency) + ")" + (t.free ? "" : " · Pro") + "</option>";
|
| 45 |
+
}).join("");
|
| 46 |
+
$("f-currency").innerHTML = C.CURRENCIES.map(function (c) { return '<option value="' + c.code + '">' + c.code + " · " + esc(c.name) + "</option>"; }).join("");
|
| 47 |
+
renderTpls();
|
| 48 |
+
}
|
| 49 |
+
function renderTpls() {
|
| 50 |
+
$("tpls").innerHTML = C.TEMPLATE_ORDER.map(function (id) {
|
| 51 |
+
var t = C.TEMPLATES[id];
|
| 52 |
+
return '<button type="button" role="radio" data-tpl="' + id + '" aria-checked="' + (doc.template === id) + '"><b>' + esc(t.name) + "</b><small>" + esc(t.title) + "</small>" + (t.free ? '<span class="free-tag">FREE</span>' : '<span class="pro-tag">PRO</span>') + "</button>";
|
| 53 |
+
}).join("");
|
| 54 |
+
}
|
| 55 |
+
$("tpls").addEventListener("click", function (e) {
|
| 56 |
+
var b = e.target.closest("button[data-tpl]"); if (!b) return;
|
| 57 |
+
var id = b.dataset.tpl;
|
| 58 |
+
if (!isFreeTpl(id) && !pro()) return upsell("The " + C.TEMPLATES[id].name.toLowerCase() + " template is part of Pro. Free includes web design and marketing retainer.", "template");
|
| 59 |
+
if (id === doc.template) return;
|
| 60 |
+
if (!confirm("Switch to the " + C.TEMPLATES[id].name + " template? Sections, pricing and timeline are replaced; your details and your client are kept.")) return;
|
| 61 |
+
var n = C.fromTemplate(id, false);
|
| 62 |
+
n.from = C.clone(doc.from); n.client = C.clone(doc.client); n.number = doc.number; n.page = doc.page;
|
| 63 |
+
if (S.profile && S.profile.currency) n.currency = S.profile.currency;
|
| 64 |
+
S.doc = doc = n; toForm(); changed();
|
| 65 |
+
toast(C.TEMPLATES[id].name + " template loaded. Edit anything in [brackets].");
|
| 66 |
+
});
|
| 67 |
+
|
| 68 |
+
/* ---------- scalar fields ---------- */
|
| 69 |
+
function toForm() {
|
| 70 |
+
Array.prototype.forEach.call(form.querySelectorAll("[name]"), function (el) {
|
| 71 |
+
var v = get(doc, el.name);
|
| 72 |
+
el.value = v == null ? "" : v;
|
| 73 |
+
});
|
| 74 |
+
$("f-accent").value = C.validHex(S.accent) ? S.accent.toLowerCase() : C.DEFAULT_ACCENT.toLowerCase();
|
| 75 |
+
renderTpls(); renderSections(); renderItems(); renderPackages(); renderTimeline(); syncLayout();
|
| 76 |
+
}
|
| 77 |
+
form.addEventListener("input", function (e) {
|
| 78 |
+
var el = e.target;
|
| 79 |
+
if (!el.name) return;
|
| 80 |
+
set(doc, el.name, el.value);
|
| 81 |
+
if (el.name === "date" && doc.date && (!doc.valid || doc.valid < doc.date)) { doc.valid = C.addDays(doc.date, 30); $("f-valid").value = doc.valid; }
|
| 82 |
+
if (el.name.indexOf("pricing.") === 0 || el.name === "currency") totLine();
|
| 83 |
+
changed();
|
| 84 |
+
});
|
| 85 |
+
form.addEventListener("submit", function (e) { e.preventDefault(); });
|
| 86 |
+
$("f-client-company").addEventListener("change", function () {
|
| 87 |
+
if (!pro()) return;
|
| 88 |
+
var c = S.clients.filter(function (x) { return x.company === doc.client.company; })[0];
|
| 89 |
+
if (c) { doc.client = C.clone(c); toForm(); changed(); toast("Filled " + (c.company || c.name) + " from your saved clients."); }
|
| 90 |
+
});
|
| 91 |
+
$("f-accent").addEventListener("input", function () {
|
| 92 |
+
if (!pro()) { this.value = C.DEFAULT_ACCENT.toLowerCase(); return upsell("Your own brand colour is a Pro feature.", "accent"); }
|
| 93 |
+
S.accent = this.value; save(); renderPreview();
|
| 94 |
+
});
|
| 95 |
+
$("f-accent").addEventListener("click", function (e) { if (!pro()) { e.preventDefault(); upsell("Your own brand colour is a Pro feature.", "accent"); } });
|
| 96 |
+
|
| 97 |
+
/* ---------- sections ---------- */
|
| 98 |
+
var KIND_LABEL = { text: "Text", pricing: "Pricing table", timeline: "Timeline", acceptance: "Acceptance" };
|
| 99 |
+
function renderSections() {
|
| 100 |
+
var box = $("sections");
|
| 101 |
+
box.innerHTML = doc.sections.map(function (s, i) {
|
| 102 |
+
var id = "sec-" + i;
|
| 103 |
+
return '<details class="sec" data-i="' + i + '"' + (i === 0 ? " open" : "") + '><summary><span class="sec-n">' + ("0" + (i + 1)).slice(-2) + '</span><span class="sec-t">' + esc(C.fill(s.title, doc) || "Untitled") + '</span><span class="kind kind-' + s.kind + '">' + KIND_LABEL[s.kind] + "</span></summary>" +
|
| 104 |
+
'<div class="sec-body"><label for="' + id + '-title">Heading</label><input id="' + id + '-title" data-f="title" value="' + esc(s.title) + '">' +
|
| 105 |
+
'<label for="' + id + '-body">' + (s.kind === "text" ? "Text" : "Intro text (shown above the " + KIND_LABEL[s.kind].toLowerCase() + ")") + "</label>" +
|
| 106 |
+
'<div class="tb" role="toolbar" aria-label="Formatting for section ' + (i + 1) + '"><button type="button" data-md="b" title="Bold" aria-label="Bold"><b>B</b></button><button type="button" data-md="i" title="Italic" aria-label="Italic"><i>I</i></button><button type="button" data-md="h" title="Heading" aria-label="Heading">H</button><button type="button" data-md="ul" title="Bulleted list" aria-label="Bulleted list">• List</button><button type="button" data-md="ol" title="Numbered list" aria-label="Numbered list">1. List</button></div>' +
|
| 107 |
+
'<textarea id="' + id + '-body" data-f="body" rows="' + (s.kind === "text" ? 8 : 3) + '">' + esc(s.body) + "</textarea>" +
|
| 108 |
+
'<div class="sec-tools"><button type="button" class="icon-btn" data-act="up" aria-label="Move section ' + (i + 1) + ' up" title="Move up">↑</button><button type="button" class="icon-btn" data-act="down" aria-label="Move section ' + (i + 1) + ' down" title="Move down">↓</button>' +
|
| 109 |
+
'<button type="button" class="btn ghost sm" data-act="lib">Save to library <span class="pro-tag">PRO</span></button><button type="button" class="btn ghost sm danger" data-act="del">Remove</button></div></div></details>';
|
| 110 |
+
}).join("");
|
| 111 |
+
}
|
| 112 |
+
$("sections").addEventListener("input", function (e) {
|
| 113 |
+
var d = e.target.closest(".sec"); if (!d || !e.target.dataset.f) return;
|
| 114 |
+
var s = doc.sections[+d.dataset.i];
|
| 115 |
+
s[e.target.dataset.f] = e.target.value;
|
| 116 |
+
if (e.target.dataset.f === "title") d.querySelector(".sec-t").textContent = C.fill(s.title, doc) || "Untitled";
|
| 117 |
+
changed();
|
| 118 |
+
});
|
| 119 |
+
$("sections").addEventListener("click", function (e) {
|
| 120 |
+
var b = e.target.closest("button"); if (!b) return;
|
| 121 |
+
var d = b.closest(".sec"), i = +d.dataset.i;
|
| 122 |
+
if (b.dataset.md) return format(d.querySelector("textarea"), b.dataset.md);
|
| 123 |
+
var act = b.dataset.act; if (!act) return;
|
| 124 |
+
if (act === "up" && i > 0) { var t = doc.sections[i]; doc.sections[i] = doc.sections[i - 1]; doc.sections[i - 1] = t; renderSections(); openSec(i - 1); }
|
| 125 |
+
else if (act === "down" && i < doc.sections.length - 1) { var u = doc.sections[i]; doc.sections[i] = doc.sections[i + 1]; doc.sections[i + 1] = u; renderSections(); openSec(i + 1); }
|
| 126 |
+
else if (act === "del") { if (!confirm("Remove the “" + C.fill(doc.sections[i].title, doc) + "” section?")) return; doc.sections.splice(i, 1); renderSections(); }
|
| 127 |
+
else if (act === "lib") {
|
| 128 |
+
if (!pro()) return upsell("The content library (reusable about us, terms and case studies) is part of Pro.", "library");
|
| 129 |
+
var s = doc.sections[i];
|
| 130 |
+
S.library = [{ id: C.uid("l"), title: s.title, body: s.body, kind: s.kind }].concat(S.library.filter(function (x) { return x.title !== s.title; })).slice(0, 200);
|
| 131 |
+
renderLibrary(); save(); return toast("Saved “" + s.title + "” to your library.");
|
| 132 |
+
} else return;
|
| 133 |
+
changed();
|
| 134 |
+
});
|
| 135 |
+
function openSec(i) { var d = $("sections").querySelector('.sec[data-i="' + i + '"]'); if (d) { d.open = true; var bt = d.querySelector('[data-act="up"]'); if (bt) bt.focus(); } }
|
| 136 |
+
/** Toolbar: wrap the selection in ** / * or prefix the selected lines. */
|
| 137 |
+
function format(ta, kind) {
|
| 138 |
+
var v = ta.value, a = ta.selectionStart, z = ta.selectionEnd;
|
| 139 |
+
if (kind === "b" || kind === "i") {
|
| 140 |
+
var mk = kind === "b" ? "**" : "*", sel = v.slice(a, z) || (kind === "b" ? "bold text" : "italic text");
|
| 141 |
+
ta.value = v.slice(0, a) + mk + sel + mk + v.slice(z);
|
| 142 |
+
ta.setSelectionRange(a + mk.length, a + mk.length + sel.length);
|
| 143 |
+
} else {
|
| 144 |
+
var ls = v.lastIndexOf("\n", a - 1) + 1, le = v.indexOf("\n", z); if (le < 0) le = v.length;
|
| 145 |
+
var n = 0, block = v.slice(ls, le).split("\n").map(function (l) {
|
| 146 |
+
var bare = l.replace(/^(#{1,3}\s+|[-*•]\s+|\d{1,3}[.)]\s+)/, "");
|
| 147 |
+
if (kind === "h") return "## " + bare;
|
| 148 |
+
if (kind === "ul") return "- " + bare;
|
| 149 |
+
n++; return n + ". " + bare;
|
| 150 |
+
}).join("\n");
|
| 151 |
+
ta.value = v.slice(0, ls) + block + v.slice(le);
|
| 152 |
+
ta.setSelectionRange(ls, ls + block.length);
|
| 153 |
+
}
|
| 154 |
+
ta.focus();
|
| 155 |
+
ta.dispatchEvent(new Event("input", { bubbles: true }));
|
| 156 |
+
}
|
| 157 |
+
$("btn-add-section").addEventListener("click", function () {
|
| 158 |
+
var k = $("add-kind").value;
|
| 159 |
+
if (k !== "text" && doc.sections.some(function (s) { return s.kind === k; })) return toast("This proposal already has a " + KIND_LABEL[k].toLowerCase() + " section.");
|
| 160 |
+
var s = C.blankSection(k), at = doc.sections.length;
|
| 161 |
+
var accIdx = doc.sections.map(function (x) { return x.kind; }).indexOf("acceptance");
|
| 162 |
+
if (k !== "acceptance" && accIdx > -1) at = accIdx;
|
| 163 |
+
doc.sections.splice(at, 0, s);
|
| 164 |
+
renderSections(); openSec(at); changed();
|
| 165 |
+
var inp = $("sections").querySelector('.sec[data-i="' + at + '"] input'); if (inp) { inp.focus(); inp.select(); }
|
| 166 |
+
});
|
| 167 |
+
|
| 168 |
+
/* ---------- content library (Pro) ---------- */
|
| 169 |
+
function renderLibrary() {
|
| 170 |
+
var box = $("library");
|
| 171 |
+
if (!pro()) { box.innerHTML = '<p class="hint">Save your best sections once (about us, terms, case studies, process) and drop them into any proposal in one click.</p><button type="button" class="btn sm" id="btn-lib-pro">Unlock the library</button>'; $("btn-lib-pro").onclick = function () { upsell(null, "library"); }; return; }
|
| 172 |
+
box.innerHTML = S.library.length ? '<ul class="lib">' + S.library.map(function (x, i) {
|
| 173 |
+
return '<li><span>' + esc(x.title) + '</span><button type="button" class="btn ghost sm" data-lib="ins" data-i="' + i + '">Insert</button><button type="button" class="icon-btn" data-lib="del" data-i="' + i + '" aria-label="Delete ' + esc(x.title) + ' from library">×</button></li>';
|
| 174 |
+
}).join("") + "</ul>" : '<p class="hint">Nothing saved yet. Open a section and press “Save to library”.</p>';
|
| 175 |
+
$("library-pick").innerHTML = box.innerHTML;
|
| 176 |
+
}
|
| 177 |
+
function libClick(e) {
|
| 178 |
+
var b = e.target.closest("[data-lib]"); if (!b) return;
|
| 179 |
+
var x = S.library[+b.dataset.i]; if (!x) return;
|
| 180 |
+
if (b.dataset.lib === "del") { S.library.splice(+b.dataset.i, 1); renderLibrary(); save(); return; }
|
| 181 |
+
var s = { id: C.uid(), kind: x.kind === "text" || !doc.sections.some(function (q) { return q.kind === x.kind; }) ? x.kind || "text" : "text", title: x.title, body: x.body };
|
| 182 |
+
var accIdx = doc.sections.map(function (q) { return q.kind; }).indexOf("acceptance"), at = accIdx > -1 && s.kind !== "acceptance" ? accIdx : doc.sections.length;
|
| 183 |
+
doc.sections.splice(at, 0, s); renderSections(); openSec(at); changed(); $("library-pick").hidden = true;
|
| 184 |
+
toast("Inserted “" + x.title + "”.");
|
| 185 |
+
}
|
| 186 |
+
$("library").addEventListener("click", libClick);
|
| 187 |
+
$("library-pick").addEventListener("click", libClick);
|
| 188 |
+
$("btn-from-library").addEventListener("click", function () {
|
| 189 |
+
if (!pro()) return upsell("The content library is part of Pro.", "library");
|
| 190 |
+
renderLibrary();
|
| 191 |
+
if (!S.library.length) return toast("Your library is empty. Open a section and press “Save to library”.");
|
| 192 |
+
$("library-pick").hidden = !$("library-pick").hidden;
|
| 193 |
+
});
|
| 194 |
+
|
| 195 |
+
/* ---------- pricing items ---------- */
|
| 196 |
+
function renderItems() {
|
| 197 |
+
$("items").innerHTML = doc.pricing.items.map(function (it, i) {
|
| 198 |
+
var id = "it" + i;
|
| 199 |
+
return '<div class="item' + (it.optional ? " is-opt" : "") + '" data-i="' + i + '">' +
|
| 200 |
+
'<div class="i-desc"><label for="' + id + '-desc">Item</label><input id="' + id + '-desc" data-k="desc" value="' + esc(it.desc) + '" placeholder="What you will do"></div>' +
|
| 201 |
+
'<div><label for="' + id + '-qty">Qty</label><input id="' + id + '-qty" data-k="qty" inputmode="decimal" value="' + esc(it.qty) + '"></div>' +
|
| 202 |
+
'<div><label for="' + id + '-rate">Rate</label><input id="' + id + '-rate" data-k="rate" inputmode="decimal" value="' + esc(it.rate) + '" placeholder="0.00"></div>' +
|
| 203 |
+
'<div><label for="' + id + '-bill">Billing</label><select id="' + id + '-bill" data-k="billing"><option value="once"' + (it.billing !== "month" ? " selected" : "") + '>One-time</option><option value="month"' + (it.billing === "month" ? " selected" : "") + ">Monthly</option></select></div>" +
|
| 204 |
+
'<div class="i-flags"><label class="check"><input type="checkbox" data-k="optional"' + (it.optional ? " checked" : "") + "> Optional</label>" +
|
| 205 |
+
'<label class="check i-sel"><input type="checkbox" data-k="selected"' + (it.selected ? " checked" : "") + "> Included</label></div>" +
|
| 206 |
+
'<div class="i-amt" aria-live="polite"></div>' +
|
| 207 |
+
'<div class="i-tools"><button type="button" class="icon-btn" data-act="up" title="Move up" aria-label="Move line ' + (i + 1) + ' up">↑</button><button type="button" class="icon-btn" data-act="del" title="Remove line" aria-label="Remove line ' + (i + 1) + '">×</button></div></div>';
|
| 208 |
+
}).join("");
|
| 209 |
+
itemAmounts(); totLine();
|
| 210 |
+
}
|
| 211 |
+
function itemAmounts() {
|
| 212 |
+
var dp = C.decimals(doc.currency);
|
| 213 |
+
Array.prototype.forEach.call($("items").querySelectorAll(".item"), function (row) {
|
| 214 |
+
var it = doc.pricing.items[+row.dataset.i] || {}, l = C.line(it, dp);
|
| 215 |
+
row.querySelector(".i-amt").textContent = C.money(l.net, doc.currency) + (l.billing === "month" ? " /month" : "") + (l.optional && !l.included ? " · not in total" : "");
|
| 216 |
+
});
|
| 217 |
+
}
|
| 218 |
+
function totLine() {
|
| 219 |
+
var T = C.totals(doc), m = function (v) { return C.money(v, doc.currency); }, parts = [];
|
| 220 |
+
if (T.once.count) parts.push("One-time total " + m(T.once.total));
|
| 221 |
+
if (T.month.count) parts.push("Monthly " + m(T.month.total));
|
| 222 |
+
if (T.optionalTotal) parts.push(T.optionalChosen + " of " + T.optionalTotal + " optional extras included");
|
| 223 |
+
$("tot-line").textContent = parts.join(" · ");
|
| 224 |
+
}
|
| 225 |
+
$("items").addEventListener("input", function (e) {
|
| 226 |
+
var row = e.target.closest(".item"); if (!row || !e.target.dataset.k) return;
|
| 227 |
+
var it = doc.pricing.items[+row.dataset.i], k = e.target.dataset.k;
|
| 228 |
+
it[k] = e.target.type === "checkbox" ? e.target.checked : e.target.value;
|
| 229 |
+
if (k === "optional") { if (it.optional) it.selected = false; row.classList.toggle("is-opt", it.optional); row.querySelector('[data-k="selected"]').checked = !!it.selected; }
|
| 230 |
+
itemAmounts(); totLine(); changed();
|
| 231 |
+
});
|
| 232 |
+
$("items").addEventListener("click", function (e) {
|
| 233 |
+
var b = e.target.closest("button[data-act]"); if (!b) return;
|
| 234 |
+
var i = +b.closest(".item").dataset.i, items = doc.pricing.items;
|
| 235 |
+
if (b.dataset.act === "del") items.splice(i, 1);
|
| 236 |
+
if (b.dataset.act === "up" && i > 0) { var t = items[i]; items[i] = items[i - 1]; items[i - 1] = t; }
|
| 237 |
+
renderItems(); changed();
|
| 238 |
+
});
|
| 239 |
+
$("btn-add-item").addEventListener("click", function () {
|
| 240 |
+
doc.pricing.items.push({ desc: "", qty: "1", rate: "", billing: "once", optional: false, selected: false });
|
| 241 |
+
renderItems(); changed();
|
| 242 |
+
var ins = $("items").querySelectorAll("input[data-k=desc]"); ins[ins.length - 1].focus();
|
| 243 |
+
});
|
| 244 |
+
|
| 245 |
+
/* ---------- packages (Pro layout) ---------- */
|
| 246 |
+
function layout() { return pro() && doc.pricing.layout === "packages" ? "packages" : "table"; }
|
| 247 |
+
function syncLayout() {
|
| 248 |
+
Array.prototype.forEach.call(document.querySelectorAll(".seg button"), function (b) { b.setAttribute("aria-checked", String(b.dataset.layout === layout())); });
|
| 249 |
+
$("packages-ed").hidden = layout() !== "packages";
|
| 250 |
+
}
|
| 251 |
+
Array.prototype.forEach.call(document.querySelectorAll(".seg button"), function (b) {
|
| 252 |
+
b.addEventListener("click", function () {
|
| 253 |
+
if (b.dataset.layout === "packages" && !pro()) return upsell("The good / better / best packages layout is part of Pro.", "packages");
|
| 254 |
+
doc.pricing.layout = b.dataset.layout; syncLayout(); renderPackages(); changed();
|
| 255 |
+
});
|
| 256 |
+
});
|
| 257 |
+
function renderPackages() {
|
| 258 |
+
var ks = doc.pricing.packages || (doc.pricing.packages = []);
|
| 259 |
+
while (ks.length < 3) ks.push({ name: "", price: "", billing: "once", blurb: "", features: "", recommended: false });
|
| 260 |
+
$("packages-ed").innerHTML = '<p class="hint">Three options side by side; optional lines from the table show below them as add-ons.</p><div class="pkgs-ed">' + ks.slice(0, 3).map(function (k, i) {
|
| 261 |
+
var id = "pk" + i;
|
| 262 |
+
return '<fieldset class="pk" data-i="' + i + '"><legend>Package ' + (i + 1) + "</legend>" +
|
| 263 |
+
'<label for="' + id + '-name">Name</label><input id="' + id + '-name" data-k="name" value="' + esc(k.name) + '">' +
|
| 264 |
+
'<div class="combo"><div><label for="' + id + '-price">Price</label><input id="' + id + '-price" data-k="price" inputmode="decimal" value="' + esc(k.price) + '"></div><div><label for="' + id + '-bill">Billing</label><select id="' + id + '-bill" data-k="billing"><option value="once"' + (k.billing !== "month" ? " selected" : "") + '>One-time</option><option value="month"' + (k.billing === "month" ? " selected" : "") + ">Monthly</option></select></div></div>" +
|
| 265 |
+
'<label for="' + id + '-blurb">One-line summary</label><input id="' + id + '-blurb" data-k="blurb" value="' + esc(k.blurb) + '">' +
|
| 266 |
+
'<label for="' + id + '-feat">What is included (one per line)</label><textarea id="' + id + '-feat" data-k="features" rows="4">' + esc(k.features) + "</textarea>" +
|
| 267 |
+
'<label class="check"><input type="radio" name="pk-rec" data-k="recommended"' + (k.recommended ? " checked" : "") + "> Recommended</label></fieldset>";
|
| 268 |
+
}).join("") + "</div>";
|
| 269 |
+
}
|
| 270 |
+
function pkInput(e) {
|
| 271 |
+
var fs = e.target.closest(".pk"); if (!fs || !e.target.dataset.k) return;
|
| 272 |
+
var i = +fs.dataset.i, k = e.target.dataset.k;
|
| 273 |
+
if (k === "recommended") doc.pricing.packages.forEach(function (p, j) { p.recommended = j === i; });
|
| 274 |
+
else doc.pricing.packages[i][k] = e.target.value;
|
| 275 |
+
changed();
|
| 276 |
+
}
|
| 277 |
+
$("packages-ed").addEventListener("input", pkInput);
|
| 278 |
+
$("packages-ed").addEventListener("change", function (e) { if (e.target.type === "radio") pkInput(e); });
|
| 279 |
+
|
| 280 |
+
/* ---------- timeline ---------- */
|
| 281 |
+
function renderTimeline() {
|
| 282 |
+
$("timeline").innerHTML = doc.timeline.map(function (r, i) {
|
| 283 |
+
var id = "tl" + i;
|
| 284 |
+
return '<div class="phase" data-i="' + i + '"><div><label for="' + id + '-ph">Phase</label><input id="' + id + '-ph" data-k="phase" value="' + esc(r.phase) + '"></div>' +
|
| 285 |
+
'<div class="ph-d"><label for="' + id + '-d">What happens</label><input id="' + id + '-d" data-k="detail" value="' + esc(r.detail) + '"></div>' +
|
| 286 |
+
'<div><label for="' + id + '-w">When</label><input id="' + id + '-w" data-k="when" value="' + esc(r.when) + '" placeholder="Week 1"></div>' +
|
| 287 |
+
'<div class="i-tools"><button type="button" class="icon-btn" data-act="up" aria-label="Move phase ' + (i + 1) + ' up">↑</button><button type="button" class="icon-btn" data-act="del" aria-label="Remove phase ' + (i + 1) + '">×</button></div></div>';
|
| 288 |
+
}).join("");
|
| 289 |
+
}
|
| 290 |
+
$("timeline").addEventListener("input", function (e) {
|
| 291 |
+
var row = e.target.closest(".phase"); if (!row || !e.target.dataset.k) return;
|
| 292 |
+
doc.timeline[+row.dataset.i][e.target.dataset.k] = e.target.value; changed();
|
| 293 |
+
});
|
| 294 |
+
$("timeline").addEventListener("click", function (e) {
|
| 295 |
+
var b = e.target.closest("button[data-act]"); if (!b) return;
|
| 296 |
+
var i = +b.closest(".phase").dataset.i, t = doc.timeline;
|
| 297 |
+
if (b.dataset.act === "del") t.splice(i, 1);
|
| 298 |
+
if (b.dataset.act === "up" && i > 0) { var x = t[i]; t[i] = t[i - 1]; t[i - 1] = x; }
|
| 299 |
+
renderTimeline(); changed();
|
| 300 |
+
});
|
| 301 |
+
$("btn-add-phase").addEventListener("click", function () { doc.timeline.push({ phase: "", detail: "", when: "" }); renderTimeline(); changed(); var ins = $("timeline").querySelectorAll("input[data-k=phase]"); ins[ins.length - 1].focus(); });
|
| 302 |
+
|
| 303 |
+
/* ---------- preview ---------- */
|
| 304 |
+
function view() {
|
| 305 |
+
var d = C.clone(doc);
|
| 306 |
+
d.pricing.layout = layout();
|
| 307 |
+
return d;
|
| 308 |
+
}
|
| 309 |
+
function accent() { return pro() && C.validHex(S.accent) ? S.accent : C.DEFAULT_ACCENT; }
|
| 310 |
+
function logoData() { return pro() && S.logo && S.logo.data ? S.logo.data : ""; }
|
| 311 |
+
function renderPreview() {
|
| 312 |
+
var el = $("doc");
|
| 313 |
+
el.className = "paper" + (P.pageSize(doc)[0] === 612 ? " letter" : "");
|
| 314 |
+
el.innerHTML = C.docHTML(view(), { credit: !pro(), logo: logoData(), accent: accent() });
|
| 315 |
+
fit();
|
| 316 |
+
}
|
| 317 |
+
function fit() {
|
| 318 |
+
var wrap = $("paper-wrap"), el = $("doc");
|
| 319 |
+
var s = Math.min(1, wrap.clientWidth / 794);
|
| 320 |
+
el.style.transform = "scale(" + s + ")";
|
| 321 |
+
wrap.style.height = Math.ceil(el.offsetHeight * s) + "px";
|
| 322 |
+
}
|
| 323 |
+
window.addEventListener("resize", fit);
|
| 324 |
+
|
| 325 |
+
/* ---------- quota + warnings ---------- */
|
| 326 |
+
function quotaLine() {
|
| 327 |
+
var q = X.quota("pdf", FREE_PDFS), el = $("quota");
|
| 328 |
+
if (pro()) { el.textContent = "Pro: unlimited PDFs, no footer line."; el.className = "quota"; return; }
|
| 329 |
+
el.textContent = q.left > 0 ? q.left + " of " + FREE_PDFS + " free PDFs left this month · printing is free" : "You have used this month's " + FREE_PDFS + " free PDFs. Pro makes them unlimited.";
|
| 330 |
+
el.className = "quota" + (q.left > 0 ? "" : " out");
|
| 331 |
+
}
|
| 332 |
+
function warnings() { $("warn").textContent = C.check(doc).join(" · "); }
|
| 333 |
+
var changeT = null;
|
| 334 |
+
function changed() {
|
| 335 |
+
save();
|
| 336 |
+
clearTimeout(changeT);
|
| 337 |
+
changeT = setTimeout(function () { renderPreview(); warnings(); }, 80);
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
/* ---------- outputs ---------- */
|
| 341 |
+
function b64ToBytes(dataUrl) {
|
| 342 |
+
var b = atob(dataUrl.split(",")[1] || ""), u = new Uint8Array(b.length);
|
| 343 |
+
for (var i = 0; i < b.length; i++) u[i] = b.charCodeAt(i);
|
| 344 |
+
return u;
|
| 345 |
+
}
|
| 346 |
+
function pdfBytes() {
|
| 347 |
+
var logo = logoData() ? { bytes: b64ToBytes(S.logo.data), w: S.logo.w, h: S.logo.h } : null;
|
| 348 |
+
return P.build(view(), { credit: !pro(), creditUrl: HUB, logo: logo, accent: accent() });
|
| 349 |
+
}
|
| 350 |
+
$("btn-pdf").addEventListener("click", function () {
|
| 351 |
+
var q = X.quota("pdf", FREE_PDFS);
|
| 352 |
+
if (!pro() && q.left <= 0) { quotaLine(); return upsell("You have used this month's " + FREE_PDFS + " free PDFs. Go Pro for unlimited PDFs with no footer line.", "pdf-limit"); }
|
| 353 |
+
var bytes;
|
| 354 |
+
try { bytes = pdfBytes(); } catch (e) { return toast("Sorry, the PDF could not be made: " + e.message); }
|
| 355 |
+
q.take();
|
| 356 |
+
X.download(C.fileName(doc, "pdf"), new Blob([bytes], { type: "application/pdf" }));
|
| 357 |
+
result("PDF downloaded.");
|
| 358 |
+
});
|
| 359 |
+
$("m-pdf").addEventListener("click", function () { $("btn-pdf").click(); });
|
| 360 |
+
$("btn-print").addEventListener("click", function () { renderPreview(); result(null); setTimeout(function () { window.print(); }, 30); });
|
| 361 |
+
var lastEmail = "";
|
| 362 |
+
$("btn-email").addEventListener("click", function () {
|
| 363 |
+
lastEmail = C.emailText(view());
|
| 364 |
+
var done = function () { result(null); toast("Email text copied. Paste it into your email and attach the PDF."); };
|
| 365 |
+
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(lastEmail).then(done, function () { fallbackCopy(lastEmail); done(); });
|
| 366 |
+
else { fallbackCopy(lastEmail); done(); }
|
| 367 |
+
});
|
| 368 |
+
function fallbackCopy(t) {
|
| 369 |
+
var ta = document.createElement("textarea"); ta.value = t; ta.setAttribute("readonly", ""); ta.style.position = "fixed"; ta.style.opacity = "0";
|
| 370 |
+
document.body.appendChild(ta); ta.select(); try { document.execCommand("copy"); } catch (e) { /* ignore */ } ta.remove();
|
| 371 |
+
}
|
| 372 |
+
$("btn-html").addEventListener("click", function () {
|
| 373 |
+
if (!pro()) return upsell("The send-ready HTML proposal (one file your client can open and accept by email) is part of Pro.", "html");
|
| 374 |
+
X.download(C.fileName(doc, "html"), new Blob([C.exportHTML(view(), { credit: false, logo: logoData(), accent: accent() })], { type: "text/html;charset=utf-8" }));
|
| 375 |
+
result("HTML proposal downloaded. Email it as an attachment or upload it to your own site.");
|
| 376 |
+
});
|
| 377 |
+
function result(msg) {
|
| 378 |
+
S.results = (S.results || 0) + 1;
|
| 379 |
+
if (pro()) recordSaved(doc, true);
|
| 380 |
+
saveNow(); quotaLine();
|
| 381 |
+
if (!pro()) $("pro-cta").hidden = false;
|
| 382 |
+
if (msg) toast(pro() ? msg : msg + " " + X.quota("pdf", FREE_PDFS).left + " of " + FREE_PDFS + " free PDFs left this month.");
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
/* ---------- Pro: saved proposals + clients ---------- */
|
| 386 |
+
function recordSaved(d, quiet) {
|
| 387 |
+
var h = S.saved.filter(function (x) { return x.id === d.id; })[0];
|
| 388 |
+
var entry = { id: d.id, doc: C.clone(d), saved: new Date().toISOString(), status: h ? h.status : (d.accept && d.accept.name ? "accepted" : "draft") };
|
| 389 |
+
S.saved = [entry].concat(S.saved.filter(function (x) { return x.id !== d.id; })).slice(0, 300);
|
| 390 |
+
renderSaved();
|
| 391 |
+
if (!quiet) toast("Saved “" + C.fill(d.title, d) + "”.");
|
| 392 |
+
}
|
| 393 |
+
var STATUSES = ["draft", "sent", "accepted", "declined"];
|
| 394 |
+
function renderSaved() {
|
| 395 |
+
var body = $("saved-body");
|
| 396 |
+
$("dl-clients").innerHTML = pro() ? S.clients.map(function (c) { return '<option value="' + esc(c.company || c.name) + '">'; }).join("") : "";
|
| 397 |
+
if (!pro()) {
|
| 398 |
+
body.innerHTML = '<div class="locked"><p>Pro keeps every proposal you make here with its status (draft, sent, accepted, declined), remembers your clients, and duplicates a past proposal for a new client in one click.</p><button type="button" class="btn" id="btn-saved-pro">Unlock saved proposals</button></div>';
|
| 399 |
+
$("btn-saved-pro").onclick = function () { upsell(null, "saved"); };
|
| 400 |
+
return;
|
| 401 |
+
}
|
| 402 |
+
var won = {};
|
| 403 |
+
S.saved.forEach(function (h) { if (h.status === "accepted") { var T = C.totals(h.doc), c = h.doc.currency; won[c] = (won[c] || 0) + T.once.total + 12 * T.month.total; } });
|
| 404 |
+
var wonTxt = Object.keys(won).map(function (c) { return C.money(won[c], c); }).join(" + ");
|
| 405 |
+
body.innerHTML = (S.saved.length ? '<p class="hist-sum">' + S.saved.length + " proposal" + (S.saved.length > 1 ? "s" : "") + (wonTxt ? " · accepted value (one-time + 12 months): " + esc(wonTxt) : "") + "</p>" +
|
| 406 |
+
'<div class="table-wrap"><table class="ht"><thead><tr><th>Date</th><th>Client</th><th>Proposal</th><th class="num">Value</th><th>Status</th><th>Actions</th></tr></thead><tbody>' +
|
| 407 |
+
S.saved.map(function (h) {
|
| 408 |
+
var d = h.doc;
|
| 409 |
+
return '<tr data-id="' + esc(h.id) + '"><td>' + esc(d.date) + "</td><td>" + esc((d.client && (d.client.company || d.client.name)) || "") + "</td><td>" + esc(C.fill(d.title, d)) + '</td><td class="num">' + esc(C.priceSummary(d)) + "</td>" +
|
| 410 |
+
'<td><select data-h="status" aria-label="Status of ' + esc(C.fill(d.title, d)) + '">' + STATUSES.map(function (s) { return '<option value="' + s + '"' + (h.status === s ? " selected" : "") + ">" + s.charAt(0).toUpperCase() + s.slice(1) + "</option>"; }).join("") + "</select></td>" +
|
| 411 |
+
'<td><button type="button" class="btn ghost sm" data-h="open">Open</button> <button type="button" class="btn ghost sm" data-h="dup">Duplicate</button> <button type="button" class="icon-btn" data-h="del" aria-label="Delete">×</button></td></tr>';
|
| 412 |
+
}).join("") + "</tbody></table></div>" : '<p class="hint">Proposals you save, download or print appear here.</p>') +
|
| 413 |
+
'<div class="btns"><button type="button" class="btn ghost sm" id="btn-save2">Save current proposal</button></div>' +
|
| 414 |
+
'<h3 class="sub">Clients (' + S.clients.length + ")</h3>" + (S.clients.length ? '<div class="chips">' + S.clients.map(function (c, i) { return '<span class="chip"><span>' + esc(c.company || c.name) + '</span><button type="button" data-cl="' + i + '" aria-label="Remove ' + esc(c.company || c.name) + '">×</button></span>'; }).join("") + "</div>" : '<p class="hint">Press “Save client” under Cover & client; start typing the company next time and the details fill in.</p>');
|
| 415 |
+
$("btn-save2").onclick = function () { recordSaved(doc); save(); };
|
| 416 |
+
}
|
| 417 |
+
$("saved-body").addEventListener("click", function (e) {
|
| 418 |
+
var cl = e.target.closest("[data-cl]");
|
| 419 |
+
if (cl) { S.clients.splice(+cl.dataset.cl, 1); renderSaved(); save(); return; }
|
| 420 |
+
var b = e.target.closest("button[data-h]"); if (!b) return;
|
| 421 |
+
var id = b.closest("tr").dataset.id, h = S.saved.filter(function (x) { return x.id === id; })[0]; if (!h) return;
|
| 422 |
+
var act = b.dataset.h;
|
| 423 |
+
if (act === "open") { S.doc = doc = C.clone(h.doc); toForm(); changed(); $("app").scrollIntoView({ behavior: "smooth" }); }
|
| 424 |
+
if (act === "dup") { S.doc = doc = C.duplicate(h.doc); toForm(); changed(); $("app").scrollIntoView({ behavior: "smooth" }); toast("Duplicated. Change the client and send."); }
|
| 425 |
+
if (act === "del") { if (!confirm("Delete this saved proposal?")) return; S.saved = S.saved.filter(function (x) { return x.id !== id; }); renderSaved(); }
|
| 426 |
+
save();
|
| 427 |
+
});
|
| 428 |
+
$("saved-body").addEventListener("change", function (e) {
|
| 429 |
+
if (e.target.dataset.h !== "status") return;
|
| 430 |
+
var h = S.saved.filter(function (x) { return x.id === e.target.closest("tr").dataset.id; })[0];
|
| 431 |
+
if (h) { h.status = e.target.value; renderSaved(); save(); }
|
| 432 |
+
});
|
| 433 |
+
$("btn-save").addEventListener("click", function () { if (!pro()) return upsell("Saved proposals and clients are part of Pro.", "saved"); recordSaved(doc); save(); });
|
| 434 |
+
$("btn-dup").addEventListener("click", function () {
|
| 435 |
+
if (!pro()) return upsell("Duplicating a proposal is part of Pro.", "duplicate");
|
| 436 |
+
recordSaved(doc, true);
|
| 437 |
+
S.doc = doc = C.duplicate(doc); toForm(); changed(); toast("Copy made. The original is in My proposals.");
|
| 438 |
+
});
|
| 439 |
+
$("btn-save-client").addEventListener("click", function () {
|
| 440 |
+
if (!pro()) return upsell("Saved clients with autocomplete are part of Pro.", "clients");
|
| 441 |
+
var c = doc.client || {};
|
| 442 |
+
if (!String(c.company || c.name || "").trim()) return toast("Add the client's company or name first.");
|
| 443 |
+
S.clients = [C.clone(c)].concat(S.clients.filter(function (x) { return (x.company || x.name) !== (c.company || c.name); }));
|
| 444 |
+
renderSaved(); save(); toast("Saved client " + (c.company || c.name) + ".");
|
| 445 |
+
});
|
| 446 |
+
$("btn-save-business").addEventListener("click", function () {
|
| 447 |
+
S.profile = { from: C.clone(doc.from), currency: doc.currency, page: doc.page };
|
| 448 |
+
save(); toast("Saved. New proposals start with your business details.");
|
| 449 |
+
$("business-hint").textContent = "Saved: " + (doc.from.name || "your business") + ". It fills every new proposal.";
|
| 450 |
+
});
|
| 451 |
+
|
| 452 |
+
/* ---------- logo (Pro) ---------- */
|
| 453 |
+
$("f-logo").addEventListener("click", function (e) { if (!pro()) { e.preventDefault(); upsell("Your logo on the cover is part of Pro.", "logo"); } });
|
| 454 |
+
$("f-logo").addEventListener("change", function () {
|
| 455 |
+
var f = this.files && this.files[0]; this.value = "";
|
| 456 |
+
if (!f) return;
|
| 457 |
+
if (f.size > 5e6) return toast("That image is over 5 MB. Try a smaller logo.");
|
| 458 |
+
var url = URL.createObjectURL(f), img = new Image();
|
| 459 |
+
img.onload = function () {
|
| 460 |
+
var s = Math.min(1, 600 / (img.naturalWidth || 300), 240 / (img.naturalHeight || 120)) || 1;
|
| 461 |
+
var w = Math.max(1, Math.round((img.naturalWidth || 300) * s)), h = Math.max(1, Math.round((img.naturalHeight || 120) * s));
|
| 462 |
+
var c = document.createElement("canvas"); c.width = w; c.height = h;
|
| 463 |
+
var g = c.getContext("2d"); g.fillStyle = "#fff"; g.fillRect(0, 0, w, h); g.drawImage(img, 0, 0, w, h);
|
| 464 |
+
S.logo = { data: c.toDataURL("image/jpeg", 0.9), w: w, h: h };
|
| 465 |
+
URL.revokeObjectURL(url); save(); logoUi(); renderPreview(); toast("Logo added to the cover.");
|
| 466 |
+
};
|
| 467 |
+
img.onerror = function () { URL.revokeObjectURL(url); toast("That file could not be read as an image."); };
|
| 468 |
+
img.src = url;
|
| 469 |
+
});
|
| 470 |
+
$("btn-logo-clear").addEventListener("click", function () { S.logo = null; save(); logoUi(); renderPreview(); });
|
| 471 |
+
function logoUi() {
|
| 472 |
+
var has = logoData();
|
| 473 |
+
$("logo-prev").innerHTML = has ? '<img src="' + has + '" alt="Your logo">' : "No logo";
|
| 474 |
+
$("btn-logo-clear").hidden = !has;
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
/* ---------- example, new, backup ---------- */
|
| 478 |
+
$("btn-example").addEventListener("click", function () {
|
| 479 |
+
var id = $("example-kind").value;
|
| 480 |
+
if (!isFreeTpl(id) && !pro()) return upsell("The " + C.TEMPLATES[id].name.toLowerCase() + " template is part of Pro. Free includes web design and marketing retainer.", "template");
|
| 481 |
+
S.doc = doc = C.fromTemplate(id, true);
|
| 482 |
+
toForm(); changed(); renderPreview(); warnings();
|
| 483 |
+
if (window.innerWidth < 980) $("preview").scrollIntoView({ behavior: "smooth", block: "start" });
|
| 484 |
+
});
|
| 485 |
+
$("btn-new").addEventListener("click", function () {
|
| 486 |
+
if (!confirm("Start a blank proposal? The current one is cleared (Pro keeps saved proposals).")) return;
|
| 487 |
+
var id = isFreeTpl(doc.template) || pro() ? doc.template : "web-design";
|
| 488 |
+
var n = C.fromTemplate(id, false);
|
| 489 |
+
n.sections = n.sections.filter(function (s) { return s.kind !== "text"; }).map(function (s) { s.body = s.kind === "acceptance" ? s.body : ""; return s; });
|
| 490 |
+
n.sections.unshift({ id: C.uid(), kind: "text", title: "Introduction", body: "" });
|
| 491 |
+
n.pricing.items = [{ desc: "", qty: "1", rate: "", billing: "once", optional: false, selected: false }];
|
| 492 |
+
n.timeline = [{ phase: "", detail: "", when: "" }];
|
| 493 |
+
n.title = "Proposal";
|
| 494 |
+
if (S.profile) { n.from = C.clone(S.profile.from); if (S.profile.currency) n.currency = S.profile.currency; n.page = S.profile.page || ""; }
|
| 495 |
+
S.doc = doc = n; toForm(); changed(); $("f-title").focus();
|
| 496 |
+
});
|
| 497 |
+
$("btn-backup").addEventListener("click", function () {
|
| 498 |
+
if (!pro()) return upsell("JSON backup of all your proposals is part of Pro.", "backup");
|
| 499 |
+
saveNow();
|
| 500 |
+
X.download("pitchsprig-backup-" + C.todayISO() + ".json", JSON.stringify({ app: "pitchsprig", version: 1, saved: new Date().toISOString(), data: S }, null, 1), "application/json");
|
| 501 |
+
});
|
| 502 |
+
$("f-restore").addEventListener("change", function () {
|
| 503 |
+
var f = this.files && this.files[0]; this.value = "";
|
| 504 |
+
if (!f) return;
|
| 505 |
+
f.text().then(function (t) {
|
| 506 |
+
var j = JSON.parse(t), d = j && j.app === "pitchsprig" ? j.data : null;
|
| 507 |
+
if (!d || typeof d !== "object" || !d.doc) throw new Error("not a Pitchsprig backup");
|
| 508 |
+
var f0 = fresh(); Object.keys(f0).forEach(function (k) { if (d[k] == null) d[k] = f0[k]; });
|
| 509 |
+
S = d; doc = S.doc; saveNow(); toForm(); renderSaved(); renderLibrary(); logoUi(); changed();
|
| 510 |
+
toast("Backup restored.");
|
| 511 |
+
}).catch(function (e) { toast("Could not restore: " + e.message + "."); });
|
| 512 |
+
});
|
| 513 |
+
$("btn-cta").addEventListener("click", function () { upsell(null, "mid-cta"); });
|
| 514 |
+
|
| 515 |
+
/* ---------- Pro state ---------- */
|
| 516 |
+
function onPro(isPro) {
|
| 517 |
+
$("pro-pill").textContent = isPro ? "Pro ✓" : "Go Pro";
|
| 518 |
+
if (isPro) $("pro-cta").hidden = true;
|
| 519 |
+
quotaLine(); renderSaved(); renderLibrary(); logoUi(); syncLayout(); renderTpls();
|
| 520 |
+
$("f-accent").value = isPro && C.validHex(S.accent) ? S.accent.toLowerCase() : C.DEFAULT_ACCENT.toLowerCase();
|
| 521 |
+
renderPreview(); warnings();
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
/* ---------- install + offline ---------- */
|
| 525 |
+
var deferred = null;
|
| 526 |
+
window.addEventListener("beforeinstallprompt", function (e) { e.preventDefault(); deferred = e; $("btn-install").hidden = false; });
|
| 527 |
+
$("btn-install").addEventListener("click", function () {
|
| 528 |
+
if (!deferred) return;
|
| 529 |
+
deferred.prompt(); deferred.userChoice.finally(function () { deferred = null; $("btn-install").hidden = true; });
|
| 530 |
+
});
|
| 531 |
+
window.addEventListener("appinstalled", function () { $("btn-install").hidden = true; });
|
| 532 |
+
if ("serviceWorker" in navigator && (location.protocol === "https:" || /^(localhost|127\.0\.0\.1)$/.test(location.hostname))) {
|
| 533 |
+
window.addEventListener("load", function () { navigator.serviceWorker.register("sw.js").catch(function () { /* offline cache is optional */ }); });
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
/* ---------- start ---------- */
|
| 537 |
+
var st = document.createElement("style"); st.id = "doc-css"; st.textContent = C.DOC_CSS; document.head.appendChild(st);
|
| 538 |
+
fillPickers();
|
| 539 |
+
toForm();
|
| 540 |
+
X.onChange(onPro);
|
| 541 |
+
window.Pitchsprig = { state: function () { return S; }, doc: function () { return doc; }, pdf: pdfBytes, lastEmail: function () { return lastEmail; } };
|
| 542 |
+
})();
|
pitchsprig/icon-192.png
ADDED
|
|
pitchsprig/icon-512.png
ADDED
|
|
pitchsprig/icon.svg
ADDED
|
|
pitchsprig/index.html
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
+
<title>Proposal Generator: Free Business Proposal Template & PDF | Pitchsprig</title>
|
| 7 |
+
<meta name="description" content="Free proposal generator for agencies and freelancers: business proposal templates with scope, pricing and timeline, as a polished PDF. No sign-up, nothing uploaded.">
|
| 8 |
+
<meta name="keywords" content="proposal generator, free proposal template, business proposal template, web design proposal template, marketing retainer proposal, consulting proposal template, client proposal pdf, proposify alternative">
|
| 9 |
+
<meta name="theme-color" content="#8A2C5A">
|
| 10 |
+
<link rel="canonical" href="https://cybermax-tools-cybermax.static.hf.space/pitchsprig/index.html">
|
| 11 |
+
<link rel="manifest" href="manifest.webmanifest">
|
| 12 |
+
<link rel="icon" href="icon.svg" type="image/svg+xml">
|
| 13 |
+
<link rel="apple-touch-icon" href="icon-192.png">
|
| 14 |
+
<meta property="og:type" content="website">
|
| 15 |
+
<meta property="og:site_name" content="CyberMax">
|
| 16 |
+
<meta property="og:title" content="Pitchsprig: proposal generator, client-ready PDF in minutes">
|
| 17 |
+
<meta property="og:description" content="Client proposals for agencies, consultants and freelancers: cover, scope, pricing with options and packages, timeline and acceptance. Free, no sign-up, nothing uploaded.">
|
| 18 |
+
<meta property="og:url" content="https://cybermax-tools-cybermax.static.hf.space/pitchsprig/index.html">
|
| 19 |
+
<meta property="og:image" content="https://cybermax-tools-cybermax.static.hf.space/pitchsprig/og.png">
|
| 20 |
+
<meta name="twitter:card" content="summary_large_image">
|
| 21 |
+
<script type="application/ld+json">
|
| 22 |
+
{"@context":"https://schema.org","@graph":[
|
| 23 |
+
{"@type":"WebApplication","name":"Pitchsprig","alternateName":"Pitchsprig proposal generator","url":"https://cybermax-tools-cybermax.static.hf.space/pitchsprig/index.html","image":"https://cybermax-tools-cybermax.static.hf.space/pitchsprig/og.png","applicationCategory":"BusinessApplication","operatingSystem":"Any (web browser)","browserRequirements":"Requires JavaScript","description":"Proposal generator for agencies, consultants and freelancers: starter templates by service, a section editor, pricing with optional items and packages, timeline, typed-name acceptance block, PDF download, print, HTML export and email text. Runs in the browser; nothing uploaded.","offers":[{"@type":"Offer","name":"Free","price":"0","priceCurrency":"USD","description":"3 PDF downloads a month, 2 templates, unlimited printing"},{"@type":"Offer","name":"Pitchsprig Pro Monthly","price":"9","priceCurrency":"USD","description":"Unlimited PDFs, no footer, all templates, your logo and colours, packages layout, HTML export, content library, saved proposals and clients; cancel any time"},{"@type":"Offer","name":"Pitchsprig Pro Lifetime","price":"79","priceCurrency":"USD","description":"Every Pro feature, pay once"}],"publisher":{"@type":"Organization","name":"CyberMax","email":"cybermax.tools@gmail.com"}},
|
| 24 |
+
{"@type":"FAQPage","mainEntity":[
|
| 25 |
+
{"@type":"Question","name":"Is Pitchsprig really free?","acceptedAnswer":{"@type":"Answer","text":"Yes. You get 3 PDF downloads every calendar month, the web design and marketing retainer templates, the full section editor, pricing table, timeline and acceptance block, unlimited printing and email text, with no account. Free PDFs carry a small Proposal made with Pitchsprig by CyberMax line."}},
|
| 26 |
+
{"@type":"Question","name":"Why not Proposify?","acceptedAnswer":{"@type":"Answer","text":"Proposify is a full proposal platform with e-signatures, open tracking and team features, priced per user: Basic $19, Team $41 and Business $65 per user per month, billed annually (Capterra, checked 2 Oct 2026). If you need those, it is a good choice. If you just need a polished proposal PDF, Pitchsprig is free for 3 a month or $79 once for unlimited, with no per-user fees."}},
|
| 27 |
+
{"@type":"Question","name":"Is my data private?","acceptedAnswer":{"@type":"Answer","text":"Yes. Pitchsprig runs entirely in your browser. Your proposals, prices and clients are saved only on this device, and the PDF is made on your device. Nothing is uploaded."}},
|
| 28 |
+
{"@type":"Question","name":"What does Pro add?","acceptedAnswer":{"@type":"Answer","text":"Unlimited PDFs with no footer line, all 6 templates, your logo and brand colour, a good-better-best packages layout, a send-ready HTML proposal your client can accept by email, a content library for reusable sections, saved proposals and clients, one-click duplicate and JSON backup."}},
|
| 29 |
+
{"@type":"Question","name":"Can I cancel?","acceptedAnswer":{"@type":"Answer","text":"Yes. The $9 monthly plan cancels any time from the link in your Stripe receipt email. The $79 Lifetime plan is a single payment with nothing to cancel."}},
|
| 30 |
+
{"@type":"Question","name":"Can my client sign the proposal?","acceptedAnswer":{"@type":"Answer","text":"Your client can type their name and date in the acceptance block, or accept from the HTML version, which opens an email to you with their acceptance. That is a record of acceptance, not an electronic signature. If you need a legally binding e-signature with an audit trail, use a dedicated e-signature service."}}]}
|
| 31 |
+
]}
|
| 32 |
+
</script>
|
| 33 |
+
<link rel="stylesheet" href="style.css">
|
| 34 |
+
</head>
|
| 35 |
+
<body>
|
| 36 |
+
<header class="top"><div class="wrap top-in">
|
| 37 |
+
<a class="brand" href="./" aria-label="Pitchsprig home"><img src="icon.svg" alt="" width="30" height="30"><span><b>Pitchsprig</b> <small>by CyberMax</small></span></a>
|
| 38 |
+
<nav class="top-nav">
|
| 39 |
+
<button class="btn ghost sm" id="btn-install" type="button" hidden>Install app</button>
|
| 40 |
+
<a href="#cmx-pro" class="top-link">Pricing</a>
|
| 41 |
+
<a href="#cmx-pro" class="pill" id="pro-pill">Pro</a>
|
| 42 |
+
</nav>
|
| 43 |
+
</div></header>
|
| 44 |
+
|
| 45 |
+
<main>
|
| 46 |
+
<div class="wrap">
|
| 47 |
+
<section class="hero">
|
| 48 |
+
<h1>Proposal generator: a client-ready proposal PDF in minutes</h1>
|
| 49 |
+
<p class="lede">For agencies, consultants and freelancers. Start from a proposal template written for your service, edit the scope, pricing and timeline, then send a polished PDF. <b>Free, no sign-up, nothing uploaded.</b></p>
|
| 50 |
+
<div class="hero-row">
|
| 51 |
+
<button class="btn" id="btn-example" type="button">Load example</button>
|
| 52 |
+
<label class="sel-inline" for="example-kind"><span class="sr">Example proposal</span>
|
| 53 |
+
<select id="example-kind"></select></label>
|
| 54 |
+
<span class="hero-note">3 free PDFs a month · print free · works offline</span>
|
| 55 |
+
</div>
|
| 56 |
+
</section>
|
| 57 |
+
</div>
|
| 58 |
+
|
| 59 |
+
<section id="app" class="app wrap" aria-label="Proposal generator">
|
| 60 |
+
<div class="cols">
|
| 61 |
+
<form id="editor" class="editor" autocomplete="off" novalidate>
|
| 62 |
+
<details class="card" open id="card-templates">
|
| 63 |
+
<summary><h2>Template</h2></summary>
|
| 64 |
+
<p class="hint">Each template comes with real starter copy, pricing lines and a timeline for that kind of work. Your details and your client are kept when you switch.</p>
|
| 65 |
+
<div class="tpls" id="tpls" role="radiogroup" aria-label="Proposal template"></div>
|
| 66 |
+
</details>
|
| 67 |
+
|
| 68 |
+
<details class="card" open>
|
| 69 |
+
<summary><h2>Cover & client</h2></summary>
|
| 70 |
+
<div class="g2">
|
| 71 |
+
<div class="span2"><label for="f-title">Proposal title</label><input id="f-title" name="title" placeholder="Website redesign proposal"></div>
|
| 72 |
+
<div><label for="f-client-company">Client company</label><input id="f-client-company" name="client.company" list="dl-clients"></div>
|
| 73 |
+
<div><label for="f-client-name">Client contact</label><input id="f-client-name" name="client.name" placeholder="First and last name"></div>
|
| 74 |
+
<div><label for="f-client-email">Client email</label><input id="f-client-email" name="client.email" type="email"></div>
|
| 75 |
+
<div><label for="f-number">Reference <span class="opt">optional</span></label><input id="f-number" name="number" placeholder="P-2026-001"></div>
|
| 76 |
+
<div><label for="f-date">Date</label><input id="f-date" name="date" type="date"></div>
|
| 77 |
+
<div><label for="f-valid">Valid until</label><input id="f-valid" name="valid" type="date"></div>
|
| 78 |
+
<div><label for="f-currency">Currency</label><select id="f-currency" name="currency"></select></div>
|
| 79 |
+
<div><label for="f-page">Paper size</label><select id="f-page" name="page"><option value="">Auto</option><option value="A4">A4</option><option value="Letter">US Letter</option></select></div>
|
| 80 |
+
</div>
|
| 81 |
+
<div class="btns"><button type="button" class="btn ghost sm" id="btn-save-client">Save client <span class="pro-tag">PRO</span></button></div>
|
| 82 |
+
</details>
|
| 83 |
+
|
| 84 |
+
<details class="card" open>
|
| 85 |
+
<summary><h2>Your business</h2></summary>
|
| 86 |
+
<div class="g2">
|
| 87 |
+
<div><label for="f-from-name">Business name</label><input id="f-from-name" name="from.name" autocomplete="organization"></div>
|
| 88 |
+
<div><label for="f-from-person">Your name</label><input id="f-from-person" name="from.person" autocomplete="name"></div>
|
| 89 |
+
<div><label for="f-from-email">Email</label><input id="f-from-email" name="from.email" type="email" autocomplete="email"></div>
|
| 90 |
+
<div><label for="f-from-phone">Phone</label><input id="f-from-phone" name="from.phone" type="tel" autocomplete="tel"></div>
|
| 91 |
+
<div class="span2"><label for="f-from-website">Website</label><input id="f-from-website" name="from.website"></div>
|
| 92 |
+
</div>
|
| 93 |
+
<div class="logo-row">
|
| 94 |
+
<div class="logo-prev" id="logo-prev" aria-live="polite">No logo</div>
|
| 95 |
+
<label class="btn ghost sm file-btn" for="f-logo">Add your logo <span class="pro-tag">PRO</span></label>
|
| 96 |
+
<input type="file" id="f-logo" accept="image/png,image/jpeg,image/webp,image/svg+xml" hidden>
|
| 97 |
+
<button type="button" class="btn ghost sm" id="btn-logo-clear" hidden>Remove logo</button>
|
| 98 |
+
<label class="color-lbl" for="f-accent">Brand colour <span class="pro-tag">PRO</span><input id="f-accent" type="color" value="#8a2c5a"></label>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="btns"><button type="button" class="btn ghost sm" id="btn-save-business">Save as my business</button><span class="hint" id="business-hint">Saved details fill every new proposal.</span></div>
|
| 101 |
+
</details>
|
| 102 |
+
|
| 103 |
+
<details class="card" open>
|
| 104 |
+
<summary><h2>Sections</h2></summary>
|
| 105 |
+
<p class="hint">Reorder with ↑ ↓. Formatting: <code>**bold**</code>, <code>*italic*</code>, <code>## heading</code>, <code>- list</code>, <code>1. list</code>, or use the toolbar. Words in <code>{client}</code> become the client's company. Replace anything in [brackets] with your own words.</p>
|
| 106 |
+
<div id="sections"></div>
|
| 107 |
+
<div class="btns add-row">
|
| 108 |
+
<label class="sr" for="add-kind">Section type</label>
|
| 109 |
+
<select id="add-kind"><option value="text">Text section</option><option value="pricing">Pricing table</option><option value="timeline">Timeline</option><option value="acceptance">Acceptance block</option></select>
|
| 110 |
+
<button type="button" class="btn ghost sm" id="btn-add-section">+ Add section</button>
|
| 111 |
+
<button type="button" class="btn ghost sm" id="btn-from-library">Insert from library <span class="pro-tag">PRO</span></button>
|
| 112 |
+
</div>
|
| 113 |
+
<div id="library-pick" hidden></div>
|
| 114 |
+
</details>
|
| 115 |
+
|
| 116 |
+
<details class="card" open>
|
| 117 |
+
<summary><h2>Pricing</h2></summary>
|
| 118 |
+
<div class="seg" role="radiogroup" aria-label="Pricing layout">
|
| 119 |
+
<button type="button" role="radio" data-layout="table" aria-checked="true">Itemised table</button>
|
| 120 |
+
<button type="button" role="radio" data-layout="packages" aria-checked="false">Good / better / best packages <span class="pro-tag">PRO</span></button>
|
| 121 |
+
</div>
|
| 122 |
+
<div id="items"></div>
|
| 123 |
+
<div class="btns"><button type="button" class="btn ghost sm" id="btn-add-item">+ Add line</button><span class="hint">Tick “Optional” for extras the client can choose; untick “Included” to show them without adding them to the total.</span></div>
|
| 124 |
+
<div class="g3">
|
| 125 |
+
<div><label for="f-disc">Discount</label><div class="combo"><input id="f-disc" name="pricing.discount.value" inputmode="decimal" placeholder="0"><select name="pricing.discount.type" aria-label="Discount type"><option value="pct">%</option><option value="amt">amount</option></select></div></div>
|
| 126 |
+
<div><label for="f-tax">Tax %</label><input id="f-tax" name="pricing.tax" inputmode="decimal" placeholder="0"></div>
|
| 127 |
+
<div><label for="f-taxlabel">Tax name</label><input id="f-taxlabel" name="pricing.taxLabel" list="dl-taxlabels" placeholder="Tax"></div>
|
| 128 |
+
</div>
|
| 129 |
+
<p class="tot-line" id="tot-line" aria-live="polite"></p>
|
| 130 |
+
<div id="packages-ed" hidden></div>
|
| 131 |
+
</details>
|
| 132 |
+
|
| 133 |
+
<details class="card" open>
|
| 134 |
+
<summary><h2>Timeline</h2></summary>
|
| 135 |
+
<div id="timeline"></div>
|
| 136 |
+
<div class="btns"><button type="button" class="btn ghost sm" id="btn-add-phase">+ Add phase</button></div>
|
| 137 |
+
</details>
|
| 138 |
+
|
| 139 |
+
<details class="card">
|
| 140 |
+
<summary><h2>Acceptance record</h2></summary>
|
| 141 |
+
<p class="hint">When your client accepts (by email or in the HTML version), record it here and it prints in the acceptance block. This is a record of acceptance, not an electronic signature.</p>
|
| 142 |
+
<div class="g3">
|
| 143 |
+
<div><label for="f-acc-name">Accepted by</label><input id="f-acc-name" name="accept.name"></div>
|
| 144 |
+
<div><label for="f-acc-role">Title and company</label><input id="f-acc-role" name="accept.role"></div>
|
| 145 |
+
<div><label for="f-acc-date">Date</label><input id="f-acc-date" name="accept.date" type="date"></div>
|
| 146 |
+
</div>
|
| 147 |
+
</details>
|
| 148 |
+
|
| 149 |
+
<details class="card" id="card-library">
|
| 150 |
+
<summary><h2>Content library <span class="pro-tag">PRO</span></h2></summary>
|
| 151 |
+
<div id="library"></div>
|
| 152 |
+
</details>
|
| 153 |
+
|
| 154 |
+
<details class="card">
|
| 155 |
+
<summary><h2>Backup</h2></summary>
|
| 156 |
+
<p class="hint">Everything lives in this browser only. Nothing is uploaded. A backup file moves your proposals, clients and library to another device.</p>
|
| 157 |
+
<div class="btns"><button type="button" class="btn ghost sm" id="btn-backup">Download backup (JSON) <span class="pro-tag">PRO</span></button><label class="btn ghost sm file-btn" for="f-restore">Restore backup</label><input type="file" id="f-restore" accept="application/json,.json" hidden><button type="button" class="btn ghost sm danger" id="btn-new">Start a blank proposal</button></div>
|
| 158 |
+
</details>
|
| 159 |
+
</form>
|
| 160 |
+
|
| 161 |
+
<aside class="preview-col" id="preview" aria-label="Preview and download">
|
| 162 |
+
<div class="actions card">
|
| 163 |
+
<div class="act-row">
|
| 164 |
+
<button type="button" class="btn big" id="btn-pdf">Download PDF</button>
|
| 165 |
+
<button type="button" class="btn ghost" id="btn-print">Print</button>
|
| 166 |
+
</div>
|
| 167 |
+
<p class="quota" id="quota" aria-live="polite"></p>
|
| 168 |
+
<p class="warn" id="warn" aria-live="polite"></p>
|
| 169 |
+
<div class="act-row small">
|
| 170 |
+
<button type="button" class="btn ghost sm" id="btn-email">Copy as email text</button>
|
| 171 |
+
<button type="button" class="btn ghost sm" id="btn-html">Send-ready HTML <span class="pro-tag">PRO</span></button>
|
| 172 |
+
<button type="button" class="btn ghost sm" id="btn-dup">Duplicate <span class="pro-tag">PRO</span></button>
|
| 173 |
+
<button type="button" class="btn ghost sm" id="btn-save">Save proposal <span class="pro-tag">PRO</span></button>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
<div class="paper-wrap" id="paper-wrap"><div id="doc" class="paper" aria-label="Proposal preview"></div></div>
|
| 177 |
+
</aside>
|
| 178 |
+
</div>
|
| 179 |
+
</section>
|
| 180 |
+
|
| 181 |
+
<div class="wrap">
|
| 182 |
+
<section class="pro-cta card" id="pro-cta" hidden>
|
| 183 |
+
<div>
|
| 184 |
+
<h2>Sending proposals every month?</h2>
|
| 185 |
+
<p>Pitchsprig Pro: unlimited PDFs with no footer line, all 6 templates, your logo and colours, good / better / best packages, a send-ready HTML proposal your client can accept by email, and a library of your best sections. <b>$9/month</b> or <b>$79 once</b>, no per-user fees.</p>
|
| 186 |
+
</div>
|
| 187 |
+
<button type="button" class="btn" id="btn-cta">See Pro plans</button>
|
| 188 |
+
</section>
|
| 189 |
+
|
| 190 |
+
<section class="saved card" id="saved" aria-labelledby="h-saved">
|
| 191 |
+
<div class="hist-head"><h2 id="h-saved">My proposals & clients <span class="pro-tag">PRO</span></h2></div>
|
| 192 |
+
<div id="saved-body"></div>
|
| 193 |
+
</section>
|
| 194 |
+
|
| 195 |
+
<section class="how" id="how">
|
| 196 |
+
<h2>How it works</h2>
|
| 197 |
+
<ol class="steps">
|
| 198 |
+
<li><b>Pick a template.</b> Web design, marketing retainer, branding, consulting, photo and video, or software. Each comes with starter copy, pricing lines and a timeline you edit.</li>
|
| 199 |
+
<li><b>Make it yours.</b> Add, reorder or remove sections. Price with quantities, one-time and monthly lines, optional extras, discount and tax, or three packages.</li>
|
| 200 |
+
<li><b>Send it.</b> Download a multi-page PDF with a cover and page numbers, print it, copy a covering email, or (Pro) send a one-file HTML proposal your client can accept by email.</li>
|
| 201 |
+
</ol>
|
| 202 |
+
</section>
|
| 203 |
+
|
| 204 |
+
<section class="compare" id="compare">
|
| 205 |
+
<h2>Pitchsprig vs other proposal software</h2>
|
| 206 |
+
<div class="table-wrap">
|
| 207 |
+
<table class="cmp">
|
| 208 |
+
<thead><tr><th scope="col">Tool</th><th scope="col">Price</th><th scope="col">Good to know</th></tr></thead>
|
| 209 |
+
<tbody>
|
| 210 |
+
<tr class="us"><th scope="row">Pitchsprig Free</th><td>$0</td><td>3 PDFs a month, 2 templates, full editor, pricing, timeline, acceptance block, unlimited printing, no account, nothing uploaded</td></tr>
|
| 211 |
+
<tr class="us"><th scope="row">Pitchsprig Pro</th><td>$9/month or <b>$79 once</b>, no per-user fees</td><td>Unlimited PDFs, no footer, all 6 templates, logo and colours, packages, HTML export, content library, saved proposals and clients. No e-signatures, open tracking or payments.</td></tr>
|
| 212 |
+
<tr><th scope="row"><a href="https://www.capterra.com/p/133332/Proposify/" target="_blank" rel="noopener nofollow">Proposify</a></th><td>Basic $19, Team $41, Business $65 per user per month (billed annually)</td><td>Full proposal platform with e-signatures, open tracking and team workflows; 4.4 stars from 299 reviews on Capterra</td></tr>
|
| 213 |
+
<tr><th scope="row"><a href="https://checkthat.ai/brands/better-proposals/pricing" target="_blank" rel="noopener nofollow">Better Proposals</a></th><td>Starter $13 per user per month billed annually, or $19 monthly</td><td>Web-based proposals with e-signatures, tracking and online payments</td></tr>
|
| 214 |
+
<tr><th scope="row"><a href="https://www.agencyhandy.com/client-portal/bonsai-pricing/" target="_blank" rel="noopener nofollow">Bonsai</a></th><td>Essentials $25 per user per month (monthly)</td><td>Freelancer suite: proposals, contracts, invoicing and payments in one account</td></tr>
|
| 215 |
+
</tbody>
|
| 216 |
+
</table>
|
| 217 |
+
</div>
|
| 218 |
+
<p class="hint">Rival prices checked 2 Oct 2026 from the linked pages (Proposify via Capterra; Better Proposals and Bonsai from search summaries of the linked pages). Prices can change; check their sites. Choose them if you need e-signatures, read tracking or card payments inside the proposal; choose Pitchsprig if you want a polished proposal without a per-user subscription and without uploading client data.</p>
|
| 219 |
+
</section>
|
| 220 |
+
|
| 221 |
+
<section class="faq" id="faq">
|
| 222 |
+
<h2>Questions</h2>
|
| 223 |
+
<details><summary>Is Pitchsprig really free?</summary><p>Yes. You get 3 PDF downloads every calendar month, the web design and marketing retainer templates, the full section editor, pricing table, timeline and acceptance block, unlimited printing and email text, with no account. Free PDFs and prints carry a small “Proposal made with Pitchsprig by CyberMax” line.</p></details>
|
| 224 |
+
<details><summary>Why not Proposify?</summary><p>Proposify is a full proposal platform with e-signatures, open tracking and team features, priced per user: Basic $19, Team $41 and Business $65 per user per month, billed annually (Capterra, checked 2 Oct 2026, where it has 4.4 stars from 299 reviews). If you need those features it is a good choice. If you need a polished proposal PDF, Pitchsprig is free for 3 a month, or $79 once for unlimited with no per-user fees.</p></details>
|
| 225 |
+
<details><summary>Why not Better Proposals or Bonsai?</summary><p>Better Proposals Starter is $13 per user per month billed annually or $19 monthly; Bonsai Essentials is $25 per user per month (checked 2 Oct 2026). Both add e-signatures, tracking and payments, which Pitchsprig does not. Pitchsprig wins on price, privacy (nothing leaves your browser) and having no per-user fees.</p></details>
|
| 226 |
+
<details><summary>Is my data private?</summary><p>Yes. Pitchsprig runs entirely in your browser. Your proposals, prices and clients are saved only on this device, and the PDF is made on your device. Nothing is uploaded.</p></details>
|
| 227 |
+
<details><summary>What does Pro add?</summary><p>Unlimited PDFs with no footer line, all 6 templates (adds branding, consulting, photo and video, software development), your logo and brand colour, a good / better / best packages layout, a send-ready HTML proposal your client can accept by email, a content library for your about us, terms and case studies, saved proposals and clients, one-click duplicate and JSON backup.</p></details>
|
| 228 |
+
<details><summary>Can I cancel?</summary><p>Yes. The $9 monthly plan cancels any time from the link in your Stripe receipt email, and Pro then switches off by itself. The $79 Lifetime plan is one payment with nothing to cancel.</p></details>
|
| 229 |
+
<details><summary>Can my client sign the proposal?</summary><p>Your client can type their name and date in the acceptance block, or accept from the HTML version, which opens an email to you with their acceptance. That is a record of acceptance, not an electronic signature. If you need a legally binding e-signature with an audit trail, use a dedicated e-signature service alongside Pitchsprig.</p></details>
|
| 230 |
+
<details><summary>What goes into a good business proposal?</summary><p>A short introduction in the client's words, the problem and goals, a clear scope (what is and is not included), deliverables, a timeline, pricing with options, terms and a simple way to say yes. Every Pitchsprig template follows that order, and the checks above the Download button flag anything still in [brackets].</p></details>
|
| 231 |
+
<details><summary>Does it work on my phone and offline?</summary><p>Yes. Pitchsprig works on phones too, and once it has loaded you can install it and use it with no connection.</p></details>
|
| 232 |
+
<details><summary>What happens after the client accepts?</summary><p>Record the acceptance, then turn the agreed price into an invoice with <a href="https://cybermax-tools-cybermax.static.hf.space/billsprig/index.html" target="_blank" rel="noopener">Billsprig</a>, our free invoice generator.</p></details>
|
| 233 |
+
</section>
|
| 234 |
+
|
| 235 |
+
<p class="disclaimer">Pitchsprig templates are starting points, not legal advice; have important contract terms reviewed.</p>
|
| 236 |
+
</div>
|
| 237 |
+
</main>
|
| 238 |
+
|
| 239 |
+
<div class="wrap">
|
| 240 |
+
<footer class="more">
|
| 241 |
+
<div class="more-title">More free tools for business from CyberMax</div>
|
| 242 |
+
<div class="more-links">
|
| 243 |
+
<a href="https://cybermax-tools-cybermax.static.hf.space/billsprig/index.html" target="_blank" rel="noopener">Billsprig · turn an accepted proposal into an invoice</a>
|
| 244 |
+
<a href="https://cybermax-tools-cybermax.static.hf.space/quotesprig/index.html" target="_blank" rel="noopener">Quotesprig · trade estimates</a>
|
| 245 |
+
<a href="https://cybermax-tools-cybermax.static.hf.space/sigsprig/index.html" target="_blank" rel="noopener">Sigsprig · email signatures</a>
|
| 246 |
+
<a href="https://cybermax-tools-cybermax.static.hf.space/tagwren/index.html" target="_blank" rel="noopener">Tagwren · price tags & labels</a>
|
| 247 |
+
<a href="https://cybermax-tools-cybermax.static.hf.space/menumoor/index.html" target="_blank" rel="noopener">Menumoor · menus & price lists</a>
|
| 248 |
+
<a href="https://noticewright.cybermax-tools.workers.dev/" target="_blank" rel="noopener">Noticewright · privacy policy generator</a>
|
| 249 |
+
<a href="https://cybermax.cybermax-tools.workers.dev/store/?utm_source=pitchsprig&utm_medium=more-from" target="_blank" rel="noopener">CyberMax Store</a>
|
| 250 |
+
</div>
|
| 251 |
+
<div class="copy">© 2026 CyberMax. All rights reserved. · Support: <a href="mailto:cybermax.tools@gmail.com">cybermax.tools@gmail.com</a></div>
|
| 252 |
+
</footer>
|
| 253 |
+
</div>
|
| 254 |
+
|
| 255 |
+
<datalist id="dl-clients"></datalist>
|
| 256 |
+
<datalist id="dl-taxlabels"><option value="Tax"><option value="VAT"><option value="GST"><option value="HST"><option value="Sales tax"></datalist>
|
| 257 |
+
<div class="mbar" id="mbar"><a class="btn ghost" href="#preview" id="m-preview">See preview</a><button type="button" class="btn" id="m-pdf">Download PDF</button></div>
|
| 258 |
+
<div class="toast" id="toast" role="status" aria-live="polite" hidden></div>
|
| 259 |
+
<script>window.CMX_PRO={"id":"pitchsprig","name":"Pitchsprig","free":"3 PDF downloads a month with a small footer line, 2 templates (web design, marketing retainer), unlimited printing and email text.","perks":["Unlimited PDFs, no footer line","All 6 templates: adds branding, consulting, photo/video and software","Your logo and brand colour","Good / better / best packages layout","Send-ready HTML proposal your client can accept by email","Content library: reusable about us, terms and case studies","Saved proposals and clients, duplicate in one click","JSON backup"],"plans":[{"offer":"st-pitchsprig-pro-monthly","label":"Monthly","price":"$9","per":"/month","note":"Cancel any time"},{"offer":"st-pitchsprig-pro-lifetime","label":"Lifetime","price":"$79","per":" once","note":"Pay once, keep forever","best":true}]};</script>
|
| 260 |
+
<script src="pro.js"></script>
|
| 261 |
+
<script src="lib/core.js"></script>
|
| 262 |
+
<script src="lib/pdf.js"></script>
|
| 263 |
+
<script src="app.js"></script>
|
| 264 |
+
</body>
|
| 265 |
+
</html>
|
pitchsprig/lib/core.js
ADDED
|
@@ -0,0 +1,603 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Pitchsprig core: proposal model, starter templates, Markdown-lite, pricing maths, document HTML, email text and
|
| 2 |
+
* the one-file HTML export. Pure functions, no DOM; works in the browser (window.PS) and in Node (tests).
|
| 3 |
+
* © 2026 CyberMax. All rights reserved. */
|
| 4 |
+
(function (root) {
|
| 5 |
+
"use strict";
|
| 6 |
+
|
| 7 |
+
/* ---------- numbers, money, dates ---------- */
|
| 8 |
+
var CURRENCIES = [
|
| 9 |
+
["USD", "US dollar", "en-US"], ["EUR", "Euro", "en-IE"], ["GBP", "British pound", "en-GB"], ["CAD", "Canadian dollar", "en-CA"],
|
| 10 |
+
["AUD", "Australian dollar", "en-AU"], ["NZD", "New Zealand dollar", "en-NZ"], ["INR", "Indian rupee", "en-IN"], ["CHF", "Swiss franc", "de-CH"],
|
| 11 |
+
["SEK", "Swedish krona", "sv-SE"], ["DKK", "Danish krone", "da-DK"], ["NOK", "Norwegian krone", "nb-NO"], ["ZAR", "South African rand", "en-ZA"],
|
| 12 |
+
["SGD", "Singapore dollar", "en-SG"], ["AED", "UAE dirham", "en-AE"], ["MXN", "Mexican peso", "es-MX"], ["BRL", "Brazilian real", "pt-BR"],
|
| 13 |
+
["JPY", "Japanese yen", "en-US"],
|
| 14 |
+
].map(function (c) { return { code: c[0], name: c[1], locale: c[2] }; });
|
| 15 |
+
function cur(code) {
|
| 16 |
+
for (var i = 0; i < CURRENCIES.length; i++) if (CURRENCIES[i].code === code) return CURRENCIES[i];
|
| 17 |
+
return { code: code || "USD", name: code || "USD", locale: "en-US" };
|
| 18 |
+
}
|
| 19 |
+
var fmtCache = {};
|
| 20 |
+
function fmt(code) {
|
| 21 |
+
if (!fmtCache[code]) {
|
| 22 |
+
var c = cur(code);
|
| 23 |
+
try { fmtCache[code] = new Intl.NumberFormat(c.locale, { style: "currency", currency: c.code }); }
|
| 24 |
+
catch (e) { fmtCache[code] = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }); }
|
| 25 |
+
}
|
| 26 |
+
return fmtCache[code];
|
| 27 |
+
}
|
| 28 |
+
function decimals(code) { return fmt(code).resolvedOptions().maximumFractionDigits; }
|
| 29 |
+
function round(n, dp) {
|
| 30 |
+
var f = Math.pow(10, dp == null ? 2 : dp);
|
| 31 |
+
var x = Number((Math.abs(Number(n) || 0) * f).toFixed(6));
|
| 32 |
+
return (n < 0 ? -1 : 1) * Math.round(x) / f;
|
| 33 |
+
}
|
| 34 |
+
/** Money in the currency's local style. `safe(symbol)` false -> ISO code instead (for PDF core fonts). */
|
| 35 |
+
function money(amount, code, safe) {
|
| 36 |
+
var parts = fmt(code).formatToParts(Number(amount) || 0);
|
| 37 |
+
return parts.map(function (p) {
|
| 38 |
+
var v = p.value.replace(/[ ]/g, " ");
|
| 39 |
+
if (p.type === "currency" && safe && !safe(v)) return cur(code).code + " ";
|
| 40 |
+
return v;
|
| 41 |
+
}).join("").replace(/\s{2,}/g, " ").trim();
|
| 42 |
+
}
|
| 43 |
+
/** Whole amounts without cents when they are round (package prices). */
|
| 44 |
+
function moneyShort(amount, code, safe) {
|
| 45 |
+
var s = money(amount, code, safe);
|
| 46 |
+
return Math.round(amount) === Number(amount) ? s.replace(/[.,]00(?=\D*$)/, "") : s;
|
| 47 |
+
}
|
| 48 |
+
function parseNum(v) {
|
| 49 |
+
if (typeof v === "number") return isFinite(v) ? v : 0;
|
| 50 |
+
var s = String(v == null ? "" : v).trim().replace(/[^\d.,\-]/g, "");
|
| 51 |
+
if (!s) return 0;
|
| 52 |
+
var neg = s.charAt(0) === "-"; s = s.replace(/-/g, "");
|
| 53 |
+
var lc = s.lastIndexOf(","), ld = s.lastIndexOf(".");
|
| 54 |
+
if (lc > -1 && ld > -1) { if (lc > ld) s = s.replace(/\./g, "").replace(",", "."); else s = s.replace(/,/g, ""); }
|
| 55 |
+
else if (lc > -1) {
|
| 56 |
+
var after = s.length - lc - 1;
|
| 57 |
+
if ((s.match(/,/g) || []).length === 1 && after > 0 && after <= 2) s = s.replace(",", "."); else s = s.replace(/,/g, "");
|
| 58 |
+
}
|
| 59 |
+
var n = parseFloat(s);
|
| 60 |
+
return isFinite(n) ? (neg ? -n : n) : 0;
|
| 61 |
+
}
|
| 62 |
+
function pad2(n) { return ("0" + n).slice(-2); }
|
| 63 |
+
function todayISO(d) { d = d || new Date(); return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()); }
|
| 64 |
+
function addDays(iso, days) {
|
| 65 |
+
var m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso || ""); if (!m) return "";
|
| 66 |
+
var d = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3] + days));
|
| 67 |
+
return d.getUTCFullYear() + "-" + pad2(d.getUTCMonth() + 1) + "-" + pad2(d.getUTCDate());
|
| 68 |
+
}
|
| 69 |
+
function fmtDate(iso, locale) {
|
| 70 |
+
var m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso || "");
|
| 71 |
+
if (!m) return iso || "";
|
| 72 |
+
try { return new Date(Date.UTC(+m[1], +m[2] - 1, +m[3])).toLocaleDateString(locale || "en-US", { year: "numeric", month: "long", day: "numeric", timeZone: "UTC" }); }
|
| 73 |
+
catch (e) { return iso; }
|
| 74 |
+
}
|
| 75 |
+
var seq = 0;
|
| 76 |
+
function uid(p) { seq++; return (p || "s") + Date.now().toString(36) + seq.toString(36) + Math.floor(Math.random() * 1e4).toString(36); }
|
| 77 |
+
function clone(o) { return JSON.parse(JSON.stringify(o)); }
|
| 78 |
+
function esc(s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }
|
| 79 |
+
|
| 80 |
+
/* ---------- tokens: {client} {contact} {us} ---------- */
|
| 81 |
+
function fill(text, p) {
|
| 82 |
+
var c = (p && p.client) || {}, f = (p && p.from) || {};
|
| 83 |
+
var client = (c.company || c.name || "your business").trim(), contact = String(c.name || "").trim().split(/\s+/)[0] || "there";
|
| 84 |
+
if (/^(dr|mr|mrs|ms|mx|prof)\.?$/i.test(contact)) { var nm = String(c.name).trim().split(/\s+/); contact = nm.length > 2 ? nm[0] + " " + nm[nm.length - 1] : nm.join(" "); }
|
| 85 |
+
return String(text == null ? "" : text).replace(/\{client\}/g, client).replace(/\{contact\}/g, contact).replace(/\{us\}/g, (f.name || "our team").trim());
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/* ---------- Markdown-lite: ## / ### headings, - and 1. lists, **bold**, *italic* ---------- */
|
| 89 |
+
function runs(line) {
|
| 90 |
+
var out = [], re = /(\*\*([^*]+)\*\*|\*([^*\s][^*]*?)\*|_([^_\s][^_]*?)_)/g, last = 0, m;
|
| 91 |
+
while ((m = re.exec(line))) {
|
| 92 |
+
if (m.index > last) out.push({ t: line.slice(last, m.index) });
|
| 93 |
+
if (m[2] != null) out.push({ t: m[2], b: true }); else out.push({ t: m[3] != null ? m[3] : m[4], i: true });
|
| 94 |
+
last = re.lastIndex;
|
| 95 |
+
}
|
| 96 |
+
if (last < line.length) out.push({ t: line.slice(last) });
|
| 97 |
+
return out.length ? out : [{ t: "" }];
|
| 98 |
+
}
|
| 99 |
+
/** Markdown-lite -> blocks [{type:'h'|'h3'|'p'|'ul'|'ol', lines|items: [[runs]]}] */
|
| 100 |
+
function blocks(md) {
|
| 101 |
+
var out = [], cur = null;
|
| 102 |
+
String(md == null ? "" : md).replace(/\r/g, "").split("\n").forEach(function (raw) {
|
| 103 |
+
var line = raw.replace(/\s+$/, ""), m;
|
| 104 |
+
if (!line.trim()) { cur = null; return; }
|
| 105 |
+
if ((m = /^\s*###\s+(.*)$/.exec(line))) { out.push({ type: "h3", lines: [runs(m[1])] }); cur = null; return; }
|
| 106 |
+
if ((m = /^\s*#{1,2}\s+(.*)$/.exec(line))) { out.push({ type: "h", lines: [runs(m[1])] }); cur = null; return; }
|
| 107 |
+
if ((m = /^\s*[-*•]\s+(.*)$/.exec(line))) {
|
| 108 |
+
if (!cur || cur.type !== "ul") { cur = { type: "ul", items: [] }; out.push(cur); }
|
| 109 |
+
cur.items.push(runs(m[1])); return;
|
| 110 |
+
}
|
| 111 |
+
if ((m = /^\s*\d{1,3}[.)]\s+(.*)$/.exec(line))) {
|
| 112 |
+
if (!cur || cur.type !== "ol") { cur = { type: "ol", items: [] }; out.push(cur); }
|
| 113 |
+
cur.items.push(runs(m[1])); return;
|
| 114 |
+
}
|
| 115 |
+
if (cur && (cur.type === "ul" || cur.type === "ol") && /^\s{2,}\S/.test(raw)) { cur.items[cur.items.length - 1] = cur.items[cur.items.length - 1].concat([{ t: " " + line.trim() }]); return; }
|
| 116 |
+
if (!cur || cur.type !== "p") { cur = { type: "p", lines: [] }; out.push(cur); }
|
| 117 |
+
cur.lines.push(runs(line.trim()));
|
| 118 |
+
});
|
| 119 |
+
return out;
|
| 120 |
+
}
|
| 121 |
+
function runsHTML(rs) {
|
| 122 |
+
return rs.map(function (r) { var t = esc(r.t); return r.b ? "<strong>" + t + "</strong>" : r.i ? "<em>" + t + "</em>" : t; }).join("");
|
| 123 |
+
}
|
| 124 |
+
function mdHTML(md) {
|
| 125 |
+
return blocks(md).map(function (b) {
|
| 126 |
+
if (b.type === "h") return "<h3>" + runsHTML(b.lines[0]) + "</h3>";
|
| 127 |
+
if (b.type === "h3") return "<h4>" + runsHTML(b.lines[0]) + "</h4>";
|
| 128 |
+
if (b.type === "p") return "<p>" + b.lines.map(runsHTML).join("<br>") + "</p>";
|
| 129 |
+
var tag = b.type === "ol" ? "ol" : "ul";
|
| 130 |
+
return "<" + tag + ">" + b.items.map(function (it) { return "<li>" + runsHTML(it) + "</li>"; }).join("") + "</" + tag + ">";
|
| 131 |
+
}).join("");
|
| 132 |
+
}
|
| 133 |
+
function plain(md) {
|
| 134 |
+
return blocks(md).map(function (b) {
|
| 135 |
+
var t = function (rs) { return rs.map(function (r) { return r.t; }).join(""); };
|
| 136 |
+
if (b.type === "ul") return b.items.map(function (it) { return "- " + t(it); }).join("\n");
|
| 137 |
+
if (b.type === "ol") return b.items.map(function (it, i) { return (i + 1) + ". " + t(it); }).join("\n");
|
| 138 |
+
return b.lines.map(t).join("\n");
|
| 139 |
+
}).join("\n\n");
|
| 140 |
+
}
|
| 141 |
+
/** Bracketed placeholders still waiting for the user's own words, e.g. [Add a measurable goal]. */
|
| 142 |
+
function placeholders(p) {
|
| 143 |
+
var n = 0, re = /\[[^\]\n]{4,}\]/g;
|
| 144 |
+
(p.sections || []).forEach(function (s) { n += (String(s.body || "").match(re) || []).length + (String(s.title || "").match(re) || []).length; });
|
| 145 |
+
((p.pricing && p.pricing.items) || []).forEach(function (it) { n += (String(it.desc || "").match(re) || []).length; });
|
| 146 |
+
return n;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/* ---------- pricing ---------- */
|
| 150 |
+
function line(it, dp) {
|
| 151 |
+
var qty = parseNum(it.qty === "" || it.qty == null ? 1 : it.qty), rate = parseNum(it.rate);
|
| 152 |
+
return { qty: qty, rate: rate, net: round(qty * rate, dp), billing: it.billing === "month" ? "month" : "once", optional: !!it.optional, included: !it.optional || !!it.selected };
|
| 153 |
+
}
|
| 154 |
+
function used(it) { return !!(String(it.desc || "").trim() || parseNum(it.rate)); }
|
| 155 |
+
function totals(p) {
|
| 156 |
+
var pr = p.pricing || {}, dp = decimals(p.currency || "USD");
|
| 157 |
+
var items = (pr.items || []).filter(used), lines = items.map(function (it) { return line(it, dp); });
|
| 158 |
+
var g = { once: { sub: 0, disc: 0, tax: 0, total: 0, count: 0 }, month: { sub: 0, disc: 0, tax: 0, total: 0, count: 0 } };
|
| 159 |
+
lines.forEach(function (l) { if (!l.included) return; var x = g[l.billing]; x.sub = round(x.sub + l.net, dp); x.count++; });
|
| 160 |
+
var d = pr.discount || {}, dv = parseNum(d.value), taxRate = parseNum(pr.tax);
|
| 161 |
+
if (dv > 0) {
|
| 162 |
+
if (d.type === "amt") { var tgt = g.once.sub > 0 ? g.once : g.month; tgt.disc = round(Math.min(dv, tgt.sub), dp); }
|
| 163 |
+
else { var pc = Math.min(dv, 100); ["once", "month"].forEach(function (k) { g[k].disc = round(g[k].sub * pc / 100, dp); }); }
|
| 164 |
+
}
|
| 165 |
+
["once", "month"].forEach(function (k) {
|
| 166 |
+
var x = g[k], base = round(x.sub - x.disc, dp);
|
| 167 |
+
x.tax = taxRate > 0 ? round(base * taxRate / 100, dp) : 0;
|
| 168 |
+
x.total = round(base + x.tax, dp);
|
| 169 |
+
});
|
| 170 |
+
var optional = lines.filter(function (l) { return l.optional; });
|
| 171 |
+
return { items: items, lines: lines, once: g.once, month: g.month, hasMonthly: g.month.count > 0, year1: round(g.once.total + 12 * g.month.total, dp),
|
| 172 |
+
optionalTotal: optional.length, optionalChosen: optional.filter(function (l) { return l.included; }).length };
|
| 173 |
+
}
|
| 174 |
+
function packages(p) {
|
| 175 |
+
return ((p.pricing && p.pricing.packages) || []).filter(function (k) { return String(k.name || "").trim() || parseNum(k.price); }).slice(0, 3).map(function (k) {
|
| 176 |
+
return { name: k.name || "", price: parseNum(k.price), billing: k.billing === "month" ? "month" : "once", blurb: k.blurb || "", features: String(k.features || "").split(/\n/).map(function (s) { return s.replace(/^\s*[-*•]\s*/, "").trim(); }).filter(Boolean), recommended: !!k.recommended };
|
| 177 |
+
});
|
| 178 |
+
}
|
| 179 |
+
/** One-line price summary for emails and cards. */
|
| 180 |
+
function priceSummary(p, safe) {
|
| 181 |
+
var c = p.currency || "USD", m = function (v) { return money(v, c, safe); };
|
| 182 |
+
if (p.pricing && p.pricing.layout === "packages" && packages(p).length) {
|
| 183 |
+
var ks = packages(p);
|
| 184 |
+
return ks.map(function (k) { return k.name + " " + moneyShort(k.price, c, safe) + (k.billing === "month" ? "/month" : ""); }).join(" · ");
|
| 185 |
+
}
|
| 186 |
+
var T = totals(p), parts = [];
|
| 187 |
+
if (T.once.count) parts.push(m(T.once.total) + " one-time");
|
| 188 |
+
if (T.month.count) parts.push(m(T.month.total) + " per month");
|
| 189 |
+
return parts.join(" + ") || "to be confirmed";
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/* ---------- starter templates ---------- */
|
| 193 |
+
var ACCEPT = "To go ahead, type your name and today's date below, or simply reply to the email this proposal came with. We will then send the deposit invoice and book the kickoff.";
|
| 194 |
+
function terms(o) {
|
| 195 |
+
return "## Payment\n- " + o.pay + "\n- Invoices are due within 14 days. [Add late-payment terms if you use them.]\n- Prices exclude tax unless shown. Third-party costs (" + (o.third || "fonts, stock images, plugins, hosting") + ") are billed at cost, only with your approval.\n\n" +
|
| 196 |
+
"## Changes\n- Work outside the scope in this proposal is quoted before it starts.\n- " + o.rev + "\n\n" +
|
| 197 |
+
"## Your part\n- " + o.client + "\n- The timeline assumes feedback within 3 working days; later feedback moves the dates.\n\n" +
|
| 198 |
+
"## Ownership\n- " + o.own + "\n\n" +
|
| 199 |
+
"## Ending the project\n- " + (o.end || "Either side can end the project with 14 days' written notice. Work done up to that point is billed.") + "\n- Both sides keep each other's confidential information private.\n\nThis proposal is valid until the date on the cover.";
|
| 200 |
+
}
|
| 201 |
+
function about(kind, extra) {
|
| 202 |
+
return "{us} is " + kind + "\n\n- [Years in business and the kinds of clients you work with]\n- [One result you are allowed to share, e.g. a client's numbers before and after]\n- [Links to two or three relevant projects]\n\n" + (extra || "You work directly with the people doing the work, with one point of contact from start to finish.");
|
| 203 |
+
}
|
| 204 |
+
function it(desc, qty, rate, billing, optional, selected) { return { desc: desc, qty: String(qty), rate: String(rate), billing: billing || "once", optional: !!optional, selected: !!selected }; }
|
| 205 |
+
function pk(name, price, billing, blurb, features, rec) { return { name: name, price: String(price), billing: billing || "once", blurb: blurb, features: features.join("\n"), recommended: !!rec }; }
|
| 206 |
+
function tl(phase, detail, when) { return { phase: phase, detail: detail, when: when }; }
|
| 207 |
+
|
| 208 |
+
var TEMPLATES = {
|
| 209 |
+
"web-design": {
|
| 210 |
+
name: "Web design", label: "Website redesign", free: true,
|
| 211 |
+
title: "Website redesign proposal",
|
| 212 |
+
client: { name: "Dr. Lena Ortiz", company: "Northwind Dental Studio", email: "lena@northwind-dental.example" },
|
| 213 |
+
from: { name: "Fieldnote Studio", person: "Sam Rivera", email: "hello@fieldnote.example", phone: "+1 503 555 0142", website: "fieldnote.example" },
|
| 214 |
+
sections: [
|
| 215 |
+
["Introduction", "Hi {contact},\n\nThank you for walking us through {client}'s website and plans. This proposal sets out how {us} will design and build a faster, clearer website that turns more visitors into enquiries, what it costs and how long it takes.\n\nPrices are fixed for the scope below. You can add optional extras in the pricing table."],
|
| 216 |
+
["Your goals", "From our call, the current site is holding the business back in three ways:\n\n- **Hard to use on phones.** Most visitors arrive on mobile and struggle to find services, prices and how to book.\n- **Slow to load.** Large images and an old theme make pages slow, and visitors leave before they see anything.\n- **Few enquiries.** Most pages have no clear next step, so people leave without getting in touch.\n\n## What success looks like\n1. A site that is quick and easy to use on any device.\n2. A clear call to action on every page, with enquiries sent straight to your inbox.\n3. A site your team can update without calling a developer.\n4. [Add a measurable goal, e.g. 30% more enquiry form submissions within 3 months of launch.]"],
|
| 217 |
+
["Scope of work", "## Included\n- Discovery workshop (90 minutes) to agree audience, pages and priorities\n- Sitemap and wireframes for the key pages\n- Custom design for the homepage and up to 6 inner page templates\n- Build on [WordPress / Webflow / Squarespace], fully responsive\n- Contact and enquiry forms connected to your email\n- On-page SEO basics: page titles, descriptions, headings, image alt text, XML sitemap and redirects from old URLs\n- Moving up to 20 existing pages of content into the new design\n- Testing on current Chrome, Safari, Edge and Firefox, on desktop and mobile\n- A 60-minute training session and a short how-to video for your team\n\n## Not included\n- Writing new copy (available as an optional extra)\n- Photography, stock images and licensed fonts (billed at cost if needed)\n- Paid advertising or ongoing SEO campaigns"],
|
| 218 |
+
["Deliverables", "- Approved sitemap and wireframes (PDF)\n- Design files for every page template\n- The live website on your domain, with admin access for your team\n- Analytics set up and connected to your account\n- A handover document: logins, hosting details and how to edit pages"],
|
| 219 |
+
["@timeline", "The project takes about seven weeks from the kickoff call. Dates move if feedback or content arrives later than planned."],
|
| 220 |
+
["@pricing", "Prices are fixed for the scope above. Optional extras are marked; the ones you choose are included in the total."],
|
| 221 |
+
["Terms", terms({ pay: "50% deposit to book the project, 50% when the site goes live.", rev: "Each design stage includes two rounds of revisions; more rounds are billed at our hourly rate.", client: "You provide content, logins and feedback on time, and one person who can approve decisions.", own: "When the final invoice is paid, you own the design and the website. We may show the finished work in our portfolio unless you ask us not to." })],
|
| 222 |
+
["About {us}", about("a small web design studio that builds fast, easy-to-run websites for local and service businesses.")],
|
| 223 |
+
["@acceptance", ACCEPT],
|
| 224 |
+
],
|
| 225 |
+
items: [it("Discovery workshop, sitemap and wireframes", 1, 900), it("Design: homepage and 6 page templates", 1, 3600), it("Build and launch, fully responsive", 1, 4200), it("SEO setup and redirects from old URLs", 1, 650), it("Content migration (per page)", 20, 35), it("Copywriting (per page)", 8, 180, "once", true, false), it("Online booking integration", 1, 750, "once", true, true), it("Care plan: hosting, updates, backups and 1 hour of edits", 1, 149, "month")],
|
| 226 |
+
packages: [pk("Starter", 4800, "once", "A polished 5-page site from a proven layout", ["Up to 5 pages", "Layout adapted to your branding", "Contact form", "SEO basics", "30 days of support"]),
|
| 227 |
+
pk("Growth", 9800, "once", "A custom site built around enquiries", ["Homepage + 6 custom page templates", "Discovery workshop and wireframes", "Booking or enquiry integration", "SEO setup and redirects", "Training session + how-to video", "60 days of support"], true),
|
| 228 |
+
pk("Premium", 16500, "once", "Everything in Growth, plus content", ["Copywriting for up to 12 pages", "Photography direction", "Conversion tracking dashboard", "Two campaign landing pages", "90 days of support"])],
|
| 229 |
+
timeline: [tl("Discovery", "Kickoff call, workshop, sitemap and wireframes", "Week 1"), tl("Design", "Homepage first, then inner pages; two rounds of revisions", "Weeks 2–3"), tl("Build", "Development, content migration, forms and SEO setup", "Weeks 4–6"), tl("Test and launch", "Cross-device testing, training, go-live and redirects", "Week 7"), tl("Support", "Fixes and small tweaks after launch", "30 days after launch")],
|
| 230 |
+
currency: "USD", tax: "",
|
| 231 |
+
},
|
| 232 |
+
"marketing": {
|
| 233 |
+
name: "Marketing / SEO retainer", label: "SEO & content retainer", free: true,
|
| 234 |
+
title: "SEO and content marketing retainer",
|
| 235 |
+
client: { name: "Priya Shah", company: "Greenline Solar", email: "priya@greenline-solar.example" },
|
| 236 |
+
from: { name: "Brightpath Marketing", person: "Alex Morgan", email: "alex@brightpath.example", phone: "+44 20 7946 0811", website: "brightpath.example" },
|
| 237 |
+
sections: [
|
| 238 |
+
["Introduction", "Hi {contact},\n\nThanks for your time on our call. You want {client} to be found by more of the right people on Google, and to turn that traffic into leads, without hiring a full in-house team. This proposal covers a monthly SEO and content retainer: what we do each month, how we report on it and what it costs.\n\nThe first month is a setup month with a one-off audit. After that the retainer runs month to month, with a 3-month minimum."],
|
| 239 |
+
["Goals and how we measure them", "## Where you are now\n- Most organic traffic lands on the homepage and a handful of old blog posts.\n- Key service pages do not reach page one for the searches your customers use.\n- There is no regular publishing plan, so the site goes quiet for months.\n\n## Goals for the first 6 months\n1. Page-one rankings for [5–10 priority keywords] in your service area.\n2. More organic visits to service pages, month on month.\n3. More of those visits turning into leads, through clearer calls to action.\n4. [Add a lead target you agree on, e.g. 40 organic enquiries a month by month 6.]\n\nEvery month we report on rankings, organic traffic, leads from search and the work done, in plain English."],
|
| 240 |
+
["Monthly scope", "## Setup (month 1)\n- Technical SEO audit: crawl errors, speed, indexing and structured data\n- Keyword and competitor research, with a priority keyword map per page\n- Search Console and analytics checked and connected\n- A 6-month content plan\n\n## Every month\n- **Content:** 4 search-focused articles (1,200+ words each), briefed, written, edited and published\n- **On-page:** better titles, headings, internal links and copy on 3–5 existing pages\n- **Technical:** monitoring and fixing issues reported in Search Console\n- **Local:** Google Business Profile posts and review-reply templates\n- **Reporting:** a monthly report and a 30-minute review call\n\n## Not included\n- Paid advertising spend or management (available as an option)\n- Website redesign or development beyond small fixes\n- Buying links (we never buy links)"],
|
| 241 |
+
["Deliverables", "- SEO audit with a prioritised fix list (month 1)\n- Keyword map and 6-month content calendar (month 1)\n- 4 published articles every month\n- Monthly report: rankings, traffic, leads and next month's plan\n- A shared folder with every brief and article"],
|
| 242 |
+
["@timeline", "SEO results build over months, not days. This is the usual rhythm; we review it together every quarter."],
|
| 243 |
+
["@pricing", "A one-off setup fee, then a monthly retainer billed in advance. Optional extras can be added or dropped any month."],
|
| 244 |
+
["Terms", terms({ pay: "Setup fee due before work starts; the retainer is billed monthly in advance.", rev: "Each article includes one round of edits; topics can be swapped up to the brief stage.", client: "You give us access to the website, Search Console and analytics, and approve articles within 5 working days.", own: "You own every article and asset we create once its month is paid. We never hold your accounts or content hostage.", end: "3-month minimum, then month to month with 30 days' written notice. No one can honestly guarantee rankings, and we do not; we commit to the work and to reporting it openly.", third: "SEO tools, stock images, ad spend" })],
|
| 245 |
+
["About {us}", about("a marketing studio focused on search and content for service businesses.", "You get a named strategist and writer, not a rotating account team.")],
|
| 246 |
+
["@acceptance", ACCEPT],
|
| 247 |
+
],
|
| 248 |
+
items: [it("SEO audit, keyword research and content plan (one-off setup)", 1, 1200), it("Monthly SEO and content retainer", 1, 2400, "month"), it("Extra article, 1,200+ words", 2, 250, "month", true, false), it("Google Ads management (ad spend paid to Google)", 1, 600, "month", true, false)],
|
| 249 |
+
packages: [pk("Local", 1200, "month", "Visibility for one location", ["2 articles a month", "Google Business Profile management", "On-page work on 2 pages a month", "Monthly report"]),
|
| 250 |
+
pk("Growth", 2400, "month", "Steady growth for a regional business", ["4 articles a month", "On-page work on 3–5 pages a month", "Technical monitoring and fixes", "Monthly report and review call"], true),
|
| 251 |
+
pk("Scale", 4200, "month", "For competitive markets", ["8 articles a month", "Digital PR and outreach", "Conversion testing on key pages", "Fortnightly calls"])],
|
| 252 |
+
timeline: [tl("Setup", "Audit, research, tracking checks and content plan", "Month 1"), tl("Fix and publish", "Technical fixes, first 8 articles, service page updates", "Months 2–3"), tl("Grow", "Steady publishing, internal links and local SEO", "Months 4–6"), tl("Review", "Results review and the plan for the next quarter", "Every 3 months")],
|
| 253 |
+
currency: "GBP", tax: "20", taxLabel: "VAT",
|
| 254 |
+
},
|
| 255 |
+
"branding": {
|
| 256 |
+
name: "Branding", label: "Brand identity", free: false,
|
| 257 |
+
title: "Brand identity proposal",
|
| 258 |
+
client: { name: "Marco Bellini", company: "Bellini Coffee Roasters", email: "marco@bellini-coffee.example" },
|
| 259 |
+
from: { name: "Northmark Design", person: "Jordan Lee", email: "studio@northmark.example", phone: "+1 312 555 0187", website: "northmark.example" },
|
| 260 |
+
sections: [
|
| 261 |
+
["Introduction", "Hi {contact},\n\nThank you for sharing the story behind {client}. You are ready to look as good as the coffee you roast. This proposal covers a new brand identity: research, a logo system, colours, type and the guidelines your team and suppliers need to use it consistently."],
|
| 262 |
+
["The challenge", "- The current logo was made quickly at launch and does not scale well: it blurs on social avatars and on signage.\n- Colours and fonts vary across the website, packaging and social posts.\n- [Add the business change behind this: new premises, a new audience, higher prices, a new product line.]\n\n## Goals\n1. A distinctive identity that fits your price point and audience.\n2. One consistent look across every touchpoint.\n3. Clear guidelines so anyone can apply the brand correctly."],
|
| 263 |
+
["Scope of work", "## Phase 1: Discovery\n- Brand questionnaire and a 2-hour workshop with the founders\n- Review of 5 competitors and the visual landscape\n- Positioning summary: audience, personality and tone of voice\n\n## Phase 2: Identity design\n- 3 distinct logo concepts, presented with mock-ups\n- Development of the chosen route over 2 rounds of revisions\n- Colour palette, typography and supporting graphic elements\n\n## Phase 3: Guidelines and rollout\n- Brand guidelines (PDF, about 20 pages)\n- Business card and email signature design\n- Social media profile and cover images"],
|
| 264 |
+
["Deliverables", "- Logo in full colour, one colour and reversed versions (SVG, PNG, PDF, EPS)\n- Colour values for print and screen (CMYK, RGB, HEX, Pantone where needed)\n- Typography with licensing guidance\n- Brand guidelines PDF\n- Business card print files and a social media kit"],
|
| 265 |
+
["@timeline", "Eight weeks from the workshop to final files, with a clear sign-off at the end of each phase."],
|
| 266 |
+
["@pricing", "Fixed fees per phase. Optional extras are marked; the ones you choose are included in the total."],
|
| 267 |
+
["Terms", terms({ pay: "40% to start, 30% when you choose a logo route, 30% on delivery of final files.", rev: "Two rounds of revisions on the chosen route are included; a new concept after sign-off is quoted separately.", client: "You attend the workshop and give one combined set of feedback per round.", own: "On final payment, all rights in the final logo and identity pass to you. Unused concepts stay with us. We may show the work in our portfolio after your launch.", third: "font licences, stock images, printing" })],
|
| 268 |
+
["About {us}", about("an independent brand design studio working with food, drink and hospitality businesses.")],
|
| 269 |
+
["@acceptance", ACCEPT],
|
| 270 |
+
],
|
| 271 |
+
items: [it("Discovery and positioning workshop", 1, 1500), it("Logo design: 3 concepts and 2 revision rounds", 1, 3800), it("Colour, typography and visual elements", 1, 1200), it("Brand guidelines (PDF)", 1, 1400), it("Business cards and social media kit", 1, 600), it("Packaging design (per product)", 2, 900, "once", true, false), it("Launch social templates (set of 20)", 1, 750, "once", true, true)],
|
| 272 |
+
packages: [pk("Essentials", 3500, "once", "A strong logo and the basics", ["Short discovery call", "2 logo concepts", "Colour palette and fonts", "Logo files for print and web"]),
|
| 273 |
+
pk("Identity", 8500, "once", "A complete, consistent brand", ["Discovery workshop", "3 logo concepts + 2 revision rounds", "Full visual system", "Brand guidelines PDF", "Business cards + social kit"], true),
|
| 274 |
+
pk("Complete", 14000, "once", "Identity plus packaging and launch", ["Everything in Identity", "Packaging for up to 3 products", "Signage and menu layouts", "Launch social templates"])],
|
| 275 |
+
timeline: [tl("Discovery", "Questionnaire, workshop and competitor review", "Weeks 1–2"), tl("Concepts", "Three logo concepts presented with mock-ups", "Weeks 3–4"), tl("Refinement", "Two rounds on the chosen route; colour and type", "Weeks 5–6"), tl("Guidelines", "Brand guidelines, cards, social kit and final files", "Weeks 7–8")],
|
| 276 |
+
currency: "USD", tax: "",
|
| 277 |
+
},
|
| 278 |
+
"consulting": {
|
| 279 |
+
name: "Consulting", label: "Consulting engagement", free: false,
|
| 280 |
+
title: "Operations consulting engagement",
|
| 281 |
+
client: { name: "Hannah Clarke", company: "Clarke Logistics", email: "hannah@clarke-logistics.example" },
|
| 282 |
+
from: { name: "Keel Advisory", person: "Daniel Okafor", email: "daniel@keeladvisory.example", phone: "+1 617 555 0133", website: "keeladvisory.example" },
|
| 283 |
+
sections: [
|
| 284 |
+
["Introduction", "Hi {contact},\n\nThank you for the open conversation about how {client} runs today. This proposal covers a focused 8-week engagement to find where time and money leak out of your operations, fix the most important issues with your team, and leave you with a plan you can run without us."],
|
| 285 |
+
["Situation and objectives", "## Situation\n- Revenue has grown, but margins have not kept up.\n- Work is tracked across spreadsheets, email and memory, so handovers slip.\n- The leadership team spends evenings firefighting instead of planning.\n\n## Objectives\n1. Map the 5 core processes from enquiry to invoice and find the bottlenecks.\n2. Agree the 3 changes with the biggest effect on margin and time.\n3. Put those changes in place with your team and measure the result.\n4. [Add your own number, e.g. cut quote turnaround from 5 days to 2.]"],
|
| 286 |
+
["Approach", "## 1. Diagnose (weeks 1–2)\n- Interviews with 6–8 team members and 3 customers\n- Process mapping workshops\n- Review of financials, tools and key reports\n\n## 2. Design (weeks 3–4)\n- Options paper with costs, benefits and risks\n- Leadership workshop to agree priorities\n\n## 3. Implement (weeks 5–8)\n- Weekly working sessions with process owners\n- New templates, checklists and dashboards\n- Training for the people who will run the new processes\n\n## Out of scope\n- Software purchases or custom development (we can recommend vendors)\n- Recruitment and HR decisions"],
|
| 287 |
+
["Deliverables", "- Current-state process maps\n- Diagnostic report with findings and quick wins\n- Prioritised 12-month roadmap\n- Process changes in place, each with an owner and a measure\n- Final presentation to the leadership team"],
|
| 288 |
+
["@timeline", "Eight weeks, with a steering check-in at the end of every phase."],
|
| 289 |
+
["@pricing", "Fixed fees per phase, so the cost does not grow with hours. Travel outside [your city] is billed at cost."],
|
| 290 |
+
["Terms", terms({ pay: "Fees are invoiced at the start of each phase.", rev: "If the scope changes, we agree the change and its fee in writing before work continues.", client: "You name a sponsor with authority to make decisions, and give access to the people and data we need.", own: "You own the reports, maps and materials made for you. We keep our general methods and tools.", end: "Either side can stop after any phase with 7 days' notice; only completed phases and agreed expenses are billed.", third: "travel, venue hire" })],
|
| 291 |
+
["About {us}", about("an operations consultancy for owner-led businesses with 10 to 200 people.", "The consultant who scopes the work is the one who does it.")],
|
| 292 |
+
["@acceptance", ACCEPT],
|
| 293 |
+
],
|
| 294 |
+
items: [it("Diagnose: interviews, process mapping and analysis", 1, 6000), it("Design: options paper and leadership workshop", 1, 4000), it("Implement: weekly working sessions (per week)", 4, 2250), it("Monthly advisory call after the engagement", 1, 750, "month", true, false), it("Additional on-site day (travel at cost)", 1, 1200, "once", true, false)],
|
| 295 |
+
packages: [pk("Diagnostic", 6000, "once", "Know exactly where the problems are", ["Interviews and process maps", "Diagnostic report", "Quick-win list"]),
|
| 296 |
+
pk("Roadmap", 10000, "once", "Diagnosis plus an agreed plan", ["Everything in Diagnostic", "Options paper", "Leadership workshop", "12-month roadmap"]),
|
| 297 |
+
pk("Full engagement", 19000, "once", "We fix it with your team", ["Everything in Roadmap", "4 weeks of implementation", "Templates and dashboards", "Team training"], true)],
|
| 298 |
+
timeline: [tl("Diagnose", "Interviews, mapping workshops and data review", "Weeks 1–2"), tl("Design", "Options paper and leadership workshop", "Weeks 3–4"), tl("Implement", "Weekly working sessions, tools and training", "Weeks 5–8"), tl("Close", "Results review and final presentation", "End of week 8")],
|
| 299 |
+
currency: "USD", tax: "",
|
| 300 |
+
},
|
| 301 |
+
"photo-video": {
|
| 302 |
+
name: "Photography / video", label: "Photo & video production", free: false,
|
| 303 |
+
title: "Brand photography and video production",
|
| 304 |
+
client: { name: "Emma Novak", company: "Copper & Clay Ceramics", email: "emma@copperclay.example" },
|
| 305 |
+
from: { name: "Lumen Field Productions", person: "Chris Adeyemi", email: "book@lumenfield.example", phone: "+61 2 5550 1290", website: "lumenfield.example" },
|
| 306 |
+
sections: [
|
| 307 |
+
["Introduction", "Hi {contact},\n\nThanks for sending over the brief. {client} needs fresh photos and short videos that show the real team, studio and products, ready for the website, social media and the spring campaign. Here is how we would plan, shoot and deliver it."],
|
| 308 |
+
["The brief", "- New website images to replace stock photos\n- Short vertical videos for Instagram, TikTok and YouTube Shorts\n- A library of images the team can use for the rest of the year\n- [Key dates: campaign launch, events, product releases]"],
|
| 309 |
+
["Production plan", "## Pre-production\n- Creative call and a shot list agreed in writing\n- One location visit and a schedule for the day\n- Call sheet with timings, people and props\n\n## Shoot day\n- 1 full day (8 hours) on location: photographer and videographer\n- Lighting, audio and stabilised camera kit included\n- Direction for team members who appear on camera\n\n## Post-production\n- Colour grading and retouching\n- Edit of 1 hero film (60–90 seconds) and 4 short vertical clips\n- Captions burned in for silent autoplay\n- Two rounds of edit revisions"],
|
| 310 |
+
["Deliverables", "- 60 edited high-resolution photos (JPEG) in web and print sizes\n- 1 hero film (60–90 s), 16:9, in 4K and 1080p\n- 4 vertical clips (15–30 s), 9:16, with captions\n- Licensed music for online use\n- An online gallery for download; files kept for 12 months"],
|
| 311 |
+
["@timeline", "Final files arrive about three weeks after the shoot day."],
|
| 312 |
+
["@pricing", "Prices include kit, editing and online usage. Optional extras are marked; the ones you choose are included in the total."],
|
| 313 |
+
["Terms", terms({ pay: "50% to book the shoot date, 50% on delivery of final files.", rev: "Two rounds of revisions on each edit are included; reshoots are quoted separately.", client: "You arrange access to the location and the people on camera, with their consent to appear.", own: "You get a licence to use the final photos and videos for your business online and in print, for as long as you like. Raw footage is not included. We may use selected work in our portfolio.", end: "If you cancel within 7 days of the shoot, the deposit is kept; we will always try to reschedule first.", third: "location fees, props, travel beyond 50 km" })],
|
| 314 |
+
["About {us}", about("a small photo and video team making honest, natural content for independent brands.")],
|
| 315 |
+
["@acceptance", ACCEPT],
|
| 316 |
+
],
|
| 317 |
+
items: [it("Pre-production: creative call, shot list and location visit", 1, 600), it("Shoot day: photographer and videographer (8 hours)", 1, 3200), it("Photo editing and retouching (per image)", 60, 18), it("Video edit: hero film and 4 vertical clips", 1, 2400), it("Second shoot day", 1, 2800, "once", true, false), it("Drone footage (licensed pilot)", 1, 650, "once", true, true), it("Extra vertical clip", 4, 220, "once", true, false)],
|
| 318 |
+
packages: [pk("Photo", 2900, "once", "A half-day of brand photos", ["4 hours on location", "30 edited photos", "Online gallery"]),
|
| 319 |
+
pk("Photo + video", 7280, "once", "Everything for web and social", ["Full shoot day, 2-person crew", "60 edited photos", "Hero film + 4 vertical clips", "Licensed music"], true),
|
| 320 |
+
pk("Campaign", 12500, "once", "Two days for a full campaign", ["Two shoot days", "100 edited photos", "Hero film + 10 vertical clips", "Drone footage"])],
|
| 321 |
+
timeline: [tl("Plan", "Creative call, shot list, location visit and call sheet", "Week 1"), tl("Shoot", "One full shoot day on location", "Week 2"), tl("First edits", "Photo selects and first video cuts for review", "Week 3"), tl("Final delivery", "Revisions, grading and final files in the gallery", "Weeks 4–5")],
|
| 322 |
+
currency: "AUD", tax: "10", taxLabel: "GST",
|
| 323 |
+
},
|
| 324 |
+
"software": {
|
| 325 |
+
name: "Software development", label: "Web app development", free: false,
|
| 326 |
+
title: "Custom web app development",
|
| 327 |
+
client: { name: "Tom Becker", company: "Summit Climbing Gyms", email: "tom@summitclimbing.example" },
|
| 328 |
+
from: { name: "Copperline Software", person: "Maya Chen", email: "maya@copperline.example", phone: "+1 415 555 0176", website: "copperline.example" },
|
| 329 |
+
sections: [
|
| 330 |
+
["Introduction", "Hi {contact},\n\nThank you for walking us through how {client} handles bookings today. This proposal covers designing and building a web app that replaces the spreadsheets: customers book and pay online, staff see one schedule, and managers get the numbers they need. We work in two-week sprints, so you see working software early and can steer as we go."],
|
| 331 |
+
["Problem and goals", "## The problem\n- Bookings arrive by phone, email and a web form, then get typed into a shared spreadsheet.\n- Double bookings and missed follow-ups cost time and customers.\n- There is no single view of revenue, utilisation or no-shows.\n\n## Goals\n1. Customers can book and pay online in under 2 minutes.\n2. Staff see one live schedule on desktop and phone.\n3. Automatic reminders cut no-shows.\n4. [Add a target, e.g. halve the admin hours spent on bookings.]"],
|
| 332 |
+
["Scope of work", "## MVP features\n- Customer booking flow with availability rules and online payment\n- Staff calendar with drag-to-reschedule\n- Email and SMS reminders\n- Admin: services, prices, staff and opening hours\n- Reports: bookings, revenue and no-shows, exportable to CSV\n\n## Technical approach\n- Responsive web app that works on phones, hosted on [your preferred cloud provider]\n- Automated tests and a staging site where you review each sprint\n- Your code in your own repository from day one\n\n## Out of scope for the MVP\n- Native iOS and Android apps\n- Integrations not listed above (quoted separately)"],
|
| 333 |
+
["Deliverables", "- Clickable prototype of the main flows\n- Working MVP in production\n- Source code in your repository, with documentation\n- Admin training session\n- 30-day warranty for bug fixes after launch"],
|
| 334 |
+
["@timeline", "About twelve weeks to launch. You review working software at the end of every two-week sprint."],
|
| 335 |
+
["@pricing", "Discovery and launch are fixed fees; build is priced per two-week sprint. Hosting and maintenance are monthly and optional after the first 3 months."],
|
| 336 |
+
["Terms", terms({ pay: "Discovery is paid up front; each sprint is invoiced when it starts; launch is invoiced at go-live.", rev: "You can change priorities at every sprint review; new features beyond the agreed sprints are estimated before they start.", client: "You name a product owner who joins sprint reviews and answers questions within 2 working days.", own: "You own the code and designs made for this project once the related invoices are paid. Open-source components keep their own licences.", end: "Either side can stop at the end of any sprint with 14 days' notice; only completed sprints are billed. Bugs reported within 30 days of launch are fixed at no cost.", third: "hosting, SMS credits, payment fees, paid APIs" })],
|
| 337 |
+
["About {us}", about("a small product studio that designs and builds web apps for growing businesses.")],
|
| 338 |
+
["@acceptance", ACCEPT],
|
| 339 |
+
],
|
| 340 |
+
items: [it("Discovery and clickable prototype", 1, 4500), it("Development sprint (2 weeks)", 4, 7500), it("Testing, launch and handover", 1, 3500), it("Hosting and maintenance: monitoring, updates and 4 hours of support", 1, 450, "month"), it("Mobile app wrapper for iOS and Android", 1, 9000, "once", true, false), it("Accounting integration (Xero or QuickBooks)", 1, 3200, "once", true, false)],
|
| 341 |
+
packages: [pk("Prototype", 4500, "once", "Validate the idea first", ["Discovery workshops", "Clickable prototype", "Estimate for the build"]),
|
| 342 |
+
pk("MVP", 38000, "once", "Booking, payments and staff calendar", ["Discovery and prototype", "4 development sprints", "Launch and handover", "30-day warranty"], true),
|
| 343 |
+
pk("MVP + care", 450, "month", "Ongoing hosting and improvements", ["Monitoring and updates", "4 hours of support a month", "Monthly usage report"])],
|
| 344 |
+
timeline: [tl("Discovery", "Workshops, user flows and clickable prototype", "Weeks 1–2"), tl("Sprints 1–2", "Booking flow and online payments", "Weeks 3–6"), tl("Sprints 3–4", "Staff calendar, reminders, admin and reports", "Weeks 7–10"), tl("Launch", "Testing, data import, training and go-live", "Weeks 11–12"), tl("Warranty", "Bug fixes after launch", "30 days")],
|
| 345 |
+
currency: "USD", tax: "",
|
| 346 |
+
},
|
| 347 |
+
};
|
| 348 |
+
var TEMPLATE_ORDER = ["web-design", "marketing", "branding", "consulting", "photo-video", "software"];
|
| 349 |
+
var SPECIAL = { "@timeline": ["timeline", "Timeline"], "@pricing": ["pricing", "Investment"], "@acceptance": ["acceptance", "Acceptance"] };
|
| 350 |
+
var KINDS = { text: "Text section", pricing: "Pricing table", timeline: "Timeline", acceptance: "Acceptance" };
|
| 351 |
+
|
| 352 |
+
function section(title, body) {
|
| 353 |
+
var sp = SPECIAL[title];
|
| 354 |
+
return sp ? { id: uid(), kind: sp[0], title: sp[1], body: body || "" } : { id: uid(), kind: "text", title: title, body: body || "" };
|
| 355 |
+
}
|
| 356 |
+
/**
|
| 357 |
+
* A new proposal from a starter template. withSample=true keeps the example client and sender so the first screen shows a
|
| 358 |
+
* finished proposal; false clears them (the user's own saved business is applied by the app).
|
| 359 |
+
*/
|
| 360 |
+
function fromTemplate(id, withSample, today) {
|
| 361 |
+
var t = TEMPLATES[id] || TEMPLATES["web-design"];
|
| 362 |
+
var date = today || todayISO();
|
| 363 |
+
var p = {
|
| 364 |
+
v: 1, id: uid("p"), template: TEMPLATES[id] ? id : "web-design", title: t.title, number: "", date: date, valid: addDays(date, 30),
|
| 365 |
+
currency: t.currency || "USD", page: "", accent: "", status: "draft",
|
| 366 |
+
from: withSample ? clone(t.from) : { name: "", person: "", email: "", phone: "", website: "" },
|
| 367 |
+
client: withSample ? clone(t.client) : { name: "", company: "", email: "" },
|
| 368 |
+
sections: t.sections.map(function (s) { return section(s[0], s[1]); }),
|
| 369 |
+
pricing: { layout: "table", items: clone(t.items), discount: { type: "pct", value: "" }, tax: t.tax || "", taxLabel: t.taxLabel || "Tax", packages: clone(t.packages) },
|
| 370 |
+
timeline: clone(t.timeline),
|
| 371 |
+
accept: { name: "", role: "", date: "" },
|
| 372 |
+
};
|
| 373 |
+
if (withSample) p.number = "P-2026-014";
|
| 374 |
+
return p;
|
| 375 |
+
}
|
| 376 |
+
function blankSection(kind) {
|
| 377 |
+
if (kind === "pricing") return { id: uid(), kind: "pricing", title: "Investment", body: "" };
|
| 378 |
+
if (kind === "timeline") return { id: uid(), kind: "timeline", title: "Timeline", body: "" };
|
| 379 |
+
if (kind === "acceptance") return { id: uid(), kind: "acceptance", title: "Acceptance", body: ACCEPT };
|
| 380 |
+
return { id: uid(), kind: "text", title: "New section", body: "" };
|
| 381 |
+
}
|
| 382 |
+
/** Copy of a proposal with a fresh id, status draft and no recorded acceptance. */
|
| 383 |
+
function duplicate(p, today) {
|
| 384 |
+
var d = clone(p);
|
| 385 |
+
d.id = uid("p"); d.status = "draft"; d.accept = { name: "", role: "", date: "" };
|
| 386 |
+
d.date = today || todayISO(); d.valid = addDays(d.date, 30);
|
| 387 |
+
d.sections.forEach(function (s) { s.id = uid(); });
|
| 388 |
+
if (d.title && !/\(copy\)$/.test(d.title)) d.title += " (copy)";
|
| 389 |
+
return d;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
/** Friendly checks shown above the download button. */
|
| 393 |
+
function check(p) {
|
| 394 |
+
var w = [];
|
| 395 |
+
if (!String((p.client || {}).company || (p.client || {}).name || "").trim()) w.push("Add who the proposal is for");
|
| 396 |
+
if (!String((p.from || {}).name || "").trim()) w.push("Add your business name");
|
| 397 |
+
var n = placeholders(p);
|
| 398 |
+
if (n) w.push(n + " [bracketed] placeholder" + (n > 1 ? "s" : "") + " still to edit");
|
| 399 |
+
if (p.valid && p.date && p.valid < p.date) w.push("Valid-until is before the proposal date");
|
| 400 |
+
return w;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
/* ---------- document HTML (preview, print and the HTML export share it) ---------- */
|
| 404 |
+
var CREDIT = "Proposal made with Pitchsprig by CyberMax";
|
| 405 |
+
var DOC_CSS = [
|
| 406 |
+
".pp{--acc:#8A2C5A;--tint:#F6EAF0;width:794px;background:#fff;color:#1A1D24;font:13.5px/1.6 Helvetica,Arial,sans-serif;position:relative;text-align:left}",
|
| 407 |
+
".pp *{box-sizing:border-box}",
|
| 408 |
+
".pp-cover{min-height:1123px;display:flex;flex-direction:column;position:relative}",
|
| 409 |
+
".pp-band{background:var(--acc);color:#fff;padding:54px 64px 50px;min-height:520px;display:flex;flex-direction:column}",
|
| 410 |
+
".pp-top{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;min-height:60px}",
|
| 411 |
+
".pp-logo{background:#fff;padding:8px 10px;display:inline-block;line-height:0}.pp-logo img{max-height:52px;max-width:200px}",
|
| 412 |
+
".pp-fromname{font-weight:700;font-size:16px;letter-spacing:.01em}",
|
| 413 |
+
".pp-num{font-size:12px;opacity:.85;text-align:right}",
|
| 414 |
+
".pp-kicker{margin-top:auto;font-size:12px;font-weight:700;letter-spacing:.22em;text-transform:uppercase;opacity:.9}",
|
| 415 |
+
".pp-title{font-size:42px;line-height:1.12;font-weight:700;margin:14px 0 18px;letter-spacing:-.01em;word-break:break-word}",
|
| 416 |
+
".pp-for{font-size:17px;opacity:.95}",
|
| 417 |
+
".pp-cmeta{padding:44px 64px 0;display:grid;grid-template-columns:1fr 1fr;gap:28px}",
|
| 418 |
+
".pp-lbl{font-size:10.5px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:#6A6F7C;margin-bottom:6px}",
|
| 419 |
+
".pp-cmeta b{display:block;font-size:15px}.pp-cmeta span{display:block;color:#4B5160;font-size:13px}",
|
| 420 |
+
".pp-dates{margin:34px 64px 0;padding-top:20px;border-top:1px solid #E3E1E6;display:flex;gap:44px;flex-wrap:wrap}",
|
| 421 |
+
".pp-dates b{display:block;font-size:14px}",
|
| 422 |
+
".pp-summary{margin:30px 64px 0;background:var(--tint);padding:18px 22px;display:flex;justify-content:space-between;gap:16px;align-items:center;flex-wrap:wrap}",
|
| 423 |
+
".pp-summary strong{font-size:20px;color:var(--acc)}",
|
| 424 |
+
".pp-foot{margin-top:auto;height:12px;background:var(--acc)}",
|
| 425 |
+
".pp-body{padding:56px 64px 72px}",
|
| 426 |
+
".pp-sec{margin:0 0 34px}",
|
| 427 |
+
".pp-sec>h2{font-size:23px;line-height:1.25;color:var(--acc);margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid var(--tint);break-after:avoid}",
|
| 428 |
+
".pp-sec>h2 small{display:block;font-size:11px;letter-spacing:.16em;color:#8B909C;font-weight:700;margin-bottom:2px}",
|
| 429 |
+
".pp h3{font-size:15.5px;margin:18px 0 6px;color:#1A1D24;break-after:avoid}.pp h4{font-size:13.5px;margin:14px 0 4px;break-after:avoid}",
|
| 430 |
+
".pp p{margin:0 0 10px}.pp ul,.pp ol{margin:0 0 10px;padding-left:22px}.pp li{margin:0 0 4px}.pp li::marker{color:var(--acc)}",
|
| 431 |
+
".pp table{width:100%;border-collapse:collapse;font-size:12.6px;margin:6px 0 10px}",
|
| 432 |
+
".pp th{font-size:10px;letter-spacing:.08em;text-transform:uppercase;text-align:left;padding:8px 8px;background:var(--tint);color:#3B404C}",
|
| 433 |
+
".pp td{padding:8px 8px;border-bottom:1px solid #E7E5EA;vertical-align:top;font-variant-numeric:tabular-nums}",
|
| 434 |
+
".pp td.r,.pp th.r{text-align:right}.pp tr{break-inside:avoid}",
|
| 435 |
+
".pp tr.opt td{color:#3B404C}.pp tr.off td{color:#9A9EA9}.pp tr.off td.d{text-decoration:line-through}",
|
| 436 |
+
".pp .tag{display:inline-block;font-size:9.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;border:1px solid currentColor;padding:0 5px;margin-left:6px;color:var(--acc)}",
|
| 437 |
+
".pp tr.off .tag{color:#9A9EA9}",
|
| 438 |
+
".pp-tot{margin-left:auto;width:330px;font-size:13px}.pp-tot td{border:0;padding:3px 0}.pp-tot td:last-child{text-align:right}",
|
| 439 |
+
".pp-tot tr.t td{border-top:2px solid var(--acc);padding-top:8px;font-weight:700;font-size:14.5px}.pp-tot tr.t td:last-child{color:var(--acc)}",
|
| 440 |
+
".pp-tot tr.gap td{padding-top:12px}.pp-y1{color:#6A6F7C;font-size:12px;text-align:right;margin:4px 0 0}",
|
| 441 |
+
".pp-pkgs{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:10px 0 14px}",
|
| 442 |
+
".pp-pkg{border:1.5px solid #E1DEE4;padding:16px 14px;break-inside:avoid;position:relative}",
|
| 443 |
+
".pp-pkg.rec{border:2px solid var(--acc)}.pp-pkg .badge{position:absolute;top:-10px;left:12px;background:var(--acc);color:#fff;font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:2px 7px}",
|
| 444 |
+
".pp-pkg h3{margin:2px 0 2px;font-size:16px}.pp-pkg .pr{font-size:22px;font-weight:700;color:var(--acc)}.pp-pkg .pr small{font-size:12px;color:#6A6F7C;font-weight:400}",
|
| 445 |
+
".pp-pkg p{color:#4B5160;font-size:12.4px;margin:4px 0 8px}.pp-pkg ul{padding-left:18px;font-size:12.4px;margin:0}",
|
| 446 |
+
".pp-tl td.when{white-space:nowrap;font-weight:700;color:var(--acc)}.pp-tl td.ph{font-weight:700;width:150px}",
|
| 447 |
+
".pp-accept{border:2px solid var(--acc);padding:18px 20px;break-inside:avoid}",
|
| 448 |
+
".pp-fields{display:grid;grid-template-columns:2fr 1.4fr 1fr;gap:18px;margin-top:14px}",
|
| 449 |
+
".pp-field .v{border-bottom:1.5px solid #1A1D24;min-height:28px;padding:4px 0;font-size:15px;font-weight:700}",
|
| 450 |
+
".pp-field .k{font-size:10.5px;color:#6A6F7C;letter-spacing:.06em;text-transform:uppercase;margin-top:4px}",
|
| 451 |
+
".pp-note{font-size:11.5px;color:#6A6F7C;margin:12px 0 0}",
|
| 452 |
+
".pp-credit{position:absolute;left:64px;bottom:26px;font-size:10.5px;color:#8B909C}",
|
| 453 |
+
].join("\n");
|
| 454 |
+
|
| 455 |
+
function mix(hex, t) {
|
| 456 |
+
var a = parseInt(String(hex).slice(1), 16), o = "#";
|
| 457 |
+
[16, 8, 0].forEach(function (s) { var v = Math.round((a >> s & 255) * (1 - t) + 255 * t); o += ("0" + v.toString(16)).slice(-2); });
|
| 458 |
+
return o;
|
| 459 |
+
}
|
| 460 |
+
var DEFAULT_ACCENT = "#8A2C5A";
|
| 461 |
+
function validHex(h) { return /^#[0-9a-f]{6}$/i.test(h || "") ? h : null; }
|
| 462 |
+
|
| 463 |
+
function pricingHTML(p, sec) {
|
| 464 |
+
var c = p.currency || "USD", m = function (v) { return esc(money(v, c)); }, pr = p.pricing || {}, out = "";
|
| 465 |
+
var T = totals(p), ks = packages(p);
|
| 466 |
+
if (pr.layout === "packages" && ks.length) {
|
| 467 |
+
out += '<div class="pp-pkgs">' + ks.map(function (k) {
|
| 468 |
+
return '<div class="pp-pkg' + (k.recommended ? " rec" : "") + '">' + (k.recommended ? '<span class="badge">Recommended</span>' : "") + "<h3>" + esc(fill(k.name, p)) + '</h3><div class="pr">' + esc(moneyShort(k.price, c)) +
|
| 469 |
+
(k.billing === "month" ? "<small> /month</small>" : "") + "</div>" + (k.blurb ? "<p>" + esc(fill(k.blurb, p)) + "</p>" : "") +
|
| 470 |
+
(k.features.length ? "<ul>" + k.features.map(function (f) { return "<li>" + esc(fill(f, p)) + "</li>"; }).join("") + "</ul>" : "") + "</div>";
|
| 471 |
+
}).join("") + "</div>";
|
| 472 |
+
var opts = T.items.map(function (x, i) { return [x, T.lines[i]]; }).filter(function (a) { return a[1].optional; });
|
| 473 |
+
if (opts.length) {
|
| 474 |
+
out += "<h3>Optional add-ons</h3><table><thead><tr><th>Add-on</th><th class=\"r\">Price</th></tr></thead><tbody>" + opts.map(function (a) {
|
| 475 |
+
return "<tr><td>" + esc(fill(a[0].desc, p)) + (a[1].qty !== 1 ? " (" + esc(String(round(a[1].qty, 3))) + " × " + m(a[1].rate) + ")" : "") + '</td><td class="r">' + m(a[1].net) + (a[1].billing === "month" ? " /month" : "") + "</td></tr>";
|
| 476 |
+
}).join("") + "</tbody></table>";
|
| 477 |
+
}
|
| 478 |
+
if (parseNum(pr.tax) > 0) out += '<p class="pp-y1">Prices exclude ' + esc(pr.taxLabel || "tax") + " (" + esc(String(round(parseNum(pr.tax), 3))) + "%).</p>";
|
| 479 |
+
return out;
|
| 480 |
+
}
|
| 481 |
+
if (!T.items.length) return '<p style="color:#9A9EA9">Add a pricing line to see the table.</p>';
|
| 482 |
+
var showBilling = T.hasMonthly;
|
| 483 |
+
out += "<table><thead><tr><th>Item</th><th class=\"r\">Qty</th><th class=\"r\">Rate</th>" + (showBilling ? "<th>Billing</th>" : "") + '<th class="r">Amount</th></tr></thead><tbody>' +
|
| 484 |
+
T.items.map(function (x, i) {
|
| 485 |
+
var l = T.lines[i], cls = l.optional ? (l.included ? "opt" : "off") : "";
|
| 486 |
+
return '<tr class="' + cls + '"><td class="d">' + esc(fill(x.desc, p)) + (l.optional ? '<span class="tag">' + (l.included ? "Optional · included" : "Optional") + "</span>" : "") + '</td><td class="r">' + esc(String(round(l.qty, 3))) +
|
| 487 |
+
'</td><td class="r">' + m(l.rate) + "</td>" + (showBilling ? "<td>" + (l.billing === "month" ? "Monthly" : "One-time") + "</td>" : "") + '<td class="r">' + m(l.net) + "</td></tr>";
|
| 488 |
+
}).join("") + "</tbody></table>";
|
| 489 |
+
var rows = [], tl = esc(pr.taxLabel || "Tax"), dd = pr.discount || {};
|
| 490 |
+
function grp(g, label, suffix) {
|
| 491 |
+
if (!g.count) return;
|
| 492 |
+
var gap = rows.length ? " gap" : "";
|
| 493 |
+
rows.push('<tr class="' + gap + '"><td>' + label + " subtotal</td><td>" + m(g.sub) + suffix + "</td></tr>");
|
| 494 |
+
if (g.disc > 0) rows.push("<tr><td>Discount" + (dd.type === "amt" ? "" : " (" + esc(String(round(parseNum(dd.value), 3))) + "%)") + "</td><td>-" + m(g.disc) + suffix + "</td></tr>");
|
| 495 |
+
if (g.tax > 0) rows.push("<tr><td>" + tl + " " + esc(String(round(parseNum(pr.tax), 3))) + "%</td><td>" + m(g.tax) + suffix + "</td></tr>");
|
| 496 |
+
rows.push('<tr class="t"><td>' + (label === "One-time" ? "Total one-time" : "Total monthly") + "</td><td>" + m(g.total) + suffix + "</td></tr>");
|
| 497 |
+
}
|
| 498 |
+
grp(T.once, "One-time", ""); grp(T.month, "Monthly", " /mo");
|
| 499 |
+
out += '<table class="pp-tot"><tbody>' + rows.join("") + "</tbody></table>";
|
| 500 |
+
if (T.once.count && T.month.count) out += '<p class="pp-y1">First 12 months: ' + m(T.year1) + "</p>";
|
| 501 |
+
return out;
|
| 502 |
+
}
|
| 503 |
+
function timelineHTML(p) {
|
| 504 |
+
var rows = (p.timeline || []).filter(function (r) { return String(r.phase || r.detail || r.when || "").trim(); });
|
| 505 |
+
if (!rows.length) return "";
|
| 506 |
+
return '<table class="pp-tl"><thead><tr><th>Phase</th><th>What happens</th><th class="r">When</th></tr></thead><tbody>' + rows.map(function (r) {
|
| 507 |
+
return '<tr><td class="ph">' + esc(fill(r.phase, p)) + "</td><td>" + esc(fill(r.detail, p)) + '</td><td class="r when">' + esc(fill(r.when, p)) + "</td></tr>";
|
| 508 |
+
}).join("") + "</tbody></table>";
|
| 509 |
+
}
|
| 510 |
+
function acceptHTML(p, interactive) {
|
| 511 |
+
var a = p.accept || {}, loc = cur(p.currency).locale;
|
| 512 |
+
var f = function (k, v, label, cls) {
|
| 513 |
+
return '<div class="pp-field ' + (cls || "") + '">' + (interactive ? '<input class="v" data-acc="' + k + '" aria-label="' + esc(label) + '" value="' + esc(v) + '"' + (k === "date" ? ' type="date"' : "") + ">" : '<div class="v">' + esc(k === "date" ? fmtDate(v, loc) : v) + "</div>") + '<div class="k">' + esc(label) + "</div></div>";
|
| 514 |
+
};
|
| 515 |
+
return '<div class="pp-accept"><div>I accept this proposal' + (p.title ? " (" + esc(fill(p.title, p)) + ")" : "") + ", including its scope, pricing and terms.</div>" +
|
| 516 |
+
'<div class="pp-fields">' + f("name", a.name, "Accepted by (typed name)") + f("role", a.role, "Title and company") + f("date", a.date, "Date") + "</div>" +
|
| 517 |
+
'<p class="pp-note">Typing a name here is a record of acceptance, not an electronic signature.' + (interactive ? "" : "") + "</p>" +
|
| 518 |
+
(interactive ? '<p class="pp-actions"><button type="button" id="pp-accept-btn">Send my acceptance by email</button></p>' : "") + "</div>";
|
| 519 |
+
}
|
| 520 |
+
/**
|
| 521 |
+
* The proposal as HTML (no <html> wrapper). opts: { credit, logo (data URL), accent, interactive }
|
| 522 |
+
*/
|
| 523 |
+
function docHTML(p, opts) {
|
| 524 |
+
opts = opts || {};
|
| 525 |
+
var acc = validHex(opts.accent) || DEFAULT_ACCENT, c = p.client || {}, f = p.from || {}, loc = cur(p.currency).locale;
|
| 526 |
+
var dt = function (iso) { return esc(fmtDate(iso, loc)); };
|
| 527 |
+
var who = c.company || c.name || "";
|
| 528 |
+
var top = (opts.logo ? '<span class="pp-logo"><img src="' + esc(opts.logo) + '" alt=""></span>' : '<span class="pp-fromname">' + esc(f.name) + "</span>") + (p.number ? '<span class="pp-num">Ref. ' + esc(p.number) + "</span>" : "");
|
| 529 |
+
var line = function (arr) { return arr.filter(function (s) { return s && String(s).trim(); }).map(function (s) { return "<span>" + esc(s) + "</span>"; }).join(""); };
|
| 530 |
+
var n = 0;
|
| 531 |
+
var body = (p.sections || []).map(function (s) {
|
| 532 |
+
n++;
|
| 533 |
+
var h = "<h2><small>" + ("0" + n).slice(-2) + "</small>" + esc(fill(s.title, p)) + "</h2>";
|
| 534 |
+
var intro = s.body ? mdHTML(fill(s.body, p)) : "";
|
| 535 |
+
var inner = s.kind === "pricing" ? intro + pricingHTML(p, s) : s.kind === "timeline" ? intro + timelineHTML(p) : s.kind === "acceptance" ? intro + acceptHTML(p, opts.interactive) : intro;
|
| 536 |
+
return '<section class="pp-sec pp-' + s.kind + '">' + h + inner + "</section>";
|
| 537 |
+
}).join("");
|
| 538 |
+
var hasPricing = (p.sections || []).some(function (s) { return s.kind === "pricing"; });
|
| 539 |
+
return '<div class="pp" style="--acc:' + acc + ";--tint:" + mix(acc, 0.9) + '">' +
|
| 540 |
+
'<section class="pp-cover"><div class="pp-band"><div class="pp-top">' + top + '</div><div class="pp-kicker">Proposal</div><div class="pp-title">' + esc(fill(p.title, p) || "Proposal") + "</div>" +
|
| 541 |
+
(who ? '<div class="pp-for">Prepared for ' + esc(who) + "</div>" : "") + "</div>" +
|
| 542 |
+
'<div class="pp-cmeta"><div><div class="pp-lbl">Prepared for</div>' + (c.name ? "<b>" + esc(c.name) + "</b>" : "") + line([c.company !== c.name ? c.company : "", c.email]) + "</div>" +
|
| 543 |
+
'<div><div class="pp-lbl">Prepared by</div>' + (f.person ? "<b>" + esc(f.person) + "</b>" : f.name ? "<b>" + esc(f.name) + "</b>" : "") + line([f.person ? f.name : "", f.email, f.phone, f.website]) + "</div></div>" +
|
| 544 |
+
'<div class="pp-dates"><div><div class="pp-lbl">Date</div><b>' + dt(p.date) + "</b></div>" + (p.valid ? '<div><div class="pp-lbl">Valid until</div><b>' + dt(p.valid) + "</b></div>" : "") + "</div>" +
|
| 545 |
+
(hasPricing ? '<div class="pp-summary"><span class="pp-lbl" style="margin:0">Investment</span><strong>' + esc(priceSummary(p)) + "</strong></div>" : "") +
|
| 546 |
+
'<div class="pp-foot"></div></section>' +
|
| 547 |
+
'<div class="pp-body">' + body + "</div>" + (opts.credit ? '<div class="pp-credit">' + CREDIT + "</div>" : "") + "</div>";
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
/** One self-contained HTML file the client can open, print and accept by email. */
|
| 551 |
+
function exportHTML(p, opts) {
|
| 552 |
+
opts = opts || {};
|
| 553 |
+
var f = p.from || {}, title = fill(p.title, p) + (p.client && (p.client.company || p.client.name) ? " for " + (p.client.company || p.client.name) : "");
|
| 554 |
+
var mail = String(f.email || "").trim();
|
| 555 |
+
var js = "(function(){var b=document.getElementById('pp-accept-btn');if(!b)return;var d=document.querySelector('[data-acc=date]');if(d&&!d.value){var t=new Date();d.value=t.getFullYear()+'-'+('0'+(t.getMonth()+1)).slice(-2)+'-'+('0'+t.getDate()).slice(-2);}" +
|
| 556 |
+
"b.onclick=function(){var v=function(k){var e=document.querySelector('[data-acc='+k+']');return e?e.value.trim():'';};if(!v('name')){alert('Please type your name first.');return;}" +
|
| 557 |
+
"var body='I accept the proposal \"'+" + JSON.stringify(fill(p.title, p)) + "+'\"'+" + JSON.stringify(p.number ? " (ref. " + p.number + ")" : "") + "+', including its scope, pricing and terms.\\n\\nName: '+v('name')+'\\nTitle and company: '+v('role')+'\\nDate: '+v('date')+'\\n\\nThis email is my record of acceptance.';" +
|
| 558 |
+
"location.href='mailto:'+" + JSON.stringify(mail) + "+'?subject='+encodeURIComponent('Accepted: '+" + JSON.stringify(fill(p.title, p)) + ")+'&body='+encodeURIComponent(body);};})();";
|
| 559 |
+
return "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">" +
|
| 560 |
+
"<title>" + esc(title) + "</title><meta name=\"generator\" content=\"Pitchsprig by CyberMax\"><style>" +
|
| 561 |
+
"html{background:#ECEAEE}body{margin:0;padding:24px 12px 60px;font-family:Helvetica,Arial,sans-serif}.bar{max-width:794px;margin:0 auto 12px;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;font-size:14px;color:#4B5160}" +
|
| 562 |
+
".bar button,#pp-accept-btn{font:inherit;font-weight:700;border:0;background:" + (validHex(opts.accent) || DEFAULT_ACCENT) + ";color:#fff;padding:10px 16px;cursor:pointer}" +
|
| 563 |
+
".sheet{max-width:794px;margin:0 auto;box-shadow:0 10px 40px rgba(0,0,0,.12);overflow:hidden}.sheet .pp{width:100%}" +
|
| 564 |
+
".pp input.v{width:100%;border:0;border-bottom:1.5px solid #1A1D24;font:inherit;font-size:15px;font-weight:700;background:#FFFBEA;padding:4px 2px}" +
|
| 565 |
+
"@media (max-width:700px){.pp-band{padding:32px 22px!important;min-height:0!important}.pp-title{font-size:30px!important}.pp-cmeta,.pp-fields{grid-template-columns:1fr!important}.pp-cmeta,.pp-body{padding-left:22px!important;padding-right:22px!important}.pp-dates,.pp-summary{margin-left:22px!important;margin-right:22px!important}.pp-pkgs{grid-template-columns:1fr!important}.pp-cover{min-height:0!important}.pp table{font-size:12px}}" +
|
| 566 |
+
"@media print{html,body{background:#fff;padding:0}.bar,.pp-actions{display:none}.sheet{box-shadow:none;max-width:none}.pp-cover{break-after:page}.pp-credit{position:fixed;bottom:8mm}@page{margin:12mm 0}}\n" + DOC_CSS + "</style></head><body>" +
|
| 567 |
+
'<div class="bar"><span>' + esc(title) + '</span><button type="button" onclick="window.print()">Print or save as PDF</button></div><main class="sheet">' + docHTML(p, { credit: opts.credit, logo: opts.logo, accent: opts.accent, interactive: true }) + "</main>" +
|
| 568 |
+
"<script>" + js + "</script></body></html>\n";
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
/** A short covering email with the key numbers. */
|
| 572 |
+
function emailText(p) {
|
| 573 |
+
var c = p.client || {}, f = p.from || {}, loc = cur(p.currency).locale;
|
| 574 |
+
var intro = (p.sections || []).filter(function (s) { return s.kind === "text" && s.body; })[0];
|
| 575 |
+
var first = intro ? plain(fill(intro.body, p)).split(/\n\n/).filter(function (x) { return !/^(hi|hello|dear)\b/i.test(x.trim()); })[0] || "" : "";
|
| 576 |
+
var tlr = (p.timeline || []).filter(function (r) { return r.when; });
|
| 577 |
+
var lines = ["Subject: " + fill(p.title, p) + (c.company || c.name ? " for " + (c.company || c.name) : ""), "",
|
| 578 |
+
"Hi " + fill("{contact}", p) + ",", "", first || "Thank you for your time. Here is our proposal.", "",
|
| 579 |
+
"The short version:",
|
| 580 |
+
"- Proposal: " + fill(p.title, p) + (p.number ? " (ref. " + p.number + ")" : ""),
|
| 581 |
+
"- Investment: " + priceSummary(p)];
|
| 582 |
+
if (tlr.length) lines.push("- Timeline: " + tlr[0].when + (tlr.length > 1 ? " to " + tlr[tlr.length - 1].when : "") + " (" + tlr.length + " stages)");
|
| 583 |
+
if (p.valid) lines.push("- Valid until: " + fmtDate(p.valid, loc));
|
| 584 |
+
lines.push("", "The full proposal is attached. If it looks right, reply to this email to accept, or fill in the acceptance block at the end, and we will book the kickoff.", "", "Best regards,");
|
| 585 |
+
[f.person, f.name, [f.email, f.phone].filter(Boolean).join(" · "), f.website].forEach(function (s) { if (s && String(s).trim()) lines.push(s); });
|
| 586 |
+
return lines.join("\n");
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
function fileName(p, ext) {
|
| 590 |
+
var c = p.client || {};
|
| 591 |
+
var parts = ["Proposal", c.company || c.name, p.number].filter(Boolean).join("-");
|
| 592 |
+
return parts.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[^A-Za-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 90) + "." + (ext || "pdf");
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
var api = {
|
| 596 |
+
CURRENCIES: CURRENCIES, cur: cur, decimals: decimals, round: round, money: money, moneyShort: moneyShort, parseNum: parseNum, todayISO: todayISO, addDays: addDays, fmtDate: fmtDate,
|
| 597 |
+
uid: uid, clone: clone, esc: esc, fill: fill, runs: runs, blocks: blocks, mdHTML: mdHTML, plain: plain, placeholders: placeholders,
|
| 598 |
+
line: line, used: used, totals: totals, packages: packages, priceSummary: priceSummary,
|
| 599 |
+
TEMPLATES: TEMPLATES, TEMPLATE_ORDER: TEMPLATE_ORDER, KINDS: KINDS, fromTemplate: fromTemplate, blankSection: blankSection, duplicate: duplicate, check: check,
|
| 600 |
+
DOC_CSS: DOC_CSS, CREDIT: CREDIT, DEFAULT_ACCENT: DEFAULT_ACCENT, mix: mix, validHex: validHex, docHTML: docHTML, exportHTML: exportHTML, emailText: emailText, fileName: fileName,
|
| 601 |
+
};
|
| 602 |
+
if (typeof module === "object" && module.exports) module.exports = api; else root.PS = api;
|
| 603 |
+
})(typeof self !== "undefined" ? self : this);
|
pitchsprig/lib/pdf.js
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Pitchsprig PDF writer: a small, dependency-free PDF 1.4 generator for multi-page proposals (cover page, running
|
| 2 |
+
* headers, page numbers, rich text, pricing table, packages, timeline, acceptance block).
|
| 3 |
+
* Text uses the built-in Helvetica family (WinAnsiEncoding), so it is real, selectable, searchable text.
|
| 4 |
+
* Glyph widths below come from Adobe's Core 14 AFM metrics for Helvetica and Helvetica-Bold (the oblique faces share them)
|
| 5 |
+
* (Copyright (c) 1985-1997 Adobe Systems Incorporated; metrics files are freely distributable).
|
| 6 |
+
* Everything else © 2026 CyberMax. All rights reserved. */
|
| 7 |
+
(function (root) {
|
| 8 |
+
"use strict";
|
| 9 |
+
var C = typeof module === "object" && module.exports ? require("./core.js") : root.PS;
|
| 10 |
+
|
| 11 |
+
var WR = [278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,350,556,350,222,556,333,1000,556,556,333,1000,667,333,1000,350,611,350,350,222,222,333,333,350,556,1000,333,1000,500,333,944,350,500,667,278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500];
|
| 12 |
+
var WB = [278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,350,556,350,278,556,500,1000,556,556,333,1000,667,333,1000,350,611,350,350,278,278,500,500,350,556,1000,333,1000,556,333,944,350,500,667,278,333,556,556,556,556,280,556,333,737,370,556,584,333,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556];
|
| 13 |
+
var CP = { 0x20AC: 128, 0x201A: 130, 0x0192: 131, 0x201E: 132, 0x2026: 133, 0x2020: 134, 0x2021: 135, 0x02C6: 136, 0x2030: 137, 0x0160: 138, 0x2039: 139, 0x0152: 140, 0x017D: 142,
|
| 14 |
+
0x2018: 145, 0x2019: 146, 0x201C: 147, 0x201D: 148, 0x2022: 149, 0x2013: 150, 0x2014: 151, 0x02DC: 152, 0x2122: 153, 0x0161: 154, 0x203A: 155, 0x0153: 156, 0x017E: 158, 0x0178: 159 };
|
| 15 |
+
var FALLBACK = { "ł": "l", "Ł": "L", "‐": "-", "‑": "-", "−": "-", "→": "->", "←": "<-", "✓": "v", "′": "'", "″": '"', " ": " ", " ": " ", " ": " " };
|
| 16 |
+
|
| 17 |
+
function code(ch) {
|
| 18 |
+
var c = ch.codePointAt(0);
|
| 19 |
+
if (c >= 32 && c < 127) return c;
|
| 20 |
+
if (c >= 160 && c <= 255) return c;
|
| 21 |
+
if (CP[c]) return CP[c];
|
| 22 |
+
return -1;
|
| 23 |
+
}
|
| 24 |
+
function canEncode(s) { for (var ch of String(s)) if (code(ch) < 0) return false; return true; }
|
| 25 |
+
function encode(s) {
|
| 26 |
+
var out = [];
|
| 27 |
+
for (var ch of String(s == null ? "" : s).replace(/[\t\r\n]/g, " ")) {
|
| 28 |
+
var c = code(ch);
|
| 29 |
+
if (c < 0 && FALLBACK[ch]) { encode(FALLBACK[ch]).forEach(function (x) { out.push(x); }); continue; }
|
| 30 |
+
if (c < 0) c = code(ch.normalize("NFD").charAt(0));
|
| 31 |
+
out.push(c < 0 ? 63 : c);
|
| 32 |
+
}
|
| 33 |
+
return out;
|
| 34 |
+
}
|
| 35 |
+
function width(s, size, bold) {
|
| 36 |
+
var w = 0, t = bold ? WB : WR;
|
| 37 |
+
encode(s).forEach(function (c) { w += t[c - 32] || 556; });
|
| 38 |
+
return w * size / 1000;
|
| 39 |
+
}
|
| 40 |
+
function wrap(s, maxW, size, bold) {
|
| 41 |
+
var out = [];
|
| 42 |
+
String(s == null ? "" : s).split(/\r?\n/).forEach(function (para) {
|
| 43 |
+
var words = para.split(/\s+/).filter(Boolean), cur = "";
|
| 44 |
+
if (!words.length) { out.push(""); return; }
|
| 45 |
+
words.forEach(function (wd) {
|
| 46 |
+
while (width(wd, size, bold) > maxW && wd.length > 1) {
|
| 47 |
+
var k = wd.length - 1;
|
| 48 |
+
while (k > 1 && width(wd.slice(0, k), size, bold) > maxW) k--;
|
| 49 |
+
if (cur) { out.push(cur); cur = ""; }
|
| 50 |
+
out.push(wd.slice(0, k)); wd = wd.slice(k);
|
| 51 |
+
}
|
| 52 |
+
var next = cur ? cur + " " + wd : wd;
|
| 53 |
+
if (width(next, size, bold) <= maxW) cur = next; else { out.push(cur); cur = wd; }
|
| 54 |
+
});
|
| 55 |
+
out.push(cur);
|
| 56 |
+
});
|
| 57 |
+
return out;
|
| 58 |
+
}
|
| 59 |
+
/** Rich-text wrap: runs [{t,b,i}] -> lines of segments [{t,b,i}] fitting maxW. */
|
| 60 |
+
function wrapRuns(rs, maxW, size) {
|
| 61 |
+
var words = [];
|
| 62 |
+
rs.forEach(function (r) {
|
| 63 |
+
var parts = String(r.t).split(/(\s+)/);
|
| 64 |
+
parts.forEach(function (p) {
|
| 65 |
+
if (!p) return;
|
| 66 |
+
if (/^\s+$/.test(p)) { if (words.length) words[words.length - 1].sp = true; return; }
|
| 67 |
+
words.push({ t: p, b: !!r.b, i: !!r.i, sp: false });
|
| 68 |
+
});
|
| 69 |
+
});
|
| 70 |
+
var lines = [], cur = [], w = 0;
|
| 71 |
+
words.forEach(function (wd, idx) {
|
| 72 |
+
var gap = cur.length && words[idx - 1].sp ? width(" ", size, wd.b) : 0, ww = width(wd.t, size, wd.b);
|
| 73 |
+
if (cur.length && w + gap + ww > maxW) { lines.push(cur); cur = []; w = 0; gap = 0; }
|
| 74 |
+
cur.push({ t: (cur.length && gap ? " " : "") + wd.t, b: wd.b, i: wd.i });
|
| 75 |
+
w += gap + ww;
|
| 76 |
+
});
|
| 77 |
+
if (cur.length) lines.push(cur);
|
| 78 |
+
return lines.length ? lines : [[{ t: "" }]];
|
| 79 |
+
}
|
| 80 |
+
function lit(s) {
|
| 81 |
+
return "(" + encode(s).map(function (c) {
|
| 82 |
+
if (c === 40 || c === 41 || c === 92) return "\\" + String.fromCharCode(c);
|
| 83 |
+
if (c >= 32 && c < 127) return String.fromCharCode(c);
|
| 84 |
+
return "\\" + ("00" + c.toString(8)).slice(-3);
|
| 85 |
+
}).join("") + ")";
|
| 86 |
+
}
|
| 87 |
+
function n2(v) { return (Math.round(v * 100) / 100).toString(); }
|
| 88 |
+
function rgb(hex) {
|
| 89 |
+
var m = /^#?([0-9a-f]{6})$/i.exec(hex || "") || [0, "1a1d24"];
|
| 90 |
+
var v = parseInt(m[1], 16);
|
| 91 |
+
return [(v >> 16 & 255) / 255, (v >> 8 & 255) / 255, (v & 255) / 255].map(function (x) { return Math.round(x * 1000) / 1000; }).join(" ");
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/* ---------- page writer (top-left coordinates in points) ---------- */
|
| 95 |
+
function Writer(W, H) { this.W = W; this.H = H; this.pages = []; }
|
| 96 |
+
Writer.prototype.add = function () { this.p = { ops: [], links: [] }; this.pages.push(this.p); return this.p; };
|
| 97 |
+
Writer.prototype.on = function (i) { this.p = this.pages[i]; };
|
| 98 |
+
Writer.prototype.rect = function (x, y, w, h, fill, stroke, lw) {
|
| 99 |
+
var o = ["q"];
|
| 100 |
+
if (fill) o.push(rgb(fill) + " rg");
|
| 101 |
+
if (stroke) o.push(rgb(stroke) + " RG " + n2(lw || 1) + " w");
|
| 102 |
+
o.push(n2(x) + " " + n2(this.H - y - h) + " " + n2(w) + " " + n2(h) + " re " + (fill && stroke ? "B" : fill ? "f" : "S"), "Q");
|
| 103 |
+
this.p.ops.push(o.join(" "));
|
| 104 |
+
};
|
| 105 |
+
Writer.prototype.line = function (x1, y1, x2, y2, color, lw) {
|
| 106 |
+
this.p.ops.push("q " + rgb(color) + " RG " + n2(lw || 0.5) + " w " + n2(x1) + " " + n2(this.H - y1) + " m " + n2(x2) + " " + n2(this.H - y2) + " l S Q");
|
| 107 |
+
};
|
| 108 |
+
function font(b, i) { return b && i ? "F4" : b ? "F2" : i ? "F3" : "F1"; }
|
| 109 |
+
/** Text with its baseline at y. o: size, bold, italic, color, align, spacing (letter spacing). Returns the width. */
|
| 110 |
+
Writer.prototype.text = function (x, y, s, o) {
|
| 111 |
+
o = o || {};
|
| 112 |
+
var size = o.size || 10, sp = o.spacing || 0, w = width(s, size, o.bold) + sp * Math.max(0, encode(s).length - 1);
|
| 113 |
+
if (o.align === "right") x -= w; else if (o.align === "center") x -= w / 2;
|
| 114 |
+
this.p.ops.push("BT /" + font(o.bold, o.italic) + " " + n2(size) + " Tf " + n2(sp) + " Tc " + rgb(o.color || "#1A1D24") + " rg " + n2(x) + " " + n2(this.H - y) + " Td " + lit(s) + " Tj ET");
|
| 115 |
+
return w;
|
| 116 |
+
};
|
| 117 |
+
/** One line of rich segments. */
|
| 118 |
+
Writer.prototype.segs = function (x, y, segs, size, color) {
|
| 119 |
+
var self = this;
|
| 120 |
+
segs.forEach(function (s) { x += self.text(x, y, s.t, { size: size, bold: s.b, italic: s.i, color: color }); });
|
| 121 |
+
};
|
| 122 |
+
Writer.prototype.image = function (x, y, w, h) {
|
| 123 |
+
this.p.ops.push("q " + n2(w) + " 0 0 " + n2(h) + " " + n2(x) + " " + n2(this.H - y - h) + " cm /Im1 Do Q");
|
| 124 |
+
};
|
| 125 |
+
Writer.prototype.link = function (x, y, w, h, url) { this.p.links.push({ r: [x, this.H - y - h, x + w, this.H - y], url: url }); };
|
| 126 |
+
|
| 127 |
+
function serialize(wr, info, img) {
|
| 128 |
+
var chunks = [], len = 0, offsets = [];
|
| 129 |
+
function put(x) {
|
| 130 |
+
if (typeof x === "string") { var b = new Uint8Array(x.length); for (var i = 0; i < x.length; i++) b[i] = x.charCodeAt(i) & 255; x = b; }
|
| 131 |
+
chunks.push(x); len += x.length;
|
| 132 |
+
}
|
| 133 |
+
var next = img ? 9 : 8, pageNums = [], plan = [];
|
| 134 |
+
wr.pages.forEach(function (p) {
|
| 135 |
+
var pn = next++, cn = next++, an = p.links.map(function () { return next++; });
|
| 136 |
+
pageNums.push(pn); plan.push({ p: p, pn: pn, cn: cn, an: an });
|
| 137 |
+
});
|
| 138 |
+
function obj(n, body) { offsets[n] = len; put(n + " 0 obj\n"); if (typeof body === "string") put(body); else body(); put("\nendobj\n"); }
|
| 139 |
+
put("%PDF-1.4\n%âãÏÓ\n");
|
| 140 |
+
obj(1, "<< /Type /Catalog /Pages 2 0 R >>");
|
| 141 |
+
obj(2, "<< /Type /Pages /Kids [" + pageNums.map(function (n) { return n + " 0 R"; }).join(" ") + "] /Count " + pageNums.length + " >>");
|
| 142 |
+
["Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique"].forEach(function (f, i) {
|
| 143 |
+
obj(3 + i, "<< /Type /Font /Subtype /Type1 /BaseFont /" + f + " /Encoding /WinAnsiEncoding >>");
|
| 144 |
+
});
|
| 145 |
+
obj(7, "<< /Title " + lit(info.title || "Proposal") + " /Author " + lit(info.author || "") + " /Subject (Proposal) /Producer (Pitchsprig by CyberMax) /Creator (Pitchsprig) /CreationDate (D:" + info.date + ") >>");
|
| 146 |
+
if (img) obj(8, function () {
|
| 147 |
+
put("<< /Type /XObject /Subtype /Image /Width " + img.w + " /Height " + img.h + " /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length " + img.bytes.length + " >>\nstream\n");
|
| 148 |
+
put(img.bytes); put("\nendstream");
|
| 149 |
+
});
|
| 150 |
+
plan.forEach(function (q) {
|
| 151 |
+
var content = q.p.ops.join("\n");
|
| 152 |
+
obj(q.pn, "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 " + n2(wr.W) + " " + n2(wr.H) + "] /Resources << /Font << /F1 3 0 R /F2 4 0 R /F3 5 0 R /F4 6 0 R >>" +
|
| 153 |
+
(img ? " /XObject << /Im1 8 0 R >>" : "") + " >> /Contents " + q.cn + " 0 R" + (q.an.length ? " /Annots [" + q.an.map(function (n) { return n + " 0 R"; }).join(" ") + "]" : "") + " >>");
|
| 154 |
+
obj(q.cn, "<< /Length " + content.length + " >>\nstream\n" + content + "\nendstream");
|
| 155 |
+
q.p.links.forEach(function (l, i) {
|
| 156 |
+
obj(q.an[i], "<< /Type /Annot /Subtype /Link /Rect [" + l.r.map(n2).join(" ") + "] /Border [0 0 0] /A << /S /URI /URI " + lit(l.url) + " >> >>");
|
| 157 |
+
});
|
| 158 |
+
});
|
| 159 |
+
var xref = len, count = next;
|
| 160 |
+
var x = "xref\n0 " + count + "\n0000000000 65535 f \n";
|
| 161 |
+
for (var i = 1; i < count; i++) x += ("000000000" + (offsets[i] || 0)).slice(-10) + " 00000 n \n";
|
| 162 |
+
put(x + "trailer\n<< /Size " + count + " /Root 1 0 R /Info 7 0 R >>\nstartxref\n" + xref + "\n%%EOF\n");
|
| 163 |
+
var out = new Uint8Array(len), o = 0;
|
| 164 |
+
chunks.forEach(function (c) { out.set(c, o); o += c.length; });
|
| 165 |
+
return out;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
/* ---------- the proposal layout ---------- */
|
| 169 |
+
var INK = "#1A1D24", MUTED = "#6A6F7C", SOFT = "#8B909C", RULE = "#E3E1E6", WHITE = "#FFFFFF";
|
| 170 |
+
var LETTER = ["USD", "CAD", "MXN"];
|
| 171 |
+
function pageSize(p) {
|
| 172 |
+
var s = p.page || (LETTER.indexOf(p.currency) > -1 ? "Letter" : "A4");
|
| 173 |
+
return s === "Letter" ? [612, 792] : [595.28, 841.89];
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Build the proposal PDF. opts: { credit: bool, creditUrl, logo: {bytes, w, h}, accent, date: Date }. Returns a Uint8Array.
|
| 178 |
+
*/
|
| 179 |
+
function build(p, opts) {
|
| 180 |
+
opts = opts || {};
|
| 181 |
+
var acc = C.validHex(opts.accent) || C.DEFAULT_ACCENT, tint = C.mix(acc, 0.9);
|
| 182 |
+
var sz = pageSize(p), W = sz[0], H = sz[1], M = 54, L = M, R = W - M, CW = R - L, TOP = 74, BOTTOM = H - 58;
|
| 183 |
+
var wr = new Writer(W, H), cur = p.currency || "USD", loc = C.cur(cur).locale;
|
| 184 |
+
var money = function (v) { return C.money(v, cur, canEncode); };
|
| 185 |
+
var fill = function (s) { return C.fill(s, p); };
|
| 186 |
+
var c = p.client || {}, f = p.from || {}, who = c.company || c.name || "";
|
| 187 |
+
var title = fill(p.title) || "Proposal";
|
| 188 |
+
|
| 189 |
+
/* cover */
|
| 190 |
+
wr.add();
|
| 191 |
+
var bandH = Math.round(H * 0.46);
|
| 192 |
+
wr.rect(0, 0, W, bandH, acc);
|
| 193 |
+
if (opts.logo && opts.logo.bytes && opts.logo.w && opts.logo.h) {
|
| 194 |
+
var lh = 44, lw = lh * opts.logo.w / opts.logo.h;
|
| 195 |
+
if (lw > 170) { lw = 170; lh = lw * opts.logo.h / opts.logo.w; }
|
| 196 |
+
wr.rect(L - 8, 40, lw + 16, lh + 16, WHITE);
|
| 197 |
+
wr.image(L, 48, lw, lh);
|
| 198 |
+
} else if (f.name) wr.text(L, 62, f.name, { size: 13, bold: true, color: WHITE });
|
| 199 |
+
if (p.number) wr.text(R, 62, "Ref. " + p.number, { size: 9, color: WHITE, align: "right" });
|
| 200 |
+
var tl = wrap(title, CW, 30, true).slice(0, 4);
|
| 201 |
+
var forY = bandH - 42, lastY = forY - (who ? 34 : 0), firstY = lastY - (tl.length - 1) * 35;
|
| 202 |
+
wr.text(L, firstY - 44, "PROPOSAL", { size: 9.5, bold: true, color: WHITE, spacing: 2.4 });
|
| 203 |
+
tl.forEach(function (t, i) { wr.text(L, firstY + i * 35, t, { size: 30, bold: true, color: WHITE }); });
|
| 204 |
+
if (who) wrap("Prepared for " + who, CW, 14, false).slice(0, 2).forEach(function (t, i) { wr.text(L, forY + i * 18, t, { size: 14, color: WHITE }); });
|
| 205 |
+
|
| 206 |
+
var y = bandH + 48, colW = CW / 2 - 12;
|
| 207 |
+
function party(x, label, bold, rest) {
|
| 208 |
+
var yy = y;
|
| 209 |
+
wr.text(x, yy, label, { size: 7.5, bold: true, color: MUTED, spacing: 1 }); yy += 17;
|
| 210 |
+
if (bold) { wrap(bold, colW, 12, true).forEach(function (t) { wr.text(x, yy, t, { size: 12, bold: true }); yy += 15; }); }
|
| 211 |
+
rest.filter(function (s) { return s && String(s).trim(); }).forEach(function (s) { wrap(s, colW, 9.5, false).forEach(function (t) { wr.text(x, yy, t, { size: 9.5, color: "#4B5160" }); yy += 13; }); });
|
| 212 |
+
return yy;
|
| 213 |
+
}
|
| 214 |
+
var y1 = party(L, "PREPARED FOR", c.name || c.company, [c.company !== c.name ? c.company : "", c.email]);
|
| 215 |
+
var y2 = party(L + CW / 2 + 12, "PREPARED BY", f.person || f.name, [f.person ? f.name : "", f.email, f.phone, f.website]);
|
| 216 |
+
y = Math.max(y1, y2) + 18;
|
| 217 |
+
wr.line(L, y, R, y, RULE, 0.8); y += 22;
|
| 218 |
+
wr.text(L, y, "DATE", { size: 7.5, bold: true, color: MUTED, spacing: 1 });
|
| 219 |
+
wr.text(L, y + 16, C.fmtDate(p.date, loc), { size: 11, bold: true });
|
| 220 |
+
if (p.valid) { wr.text(L + 170, y, "VALID UNTIL", { size: 7.5, bold: true, color: MUTED, spacing: 1 }); wr.text(L + 170, y + 16, C.fmtDate(p.valid, loc), { size: 11, bold: true }); }
|
| 221 |
+
y += 40;
|
| 222 |
+
if ((p.sections || []).some(function (s) { return s.kind === "pricing"; })) {
|
| 223 |
+
var sumLines = wrap(C.priceSummary(p, canEncode), CW - 120, 13, true).slice(0, 3);
|
| 224 |
+
var bh = 22 + sumLines.length * 17;
|
| 225 |
+
wr.rect(L, y, CW, bh, tint);
|
| 226 |
+
wr.text(L + 14, y + 20, "INVESTMENT", { size: 7.5, bold: true, color: MUTED, spacing: 1 });
|
| 227 |
+
sumLines.forEach(function (t, i) { wr.text(R - 14, y + 22 + i * 17, t, { size: 13, bold: true, color: acc, align: "right" }); });
|
| 228 |
+
}
|
| 229 |
+
wr.rect(0, H - 10, W, 10, acc);
|
| 230 |
+
|
| 231 |
+
/* body pages */
|
| 232 |
+
y = BOTTOM + 1;
|
| 233 |
+
function newPage() {
|
| 234 |
+
wr.add();
|
| 235 |
+
var ht = title.length > 70 ? title.slice(0, 67) + "..." : title;
|
| 236 |
+
wr.text(L, 38, ht, { size: 8, color: SOFT });
|
| 237 |
+
if (who) wr.text(R, 38, who.length > 50 ? who.slice(0, 47) + "..." : who, { size: 8, color: SOFT, align: "right" });
|
| 238 |
+
wr.line(L, 46, R, 46, RULE, 0.6);
|
| 239 |
+
y = TOP;
|
| 240 |
+
}
|
| 241 |
+
function ensure(h) { if (y + h > BOTTOM) newPage(); }
|
| 242 |
+
var SIZE = 10.2, LH = 14.6;
|
| 243 |
+
|
| 244 |
+
function richBlock(md) {
|
| 245 |
+
C.blocks(fill(md)).forEach(function (b) {
|
| 246 |
+
if (b.type === "h" || b.type === "h3") {
|
| 247 |
+
var hs = b.type === "h" ? 12.5 : 11;
|
| 248 |
+
var hl = wrapRuns(b.lines[0].map(function (r) { return { t: r.t, b: true, i: r.i }; }), CW, hs);
|
| 249 |
+
y += b.type === "h" ? 8 : 4;
|
| 250 |
+
ensure(hl.length * (hs + 4) + LH * 2);
|
| 251 |
+
hl.forEach(function (ln) { y += hs + 3; wr.segs(L, y, ln, hs, INK); });
|
| 252 |
+
y += 8; return;
|
| 253 |
+
}
|
| 254 |
+
if (b.type === "p") {
|
| 255 |
+
b.lines.forEach(function (rs) {
|
| 256 |
+
wrapRuns(rs, CW, SIZE).forEach(function (ln) { ensure(LH); y += LH - 3; wr.segs(L, y, ln, SIZE, INK); y += 3; });
|
| 257 |
+
});
|
| 258 |
+
y += 7; return;
|
| 259 |
+
}
|
| 260 |
+
b.items.forEach(function (rs, i) {
|
| 261 |
+
var lines = wrapRuns(rs, CW - 16, SIZE);
|
| 262 |
+
ensure(Math.min(lines.length, 2) * LH);
|
| 263 |
+
y += LH - 3;
|
| 264 |
+
if (b.type === "ul") wr.rect(L + 3, y - 5.2, 3.6, 3.6, acc);
|
| 265 |
+
else wr.text(L, y, (i + 1) + ".", { size: SIZE, bold: true, color: acc });
|
| 266 |
+
lines.forEach(function (ln, k) { if (k) { ensure(LH); y += LH - 3; } wr.segs(L + 16, y, ln, SIZE, INK); y += 3; });
|
| 267 |
+
y += 2;
|
| 268 |
+
});
|
| 269 |
+
y += 6;
|
| 270 |
+
});
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
function tableHeader(cols) {
|
| 274 |
+
wr.rect(L, y, CW, 20, tint);
|
| 275 |
+
var x = L;
|
| 276 |
+
cols.forEach(function (col) {
|
| 277 |
+
var tx = col.align === "right" ? x + col.w - 6 : x + 6;
|
| 278 |
+
wr.text(tx, y + 13.5, col.t.toUpperCase(), { size: 7, bold: true, color: "#3B404C", align: col.align === "right" ? "right" : "left", spacing: 0.5 });
|
| 279 |
+
x += col.w;
|
| 280 |
+
});
|
| 281 |
+
y += 22;
|
| 282 |
+
}
|
| 283 |
+
/** rows: [{cells: [{lines:[str], bold, color, sub:{t,color}}], muted}] */
|
| 284 |
+
function table(cols, rows) {
|
| 285 |
+
ensure(22 + 30); tableHeader(cols);
|
| 286 |
+
rows.forEach(function (row) {
|
| 287 |
+
var prepared = row.cells.map(function (cell, i) {
|
| 288 |
+
var lines = wrap(cell.t, cols[i].w - 12, 9.4, cell.bold);
|
| 289 |
+
return { lines: lines, cell: cell };
|
| 290 |
+
});
|
| 291 |
+
var h = Math.max.apply(null, prepared.map(function (pc) { return pc.lines.length * 12.5 + (pc.cell.sub ? 11 : 0); })) + 10;
|
| 292 |
+
if (y + h > BOTTOM) { newPage(); tableHeader(cols); }
|
| 293 |
+
var x = L;
|
| 294 |
+
prepared.forEach(function (pc, i) {
|
| 295 |
+
var col = cols[i], right = col.align === "right", tx = right ? x + col.w - 6 : x + 6;
|
| 296 |
+
pc.lines.forEach(function (t, k) { wr.text(tx, y + 13 + k * 12.5, t, { size: 9.4, bold: pc.cell.bold, color: pc.cell.color || (row.muted ? SOFT : INK), align: right ? "right" : "left" }); });
|
| 297 |
+
if (pc.cell.sub) wr.text(tx, y + 13 + pc.lines.length * 12.5, pc.cell.sub.t, { size: 6.8, bold: true, color: pc.cell.sub.color, spacing: 0.4 });
|
| 298 |
+
if (row.strike && i === 0) pc.lines.forEach(function (t, k) { var tw = width(t, 9.4, false); wr.line(tx, y + 10 + k * 12.5, tx + tw, y + 10 + k * 12.5, SOFT, 0.6); });
|
| 299 |
+
x += col.w;
|
| 300 |
+
});
|
| 301 |
+
y += h;
|
| 302 |
+
wr.line(L, y - 1, R, y - 1, RULE, 0.5);
|
| 303 |
+
});
|
| 304 |
+
y += 6;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
function pricing() {
|
| 308 |
+
var pr = p.pricing || {}, T = C.totals(p), ks = C.packages(p);
|
| 309 |
+
if (pr.layout === "packages" && ks.length) {
|
| 310 |
+
var gap = 10, n = ks.length, w = (CW - gap * (n - 1)) / n, inner = w - 24;
|
| 311 |
+
var cards = ks.map(function (k) {
|
| 312 |
+
var blurb = k.blurb ? wrap(fill(k.blurb), inner, 9, false) : [];
|
| 313 |
+
var feats = k.features.map(function (ft) { return wrap(fill(ft), inner - 10, 9, false); });
|
| 314 |
+
var h = 18 + 18 + 26 + blurb.length * 12 + 6 + feats.reduce(function (s, fl) { return s + fl.length * 12 + 3; }, 0) + 12;
|
| 315 |
+
return { k: k, blurb: blurb, feats: feats, h: h };
|
| 316 |
+
});
|
| 317 |
+
var ch = Math.max.apply(null, cards.map(function (cd) { return cd.h; }));
|
| 318 |
+
ensure(ch + 16); y += 8;
|
| 319 |
+
cards.forEach(function (cd, i) {
|
| 320 |
+
var x = L + i * (w + gap), k = cd.k, yy = y;
|
| 321 |
+
wr.rect(x, yy, w, ch, null, k.recommended ? acc : "#D9D5DD", k.recommended ? 2 : 1);
|
| 322 |
+
if (k.recommended) { wr.rect(x + 10, yy - 7, width("RECOMMENDED", 6.5, true) + 0.6 * 10 + 12, 13, acc); wr.text(x + 16, yy + 2.6, "RECOMMENDED", { size: 6.5, bold: true, color: WHITE, spacing: 0.6 }); }
|
| 323 |
+
yy += 26; wr.text(x + 12, yy, fill(k.name), { size: 12.5, bold: true });
|
| 324 |
+
yy += 24; var pw = wr.text(x + 12, yy, C.moneyShort(k.price, cur, canEncode), { size: 17, bold: true, color: acc });
|
| 325 |
+
if (k.billing === "month") wr.text(x + 14 + pw, yy, "/month", { size: 8.5, color: MUTED });
|
| 326 |
+
yy += 8;
|
| 327 |
+
cd.blurb.forEach(function (t) { yy += 12; wr.text(x + 12, yy, t, { size: 9, color: "#4B5160" }); });
|
| 328 |
+
yy += 8;
|
| 329 |
+
cd.feats.forEach(function (fl) {
|
| 330 |
+
fl.forEach(function (t, j) { yy += 12; if (!j) wr.rect(x + 12, yy - 4.6, 3, 3, acc); wr.text(x + 21, yy, t, { size: 9 }); });
|
| 331 |
+
yy += 3;
|
| 332 |
+
});
|
| 333 |
+
});
|
| 334 |
+
y += ch + 14;
|
| 335 |
+
var opt = T.items.map(function (x, i) { return [x, T.lines[i]]; }).filter(function (a) { return a[1].optional; });
|
| 336 |
+
if (opt.length) {
|
| 337 |
+
ensure(60); y += 4; wr.text(L, y + 10, "Optional add-ons", { size: 11, bold: true }); y += 18;
|
| 338 |
+
table([{ t: "Add-on", w: CW - 130 }, { t: "Price", w: 130, align: "right" }], opt.map(function (a) {
|
| 339 |
+
return { cells: [{ t: fill(a[0].desc) + (a[1].qty !== 1 ? " (" + C.round(a[1].qty, 3) + " x " + money(a[1].rate) + ")" : "") }, { t: money(a[1].net) + (a[1].billing === "month" ? " /month" : ""), bold: true }] };
|
| 340 |
+
}));
|
| 341 |
+
}
|
| 342 |
+
if (C.parseNum(pr.tax) > 0) { ensure(14); y += 10; wr.text(R, y, "Prices exclude " + (pr.taxLabel || "tax") + " (" + C.round(C.parseNum(pr.tax), 3) + "%).", { size: 8.5, color: MUTED, align: "right" }); y += 8; }
|
| 343 |
+
return;
|
| 344 |
+
}
|
| 345 |
+
if (!T.items.length) return;
|
| 346 |
+
var cols = [{ t: "Item", w: 0 }, { t: "Qty", w: 40, align: "right" }, { t: "Rate", w: 78, align: "right" }];
|
| 347 |
+
if (T.hasMonthly) cols.push({ t: "Billing", w: 62 });
|
| 348 |
+
cols.push({ t: "Amount", w: 84, align: "right" });
|
| 349 |
+
cols[0].w = CW - cols.slice(1).reduce(function (s, x) { return s + x.w; }, 0);
|
| 350 |
+
table(cols, T.items.map(function (x, i) {
|
| 351 |
+
var l = T.lines[i], cells = [{ t: fill(x.desc), sub: l.optional ? { t: l.included ? "OPTIONAL · INCLUDED" : "OPTIONAL · NOT INCLUDED", color: l.included ? acc : SOFT } : null },
|
| 352 |
+
{ t: String(C.round(l.qty, 3)) }, { t: money(l.rate) }];
|
| 353 |
+
if (T.hasMonthly) cells.push({ t: l.billing === "month" ? "Monthly" : "One-time" });
|
| 354 |
+
cells.push({ t: money(l.net), bold: true });
|
| 355 |
+
return { cells: cells, muted: l.optional && !l.included, strike: l.optional && !l.included };
|
| 356 |
+
}));
|
| 357 |
+
var rows = [], dd = pr.discount || {}, tl = pr.taxLabel || "Tax";
|
| 358 |
+
function grp(g, label, suf) {
|
| 359 |
+
if (!g.count) return;
|
| 360 |
+
if (rows.length) rows.push(null);
|
| 361 |
+
rows.push([label + " subtotal", money(g.sub) + suf]);
|
| 362 |
+
if (g.disc > 0) rows.push(["Discount" + (dd.type === "amt" ? "" : " (" + C.round(C.parseNum(dd.value), 3) + "%)"), "-" + money(g.disc) + suf]);
|
| 363 |
+
if (g.tax > 0) rows.push([tl + " " + C.round(C.parseNum(pr.tax), 3) + "%", money(g.tax) + suf]);
|
| 364 |
+
rows.push({ total: label === "One-time" ? "Total one-time" : "Total monthly", v: money(g.total) + suf });
|
| 365 |
+
}
|
| 366 |
+
grp(T.once, "One-time", ""); grp(T.month, "Monthly", " /mo");
|
| 367 |
+
var need = rows.reduce(function (s, r) { return s + (r === null ? 8 : r.total ? 30 : 15); }, 0) + (T.once.count && T.month.count ? 18 : 0);
|
| 368 |
+
ensure(need + 6);
|
| 369 |
+
var tx = R - 250;
|
| 370 |
+
rows.forEach(function (r) {
|
| 371 |
+
if (r === null) { y += 8; return; }
|
| 372 |
+
if (r.total) {
|
| 373 |
+
y += 4; wr.line(tx, y, R, y, acc, 1.4);
|
| 374 |
+
wr.text(tx, y + 16, r.total, { size: 10.5, bold: true }); wr.text(R, y + 16, r.v, { size: 12, bold: true, color: acc, align: "right" });
|
| 375 |
+
y += 26; return;
|
| 376 |
+
}
|
| 377 |
+
wr.text(tx, y + 11, r[0], { size: 9.4, color: MUTED }); wr.text(R, y + 11, r[1], { size: 9.4, align: "right" }); y += 15;
|
| 378 |
+
});
|
| 379 |
+
if (T.once.count && T.month.count) { y += 4; wr.text(R, y + 9, "First 12 months: " + money(T.year1), { size: 8.5, color: MUTED, align: "right" }); y += 14; }
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
function timeline() {
|
| 383 |
+
var rows = (p.timeline || []).filter(function (r) { return String(r.phase || r.detail || r.when || "").trim(); });
|
| 384 |
+
if (!rows.length) return;
|
| 385 |
+
table([{ t: "Phase", w: 120 }, { t: "What happens", w: CW - 230 }, { t: "When", w: 110, align: "right" }], rows.map(function (r) {
|
| 386 |
+
return { cells: [{ t: fill(r.phase), bold: true }, { t: fill(r.detail) }, { t: fill(r.when), bold: true, color: acc }] };
|
| 387 |
+
}));
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
function acceptance() {
|
| 391 |
+
var a = p.accept || {};
|
| 392 |
+
var intro = wrap("I accept this proposal" + (title ? " (" + title + ")" : "") + ", including its scope, pricing and terms.", CW - 28, SIZE, false);
|
| 393 |
+
var h = 18 + intro.length * LH + 62 + 34;
|
| 394 |
+
ensure(h + 8); y += 4;
|
| 395 |
+
wr.rect(L, y, CW, h, null, acc, 1.6);
|
| 396 |
+
var yy = y + 10;
|
| 397 |
+
intro.forEach(function (t) { yy += LH; wr.text(L + 14, yy - 3, t, { size: SIZE }); });
|
| 398 |
+
yy += 30;
|
| 399 |
+
var fw = [(CW - 28 - 36) * 0.44, (CW - 28 - 36) * 0.32, (CW - 28 - 36) * 0.24], fx = L + 14;
|
| 400 |
+
[[a.name, "ACCEPTED BY (TYPED NAME)"], [a.role, "TITLE AND COMPANY"], [a.date ? C.fmtDate(a.date, loc) : "", "DATE"]].forEach(function (fd, i) {
|
| 401 |
+
if (fd[0]) wrap(fd[0], fw[i], 11.5, true).slice(0, 1).forEach(function (t) { wr.text(fx, yy, t, { size: 11.5, bold: true }); });
|
| 402 |
+
wr.line(fx, yy + 5, fx + fw[i], yy + 5, INK, 0.9);
|
| 403 |
+
wr.text(fx, yy + 17, fd[1], { size: 6.8, bold: true, color: MUTED, spacing: 0.4 });
|
| 404 |
+
fx += fw[i] + 18;
|
| 405 |
+
});
|
| 406 |
+
yy += 40;
|
| 407 |
+
wr.text(L + 14, yy, "Typing a name here is a record of acceptance, not an electronic signature.", { size: 8.2, italic: true, color: MUTED });
|
| 408 |
+
y += h + 6;
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
(p.sections || []).forEach(function (s, idx) {
|
| 412 |
+
var st = wrap(fill(s.title) || " ", CW, 17, true);
|
| 413 |
+
if (wr.pages.length === 1) newPage();
|
| 414 |
+
else {
|
| 415 |
+
y += 14;
|
| 416 |
+
var introH = s.body ? Math.min(C.plain(fill(s.body)).length / 95 + 1, 6) * LH : 0;
|
| 417 |
+
var need = s.kind === "pricing" ? 150 : s.kind === "timeline" ? 110 : s.kind === "acceptance" ? 160 : LH * 3;
|
| 418 |
+
ensure(st.length * 21 + 34 + (s.kind === "text" ? need : introH + need));
|
| 419 |
+
}
|
| 420 |
+
wr.text(L, y + 8, ("0" + (idx + 1)).slice(-2), { size: 8, bold: true, color: SOFT, spacing: 1.5 });
|
| 421 |
+
y += 10;
|
| 422 |
+
st.forEach(function (t) { y += 21; wr.text(L, y, t, { size: 17, bold: true, color: acc }); });
|
| 423 |
+
y += 8; wr.rect(L, y, CW, 1.6, tint); y += 14;
|
| 424 |
+
if (s.body) richBlock(s.body);
|
| 425 |
+
if (s.kind === "pricing") pricing();
|
| 426 |
+
else if (s.kind === "timeline") timeline();
|
| 427 |
+
else if (s.kind === "acceptance") acceptance();
|
| 428 |
+
});
|
| 429 |
+
|
| 430 |
+
/* footer on every page */
|
| 431 |
+
var n = wr.pages.length;
|
| 432 |
+
for (var i = 0; i < n; i++) {
|
| 433 |
+
wr.on(i);
|
| 434 |
+
var fy = i === 0 ? H - 22 : H - 30;
|
| 435 |
+
if (opts.credit) {
|
| 436 |
+
var cw = wr.text(L, fy, C.CREDIT, { size: 7.5, color: i === 0 ? MUTED : SOFT });
|
| 437 |
+
if (opts.creditUrl) wr.link(L, fy - 8, cw, 11, opts.creditUrl);
|
| 438 |
+
}
|
| 439 |
+
if (i > 0) wr.text(R, fy, "Page " + (i + 1) + " of " + n, { size: 7.5, color: SOFT, align: "right" });
|
| 440 |
+
}
|
| 441 |
+
var d = opts.date || new Date();
|
| 442 |
+
var stamp = d.getUTCFullYear() + [d.getUTCMonth() + 1, d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()].map(function (v) { return ("0" + v).slice(-2); }).join("") + "Z";
|
| 443 |
+
return serialize(wr, { title: title + (who ? " - " + who : ""), author: f.name || "", date: stamp }, opts.logo && opts.logo.bytes ? opts.logo : null);
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
var api = { build: build, encode: encode, canEncode: canEncode, width: width, wrap: wrap, wrapRuns: wrapRuns, pageSize: pageSize };
|
| 447 |
+
if (typeof module === "object" && module.exports) module.exports = api; else root.PSPDF = api;
|
| 448 |
+
})(typeof self !== "undefined" ? self : this);
|
pitchsprig/manifest.webmanifest
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "Pitchsprig: proposal generator",
|
| 3 |
+
"short_name": "Pitchsprig",
|
| 4 |
+
"description": "Client proposals as a polished PDF in minutes: templates by service, pricing with options and packages, timeline and acceptance. Free, nothing uploaded, works offline.",
|
| 5 |
+
"start_url": "./?utm_source=pwa",
|
| 6 |
+
"scope": "./",
|
| 7 |
+
"display": "standalone",
|
| 8 |
+
"background_color": "#F7F3F1",
|
| 9 |
+
"theme_color": "#8A2C5A",
|
| 10 |
+
"categories": ["business", "productivity"],
|
| 11 |
+
"icons": [
|
| 12 |
+
{"src": "icon.svg", "sizes": "any", "type": "image/svg+xml"},
|
| 13 |
+
{"src": "icon-192.png", "sizes": "192x192", "type": "image/png"},
|
| 14 |
+
{"src": "icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any"},
|
| 15 |
+
{"src": "icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable"}
|
| 16 |
+
]
|
| 17 |
+
}
|
pitchsprig/og.png
ADDED
|
Git LFS Details
|
pitchsprig/pro.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* CyberMax Pro unlock with plans, for static web apps (copied into each product's web/ folder; each product stays
|
| 2 |
+
* self-contained). Extends pro.js with several plans (monthly, yearly, one-time) and a re-check for subscriptions.
|
| 3 |
+
* Config before this script:
|
| 4 |
+
* window.CMX_PRO = { id, name, perks: [..], plans: [{ offer, label, price, per, note, best }], free: "one line" }
|
| 5 |
+
* Buy: counted link https://data.cybermax-tools.workers.dev/buy/<offer>?s=app-<id> -> Stripe Payment Link.
|
| 6 |
+
* After checkout Stripe sends the buyer to data.cybermax-tools.workers.dev/unlock/<id>?session_id=..., which checks the
|
| 7 |
+
* Checkout Session (and, for a subscription, that it is still active) and returns here with #cmx-pro=<session id>.
|
| 8 |
+
* The app checks that code once (/unlock/<id>?json=1&session_id=..) and remembers Pro in this browser; it re-checks every
|
| 9 |
+
* 3 days, so a cancelled subscription turns off by itself (one tiny request per buyer every 3 days, none for free users).
|
| 10 |
+
* The same code (shown on the receipt page and in the Pro box) unlocks Pro on another device. No account, no tracking.
|
| 11 |
+
* (c) 2026 CyberMax. All rights reserved. */
|
| 12 |
+
(function () {
|
| 13 |
+
"use strict";
|
| 14 |
+
var C = window.CMX_PRO || {};
|
| 15 |
+
if (!C.id) return;
|
| 16 |
+
var DATA = "https://data.cybermax-tools.workers.dev";
|
| 17 |
+
var KEY = "cmx-pro:" + C.id;
|
| 18 |
+
var SID = /^cs_(live|test)_[A-Za-z0-9]{10,200}$/;
|
| 19 |
+
var RECHECK = 3 * 864e5;
|
| 20 |
+
var listeners = [];
|
| 21 |
+
|
| 22 |
+
function get() { try { return JSON.parse(localStorage.getItem(KEY) || "null"); } catch (e) { return null; } }
|
| 23 |
+
function set(v) { try { if (v) localStorage.setItem(KEY, JSON.stringify(v)); else localStorage.removeItem(KEY); } catch (e) { /* private mode */ } mem = v; }
|
| 24 |
+
var mem = get();
|
| 25 |
+
function isPro() { return !!(mem && mem.code); }
|
| 26 |
+
|
| 27 |
+
function check(code) {
|
| 28 |
+
return fetch(DATA + "/unlock/" + encodeURIComponent(C.id) + "?json=1&session_id=" + encodeURIComponent(code))
|
| 29 |
+
.then(function (r) { return r.json(); })
|
| 30 |
+
.then(function (j) { return j && typeof j.pro === "boolean" ? j.pro : null; })
|
| 31 |
+
.catch(function () { return null; });
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
function unlock(code) {
|
| 35 |
+
return check(code).then(function (ok) {
|
| 36 |
+
if (ok) { set({ code: code, at: new Date().toISOString(), checked: Date.now() }); apply(); toast("Pro unlocked. Thank you for choosing " + C.name + "!"); }
|
| 37 |
+
else if (ok === false) toast("That code is not an active " + C.name + " Pro order.");
|
| 38 |
+
else toast("Could not reach the unlock check. Try again in a minute.");
|
| 39 |
+
return ok;
|
| 40 |
+
});
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
function recheck() {
|
| 44 |
+
if (!isPro() || Date.now() - (mem.checked || 0) < RECHECK) return;
|
| 45 |
+
check(mem.code).then(function (ok) {
|
| 46 |
+
if (ok === false) { set(null); apply(); toast(C.name + " Pro has ended in this browser. Everything free is still here."); }
|
| 47 |
+
else if (ok) set(Object.assign({}, mem, { checked: Date.now() }));
|
| 48 |
+
});
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function toast(msg) {
|
| 52 |
+
var t = document.getElementById("toast");
|
| 53 |
+
if (t) { t.textContent = msg; t.hidden = false; t.classList.add("show"); setTimeout(function () { t.classList.remove("show"); }, 3500); }
|
| 54 |
+
var s = document.getElementById("cmx-pro-msg");
|
| 55 |
+
if (s) s.textContent = msg;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """ }[c]; }); }
|
| 59 |
+
function buyUrl(offer, from) { return DATA + "/buy/" + offer + "?s=app-" + C.id + (from ? "-" + from : ""); }
|
| 60 |
+
|
| 61 |
+
function box() {
|
| 62 |
+
var el = document.getElementById("cmx-pro");
|
| 63 |
+
if (!el) {
|
| 64 |
+
el = document.createElement("section");
|
| 65 |
+
el.id = "cmx-pro";
|
| 66 |
+
var anchor = document.querySelector("footer.more") || document.querySelector("main footer") || document.querySelector("footer");
|
| 67 |
+
if (anchor && anchor.parentNode) anchor.parentNode.insertBefore(el, anchor); else (document.querySelector("main") || document.body).appendChild(el);
|
| 68 |
+
}
|
| 69 |
+
el.className = "cmx-pro";
|
| 70 |
+
return el;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
function render() {
|
| 74 |
+
var el = box();
|
| 75 |
+
if (isPro()) {
|
| 76 |
+
el.innerHTML = '<h2>' + esc(C.name) + ' Pro <span class="cmx-pro-badge">on</span></h2><p>Thank you! Pro is on in this browser: ' + C.perks.map(esc).join(" · ") +
|
| 77 |
+
'.</p><p class="cmx-pro-small">Your unlock code (paste it on another device): <code style="user-select:all;word-break:break-all">' + esc(mem.code) +
|
| 78 |
+
'</code></p><p class="cmx-pro-small">Monthly or yearly plan? Cancel any time from the link in your Stripe receipt email.</p>';
|
| 79 |
+
return;
|
| 80 |
+
}
|
| 81 |
+
var plans = (C.plans || []).map(function (p) {
|
| 82 |
+
return '<a class="cmx-plan' + (p.best ? " best" : "") + '" href="' + buyUrl(p.offer) + '" rel="nofollow" data-offer="' + esc(p.offer) + '">' +
|
| 83 |
+
(p.best ? "<i>Best value</i>" : "") + "<b>" + esc(p.label) + '</b><span class="cmx-price">' + esc(p.price) + "<small>" + esc(p.per || "") +
|
| 84 |
+
'</small></span><span class="cmx-note">' + esc(p.note || "") + "</span></a>";
|
| 85 |
+
}).join("");
|
| 86 |
+
el.innerHTML = '<h2>' + esc(C.name) + ' Pro</h2>' + (C.free ? '<p class="cmx-pro-small">Free: ' + esc(C.free) + "</p>" : "") +
|
| 87 |
+
"<ul>" + C.perks.map(function (p) { return "<li>" + esc(p) + "</li>"; }).join("") + '</ul><div class="cmx-plans">' + plans +
|
| 88 |
+
'</div><p class="cmx-pro-small">Secure Stripe checkout. Pro turns on the moment you pay; no account needed. Subscriptions cancel any time.</p>' +
|
| 89 |
+
'<details><summary>Already bought Pro?</summary><form id="cmx-pro-form"><label>Unlock code <input id="cmx-pro-code" autocomplete="off" placeholder="cs_live_…"></label> <button class="btn ghost" type="submit">Unlock</button></form></details><p id="cmx-pro-msg" class="cmx-pro-small" aria-live="polite"></p>';
|
| 90 |
+
var f = document.getElementById("cmx-pro-form");
|
| 91 |
+
if (f) f.onsubmit = function (e) { e.preventDefault(); var c = (document.getElementById("cmx-pro-code").value || "").trim(); if (SID.test(c)) unlock(c); else toast("Paste the code from your receipt page (it starts with cs_live_)."); };
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function apply() {
|
| 95 |
+
document.documentElement.classList.toggle("cmx-pro", isPro());
|
| 96 |
+
render();
|
| 97 |
+
listeners.forEach(function (fn) { try { fn(isPro()); } catch (e) { /* app hook */ } });
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/** Scroll to the Pro box (call when a free user hits a limit); `from` tags the counted buy links. */
|
| 101 |
+
function upsell(reason, from) {
|
| 102 |
+
var el = box();
|
| 103 |
+
if (from) Array.prototype.forEach.call(el.querySelectorAll("a.cmx-plan"), function (a) { a.href = buyUrl(a.getAttribute("data-offer"), from); });
|
| 104 |
+
if (reason) toast(reason);
|
| 105 |
+
el.scrollIntoView({ behavior: "smooth", block: "start" });
|
| 106 |
+
el.classList.add("cmx-pro-flash"); setTimeout(function () { el.classList.remove("cmx-pro-flash"); }, 1600);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/** Free monthly allowance kept in this browser: quota("pdf", 5) -> {used, left, take()}. */
|
| 110 |
+
function quota(name, limit) {
|
| 111 |
+
var k = "cmx-quota:" + C.id + ":" + name, month = new Date().toISOString().slice(0, 7), q;
|
| 112 |
+
try { q = JSON.parse(localStorage.getItem(k) || "null"); } catch (e) { q = null; }
|
| 113 |
+
if (!q || q.m !== month) q = { m: month, n: 0 };
|
| 114 |
+
return {
|
| 115 |
+
used: q.n, left: Math.max(0, limit - q.n), limit: limit,
|
| 116 |
+
take: function () { if (isPro()) return true; if (q.n >= limit) return false; q.n++; try { localStorage.setItem(k, JSON.stringify(q)); } catch (e) { /* */ } this.used = q.n; this.left = Math.max(0, limit - q.n); return true; },
|
| 117 |
+
};
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
function download(name, data, type) {
|
| 121 |
+
var a = document.createElement("a");
|
| 122 |
+
a.href = URL.createObjectURL(data instanceof Blob ? data : new Blob([data], { type: type || "text/csv;charset=utf-8" }));
|
| 123 |
+
a.download = name;
|
| 124 |
+
document.body.appendChild(a); a.click(); a.remove();
|
| 125 |
+
setTimeout(function () { URL.revokeObjectURL(a.href); }, 2000);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
window.CMXPro = { isPro: isPro, onChange: function (fn) { listeners.push(fn); fn(isPro()); }, upsell: upsell, quota: quota, download: download, toast: toast };
|
| 129 |
+
|
| 130 |
+
var m = /[#&]cmx-pro=([^&]+)/.exec(location.hash || "");
|
| 131 |
+
function start() {
|
| 132 |
+
if (m && SID.test(decodeURIComponent(m[1]))) {
|
| 133 |
+
var code = decodeURIComponent(m[1]);
|
| 134 |
+
history.replaceState(null, "", location.pathname + location.search);
|
| 135 |
+
apply(); unlock(code);
|
| 136 |
+
} else { apply(); recheck(); }
|
| 137 |
+
}
|
| 138 |
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start); else start();
|
| 139 |
+
})();
|
pitchsprig/robots.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
User-agent: *
|
| 2 |
+
Allow: /
|
| 3 |
+
Sitemap: https://cybermax-tools-cybermax.static.hf.space/pitchsprig/sitemap.xml
|
pitchsprig/sitemap.xml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://cybermax-tools-cybermax.static.hf.space/pitchsprig/index.html</loc><lastmod>2026-10-02</lastmod><changefreq>monthly</changefreq></url></urlset>
|
pitchsprig/style.css
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Pitchsprig. © 2026 CyberMax. All rights reserved. */
|
| 2 |
+
:root{
|
| 3 |
+
--accent:#8A2C5A;--accent2:#5E1D3D;--ink:#1A1D24;--muted:#5F6472;--bg:#F7F3F1;--card:#FFFFFF;--line:#E6DFE0;--field:#FFFFFF;
|
| 4 |
+
--soft:#F6EAF0;--warn:#9A4B00;--on:#FFFFFF;--shadow:0 1px 2px rgba(26,29,36,.06),0 6px 24px rgba(26,29,36,.06);
|
| 5 |
+
color-scheme:light dark;
|
| 6 |
+
}
|
| 7 |
+
@media (prefers-color-scheme:dark){
|
| 8 |
+
:root{--accent:#E58AB5;--accent2:#F3B8D2;--ink:#EEEDF1;--muted:#A9A6B2;--bg:#141218;--card:#1D1A22;--line:#332E3A;--field:#16141B;--soft:#2C1E27;--warn:#F2B66B;--on:#1A0D14;--shadow:none}
|
| 9 |
+
}
|
| 10 |
+
*{box-sizing:border-box}
|
| 11 |
+
[hidden]{display:none!important}
|
| 12 |
+
html{-webkit-text-size-adjust:100%;scroll-padding-top:70px;scroll-padding-bottom:84px}
|
| 13 |
+
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
|
| 14 |
+
a{color:var(--accent)}
|
| 15 |
+
code{font-size:.86em;background:var(--soft);padding:1px 4px;border-radius:4px}
|
| 16 |
+
.wrap{max-width:1260px;margin:0 auto;padding:0 16px}
|
| 17 |
+
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
|
| 18 |
+
h1,h2,h3{line-height:1.2;letter-spacing:-.01em}
|
| 19 |
+
h1{font-size:clamp(1.7rem,4.4vw,2.6rem);margin:18px 0 8px;font-weight:800}
|
| 20 |
+
h2{font-size:1.15rem;margin:0}
|
| 21 |
+
:focus-visible{outline:3px solid color-mix(in srgb,var(--accent) 55%,transparent);outline-offset:2px}
|
| 22 |
+
|
| 23 |
+
/* header */
|
| 24 |
+
.top{position:sticky;top:0;z-index:20;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}
|
| 25 |
+
.top-in{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:56px}
|
| 26 |
+
.brand{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--ink);font-size:1.12rem;min-width:0}
|
| 27 |
+
.brand small{color:var(--muted);font-weight:500;font-size:.78rem}
|
| 28 |
+
.top-nav{display:flex;align-items:center;gap:8px}
|
| 29 |
+
.top-link{color:var(--ink);text-decoration:none;font-weight:600;font-size:.93rem;padding:6px 4px}
|
| 30 |
+
.pill{background:var(--accent);color:var(--on);text-decoration:none;font-weight:800;font-size:.8rem;padding:5px 12px;border-radius:999px;letter-spacing:.02em;white-space:nowrap}
|
| 31 |
+
html.cmx-pro .pill{background:transparent;color:var(--accent);border:2px solid var(--accent)}
|
| 32 |
+
|
| 33 |
+
/* hero */
|
| 34 |
+
.hero{padding:4px 0 12px}
|
| 35 |
+
.lede{font-size:1.06rem;max-width:780px;margin:0 0 14px}
|
| 36 |
+
.hero-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
|
| 37 |
+
.hero-note{color:var(--muted);font-size:.9rem}
|
| 38 |
+
.sel-inline select{width:auto;max-width:100%}
|
| 39 |
+
|
| 40 |
+
/* controls */
|
| 41 |
+
.btn{appearance:none;border:2px solid var(--accent);background:var(--accent);color:var(--on);font:inherit;font-weight:700;border-radius:10px;padding:9px 16px;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:6px;line-height:1.2;justify-content:center}
|
| 42 |
+
.btn:hover{filter:brightness(1.07)}
|
| 43 |
+
.btn.ghost{background:transparent;color:var(--ink);border-color:var(--line)}
|
| 44 |
+
.btn.ghost:hover{border-color:var(--accent)}
|
| 45 |
+
.btn.sm{padding:6px 11px;font-size:.88rem;border-radius:9px}
|
| 46 |
+
.btn.big{padding:12px 22px;font-size:1.05rem;flex:1}
|
| 47 |
+
.btn.danger{color:#B42318}
|
| 48 |
+
@media (prefers-color-scheme:dark){.btn.danger{color:#FF8A80}}
|
| 49 |
+
.pro-tag,.free-tag{display:inline-block;font-size:.64rem;font-weight:800;letter-spacing:.04em;background:var(--accent);color:var(--on);border-radius:5px;padding:1px 5px;vertical-align:middle;font-style:normal}
|
| 50 |
+
.free-tag{background:transparent;color:var(--muted);border:1px solid var(--line)}
|
| 51 |
+
html.cmx-pro .pro-tag{display:none}
|
| 52 |
+
label{display:block;font-size:.84rem;font-weight:600;margin:10px 0 4px}
|
| 53 |
+
.opt{font-weight:400;color:var(--muted)}
|
| 54 |
+
input,select,textarea{width:100%;font:inherit;font-size:16px;color:var(--ink);background:var(--field);border:1.5px solid var(--line);border-radius:9px;padding:9px 10px;min-width:0}
|
| 55 |
+
textarea{resize:vertical;line-height:1.45}
|
| 56 |
+
input:focus,select:focus,textarea:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent)}
|
| 57 |
+
input[type=checkbox],input[type=radio]{width:auto;accent-color:var(--accent)}
|
| 58 |
+
.check{display:flex;gap:7px;align-items:center;font-weight:600;margin:6px 0}
|
| 59 |
+
.hint{color:var(--muted);font-size:.86rem;margin:6px 0}
|
| 60 |
+
.btns{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:12px}
|
| 61 |
+
.combo{display:flex;gap:6px}.combo>*{flex:1 1 0;min-width:0}.combo select{flex:0 0 auto;width:auto}
|
| 62 |
+
.icon-btn{appearance:none;border:1.5px solid var(--line);background:transparent;color:var(--ink);width:36px;height:36px;border-radius:9px;cursor:pointer;font-size:1rem;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}
|
| 63 |
+
.icon-btn:hover{border-color:var(--accent);color:var(--accent)}
|
| 64 |
+
|
| 65 |
+
/* app */
|
| 66 |
+
.app{padding-bottom:10px}
|
| 67 |
+
.cols{display:grid;grid-template-columns:minmax(0,1fr);gap:16px;align-items:start}
|
| 68 |
+
@media (min-width:1000px){.cols{grid-template-columns:minmax(0,470px) minmax(0,1fr)}.preview-col{position:sticky;top:70px}}
|
| 69 |
+
@media (min-width:1200px){.cols{grid-template-columns:minmax(0,520px) minmax(0,1fr)}}
|
| 70 |
+
.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px 16px;box-shadow:var(--shadow);min-width:0}
|
| 71 |
+
.editor{display:flex;flex-direction:column;gap:12px;min-width:0}
|
| 72 |
+
.editor>details>summary{cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between}
|
| 73 |
+
.editor summary::-webkit-details-marker{display:none}
|
| 74 |
+
.editor>details>summary::after{content:"";width:9px;height:9px;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(45deg);margin-right:4px;transition:transform .15s}
|
| 75 |
+
.editor>details[open]>summary::after{transform:rotate(225deg)}
|
| 76 |
+
.editor>details[open]>summary{margin-bottom:4px}
|
| 77 |
+
.g2{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
|
| 78 |
+
.g3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:0 12px}
|
| 79 |
+
.span2{grid-column:span 2}
|
| 80 |
+
|
| 81 |
+
/* templates */
|
| 82 |
+
.tpls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0 2px}
|
| 83 |
+
.tpls button{appearance:none;font:inherit;text-align:left;border:1.5px solid var(--line);background:transparent;color:var(--ink);border-radius:11px;padding:9px 10px 10px;cursor:pointer;display:flex;flex-direction:column;gap:2px;position:relative;min-width:0}
|
| 84 |
+
.tpls button b{display:block;font-size:.9rem;padding-right:40px}
|
| 85 |
+
.tpls button small{color:var(--muted);font-size:.76rem;line-height:1.3}
|
| 86 |
+
.tpls button .pro-tag,.tpls button .free-tag{position:absolute;top:8px;right:8px}
|
| 87 |
+
.tpls button[aria-checked=true]{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent) inset;background:var(--soft)}
|
| 88 |
+
.tpls button:hover{border-color:var(--accent)}
|
| 89 |
+
|
| 90 |
+
/* sections */
|
| 91 |
+
.sec{border:1px solid var(--line);border-radius:11px;margin:8px 0;background:var(--bg)}
|
| 92 |
+
.sec>summary{display:flex;align-items:center;gap:10px;padding:10px 12px;cursor:pointer;list-style:none;min-width:0}
|
| 93 |
+
.sec>summary::-webkit-details-marker{display:none}
|
| 94 |
+
.sec-n{font-size:.74rem;font-weight:800;color:var(--muted);letter-spacing:.06em}
|
| 95 |
+
.sec-t{font-weight:700;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
| 96 |
+
.kind{font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:1px 8px;white-space:nowrap}
|
| 97 |
+
.kind-pricing,.kind-timeline,.kind-acceptance{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 40%,transparent)}
|
| 98 |
+
.sec-body{padding:0 12px 12px}
|
| 99 |
+
.sec-body label:first-child{margin-top:0}
|
| 100 |
+
.tb{display:flex;flex-wrap:wrap;gap:4px;margin:2px 0 6px}
|
| 101 |
+
.tb button{appearance:none;font:inherit;font-size:.84rem;border:1.5px solid var(--line);background:var(--card);color:var(--ink);border-radius:7px;padding:4px 10px;cursor:pointer;min-width:36px}
|
| 102 |
+
.tb button:hover{border-color:var(--accent)}
|
| 103 |
+
.sec-tools{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}
|
| 104 |
+
.sec-tools .danger{margin-left:auto}
|
| 105 |
+
.add-row select{width:auto;flex:1 1 150px}
|
| 106 |
+
#library-pick{margin-top:10px}
|
| 107 |
+
.lib{list-style:none;padding:0;margin:6px 0}
|
| 108 |
+
.lib li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px dashed var(--line)}
|
| 109 |
+
.lib li span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
|
| 110 |
+
|
| 111 |
+
/* pricing */
|
| 112 |
+
.seg{display:flex;flex-wrap:wrap;gap:4px;background:var(--bg);border:1px solid var(--line);border-radius:11px;padding:4px;margin:6px 0 8px}
|
| 113 |
+
.seg button{appearance:none;font:inherit;font-weight:700;font-size:.88rem;border:0;background:transparent;color:var(--ink);padding:7px 12px;border-radius:8px;cursor:pointer;flex:1 1 auto}
|
| 114 |
+
.seg button[aria-checked=true]{background:var(--accent);color:var(--on)}
|
| 115 |
+
.seg button[aria-checked=true] .pro-tag{background:var(--on);color:var(--accent)}
|
| 116 |
+
.item{display:grid;grid-template-columns:.8fr 1.1fr 1.3fr;gap:4px 8px;padding:10px 0;border-bottom:1px dashed var(--line);align-items:end}
|
| 117 |
+
.item .i-desc{grid-column:1/-1}
|
| 118 |
+
.item label{margin:0 0 2px;font-size:.74rem;color:var(--muted)}
|
| 119 |
+
.item .check{font-size:.84rem;color:var(--ink);margin:2px 0}
|
| 120 |
+
.i-flags{grid-column:1/2;display:flex;flex-direction:column}
|
| 121 |
+
.item:not(.is-opt) .i-sel{display:none}
|
| 122 |
+
.i-amt{grid-column:2/3;font-weight:800;font-variant-numeric:tabular-nums;font-size:.92rem;align-self:center}
|
| 123 |
+
.item .i-tools,.phase .i-tools{display:flex;gap:6px;justify-content:flex-end;align-self:center}
|
| 124 |
+
.tot-line{font-weight:700;margin:12px 0 0;color:var(--accent);font-size:.93rem}
|
| 125 |
+
.tot-line:empty{display:none}
|
| 126 |
+
.pkgs-ed{display:grid;grid-template-columns:1fr;gap:10px}
|
| 127 |
+
.pk{border:1px solid var(--line);border-radius:11px;padding:6px 12px 10px;margin:0;min-width:0}
|
| 128 |
+
.pk legend{font-weight:800;font-size:.84rem;padding:0 4px}
|
| 129 |
+
.pk label{margin-top:6px}
|
| 130 |
+
.phase{display:grid;grid-template-columns:1fr 1fr auto;gap:4px 8px;padding:8px 0;border-bottom:1px dashed var(--line);align-items:end}
|
| 131 |
+
.phase .ph-d{grid-column:1/-1;order:3}
|
| 132 |
+
.phase .i-tools{order:4;grid-column:1/-1}
|
| 133 |
+
.phase label{margin:0 0 2px;font-size:.74rem;color:var(--muted)}
|
| 134 |
+
.logo-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:12px}
|
| 135 |
+
.logo-prev{min-width:90px;height:44px;border:1.5px dashed var(--line);border-radius:9px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:.8rem;padding:3px 8px;background:#fff}
|
| 136 |
+
.logo-prev img{max-height:36px;max-width:150px}
|
| 137 |
+
.file-btn{margin:0;cursor:pointer}
|
| 138 |
+
.color-lbl{display:flex;align-items:center;gap:8px;margin:0;font-size:.86rem}
|
| 139 |
+
.color-lbl input{width:46px;height:36px;padding:2px;cursor:pointer}
|
| 140 |
+
|
| 141 |
+
/* preview + actions */
|
| 142 |
+
.preview-col{min-width:0;scroll-margin-top:68px}
|
| 143 |
+
#cmx-pro,#app,#saved{scroll-margin-top:68px}
|
| 144 |
+
.actions{margin-bottom:12px}
|
| 145 |
+
.act-row{display:flex;gap:8px;flex-wrap:wrap}
|
| 146 |
+
.act-row.small{margin-top:10px}
|
| 147 |
+
.quota{margin:10px 0 0;font-weight:700;font-size:.93rem}
|
| 148 |
+
.quota.out{color:var(--warn)}
|
| 149 |
+
.warn{margin:4px 0 0;color:var(--warn);font-size:.86rem}
|
| 150 |
+
.warn:empty{display:none}
|
| 151 |
+
.paper-wrap{position:relative;overflow:hidden;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.08),0 18px 40px rgba(26,29,36,.14);background:#fff}
|
| 152 |
+
.paper{width:794px;transform-origin:0 0}
|
| 153 |
+
.paper .pp-credit{display:block}
|
| 154 |
+
html.cmx-pro .paper .pp-credit{display:none}
|
| 155 |
+
|
| 156 |
+
/* after the app */
|
| 157 |
+
.pro-cta{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:14px;margin:22px 0;border:2px solid var(--accent);background:var(--soft)}
|
| 158 |
+
.pro-cta p{margin:6px 0 0;max-width:820px}
|
| 159 |
+
.saved{margin:22px 0}
|
| 160 |
+
.hist-head{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
|
| 161 |
+
.hist-sum{font-weight:700;margin:10px 0 4px}
|
| 162 |
+
.sub{font-size:.98rem;margin:18px 0 8px}
|
| 163 |
+
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
|
| 164 |
+
.ht{width:100%;border-collapse:collapse;font-size:.9rem;margin-top:8px}
|
| 165 |
+
.ht th,.ht td{padding:8px 6px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}
|
| 166 |
+
.ht td.num{text-align:right;font-variant-numeric:tabular-nums}
|
| 167 |
+
.ht select{width:auto;padding:4px 6px;font-size:.88rem}
|
| 168 |
+
.chips{display:flex;flex-wrap:wrap;gap:6px}
|
| 169 |
+
.chip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:999px;padding:3px 4px 3px 11px;font-size:.85rem;max-width:100%}
|
| 170 |
+
.chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
| 171 |
+
.chip button{border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:1rem;width:24px;height:24px;border-radius:50%}
|
| 172 |
+
.locked{display:flex;flex-wrap:wrap;align-items:center;gap:12px;justify-content:space-between;color:var(--muted);margin-top:8px}
|
| 173 |
+
.locked p{margin:0;max-width:680px}
|
| 174 |
+
section.how,section.compare,section.faq{margin:34px 0}
|
| 175 |
+
section.how h2,section.compare h2,section.faq h2{font-size:1.45rem;margin-bottom:12px}
|
| 176 |
+
.steps{display:grid;gap:12px;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));padding:0;margin:0;list-style:none;counter-reset:s}
|
| 177 |
+
.steps li{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:16px 16px 16px 58px;position:relative;counter-increment:s}
|
| 178 |
+
.steps li::before{content:counter(s);position:absolute;left:16px;top:14px;width:30px;height:30px;border-radius:50%;background:var(--accent);color:var(--on);font-weight:800;display:flex;align-items:center;justify-content:center}
|
| 179 |
+
.cmp{width:100%;border-collapse:collapse;background:var(--card);border-radius:12px;overflow:hidden;font-size:.94rem}
|
| 180 |
+
.cmp th,.cmp td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
|
| 181 |
+
.cmp thead th{background:var(--soft);font-size:.82rem;text-transform:uppercase;letter-spacing:.03em}
|
| 182 |
+
.cmp tr.us th,.cmp tr.us td{background:color-mix(in srgb,var(--accent) 7%,var(--card))}
|
| 183 |
+
.faq details{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px 16px;margin-bottom:8px}
|
| 184 |
+
.faq summary{cursor:pointer;font-weight:700}
|
| 185 |
+
.faq p{margin:8px 0 0}
|
| 186 |
+
.disclaimer{color:var(--muted);font-size:.88rem;border-left:3px solid var(--line);padding-left:12px}
|
| 187 |
+
footer.more{border-top:1px solid var(--line);margin-top:30px;padding:22px 0 40px}
|
| 188 |
+
.more-title{font-weight:800;margin-bottom:10px}
|
| 189 |
+
.more-links{display:flex;flex-wrap:wrap;gap:8px 16px;margin-bottom:16px}
|
| 190 |
+
.more-links a{text-decoration:none;font-weight:600}
|
| 191 |
+
.more-links a:hover{text-decoration:underline}
|
| 192 |
+
.copy{color:var(--muted);font-size:.88rem}
|
| 193 |
+
.toast{position:fixed;left:50%;bottom:20px;transform:translateX(-50%) translateY(20px);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:10px;font-weight:600;opacity:0;transition:.2s;z-index:50;max-width:calc(100% - 32px);pointer-events:none;text-align:center}
|
| 194 |
+
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
|
| 195 |
+
|
| 196 |
+
@media (max-width:640px){
|
| 197 |
+
.g2{grid-template-columns:1fr}.span2{grid-column:auto}
|
| 198 |
+
.g3{grid-template-columns:1fr 1fr}.g3>div:first-child{grid-column:span 2}
|
| 199 |
+
.tpls{grid-template-columns:repeat(2,minmax(0,1fr))}
|
| 200 |
+
.cmp thead{display:none}.cmp,.cmp tbody,.cmp tr,.cmp th,.cmp td{display:block;width:100%}
|
| 201 |
+
.cmp tr{border-bottom:1px solid var(--line);padding:6px 0}.cmp th,.cmp td{border:0;padding:3px 12px}
|
| 202 |
+
.top-link{display:none}
|
| 203 |
+
.brand small{display:none}
|
| 204 |
+
.hero-row .btn{flex:1}
|
| 205 |
+
.sel-inline{flex:1 1 100%}.sel-inline select{width:100%}
|
| 206 |
+
}
|
| 207 |
+
@media (min-width:640px){.pkgs-ed{grid-template-columns:1fr 1fr 1fr}}
|
| 208 |
+
@media (min-width:1000px){.pkgs-ed{grid-template-columns:1fr}}
|
| 209 |
+
|
| 210 |
+
/* phone action bar */
|
| 211 |
+
.mbar{display:none}
|
| 212 |
+
@media (max-width:999px){
|
| 213 |
+
.mbar{display:flex;gap:8px;position:fixed;left:0;right:0;bottom:0;z-index:30;padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:color-mix(in srgb,var(--card) 94%,transparent);backdrop-filter:blur(8px);border-top:1px solid var(--line)}
|
| 214 |
+
.mbar .btn{flex:1}
|
| 215 |
+
.toast{bottom:84px}
|
| 216 |
+
body{padding-bottom:72px}
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/* Pro box (shared/pro-unlock/pro-plans.css) */
|
| 220 |
+
#cmx-pro.cmx-pro{border:2px solid var(--accent,#b63a10);border-radius:16px;padding:20px;margin:28px 0;background:var(--card,#fff)}
|
| 221 |
+
#cmx-pro h2{margin:0 0 8px}
|
| 222 |
+
#cmx-pro ul{margin:8px 0 14px;padding-left:20px}
|
| 223 |
+
.cmx-pro-badge{background:var(--accent,#b63a10);color:#fff;border-radius:999px;padding:2px 10px;font-size:.7em;vertical-align:middle}
|
| 224 |
+
.cmx-pro-small{font-size:.88em;opacity:.8}
|
| 225 |
+
.cmx-plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:10px 0}
|
| 226 |
+
.cmx-plan{position:relative;display:flex;flex-direction:column;gap:2px;padding:14px;border:1px solid var(--line,#d9d3c7);border-radius:12px;text-decoration:none;color:inherit;background:var(--bg,#faf8f3)}
|
| 227 |
+
.cmx-plan:hover,.cmx-plan:focus{border-color:var(--accent,#b63a10);outline:none}
|
| 228 |
+
.cmx-plan.best{border:2px solid var(--accent,#b63a10)}
|
| 229 |
+
.cmx-plan i{position:absolute;top:-10px;right:10px;background:var(--accent,#b63a10);color:#fff;font-style:normal;font-size:.72em;font-weight:700;border-radius:999px;padding:2px 8px}
|
| 230 |
+
.cmx-price{font-size:1.5em;font-weight:800}
|
| 231 |
+
.cmx-price small{font-size:.55em;font-weight:600;opacity:.75}
|
| 232 |
+
.cmx-note{font-size:.82em;opacity:.75}
|
| 233 |
+
.cmx-pro-flash{animation:cmxflash 1.5s ease}
|
| 234 |
+
@keyframes cmxflash{0%,100%{box-shadow:none}30%{box-shadow:0 0 0 6px color-mix(in srgb,var(--accent,#b63a10) 35%,transparent)}}
|
| 235 |
+
#cmx-pro details{margin-top:8px}
|
| 236 |
+
#cmx-pro input{max-width:280px}
|
| 237 |
+
#cmx-pro form{display:flex;flex-wrap:wrap;gap:8px;align-items:end}
|
| 238 |
+
#cmx-pro form label{flex:1 1 220px;margin:0}
|
| 239 |
+
@media (prefers-color-scheme:dark){.cmx-plan i,.cmx-pro-badge{color:var(--on)}}
|
| 240 |
+
|
| 241 |
+
/* print: only the proposal */
|
| 242 |
+
@media print{
|
| 243 |
+
@page{margin:14mm 0;size:auto}
|
| 244 |
+
@page :first{margin:0}
|
| 245 |
+
html,body{background:#fff!important;padding:0!important}
|
| 246 |
+
body *{visibility:hidden}
|
| 247 |
+
.top,.toast,.mbar{display:none!important}
|
| 248 |
+
#doc,#doc *{visibility:visible}
|
| 249 |
+
.paper-wrap{position:static;overflow:visible;box-shadow:none;height:auto!important}
|
| 250 |
+
#doc{position:absolute;left:0;top:0;transform:none!important;width:100%!important}
|
| 251 |
+
#doc .pp{width:100%}
|
| 252 |
+
#doc .pp-cover{break-after:page;min-height:100vh}
|
| 253 |
+
#doc .pp-credit{position:fixed;bottom:6mm}
|
| 254 |
+
}
|
pitchsprig/sw.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Pitchsprig offline cache. © 2026 CyberMax. All rights reserved. */
|
| 2 |
+
var CACHE = "pitchsprig-v1";
|
| 3 |
+
var FILES = ["./", "index.html", "style.css", "pro.js", "lib/core.js", "lib/pdf.js", "app.js", "manifest.webmanifest", "icon.svg", "icon-192.png", "icon-512.png"];
|
| 4 |
+
self.addEventListener("install", function (e) {
|
| 5 |
+
e.waitUntil(caches.open(CACHE).then(function (c) { return c.addAll(FILES); }).then(function () { return self.skipWaiting(); }));
|
| 6 |
+
});
|
| 7 |
+
self.addEventListener("activate", function (e) {
|
| 8 |
+
e.waitUntil(caches.keys().then(function (keys) {
|
| 9 |
+
return Promise.all(keys.filter(function (k) { return k.indexOf("pitchsprig-") === 0 && k !== CACHE; }).map(function (k) { return caches.delete(k); }));
|
| 10 |
+
}).then(function () { return self.clients.claim(); }));
|
| 11 |
+
});
|
| 12 |
+
self.addEventListener("fetch", function (e) {
|
| 13 |
+
var req = e.request, url = new URL(req.url);
|
| 14 |
+
if (req.method !== "GET" || url.origin !== location.origin) return;
|
| 15 |
+
var scope = new URL(self.registration.scope);
|
| 16 |
+
if (url.pathname.indexOf(scope.pathname) !== 0) return;
|
| 17 |
+
if (req.mode === "navigate") {
|
| 18 |
+
// Network first for pages so updates arrive quickly; the cached page works offline.
|
| 19 |
+
e.respondWith(fetch(req).then(function (r) {
|
| 20 |
+
var copy = r.clone(); caches.open(CACHE).then(function (c) { c.put("index.html", copy); });
|
| 21 |
+
return r;
|
| 22 |
+
}).catch(function () { return caches.match("index.html"); }));
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
// Cache first for static files in this app's folder, refreshed in the background.
|
| 26 |
+
e.respondWith(caches.match(req, { ignoreSearch: true }).then(function (hit) {
|
| 27 |
+
var net = fetch(req).then(function (r) {
|
| 28 |
+
if (r && r.ok) { var copy = r.clone(); caches.open(CACHE).then(function (c) { c.put(req, copy); }); }
|
| 29 |
+
return r;
|
| 30 |
+
});
|
| 31 |
+
return hit || net;
|
| 32 |
+
}));
|
| 33 |
+
});
|