=== On1Q Microsurvey Widget ===
Tags: survey, microsurvey, feedback
Requires at least: 6.3
Requires PHP: 7.4
Stable tag: 0.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect once for approved campaigns. Preview with temporary On1Q test mode.

== Description ==

Integration-test release. Not submitted to or approved by WordPress.org. Requires the matching On1Q test-mode server update first.

Production mode displays approved, active campaigns automatically on the public homepage. Campaign permissions and timing remain in On1Q. No campaign changes are needed in WordPress.

On1Q test mode is a separate administrator-session preview started from Settings > On1Q Widget. It lasts at most 30 minutes and has an Exit On1Q test mode control. Opening, ending or expiring it never enables production or approves a campaign. Other visitors retain normal production behavior.

Previews use only currently approved, active and eligible campaigns. They change no impressions, responses, skip counts or credits. Preview answers stay in the administrator browser and are never submitted to the live API. Preview uses no visitor identifier storage.

The WordPress preview interface/proxy requires manage_options, the same authenticated login session, an active temporary session and a nonce. Other users/login sessions cannot inherit it. Closing the tab stops that preview page; its transient remains until explicit exit or 30-minute expiry. Normal homepage tabs are unaffected.

== Upgrade ==

Deploy the matching server update before replacing the plugin. No database migration or dashboard update is required. Website ID and verification token remain. Existing automatic production stays enabled. If the previous plugin used the public click-to-load invitation, production stays off until the owner explicitly enables and saves it, avoiding a silent switch to automatic delivery.

== External service ==

Service: https://on1q.com/
Dashboard: https://app.on1q.com/
Public website privacy information: https://on1q.com/privacy.html

Production loads https://api.on1q.com/static/widget/microsurvey-widget.js?v=testmode1 and the automatic-config/, automatic-question/ and automatic-answer/ endpoints under https://api.on1q.com/api/widget/. It shares website/campaign identifiers, a browser visitor identifier, page origin/path and responses/skips. Query parameters are excluded. The service sees network IP/browser headers. Production uses localStorage and sessionStorage. No WordPress passwords, usernames, member profiles or registrations are sent.

Administrator previews use a protected WordPress AJAX proxy to /api/widget/preview-question/. That service endpoint is intentionally public and read-only: it returns only an already approved, currently eligible public question, writes no data/counters and issues no live response token. It reveals no pending/draft questions. The proxy rejects live tokens. Preview answers remain local; the preview widget makes no live API requests or visitor-storage writes.

Preview pages send private/no-store/noindex. Caches must bypass logged-in WordPress users and on1q_preview/on1q_test_exited query URLs. Do not use cache-everything rules that ignore authenticated cookies. Production remains limited to eligible public homepage URLs, excluding other pages, query URLs, private/password-protected content and WooCommerce account/cart/checkout contexts.

The plugin is a free GPL connector to a separate service; hosted survey availability, terms and charges are separate. It promises no earnings or legal compliance. Finalize service-specific privacy/retention/terms and public-distribution checks before general release.

== Installation ==

1. Deploy the matching server update first.
2. Replace the installed plugin through Upload Plugin; do not delete it first.
3. Confirm the website connection and explicitly choose production on/off in Settings > On1Q Widget.
4. Start On1Q test mode, then click Preview On1Q question in the dedicated preview page.
5. Answer/skip and confirm live results and credits remain unchanged. Exit using Exit On1Q test mode.
6. Verify ordinary visitors see production behavior without a preview button/banner.

== Changelog ==

= 0.3.0 =
Temporary administrator preview, no-results/no-billing preview path, explicit On1Q exit/expiry messages, automatic production and safe upgrade from the public invitation.

= 0.2.0 =
Website connection and publisher campaign approvals.
