Template data
The JSON document every PDF template reads: data contract version 2. Version 2 only adds keys to version 1, so an old template keeps working.
Rules for a reader
- Every version 2 key can be
null. Readdata.contract?.version ?? 1and hide a section the data does not have. - Energies in the simulation series are Wh; the kit's selectors give kWh. Money is in
offer.currency(else the organisation's). - Personal data:
agreement.customer.personal_idis a personnummer. Do not log the data. -
The example houses in every template zip (
sample-data/house-*.json) have this exact shape. Open one next to this page: house-1.json.
Version 1 keys
| Key | What it holds |
|---|---|
organisation | The installer: name, address, colours, currency. |
manager | The offer's manager: name, e-mail, phone (null when not set: the kit's contact() then uses the organisation's). |
prospect | The customer: name, address, phone, e-mail. |
offer | The offer: number, dates, title, lines, adjustments, subtotals, grand_total, summary (kWp, battery kWh, inverter kW). |
equipment[] | The products on the lines, with their data sheets (power, warranty, images). |
package, requirement | The package the offer came from, and the customer's requirements. |
monthly_simulation, yearly_simulation | The energy simulation: production and use per month (Wh), and the 25-year economy (summary: costs, savings, balances). |
screenshots[], attachments, colors | Older images, the offer's attachments, the organisation's colours. |
Version 2 keys
| Key | What it holds |
|---|---|
contract | {version: 2, made_at, locale}. locale is sv or en (the organisation's). |
site | The address, the municipality, lat/lng, the house height, daylight_hours[12] and sun_path[12] (sunrise, sunset, the sun's noon height) on the 15th of each month. |
images | The house images as data: URLs: views[] (pick by id: front, roofs, plan), aerial (null in production today), photos[] (the installer's house photos, at most 3), illustration. The kit's pictures(data) picks a cover. |
economy | The bill without and with the system: year1 {cost_without, cost_with, savings} and monthly_bills {without[12], with[12], difference[12]}. |
alternatives | The customer's other offers (at most 5) for a comparison: price, savings, payback, production. |
wiring | The electrician's report: strings, checks, cables, protection suggestions (breakers, RCD type, fuses), diagrams as SVG. |
structural | The snow and wind loads per roof face (Boverket EKS 11 map values). Print them as facts only when availability is automatic or entered. |
mounting | The mounting products and the hooks and rails per roof face. |
bom | The bill of materials: items[] with group, key, title, qty, unit, source. Print cost only with settings.showCost. |
agreement | The agreement's facts: the organisation (org number, F-skatt, insurance), the customer and co-customer, the property, the payment plan, the grön teknik subsidy, warranties, schedule and scope. |
Settings
Settings are not data: the installer sets them per template and the app reads them with
useSettings(). Examples: accent, logoDataUrl, showCost,
compareOffers, termsHtml, lightPrint, photos, and
scheme (the organisation's brand colours and fonts, applied by the kit's schemeAttrs()).
The types of every key are in the kit: kit/src/contract.ts (TemplateData) in each
template zip, and AI-GUIDE.md explains them for an AI chat.