=== Reviso for Bricks ===
Contributors: benelwoods
Tags: bricks, bricks builder, comments, client review, feedback
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The collaboration layer Bricks Builder is missing — pinned comments, threads, client approvals, and shareable review links, native to the builder.

== Description ==

**Reviso for Bricks** turns Bricks Builder into a true collaboration tool. Reviewers (clients, teammates, stakeholders) leave pinned feedback directly on your pages — no logins, no email chains, no PDF round-trips.

= What's in the free version =

* **Pinned comments** on any Bricks element — desktop, tablet, or mobile
* **Threaded replies** so a back-and-forth doesn't sprawl across messages
* **Status tracking** — open, in progress, resolved — with filters
* **Single-page review links** — share one page at a time with anyone, no login required
* **Admin-bar quick-review** — spin up a review for the current page (or whole site, Pro) from the Reviso icon on the front-end admin bar
* **Client approvals** — reviewers can mark a page as approved (own admin tab — Reviso → Approvals)
* **Email notifications** when someone leaves a comment, replies, or approves a page — with optional burst-coalescing so a flurry of comments arrives as a single email
* **Bricks-native UI** — the comment overlay matches the builder so it doesn't feel bolted on
* **Element-anchored pins** that survive page edits (three fallback strategies — DOM, content, position)

= Available with the Pro addon =

