=== SpreadsheetConverter Calculator ===
Contributors: spreadsheetconverter
Tags: calculator, excel, spreadsheet, form, embed
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 12.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed live, calculating web pages converted from Excel by SpreadsheetConverter — inline in your theme, no iframe.

== Description ==

SpreadsheetConverter (https://www.spreadsheetconverter.com/) turns an Excel
workbook into an interactive, calculating web page. This plugin embeds that
calculator in WordPress as a Gutenberg block — rendered inline by your
theme (no iframe), SEO-visible, and recalculating live as visitors type.

**Two hosting modes:**

* **Host on this site (recommended)** — paste the conversion link copied
  from the SpreadsheetConverter task pane in Excel and click *Host on this
  site*. WordPress fetches the calculator from the SpreadsheetConverter
  cloud and stores it inside your own site
  (`wp-content/uploads/ssc-embed/`). Everything is then served same-origin
  — fast, no CORS, and the calculator keeps working forever, even after
  the conversion link expires.
* **Link to the cloud** — click *Publish to Cloud* in Excel, paste the
  permanent link. The calculator stays on the SpreadsheetConverter cloud;
  your page references it and is always current when you re-publish.

An offline fallback lets you upload the calculator zip manually if your
WordPress host cannot reach the SpreadsheetConverter cloud. Classic
(non-block) themes can use the `[ssc_calc]` shortcode.

One calculator per page. The block validates the pasted link and tells
you exactly what to do if it is the wrong kind (for example a temporary
"Test in Cloud" link).

== External services ==

This plugin connects to the SpreadsheetConverter cloud in two situations,
both initiated explicitly by an editor — never on a public page view in
self-host mode:

1. **Host on this site** — when an editor clicks the button, the WordPress
   server downloads the calculator bundle from the conversion link's host
   (`*.spreadsheetconverter.com`). The pasted URL (containing the
   conversion job id) is the only data sent.
2. **Link to the cloud** — the page embeds the calculator directly from
   the SpreadsheetConverter hosting cloud (`*.spreadsheethosting.com`);
   visitors' browsers request the calculator files from that host. When
   configuring the block, the WordPress server fetches the published
   calculator's index page once to read its name.

Both services are provided by Framtidsforum I&M AB (SpreadsheetConverter).
Terms of use: https://www.spreadsheetconverter.com/terms-of-use/
Privacy policy: https://www.spreadsheetconverter.com/privacy-policy/

== Getting started ==

= Part 1 — Convert your spreadsheet (in Excel) =

1. **Start Excel and open your workbook** — e.g. `mortgage-calculator.xlsx`.
2. **Open the SpreadsheetConverter task pane** (Home ribbon →
   SpreadsheetConverter).
3. **Sign in** if prompted (required to convert).
4. **Press Convert.** The spreadsheet becomes an interactive web
   calculator (a few seconds).
5. **Copy the link for the path you want:**
   * To host it on your own WordPress site (recommended): after Convert,
     click **Copy link**. Use it within a few minutes (it is a short-lived
     conversion link).
   * To link to the SpreadsheetConverter cloud instead: first click
     **Publish to Cloud**, then **Copy permanent link**. Only a Publish to
     Cloud link works for cloud-linking — a conversion link, or a
     temporary "Test in Cloud" link (its address contains `/tmp/`), is
     rejected by the block.
   * In both cases you paste the **whole link** and the block double-checks
     it. Nothing is downloaded to your computer.

= Part 2 — Add it to your WordPress page =

6. **Open your WordPress page for editing** (Pages → Add New). You are
   already signed in to WordPress here — that is why you never type a
   password into Excel.
7. **Add the SpreadsheetConverter block** (＋ → "SpreadsheetConverter
   Calculator").
8. **Paste your link.** The block recognizes the link type and offers the
   matching option:
   * Conversion link → **Host on this site** (recommended). Click it.
     WordPress fetches your calculator and stores it inside your own site.
   * Publish-to-Cloud link → **Link to the cloud.** The calculator stays
     on the cloud; your page references it.
   * Temporary "Test in Cloud" link → the block shows: *"This is a
     temporary test link — click Publish to Cloud in Excel for a permanent
     one."*
   * Anything unrecognized → *"That doesn't look like a
     SpreadsheetConverter link — copy it again from the Excel panel."*
9. **See the live preview** inside the editor — no grey iframe,
   theme-styled, calculates live.
10. **Press Publish** (the WordPress button). The page goes live.
11. **View your live page.** It calculates, validates, moves between
    sheets, and Submit works.

== Frequently Asked Questions ==

= How many calculators can I put on one page? =

One. Each page hosts a single calculator; put more on their own pages.

= My theme uses the classic editor — can I still embed? =

Yes: `[ssc_calc token="…"]` (a link you pasted/hosted via the block or a
permanent cloud link) or `[ssc_calc src="…"]` (the calculator's base URL).

= How do I update the calculator later? =

Convert again in Excel and re-click *Host on this site* (or re-Publish to
Cloud). Re-hosting replaces the stored copy.

= I am upgrading from the classic version — will my existing calculators break? =

No. The classic plugin embedded each calculator as a fixed `<iframe>` saved
directly in your page, pointing at files in `wp-content/uploads/ssc/`.
Version 12 does not touch those files, so your existing pages keep working
exactly as before. What changes is only the editor: the old upload screen is
replaced by the new "SpreadsheetConverter Calculator" block. To add a *new*
calculator, use that block (or the `[ssc_calc]` shortcode). After updating you
will see a one-time admin notice with the same reminder; you can dismiss it.

= The calculator isn't working on my page =

If you self-hosted, open
`https://<your-site>/wp-content/uploads/ssc-embed/<name>/index.html`
directly in a browser. That page runs the calculator on its own — if it
works there but not on your page, the issue is page/theme integration,
not the calculator.

= My WordPress host cannot reach the internet =

Use the offline fallback: click *Download zip* in the Excel task pane and
upload the zip in the block.

== Changelog ==

= 12.0.1 =
* Add a one-time, dismissible admin notice for sites upgrading from the
  classic (pre-12) plugin: confirms existing iframe embeds keep working and
  points to the new block. Shown only when classic data is detected.
* Add an "Upgrading from the classic version?" FAQ entry.

= 12.0.0 =
* Complete rewrite for SpreadsheetConverter v12.
* Gutenberg block with inline (no-iframe) rendering via the `<ssc-calc>`
  embed mount.
* Self-host mode: block-initiated pull — WordPress fetches the calculator
  bundle server-side; no credentials, no CORS.
* Cloud-link mode: reference a permanent Publish-to-Cloud URL.
* Manual zip upload fallback for air-gapped hosts.
* `[ssc_calc]` shortcode for classic themes.
* Removed: custom post type, upload-triggered ZIP extraction, version
  regex, debug file logging, TinyMCE iframe inserter.

== Upgrade Notice ==

= 12.0.1 =
Major rewrite (v12). Your existing embedded calculators keep working — nothing
is removed. The editor changes: add new calculators with the new
SpreadsheetConverter Calculator block or the [ssc_calc] shortcode. A one-time
admin notice explains this after updating.

= 12.0.0 =
Major rewrite. The old upload-and-iframe flow is replaced by a Gutenberg
block that embeds the calculator inline (no iframe). After updating, re-add
your calculator with the new SpreadsheetConverter Calculator block or the
[ssc_calc] shortcode. Old pages stay as they are until you re-embed.
