=== Spin Wheel ===
Contributors: bdthemes, selimmw, mohammaadfarid, abutalib, maudud, muhammadasik, arafatakashakku, shmusuf, shaikatazim, shamim496
Donate link: https://bdthemes.com/
Tags: coupon, lucky wheel, fortune wheel, coupon wheel, discount
Stable tag: 2.4.0
Requires PHP: 7.4
Requires at least: 6.7
Tested up to: 7.1
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

The Spin Wheel plugin allows you to engage your visitors with an interactive spinning wheel that offers coupons and other rewards.

== Description ==

Boost your website engagement and drive more sales with 🎁 **Spin Wheel**, the best spin wheel popup WordPress plugin. Offer your visitors a fun, gamified experience by letting them **spin to win** exclusive discounts and coupons. This interactive tool is perfect for growing your email list and enhancing customer loyalty.

With extensive customization options, advanced display settings, and robust spam protection, **Spin Wheel** makes it easy to create captivating offers that boost conversions and keep users coming back.

**[Try the Demo](https://bdthemes.com/plugin/spin-wheel/)** | **[Documentation](https://bdthemes.com/knowledge-base/spin-wheel/spin-wheel-plugin/)** | **[Upgrade Pro](https://bdthemes.com/plugin/spin-wheel/)**

**With Spin Wheel, you can:**

Capture user attention with a customizable **Interactive spin wheel for WordPress** that appears at the right moment, whether on **page load**, **exit intent**, or after a **specified period** of inactivity.

Optimize for various devices, including **desktop, tablet, and mobile**, ensuring a seamless experience for all users.
Configure advanced display rules like user status, **role-based visibility**, and **specific show/hide times**, giving you total control over your campaign.

= KEY FEATURES: =

**Comprehensive Campaign Control:**

- **Campaign Settings:** Easily manage multiple campaigns with unique names and status options. Includes fortune wheel popup testing in Development mode.
- **Device Visibility:** Determine the coupon spin wheel’s visibility for specific devices—Desktop, Tablet, and Mobile—to reach your audience wherever they are.

**Spam Protection:**

- **Email Coupon Delivery:** Automatically email coupons to winners, ensuring an efficient, secured and user-friendly experience.
- **Email Verification:** Require visitors to confirm their email address with a one-time code sent from your own site before they can spin.
- **Rate Limiting:** Cap how many entries a single IP address can submit within a time window.
- **Entry Restrictions:** Allow one entry per email address, and cap the total number of participants per wheel.

**Display Rules for Maximum Flexibility:**

- **Trigger Options:** Choose when the lucky wheel popup appears—on page load, on exit intent, upon scrolling, or after a period of inactivity.
- **Re-appearance Control:** Define a reappearance interval (in days) for users who have already seen the discount wheel popup, maintaining a non-intrusive experience.
- **Visibility Timeframe:** Set specific start and end dates to control when the popup is active, perfect for time-sensitive promotions.
- **Advanced User Conditions:** Customize visibility based on user status (logged in/out) and roles (admin, editor, author, etc.) for targeted engagement.

**Stylish Customization Options:**

- **Wheel Section Colors:** Personalize each segment’s background color to create a creative and brand-aligned spin wheel.
Configurable Coupons for Every Spin:
Custom Coupon Labels and Codes: Offer unique prizes with customizable labels and discount codes.
- **Winning Probability:** Control the odds of winning with adjustable probabilities for each segment; the winning slice is always chosen on the server.
Form Customization for a Seamless User Experience:

- **Styling Options:** Adjust colors, text sizes, and alignment for the form container, title, description, and input fields to match your brand’s aesthetics.
- **Field visibility:** Show or hide the name, email, and phone fields independently and set each as optional or required.
- **Terms & conditions:** Optional checkbox with a customizable label (HTML allowed, e.g. a link to your terms page) so visitors must agree before spinning.
- **Submit Button Design:** Customize the submit button’s color, alignment, and size for a polished and professional look.

**Winning and Losing Messages:**

- **Winning Info:** Personalize the victory message with custom titles, descriptions, and styling for coupon codes.
- **Losing Info:** Customize the text and design for messages when users don’t win.

**Two Ways to Award Prizes:**

- **Instant Win:** The visitor sees the prize the wheel lands on and receives it straight away, with an optional winner email.
- **Event Mode:** Entries are collected without awarding anything automatically. You then pick winners yourself from the Entries screen, or draw a number of random winners in one click, and revert a selection at any time.

**Track Entries for Enhanced Insights:**

- **Entry Count Display:** Keep track of the participants on your backend in a lost form for quick reports.
- **Campaign Tracking:** Optionally store utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid and fbclid with each entry and export them to CSV.
- **Data Retention:** Automatically delete entries older than a number of days you choose, or keep them forever.

= How to embed your wheel =

- **Shortcode (default):** In the **Usage** box while editing a wheel, copy `[spin_wheel id="…"]` and paste it into any page or post. You can also use the **Spin Wheel** block in the block editor.
- **Auto embed:** In the same **Usage** sidebar, set **Display method** to **Auto Embed** and update the wheel. One published wheel can be embedded **site-wide** (front-end pages): scripts and styles load the same way as the shortcode, and your wheel’s **display rules** (devices, pages, dates, etc.) still apply. Choosing Auto Embed on another wheel replaces the previous choice. Switch back to **Shortcode** to stop site-wide embedding for that wheel. If the same wheel is already on a page via shortcode or block, it is not output twice.

Spin Wheel is a versatile and powerful tool for engaging users, collecting emails, and boosting sales. With easy-to-use features and extensive customization options, this plugin is your best choice for adding an interactive element to your marketing strategy.

== Checkout our other Plugins 👑 ==

Explore the best free addons for Elementor and Gutenberg to boost your site with advanced blocks, sliders and eCommerce tools.

* **[Element Pack](https://wordpress.org/plugins/bdthemes-element-pack-lite/)** - Build responsive websites from scratch with an all-rounder package of 300+ widgets and 2700+ ready-to-use assets for Elementor.

* **[Prime Slider](https://wordpress.org/plugins/bdthemes-prime-slider-lite/)** - The revolutionary slider builder addon for Elementor with a next-gen superb interface and 50+ unique slider designs.

* **[Ultimate Post Kit](https://wordpress.org/plugins/ultimate-post-kit/)** - Best blogging addon for building a quality blogging website with fine-tuned post layouts, carousels, sliders and lists.

* **[Ultimate Store Kit](https://wordpress.org/plugins/ultimate-store-kit/)** - The only eCommerce addon for answering all your online store design problems in one package for WooCommerce and EDD.

* **[Pixel Gallery](https://wordpress.org/plugins/pixel-gallery/)** - The first Elementor-based WordPress gallery addon offering 60+ flexible and customizable gallery builder widgets.

* **[ZoloBlocks](https://wordpress.org/plugins/zoloblocks/)** - Mind-blowing dynamic block plugin for Gutenberg with powerful and advanced features offering a greater web design experience.

* **[Augmented Reality Viewer](https://wordpress.org/plugins/ar-viewer/)** - Bring your products to life with immersive 3D and AR experiences directly inside your WordPress website.

* **[Dark Reader](https://wordpress.org/plugins/dark-reader/)** - Instantly transform your website into a sleek, eye-friendly dark mode experience with smooth and elegant styling.

* **[Instant Image Generator](https://wordpress.org/plugins/ai-image/)** - Generate AI-powered images or import visuals instantly from popular platforms like Unsplash, Openverse, Pixabay, Pexels and Giphy — all from one place.

* **[Live Copy Paste](https://wordpress.org/plugins/live-copy-paste/)** - Seamlessly copy and paste sections, widgets and entire pages across domains with zero hassle.

* **[One Accessibility](https://wordpress.org/plugins/website-accessibility/)** - Make your website inclusive and accessible to everyone with essential accessibility enhancements and compliance-ready tools.

* **[QR Code Generator & Scanner](https://wordpress.org/plugins/zolo-qr-code/)** - Create and manage dynamic QR codes directly from your WordPress dashboard for smarter engagement and tracking.

* **[Smart Admin Assistant](https://wordpress.org/plugins/smart-admin-assistant/)** - Enhance your WordPress dashboard with productivity-focused tools and smart site management features.

* **[Spin Wheel](https://wordpress.org/plugins/spin-wheel/)** - Engage visitors with an interactive spinning wheel that offers discounts, coupons and promotional rewards.

* **[Swift Checkout for WooCommerce](https://wordpress.org/plugins/swift-checkout/)** - Simplify the WooCommerce checkout process to improve user experience and boost conversion rates.

Visit [BdThemes](https://bdthemes.com/) to learn about our services, Elementor page builder-based products, informative blogs and documentation.


== Installation ==

This section describes how to install the plugin and get it working.

1. Upload the plugin files to the `/wp-content/plugins/spin-wheel` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to the 'Spin Wheel' settings page to configure your spinning wheel and rewards.

== Frequently Asked Questions ==

= Does it support all blocks? =

Yes, it supports all WordPress blocks without any issues.

= Can I customize the rewards? =

Yes, you can easily customize the rewards and coupons offered by the spinning wheel through the plugin settings.

= Is the plugin responsive? =

Yes, the Spin Wheel plugin is designed to work seamlessly on both desktop and mobile devices.

= What is Auto Embed, and how is it different from the shortcode? =

**Shortcode** is the default: you place `[spin_wheel id="…"]` (or the block) where you want the wheel. **Auto Embed** is optional: pick it in the wheel’s **Usage** sidebar, save, and that **published** wheel is injected on front-end pages globally (one wheel at a time). Assets and behavior match the shortcode; unpublishing the wheel or switching back to Shortcode clears site-wide embedding when that wheel was the active one.

== Screenshots ==

1. **Spin Wheel Interface** - The interactive spinning wheel that engages visitors.
2. **Settings Page** - Configure your spinning wheel and rewards.
3. **Responsive Design** - The plugin works seamlessly on both desktop and mobile devices.

== Third-Party Libraries ==

This plugin bundles one third-party JavaScript library:

* **lucky-canvas** v1.7.27 — draws the wheel, grid and slot-machine canvases.
  Source code: https://github.com/LuckDraw/lucky-canvas
  npm package: https://www.npmjs.com/package/lucky-canvas
  License: Apache-2.0
  The file at `public/js/lucky-canvas.umd.min.js` is the unmodified `dist/index.umd.js`
  build published on npm, which upstream distributes already minified. Its source map is
  shipped alongside it as `lucky-canvas.umd.min.js.map`, and the exact file can be
  refetched from https://cdn.jsdelivr.net/npm/lucky-canvas@1.7.27/dist/index.umd.js

== External Services ==

This plugin does not connect to any external service. It sends no data to third parties
and makes no remote requests. Everything — including prize selection, entry storage and
email verification codes — is processed on your own site, and all emails are sent with
WordPress's own `wp_mail()` function.

== Privacy ==

Entries are stored in two custom database tables on your own site (`{prefix}swp_entries`
and `{prefix}swp_winners`). Depending on how you configure a wheel, an entry can hold the
visitor's name, email address, phone number, the prize they landed on, their IP address,
their browser user agent, and — if you enable Campaign Tracking — the campaign parameters
from the address they arrived on. Use the **Delete entries older than** setting on
Settings → Database to remove old entries automatically.

Deleting the plugin only removes this data when you have first switched on **Delete Data on
Uninstall** on Settings → Database; otherwise your wheels, entries and settings are left in
place. Deactivating the plugin never removes anything.

== Changelog ==

= 2.4.0 [7th September 2026] =

* Added: Event Mode is now a built-in wheel mode. Collect entries, then select winners individually, draw a number of random winners at once, or revert a selection — all from the Entries screen, with a Selected Winners summary and winner notification emails.
* Added: Per-wheel Entry Restrictions and Maximum Participants controls, plus a site-wide default for entry restrictions.
* Added: Email verification (one-time code) for entry forms, sent with wp_mail() from your own site. Includes an expiry setting, resend throttling and an attempt limit.
* Added: Phone number field for entry forms, with its own label and required toggle.
* Added: Campaign tracking — optionally store utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid and fbclid with each entry, shown on the Entries screen and included in CSV exports.
* Added: Security settings — cap the number of entries accepted from one IP address within a configurable time window.
* Added: Database settings — automatically delete entries older than a chosen number of days via the daily cleanup task, plus an opt-in "Delete Data on Uninstall" switch.
* Fixed: The uninstall routine was gated on a setting that had no interface, so it never ran. It now honours the new opt-in switch, and only deletes this plugin's own posts and meta instead of every orphaned meta row on the site.
* Fixed: The entries screen no longer reaches into a private method with Reflection (which is deprecated in PHP 8.5).
* Added: Sound effects toggle, Inline display mode, and Image / Label + Image prize representation.
* Removed: The Pro helper class, its per-feature gates and the license check. No feature in this plugin is gated behind a license, add-on or filter any more.
* Security: Settings are now validated against allow-lists as well as sanitized, the raw request payload is no longer passed to extension filters, and the wheel style JSON is rebuilt against an explicit schema instead of being stored straight from json_decode().
* Fixed: Footer credit lines are now escaped with wp_kses() instead of interpolating raw HTML into an escaped string.
* Fixed: Escaping functions now match their output context throughout the admin screens (esc_attr for HTML attributes, esc_html for element content), and template variables no longer shadow WordPress globals.
* Updated: Bundled lucky-canvas now carries a full attribution header (version, repository, license) and ships with its upstream source map.
* Updated: Cleared all Plugin Check and WordPress Coding Standards findings; developer-only files (.buildignore, CODEBASE.md) no longer ship in the plugin.

= 2.3.1 [26th August 2026] =

* Fixed: After Scroll Percentage trigger stopped working after the wheel was closed. The scroll listener now remains active and respects the reappear delay setting, allowing the wheel to reappear on subsequent scrolling.
* Fixed: Reappearing the wheel created duplicate canvases and event bindings. The wheel is now initialized only once per page view, and subsequent appearances reuse the existing instance.

= 2.3.0 [17th August 2026] =

* Updated: Pro-only features (Event Mode, prize images, entry restrictions, participant limits, display modes, presets, advanced form options, OTP verification, rate limiting, VPN/proxy blocking, sound effects, database management, UTM capture and CRM) are now delivered entirely by the Spin Wheel Pro add-on. The free plugin no longer ships their code and simply exposes the hooks Pro attaches to.
* Removed: Upgrade badges, upsell notices and the CRM teaser screen from the admin area, per WordPress.org guidelines.
* Removed: The OTP handler, VPN/proxy detector and the ipapi.is external-service integration; with them the third-party service disclosure is no longer needed in this plugin.
* Updated: The daily cleanup event is still scheduled by the free plugin, but the auto-cleanup handler now lives in Pro; without Pro the event is a harmless no-op.
* Updated: Codebase trimmed and simplified — the free plugin is now a complete, license-free spin wheel with no locked or partially disabled functionality.

= 2.2.6 [15th August 2026] =

* Added: All built-in features (rate limiting, UTM capture, sound effects, database management, OTP, phone field, participant limits, presets, display modes, and more) are now fully functional in the free plugin without a license.
* Added: Disclosure of the optional VPN/proxy detection service (ipapi.is) in the readme, including Terms and Privacy links.
* Fixed: Security issue where a participant's name could inject a spreadsheet formula into exported CSV files (CSV/formula injection).
* Fixed: Hardened IP-address handling for rate limiting and VPN checks (validated, unslashed, sanitized).
* Removed: Custom CSS/JavaScript fields and the admin promotional feed widget, per WordPress.org guidelines.
* Updated: Output escaping, input sanitization, nonce handling, and translation (i18n) improved throughout for security and coding-standard compliance.

= 2.2.5 [13th August 2026] =

* Updated: Release workflow improved
* Updated: System improved

= 2.2.4 [10th August 2026] =

* Updated: Admin API Biggopti removed

= 2.2.3 [8th August 2026] =

* Fixed: Security issue where data returned by the promotions API could be injected as script into the WordPress admin area
* Fixed: Promotion links and images are now restricted to http(s) and mailto addresses
* Updated: Security improved

= 2.2.2 [21st May 2026] =

* Updated: Made compatible with WordPress version 7.0

= 2.2.1 [14th May 2026] =

* Updated: System improved

= 2.2.0 [4th May 2026] =

* Added: N Squares type wheel added

= 2.1.7 [28th April 2026] =

* Updated: System improved

= 2.1.6 [16th April 2026] =

* Added: **Auto Embed** in the **Usage** sidebar: choose **Shortcode** (default) or **Auto Embed** to show one published wheel site-wide on the front end without pasting a shortcode on every page.

= 2.1.5 [13th April 2026] =

* Added: Form field show/hide switches for name, email, and phone, plus per-field “required” options.
* Added: Optional terms & conditions checkbox for the spin form, with a customizable label (HTML supported).
* Improved: Terms & conditions row layout and styling (padding, focus, hover, validation) so it matches the rest of the entry form.
* Fixed: OTP “send code” AJAX (`swp_send_otp`) now runs correctly instead of being unreachable behind the admin “get pages” handler.

= 2.1.4 [9th April 2026] =

* Fixed: Big wheel prize labels wrap by whole words only ( Thanks to AG )
* Fixed: Admin settings custom toggle switches no longer show a stray native checkbox tick on the track.
    
= 2.1.3 [10th March 2026] =

* Added: Admin Dashboard Feeds added

= 2.1.2 [1st March 2026] =

* Added: Translation support (i18n) across the plugin ( Thanks to Luis Lafontaine )

= 2.1.1 [12th January 2026] =

* Fixed: Security issue fixed for prize selection
* Updated: Spin Wheel Live Preview UX Improvement

= 2.1.0 [8th January 2026] =

* Added: Candy Pop Wheel Preset Added
* Added: Spin Prize Label Text Rotation added

= 2.0.5 [5th January 2026] =

* Added: Spin Wheel Button Control added
* Fixed: Default preset selection for new wheel issue fixed
* Fixed: Fixed the issue where the spin wheel was not properly centered

= 2.0.4 [1st January 2026] =

* Fixed: Prize configuration panel and popup shadow design issue fixed

= 2.0.3 [22nd December 2025] =

* Added: Configurable email sending option for Instant Mode ( Thanks to Professor Academy )
* Fixed: Email body template rendering issue fixed

= 2.0.2 [17th December 2025] =

* Fixed: Responsive issue fixed ( Thanks to yavsan2323 )
* Updated: System improved

= 2.0.1 [14th December 2025] =

* Fixed: VPN/proxy detection issue fixed
* Fixed: Spin color save state issue fixed
* Fixed: Spin button click issue fixed in responsive devices ( Thanks to Yavsan )

= 2.0.0 [10th December 2025] =

* Added: Event Mode feature
* Added: Prize Images feature
* Added: Entry Restrictions feature
* Added: Maximum Participants feature
* Added: Display Modes feature
* Added: Presets feature
* Updated: System improved

= 1.1.8 [27th November 2025] =

* Updated: System improved

= 1.1.7 [26th November 2025] =

* Updated: System improved

= 1.1.6 [20th November 2025] =

* Fixed: Notice duplicate issue fixed

= 1.1.5 [12th November 2025] =

* Fixed: Update notice fixed

= 1.1.4 [11th November 2025] =

* Fixed: API Banner duplicate issue fixed

= 1.1.3 [11th November 2025] =

* Updated: System improved

= 1.1.2 [9th November 2025] =

* Added: Black Friday promotional menu
* Added: Major update notice

= 1.1.1 [8th September 2025] =

* Updated: BdThemes Store notice integrated and shown to admin
* Fixed: DCI Notice removed for security reason

= 1.1.0 [3rd July 2025] =

* Added: Solid Circle Overlay added
* Fixed: Probability issue fixed
* Fixed: DCI Notice transition issue fixed
* Updated: Probability field updated for fraction supports

= 1.0.12 [21th April 2025] =

* Updated: Made Compatible with WordPress Version 6.8
* Updated: Only one plugin DCI notice will show at a time

= 1.0.11 [2nd March 2025] =

* Fixed: Confetti issue fixed

= 1.0.10 [9th February 2025] =

* Added: Buttons Text fields are added
* Updated: System improved

= 1.0.9 [4th December 2024] =

* Added: Confetti Features added
* Added: Data Send to CRM feature added
* Improved: Overall System improved

= 1.0.8 [30th November 2024] =

* Added: Confetti Effects added

= 1.0.7 [19th November 2024] =

* Fixed: Trigger Spin issue fixed (Thanks to Saif)

= 1.0.6 [18th November 2024] =

* Added: Wheel Designs added
* Improved: Overall System improved

= 1.0.5 [29th October 2024] =

* Added: Probability Feature added
* Added: WooCommerce Support added
* Added: Data Delete feature added
* Improved: Overall System improved

= 1.0.3 [24th October 2024] =

* Improved: System improved & Minor issues fixed

= 1.0.2 [16th October 2024] =

* Improved: Cookie improved for users Data
* Improved: System improved
* Improved: Language file improved

= 1.0.1 [9th October 2024] =

* Fixed: WP Standard fixed

= 1.0.0 [9th October 2024] =

* Initial Release