[Reviso for Bricks — Pro](https://getreviso.io/pricing/) extends the free plugin with:

* **Multi-page Reviews** — bundle a whole site (or any subset of items) into one shareable Review, covering any post type and Bricks templates
* **Email-restricted Reviews** — each invitee gets a private magic link, with four roles (Viewer / Reviewer / Approver / Lead)
* **AI** — automatic comment triage (bug / design / copy / content) and AI-summarised feedback rollups
* **White-label** — your agency branding on the review portal, with light + dark logos that auto-pick the right variant for each surface (portal, builder splash, email header)
* **Integrations** — Slack, Discord, and generic webhooks (Zapier/Make → ClickUp, Trello, Jira, …)
* **Email digests** — optional weekly summaries
* **Advanced notifications** — multi-recipient delivery, From/Reply-To control, printable approval certificates
* **Audit log** + per-reviewer revoke
* **Concurrent reviews** with configurable expiry — including a no-end-date option

The Pro addon requires this free plugin to be installed.

= Privacy & data =

Reviso stores comment data **on your own WordPress site**. We don't see your reviewers' feedback. Optional anonymous telemetry (off by default) is opt-in. Full details in our [privacy policy](https://getreviso.io/privacy-policy/).

== Installation ==

1. Upload the plugin or install from the WordPress.org repository.
2. Activate **Reviso for Bricks**.
3. Open Bricks Builder on any page — the comment overlay appears in the bottom-right.
4. (Optional) Install [Reviso Pro](https://getreviso.io/pricing/) to unlock multi-page Reviews and the rest of the paid feature set.

== Frequently Asked Questions ==

= Does this require a license key? =

No — the free plugin is fully functional. A license key is only needed if you also install the [Pro addon](https://getreviso.io/pricing/).

= Do my reviewers need a WordPress account? =

No. Share a review link and your reviewer comments as themselves — Reviso captures their name and email when they leave their first comment.

= Is this only for Bricks Builder? =

The pin-on-element UX is designed around Bricks. We use Bricks's element IDs (`brxe-*`) for anchoring. Support for other builders is not currently on the roadmap.

= Where is my data stored? =

In your own WordPress database (`wp_reviso_*` tables). Reviso doesn't transmit comment content anywhere unless you opt in to the optional telemetry ping (which only sends version numbers + feature-enabled flags — never comment content or PII).

== Screenshots ==

1. Comment overlay in Bricks Builder — pinned threads, dark/light theme, filterable status.
2. Client review link — a reviewer leaves pinned feedback and marks the page approved, no login required.
3. Settings — comment defaults plus email notifications with optional burst-coalescing and a test-email button.
4. Approvals — the admin Approvals tab showing who signed off on each page.

== Changelog ==

= 1.0.6 =
* WordPress.org Plugin Directory compliance: the free plugin now contains only its own fully-functional features — single-page public-link reviews, pinned comments, threaded replies, client approvals, and email notifications. Multi-page / entire-site Reviews, email-restricted Reviews, advanced notification delivery, printable approval certificates, and white-label branding are provided solely by the separate Reviso for Bricks — Pro add-on and are no longer present (even inactively) in the free plugin.
* Removed all licence-tied wording from the free plugin's review flow: a review can be "read-only" as a neutral state (an add-on decides when), with no upgrade/renew messaging in the free plugin.
* The free plugin now contains no white-label code, no licence checks, and no licence-activation code of any kind — every paid-feature concern, including licence activation, lives entirely in the separate Pro add-on, which the free plugin only ever points to.
* New free control: "Coalesce bursts" under Settings → Notifications batches a flurry of comments into a single email (configurable, on by default) so reviewers leaving several comments in a row don't trigger an email each.

= 1.0.2 =
* Comment status (open / in progress / resolved) can now be set right from the Bricks builder by any editor.
* The client review portal and the printable approval certificate now load their styles and scripts the standard WordPress way.
* Internal housekeeping and WordPress.org plugin directory compliance improvements.

= 1.0.1 =
* The Reviso Pro page and upgrade prompts now offer a 14-day free trial (no card) alongside the paid plans.

= 1.0.0 =
* First public release. The free plugin covers pinned comments, threaded replies, single-page client review links, client approvals, and email notifications; the optional Reviso for Bricks — Pro add-on adds multi-page Reviews, AI, white-label, integrations, digests, and more.

= 0.21.7 =
* Fixed: client approvals work again on single-page review links — the "mark approved" button had been hidden for public links by a recent change.

= 0.21.6 =
* The Reviso Pro page buttons now link straight to checkout for the chosen plan, with monthly/annual options.
* Admin prompts are tidier — the anonymous-diagnostics opt-in and the bug/feedback prompt no longer appear at the same time.

= 0.21.5 =
* Fixed: client review links no longer 404 on sites using "Plain" permalinks — the link now falls back to a query-string URL when pretty permalinks aren't enabled.

= 0.21.4 =
* Approval certificates are now emailed as a proper PDF instead of an HTML file.
* The "New review" wizard now shows the Pro scope/reviewer options (Selected pages, Entire website, email-restricted) as upgrade hints, and a dismissible upgrade notice appears on Reviso's own admin screens.

= 0.21.3 =
* Updated the Reviso Pro overview page with current plans and pricing.

= 0.21.2 =
* Cleaner Settings: the free plugin now shows just the settings it actually provides (General, Comments) plus a single "Reviso Pro" overview page. The License, White Label, AI and Integrations tabs now appear only when the Reviso for Bricks — Pro add-on is installed.

= 0.21.1 =
* Fixed: client review comments are now scoped to the review they belong to — reviewers no longer see comments from other reviews on a page shared by more than one review.
* Housekeeping: the optional paid extras (team assignment, advanced email delivery) now live entirely in the separate Reviso for Bricks — Pro add-on.

= 0.21.0 =
* New: Reviewer links for Pro reviews (multi-page or email-restricted) now degrade gracefully to **read-only** if the site's Pro plan lapses — clients keep reading the feedback and a banner explains new comments are paused, instead of the link breaking. Enforced server-side.
* New: Opt-in anonymous telemetry now includes a `trial_state` field, so we can understand how the Pro trial is working without collecting anything identifying.
* Internal: added `Reviso_Comments::count_all()` and `Reviso_Review::is_pro_locked()` read APIs used by the Pro add-on.

= 0.20.11 =
* Internal: Plugin Check cleanups — translators comment now sits directly above the `__()` call inside `sprintf()` (the rule treats the comment as belonging only to the line immediately following it), and the raw `$_POST['author_email']` read in the comment-submit handler is now routed through `sanitize_text_field()` purely to satisfy the input-sanitization scanner (the value is still email-validated via `sanitize_email()` for storage).

= 0.20.10 =
* Dev: New `reviso_review_auto_open_sidebar` filter — site-specific extensions can suppress the FE's "open the comment sidebar on page load" behaviour per-review. Default true (existing behaviour preserved). Receives the boolean and the Review row; return false to make the reviewer click the FAB themselves.

= 0.20.9 =
* Fix: **Reviewer can actually submit with blank email.** 0.20.7 made the email field optional in the identity gate and the server, but the client-side `identified()` check still required email to be truthy — so a name-only reviewer would pass the gate, then the engine's "are we identified yet?" check would fail on the next render and re-open the gate in a loop. Fixed: `identified()` now returns true for any reviewer with a name (or a logged-in WP user).

= 0.20.8 =
* Fix: **Reviewer page-handoff is cache-safe.** The redirect from the dashboard's page card to the target page now carries a per-session cache-buster query arg, so page-cache plugins (WP Rocket, W3 Total Cache, LiteSpeed Cache, Cloudflare APO, server-level fastcgi_cache, etc.) can't return a stale overlay-less response on the first hit after starting a session.
* Fix: **Pages-nav navigation routes through the handoff.** Clicking a different page in the floating pages-nav now goes through `/reviso-review/<slug>/item/<id>/` instead of the bare permalink, so the session re-bootstraps on every navigation and the overlay appears reliably even when the destination page is cached.
* Improvement: Removed the "Only the site owner sees this — we won't email you." line from the identity gate (was added in 0.20.7; cluttered the form). The email field stays labelled "(optional)".
* Dev: New `reviso_review_exclude_name_prefixes` filter on `Reviso_Review::find()` and `count()` — site-specific extensions can hide ephemeral Reviews (e.g. an auto-generated demo) from the admin list without patching core. Pass an array of name prefixes; rows whose `name` LIKE prefix% are excluded.

= 0.20.7 =
* Improvement: **Reviewer email is now optional** on "anyone with link" reviews. The plugin never emails reviewers in link mode — their address is only shown alongside their name in the site owner's notification emails — so requiring it was friction without benefit. The identity gate now labels the email field "(optional)" and explicitly notes "Only the site owner sees this — we won't email you." Name is still required. Email-restricted reviews continue to pre-fill the invitee's email from their magic link (unchanged).

= 0.20.6 =
* New: **Exit review mode** button on the off-scope banner. Reviewers who wandered onto a page outside the review's scope can now drop the session in one click without manually clearing cookies or closing the browser.
* Tweak: Admin-bar quick-review panel — removed the forced full-width on the CTA pill and locked the "New Review" link to inline-flex so its arrow can't be displaced by inherited styles.

= 0.20.5 =
* Fix: **Admin-bar quick-review panel** — "Pro feature" upgrade pill now has proper horizontal padding, and the "New Review →" link no longer wraps the arrow onto a new line.
* Fix: **Quick-review panel skipped on the reviewer dashboard URL.** It was sticking on "Loading quick review…" there because the dashboard has no post context. The Reviso admin-bar root remains clickable so logged-in admins can still navigate to Settings.

= 0.20.4 =
* Fix: **Reviewer page-handoff URL renamed `/page/<id>/` → `/item/<id>/`.** The `/page/N/` segment collides with WordPress's built-in pagination, so canonical-redirect handlers (core's `redirect_canonical`, Rank Math, etc.) were stripping it and bouncing reviewers back to the dashboard URL. Rewrites flush automatically on first admin load after upgrade.

= 0.20.3 =
* Fix: **Reviewer page click is now hardened against theme/SPA click interception.** The dashboard renders inside the active theme so any `wp_head`-enqueued click handler (smooth page transitions, AJAX nav, etc.) was eating the navigation. Page cards now use a capture-phase listener that forces a hard browser navigation, plus inline onclick + target="_top" as belt-and-braces.
* Internal: Server-side debug logging (gated on `WP_DEBUG`) added to the review page-handoff path so the redirect chain is traceable from the PHP error log when something does go wrong.

= 0.20.2 =
* Fix: **Reviewer page click reliably enters review mode.** The page-handoff endpoint now sets the per-page session cookies on its own response instead of relying on a second-hop bridge — robust against caching plugins, security plugins, and CDN edge rules that strip query args before the bridge can run.
* Improvement: **Free wizard: "Create as Draft" when an active review exists.** The submit button label adapts so it's clear the new review won't go live immediately; a warning panel on step 3 explains why and what to do next.
* Improvement: **Activate buttons disabled with explanatory tooltip** on the Reviews table and the per-review screen when another review is already active on Free — no more click-then-error.
* Improvement: **Reviews table column overflow fix** — dropped the fixed table layout so the action column has room for both the Activate/Deactivate button and the Manage → link.

= 0.20.1 =
* Fix: **Anyone-with-link reviews now open per-page review mode reliably.** Clicking a page card on the reviewer dashboard could silently bounce back to the dashboard when the target page was the front page set to "Latest posts" (or any other queryless URL) — the handoff now passes the page ID explicitly so the legacy session bridge no longer has to infer it from `get_queried_object_id()`.
* Improvement: **Free tier — stage multiple reviews as Draft.** Free still caps you at one *active* review at a time, but you can now create additional reviews and keep them as Drafts. Activating one auto-blocks the others; the Reviews table has inline Activate/Deactivate buttons so switching between them is one click.
* Fix: **AI and Integrations tabs no longer show an orphaned Save button** when Pro/Agency isn't installed. The AI tab now also shows the "Upgrade to Pro" card that the other Pro-gated tabs use, instead of an empty form.

= 0.20.0 =
* New: **Comments link to the Review they were left under.** A new `review_id` column on `wp_reviso_comments` lets the all-comments admin filter by Review, so you can see exactly which round of feedback belongs to which engagement. Legacy review-mode and builder-direct comments stay accessible (stored with NULL review_id).
* Improvement: Polish across the builder overlay, admin quick-review panel, and front-end reviewer surfaces.
* DB: Migration 0.6.0 adds the `review_id` column + index. Safe upgrade — no existing rows are altered (NULL is the documented legacy/builder-direct case).

= 0.19.0 =
* New: **Always-on bottom-left page nav for reviewers.** Floating mini-panel lists every page in the review with status badges (To do / In review / Approved), highlights the current page, and links back to the dashboard. Collapsible — preference persists across navigation.
* New: **Off-scope banner.** When a reviewer wanders to a URL outside the review's bundled pages, a slim warning banner appears at the top of the page with a one-click "Back to review dashboard". Page stays interactive — they can hop back without losing context.
* New: **Auto-bridge for in-scope navigation.** When a reviewer clicks an internal link to another page in the review's scope, Reviso seamlessly mints a fresh per-page token and drops them into review mode — no more "this page isn't being reviewed" gotcha for pages that are.
* New: **Lead reviewers can invite others from the dashboard.** Lead role finally has a usable affordance — invite form sits below the page list, sends magic-link invitations to new reviewers with the Reviewer role (no privilege chain), all audit-logged.
* New: **Email-restricted reviewers get a pre-filled identity gate.** Email is shown read-only (it's the address they were invited at), and the name is suggested from the email's local-part ("alice.smith" → "Alice Smith"). One-keystroke confirm, no retyping their own email.
* New: **Reviewer-side role enforcement.** Approve button is gated to Approver + Lead roles (Viewer + Reviewer can see the site and post comments but can't sign off). Server-side re-checked so a crafted POST can't bypass.
* New: **Approval propagates to page status.** Marking a page approved now flips its status in the reviewer dashboard + bottom-left nav from "In review" to "Approved" — was previously only recorded in the Approvals tab.
* New: **Comment form is draggable** by its header bar, with viewport clamping. Resize the textarea and the form auto-nudges upward so the action buttons stay reachable.
* Fix: **Comment-mode pin no longer "disappears"** between click and form submit. The pulsing pending-pin now persists until the form closes or the comment saves, so reviewers see continuous visual feedback.
* Fix: **Comment overlay no longer shows in the Bricks Builder editor canvas.** Now restricted to Preview Mode only — switching out of preview hides the sidebar, FAB, comment form, pins, and popovers. Body-class mirror tracks `#bricks-toolbar.is-previewing`.
* Fix: **Front-end review-mode cursor** now matches the in-builder custom comment-bubble glyph instead of a plain crosshair. Same SVG, hardcoded brand colour (data-URL cursors can't reference CSS variables).
* Fix: **Light/dark theme switcher icon** missing in the front-end sidebar — added the SVG-sizing rule that exists in builder.css but was missing from review.css.
* Fix: **Device + Round filters** in the reviewer sidebar were unclickable — root cause was popover z-index 99999 sitting behind the front-end sidebar's 2147483610. Bumped popover to 2147483630 (just below the lightbox slot).
* Fix: **Bricks Templates dropped from reviewable post types.** They're page parts, not standalone pages — `get_permalink()` redirected to home, which is what reviewers were seeing. Site-specific CPTs can be added back via the `reviso_reviewable_post_types` filter.
* Fix: **Portal landing template** now actually reads white-label settings — was previously reading non-existent option keys (`reviso_whitelabel_logo`, `reviso_whitelabel_accent`) so agency branding never reached the dashboard. Portal background mode (light/dark/custom) properly applied to CSS variables.
* Fix: **Dashboard chrome cleanup.** The bottom-left nav panel + off-scope banner no longer pile onto the `/reviso-review/<slug>/` dashboard URL — the Reviews module owns that template and renders its own page list.

= 0.18.0 =
* New: **Admin-bar quick-review panel.** Hover the Reviso icon on the front-end admin bar to generate a review for the current page (or, on Pro, the whole site) without leaving the page. The per-page link controls and the current-round indicator now live here too, replacing the old separate dropdowns.
* New: **Create Review supports every reviewable post type + Bricks templates** — not just pages and posts. The selector groups items by post type with collapsible sections, a live title filter, and a 500-per-type cap to stay fast on large sites.
* New: **No-end-date option** on the create-review wizard for engagements that don't have a fixed end date. Existing default (30 days) unchanged.
* New: **Approvals is now its own top-level admin section** (Reviso → Approvals), peer to Reviews — promoted out of Settings → Approvals because managed records belong next to Reviews. Old `?tab=approvals` deep-links auto-redirect.
* New: **White-label light + dark logos with auto-pick.** Upload both variants and Reviso chooses the one that contrasts against each surface (portal, builder splash, email header — all driven by a single `Reviso_Settings::pick_logo()` resolver). Added an optional email-header override + portal-background mode selector. Existing single-logo uploads keep working as a fallback.
* New: **Portal landing page now respects white-label brand and background mode.** Previously the reviewer landing read from non-existent option keys, so agency branding never reached it — fixed. Portal background can now be light (default), dark, or a custom hex; logo variant + companion colours adapt automatically.
* New: **Email-restricted reviews no longer expose a meaningless public share URL** on the review detail screen — they show invitee management instead.
* Improvement: Defaults on the Create Review wizard now lean toward the common case — Entire Website + Include future pages both checked for Pro users.
* Improvement: Viewer role label clarified — Viewers see the site only (the comment overlay never mounts for them), useful for read-only stakeholders.
* Fix: **404 on review URLs after upgrading.** Installs that picked up the Reviews module via an update (rather than activating fresh) had unflushed rewrite rules, so `/reviso-review/<slug>/` landings and emailed activation links 404'd. Added a version-keyed one-shot flush on `init` so this self-heals.
* Removed: Legacy "Review link expiry" row in Settings → General — superseded by per-review expiry on the Reviews tab. The underlying option keeps applying to legacy per-page tokens for back-compat.

= 0.17.0 =
* Architecture: split into a free plugin (this) plus an optional Pro addon. AI, white-label, integrations, and digests now live in the Pro plugin.
* Free continues to ship comments, pins, threads, basic notifications, telemetry (opt-in), and single-page Reviews with the free-tier limit (one active review at a time).

= 0.16.0 =
* New: Reviews — bundle multiple pages under a single shareable link, with optional email-restricted access and magic-link auth (Pro).
* Free tier supports one active single-page review at a time.
* New: per-page checklist landing for reviewers; per-review expiry; audit log.

= 0.15.0 =
* Opt-in anonymous product telemetry (off by default).
* Self-hosted update server endpoint sample for the Pro addon.

= 0.14.1 =
* Screenshot capture rewrite — captures the area you actually clicked on.
* Review-link hardening — noindex headers, no-referrer policy, rate-limit on token validation.

= 0.14.0 =
* Email notifications overhaul: per-event toggles, multi-recipient, From/Reply-To, throttling, per-user opt-out, certificate attachment, SMTP nudge.

== Upgrade Notice ==

= 0.20.0 =
Comments are now linked to the Review they were left under, with a per-Review filter in the all-comments admin view. Adds a non-destructive `review_id` column to `wp_reviso_comments` (existing comments keep working with NULL = legacy). Safe upgrade.

= 0.19.0 =
Major reviewer-experience overhaul: bottom-left page nav, off-scope banner, auto-bridge between in-scope pages, Lead invite from dashboard, role-aware approve, draggable comment form. Plus several fixes. Safe upgrade — no DB changes.

= 0.18.0 =
Fixes a 404 on /reviso-review/ landings after upgrading from 0.16.x → 0.17.x. Adds admin-bar quick-review, post-type support in the create wizard, light/dark white-label logos, Approvals admin tab. Safe upgrade.

= 0.17.0 =
Architecture split — AI / white-label / integrations / digests are now in a separate Pro addon plugin. If you were using those features, install Reviso for Bricks — Pro from getreviso.io to keep them.
