=== Bounmee Wallet Leaderboard ===
Contributors: bounmee
Tags: polymarket, prediction markets, leaderboard, trading, wallets
Requires at least: 5.5
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 3.7.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed a live Polymarket top-wallet leaderboard on any page. Always-fresh API data, 30D/7D toggle, White & Navy Blue themes, category filters.

== Description ==

**Bounmee Wallet Leaderboard** fetches the top 10 Polymarket traders from the official Polymarket Data API and renders them in a clean, responsive widget using a single shortcode.

All API requests are proxied through WordPress (admin-ajax.php), so there are no CORS issues regardless of your server environment. Data is always fetched fresh — no caching — so visitors always see current rankings.

**Features:**

* Live top-10 leaderboard ranked by PNL
* **30D / 7D period toggle** — switch between 30-day and 7-day best wallets on the widget, no page reload
* **Two themes** — White (default, clean light design) and Navy Blue (dark gradient background, full contrast adaptation)
* Category filters: All, Politics, Crypto, Sports, Culture, Tech, Finance, Macro
* Wallet of the Day spotlight card with auto-generated performance analysis *(optional)*
* Side-by-side wallet compare tool with PNL, volume, and efficiency bars *(optional)*
* Optional CopyTrade button per row linking to an external copy-trading service *(opt-in, off by default)*
* Server-side AJAX proxy — no CORS issues on any host
* No caching — every request fetches live data from the Polymarket API
* Zero first-paint spinner — data seeded server-side on page load
* Mobile responsive: card layout on small screens, table on desktop
* Fully theme-isolated CSS — scoped under a unique ID, immune to theme interference in both directions
* No external JavaScript dependencies — pure vanilla JS, no jQuery required

**Shortcode:**

`[polymarket_leaderboard]`

Optional default category:

`[polymarket_leaderboard category="CRYPTO"]`

Valid values: `OVERALL` `POLITICS` `SPORTS` `CRYPTO` `CULTURE` `ECONOMICS` `TECH` `FINANCE`

== Installation ==

1. Upload the `bounmee-wallet-leaderboard` folder to `/wp-content/plugins/`, or install via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin via **Plugins → Installed Plugins**.
3. Add `[polymarket_leaderboard]` to any page or post.
4. Visit **Settings → Polymarket LB** to choose your theme, enable optional features.

== Frequently Asked Questions ==

= Does this plugin slow down my site? =

No. Scripts and API calls only run on pages where `[polymarket_leaderboard]` is placed. Nothing is injected globally.

= What happens if the Polymarket API is down? =

The widget falls back to anonymised demo data automatically. Clicking Refresh or switching a filter will retry the live API.

= Can I set a default category? =

Yes. Use `[polymarket_leaderboard category="POLITICS"]` to pre-select a category on load. Valid values: OVERALL, POLITICS, SPORTS, CRYPTO, CULTURE, ECONOMICS, TECH, FINANCE.

= Does it work with page caching plugins? =

Yes. The initial seed data is rendered server-side and AJAX calls happen client-side after page load, so full-page caching is fully compatible. The Refresh button and period toggle always hit the live API.

= Will the widget break my theme's styles? =

No. All widget CSS is scoped under a unique ID with high specificity. It cannot affect your theme, and your theme cannot override the widget styles.

= What is the CopyTrade button? =

An optional button that appears on each leaderboard row when enabled in Settings. It links to an external copy-trading service of your choice. Disabled by default — you must consciously enable it and set your URL in Settings. This is an affiliate/referral feature — full disclosure is shown in the setup panel per WP.org guideline 10.

= What is the 30D / 7D toggle? =

A pill toggle in the widget controls bar that switches the leaderboard between 30-day (MONTH) and 7-day (WEEK) best wallets by calling the Polymarket API with the corresponding `timePeriod` parameter. The leaderboard, mobile cards, Wallet of the Day, and compare tool all update accordingly.

= How do I change the theme? =

Go to **Settings → Polymarket LB** and choose White or Navy Blue under Widget Theme. Save — the change applies immediately to all shortcode instances.

= What data does this plugin collect? =

None. The plugin only fetches public data from the Polymarket API. No visitor data is collected or transmitted.

== External Services ==

This plugin connects to the **Polymarket Data API** to retrieve public leaderboard data.

* **Service:** Polymarket Data API
* **Endpoint:** `https://data-api.polymarket.com/v1/leaderboard`
* **When it is called:** On every page load where `[polymarket_leaderboard]` is placed (server-side seed), and on every category filter click, period toggle, or Refresh button click (client-side via AJAX proxy)
* **Data sent:** Query parameters only — leaderboard category, time period (MONTH or WEEK), result limit, and sort order. No user data of any kind is transmitted.
* **Data received:** Public on-chain wallet rankings including rank, wallet address, username (if set), PNL, volume, profile image URL, and X username (if set). All data is public on-chain information.
* **Polymarket Terms of Service:** https://polymarket.com/tos
* **Polymarket Privacy Policy:** https://polymarket.com/privacy-policy

This plugin also loads fonts from **Google Fonts** on pages that use the shortcode:

* **Service:** Google Fonts CDN
* **URL:** `https://fonts.googleapis.com`
* **Google Privacy Policy:** https://policies.google.com/privacy

== Privacy Policy ==

This plugin does not collect, store, or transmit any personal data about site visitors.

On page load and on user interactions (filter changes, period toggle, refresh), the plugin makes requests to the public Polymarket Data API. These requests contain only query parameters (category, time period, limit) — no user information is included.

No analytics, tracking pixels, or third-party beacons are included.

== Changelog ==

= 3.7.0 =
* New: 24H period toggle now shows period-aware Wallet of the Day badge and subtitle
* Fix: Tested up to WordPress 7.0
* Fix: Minor CSS scoping improvements for theme compatibility

= 3.6.4 =
* New: 24H period toggle — adds a "🔥 24H" button alongside 30D and 7D, fetching `timePeriod=DAY` from the Polymarket API to surface wallets that are hot right now rather than long-term PNL leaders
* New: Period-aware badge copy — the #1 wallet why-badge shows "🔥 Hottest wallet right now" in 24H mode instead of the standard monthly/weekly label
* New: Subtitle label updates to "last 24-hour PNL" when 24H is active, consistent with 30D/7D behaviour
* Fix: PHP period whitelist now includes `DAY` so AJAX proxy correctly passes the new period to the Polymarket API

= 3.6.3 =
* Fix: `shortcode_atts` filter tag was `bounwale_leaderboard` instead of `polymarket_leaderboard` — caused `[polymarket_leaderboard]` shortcode to not work correctly on sites using shortcode attribute filters
* Fix: `wp_register_script/style` called with `false` as src (invalid) — changed to empty string `''`, the correct WordPress approach for inline-only asset handles
* Fix: Table loading row used `colspan="6"` on a 5-column table — corrected to `colspan="5"` (affected both the PHP seed markup and the JS loading state)
* Fix: `bounwale_maybe_redirect_setup` on `admin_init` now guards with `is_admin()` to prevent redirect loops on non-admin requests
* Fix: `admin_enqueue_scripts` hook check now uses exact match `settings_page_bounwale-leaderboard` instead of `strpos` — prevents accidental asset loading on unrelated admin pages; also fixes the `false`-src registers for admin handles
* Fix: `uninstall.php` was deleting `ttg_options` / `ttg_setup_redirect` (legacy keys from an old version) instead of `bounwale_options` / `bounwale_setup_redirect` — plugin options were never cleaned up on deletion
* Fix: readme.txt 3.6.1 changelog entry was self-contradictory (listed two conflicting rename targets); corrected to reflect final slug `bounmee-wallet-leaderboard`
* Fix: README.md Plugin URI pointed to old slug `prediction-market-wallet-leaderboard`; updated to `bounmee-wallet-leaderboard`

= 3.6.2 =
* Plugin officially renamed to "Bounmee Wallet Leaderboard"; slug `bounmee-wallet-leaderboard`
* Fix: Layout never scrolls horizontally — root container enforces `overflow-x:hidden`; table uses `table-layout:fixed` instead of fixed `min-width`
* Fix: Responsive breakpoints extended — new 900px, 360px breakpoints ensure widget fills its container cleanly at all screen sizes without breaking or overflowing
* Fix: Mobile card actions stack to single column on phones ≤480px for better tap targets
* Fix: Filter buttons, WOTD stats, and card padding tightened on very small screens (≤360px)

= 3.6.1 =
* Fix: Wallet of the Day "Share on X" button on mobile now correctly populated with wallet stats (was always `href="#"`)
* Fix: PHP category whitelist trimmed to match UI — removed unused `MENTIONS` and `WEATHER` values
* Plugin renamed to "Bounmee Wallet Leaderboard"; slug updated to `bounmee-wallet-leaderboard`

= 3.6.0 =
* Fix: All inline `<script>` and `<style>` tags replaced with proper WordPress enqueue API (`wp_register_script/style`, `wp_add_inline_script/style`) — required for WP.org compliance
* Fix: Admin JS registered under its own handle; admin assets hooked via `admin_enqueue_scripts` with page-scoped check

= 3.5.0 — 3.5.1 =
* Fix: Controls row (live dot + 30D/7D + Refresh) centred on both themes, desktop and mobile
* Fix: "Compare Any Two Wallets" heading centred on both themes

= 3.4.1 — 3.4.9 =
* Fix: Table row colour bleed eliminated; text sizes increased for readability
* Fix: 7D volume fallback chain (`vol → volume → tradedAmount → notional`)
* Fix: Share on X split into desktop and mobile copies, both updated by JS
* Fix: Navy Blue theme rendered as rounded card with padding and shadow
* Fix: Compare accordion alignment and text stacking on all themes

= 3.3.0 =
* New: White / Navy Blue theme selector in Settings
* New: 30D / 7D period toggle — switches `timePeriod` on the Polymarket API; all UI elements reflect the selected period
* Removed all transient and sessionStorage caching — always-live data
* Fixed: WCAG AA contrast on PNL green, rank badges, and wallet addresses in both themes

= 3.2.0 — 3.2.3 =
* Added first-run setup wizard and Settings page with opt-in feature controls
* All external links off by default (WP.org guideline 10)
* Full CSS isolation scoped under `#ttg-lb-root-wp`

= 3.0.0 — 3.1.0 =
* Initial release: server-side AJAX proxy, category filters, Wallet of the Day, compare tool, mobile card layout, demo data fallback
* Google Fonts loaded via `wp_enqueue_style`; `uninstall.php` added

== Upgrade Notice ==

= 3.7.0 =
Minor improvements to period-aware UI and CSS scoping. No breaking changes — existing shortcodes continue to work unchanged.

= 3.6.1 =
Fixes mobile "Share on X" button in Wallet of the Day, trims unused API categories, and renames the plugin. No breaking changes — existing shortcodes continue to work unchanged.

= 3.6.0 =
Replaces all inline script/style tags with proper WordPress enqueue API calls. Required for WP.org compliance. No breaking changes.

= 3.3.0 =
Adds White/Navy Blue theme selector, 30D/7D period toggle, and always-live data. Recommended upgrade for all users.
