=== WebEquipe Spin & Win Wheel ===
Contributors: webequipe, codersbucket
Tags: spin wheel, lucky draw, giveaway, coupon, lead generation
Requires at least: 5.4
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Spin-to-win for WordPress – engage visitors, capture emails, and deliver coupons to boost signups and sales.

== Description ==
Engage your visitors with an interactive spin-to-win wheel! Collect leads, reward users instantly, and boost conversions.

**WebEquipe Spin & Win Wheel** is a gamified marketing tool for WordPress that lets you create multiple customizable spin-to-win wheels with prizes, probabilities, and unique branding.  
Perfect for lead generation, coupons, giveaways, and seasonal campaigns.

### 🎯 Key Features
- Create unlimited spin-to-win wheels with custom rewards.  
- Define probabilities for each prize segment.  
- Fully customizable design (colors, sizes, logos, and backgrounds).  
- Display the wheel as a popup and sidebar.  
- Multiple trigger options: on page load, button click.  
- Collect user data (name, email, etc.).  
- Export participant data as CSV and import into email-marketing tools.  
- Winner and admin email notifications.  
- Works with or without WooCommerce.  
- Responsive and lightweight — works seamlessly on mobile and desktop.

### 💡 Use Cases
- Lead generation and newsletter sign-ups.  
- Discount or coupon giveaways.  
- Seasonal and festive promotions.  
- Gamified user-engagement campaigns.  
- Reward programs for loyal customers.

### 🚀 Pro Features (Coming Soon)
- AI-powered display timing and prize optimization.  
- Advanced WooCommerce coupon integration.  
- Email-marketing integrations (Mailchimp, Klaviyo, and more).  
- Built-in analytics dashboard for insights and performance tracking.

### 🌟 Why Choose WebEquipe Spin & Win Wheel
Turn visitors into customers by making engagement fun.  
Gamify your website, capture leads effortlessly, and watch your conversions rise — all from within your WordPress dashboard.

== Installation ==

1. Upload **webequipe-spin-win-wheel.zip** to the `/wp-content/plugins/` directory, or install it directly through the WordPress Plugin Installer.  
2. Activate the plugin through the **'Plugins'** menu in WordPress.  
3. After activation, you'll see **"WebEquipe Spin & Win Wheel"** in your WordPress admin menu.

== Privacy Policy ==

This site uses the WebEquipe Spin & Win Wheel plugin to run a spin-to-win campaign. It collects personal data submitted through the spin form, including name, email address, phone number, spin result, and page URL. The data is stored in custom database tables on this site and is used to run the campaign and send winner/admin notifications if enabled. Data remains until entries are deleted or the plugin is uninstalled.

Why this matters: site owners are responsible for telling visitors what data is collected and how it is used.

How to use the suggested text:

1. In WordPress Admin, go to **Settings → Privacy**.
2. Click **"Check for suggested privacy policy text"**.
3. Add the WebEquipe Spin & Win Wheel section to your site's privacy policy page.

== Configuration ==

### Quick Start Guide

After activating the plugin, follow these steps to create and configure your first spin-to-win wheel.

### Step 1: Create Your First Wheel

1. Navigate to **WebEquipe Spin & Win Wheel → All Wheel** in your WordPress admin dashboard.
2. Click **"Add New"** at the top of the page.

You will see 4 tabs with default values. You can customize them as needed.

### Step 2: General Tab - Set Up Basic Settings

1. **Basic Information**
   1. Enter a **Title** for your wheel (e.g., "Summer Giveaway Wheel").
   2. Add an optional **Description** to help you identify this wheel later.
2. **Status**: Set to "Active" to enable the wheel, or "Inactive" to disable it temporarily.
3. **Spin Display Settings**
   1. **When Load**: Choose how your wheel appears
      - **Popup**: Opens automatically on your page
      - **Button Click**: Shows a button; clicking it opens the modal
   2. **Responsive Display Setting**: Choose which devices to support (Laptop, Tablet, Mobile).
   3. **Show On**: Choose how the popup appears
      - **Left Slide**: Appears from left to right
      - **Right Slide**: Appears from right to left
      - **Center**: Appears as a centered modal
   4. **Form Field Setting**
      - **Email**: Always shown and required
      - **Name** and **Mobile**: Can be enabled/disabled
   5. **Spin Behavioral Settings**
      - **Spin Popup First Display**: Wait time (seconds) before the popup appears
      - **Spin Duration**: Number of seconds the wheel spins
      - **Wait Time to Re-open Wheel**: Cooldown before the popup can open again
      - **Wait Time to Try with Same Email**: Cooldown before the same email can submit again

### Step 3: Items Tab - Prize Segments

1. This tab shows the prize list. Each row is a segment on the wheel.
2. For each segment, configure:
   - **Win?**: Yes or No. This decides whether the win/lose message is shown.
   - **Label**: The text displayed on the wheel segment (e.g., "10% Off", "Try Again", "Free Shipping")
   - **Value**: The actual prize value or message shown to winners
   - **Probability**: The chance of winning this prize (as a percentage). Total should equal 100%
   - **Background Color**: Color of the segment
   - **Text Color**: Color of the text on the segment
3. **Add New Row+**: Add a new prize segment.
4. **Important**: Ensure all probabilities add up to 100%.
5. **Choose Template**: Select a built-in color template or customize each segment color manually.

### Step 4: Design Tab - Look and Feel

1. **Template**: Choose a pre-designed template. There are 4 layouts.
2. **Card Settings**: Customize the popup/form container:
   - Background color, text color, border radius, padding
3. **Wheel Center**: Customize the center of the wheel:
   - Background color, border color, and width
   - Choose a default icon (dot, star, film) or upload a custom image
4. **Wheel Stroke Settings**: Customize segment borders and text:
   - Border color and size
   - Font size, family, and style
5. **Form Design Settings**: Customize the user input form:
   - Alignment, button text and colors
   - Initial button appearance
6. **Initial Button Settings**: If **When Load** is set to **Button**, configure the button colors.

### Step 5: Finish

1. **Message Settings**: Messages shown after form submission.
   1. **Win Message**: You can use `{label}` and `{value}` in the message.  
      Example: 🎉 Congratulations! You won {label}. Use {value} as your coupon code.
   2. **Lose Message**: Message shown when the user does not win.
2. **Email Settings**: Only winners receive an email.
   1. **Send Email After Submit**: Yes/No.
   2. Customize **From Name**, **From Address**, and **Subject**.
   3. **Body**: Use dynamic fields like `{customer}`, `{customer_phone}`, `{spin_label}`, `{spin_value}`.
3. **Notification Settings**: Enable or disable admin notifications.

### Step 6: Save and Test

1. Click **"Create Wheel"** to save.
2. On the **Edit Wheel** page, copy the shortcode shown at the top, such as `[wsww-spin id="1"]`.
3. Paste the shortcode on any page, post, or widget.
4. If **When Load** is set to **Button**, the shortcode renders a button. If set to **Popup**, the wheel opens automatically.

### List and Edit

From **All Wheel**, you can view all wheels and their shortcodes. Click a title to edit or use **Delete** to remove a wheel.

The edit screen uses the same tabs: **General**, **Items**, **Design**, and **Finish**. You can update these settings at any time.

### Viewing and Managing Results

1. Navigate to **WebEquipe Spin & Win Wheel → All Winner** to see all participants.
2. View details of each spin, including:
   - User information (name, email, etc.)
   - Prize won
   - Date and time
   - Claim status
3. Click an email to view winner details. Use **"Claim this prize"** to set the claim status.
4. Export data as CSV for use in email marketing tools or CRM systems.

### Testing Your Setup

Before launching your campaign:

1. **Test the Wheel**: Create a test wheel and spin it multiple times to verify probabilities.
2. **Test Email Notifications**: Ensure winner emails are being sent correctly.
3. **Test on Mobile**: Verify the wheel displays and functions properly on mobile devices.
4. **Test Different Browsers**: Check compatibility across Chrome, Firefox, Safari, and Edge.
5. **Test Display Triggers**: Verify popup timing and auto-trigger settings work as expected.

 **Tip:** For best results, test the wheel on both desktop and mobile before launching your campaign.

== Third-Party Libraries ==

This plugin bundles the following libraries:

- Bootstrap v5.3.8 (assets/js/bootstrap.bundle.min.js, assets/css/bootstrap.min.css)
- D3.js v3.5.17 (assets/js/d3.v3.min.js)

License details and source URLs are listed in THIRD-PARTY-LICENSES.txt.

== Frequently Asked Questions ==

= Does WebEquipe Spin & Win Wheel work without WooCommerce? =  
Yes! WebEquipe Spin & Win Wheel works independently. You can use it to collect leads, show rewards, or display messages even without WooCommerce.

= Can I customize the wheel colors and segments? =  
Absolutely. You can customize every part — wheel colors, labels, logos, backgrounds, and popup layout.

= How are winners notified? =  
You can set up automatic email notifications for winners, and receive admin alerts for every spin.

= Can I export user data? =  
Yes, all leads or participants can be exported as a CSV file and imported into your preferred CRM or email-marketing platform.

= Does it slow down my website? =  
No. The plugin is lightweight, optimized for performance, and loads assets only where needed.

= What's included in the Pro version? =  
The upcoming Pro version will include AI-powered optimization, advanced WooCommerce coupon integration, email marketing integrations (Mailchimp, Klaviyo, etc.), and built-in analytics.

= How do I find my wheel ID? =  
After creating a wheel, you can find the ID in the URL when editing the wheel (e.g., `admin.php?page=wsww-spin&action=edit&id=1` - the ID is `1`). You can also see all wheel IDs in the "All Wheel" list page.

= Why isn't my wheel appearing on the frontend? =  
Check the following:
- Ensure the wheel status is set to "Active"
- Check that you've added the shortcode correctly: `[wsww-spin id="your-id"]`
- For popup mode, check your display settings (display after X seconds, etc.)
- Clear your browser cache and WordPress cache if using a caching plugin

= Why aren't email notifications being sent? =  
- Verify email settings are configured in the Email tab
- Check that "Send Email to Winner" is enabled
- Ensure the "From Address" is a valid email address
- Test your WordPress email functionality (some hosts require SMTP configuration)
- Check spam/junk folders

= How do I reset or delete a wheel? =  
Go to **All Wheel**, find your wheel, and click "Delete". This will remove the wheel and all associated data. This action cannot be undone.

== Troubleshooting ==

### Common Issues and Solutions

**Issue: Wheel not spinning or showing errors**
- Solution: Ensure JavaScript is enabled in your browser
- Check browser console for errors
- Verify all required fields are filled in the wheel configuration
- Ensure probabilities add up to 100%

**Issue: Popup not appearing**
- Solution: Check display settings (Display After X seconds)
- Verify the wheel status is "Active"
- Clear browser cache
- Check if other plugins are interfering with popup functionality

**Issue: Shortcode not working**
- Solution: Verify the shortcode syntax: `[wsww-spin id="1"]` (use quotes around the ID)
- Ensure the wheel ID is correct
- Check that the page/post is published (not draft)
- Try deactivating and reactivating the plugin

**Issue: Email notifications not sending**
- Solution: Configure SMTP plugin if your host requires it
- Verify email settings in the Email tab
- Check WordPress email functionality
- Ensure "From Address" is valid and not blocked

**Issue: Wheel design not displaying correctly**
- Solution: Clear browser cache
- Check for CSS conflicts with your theme
- Verify all color codes are valid hex colors (e.g., #FF0000)
- Test in different browsers

**Issue: Data not being collected**
- Solution: Verify required fields are set in Data Process tab
- Check that form fields are enabled
- Ensure JavaScript is enabled
- Check browser console for errors

**Issue: Admin page showing redirect errors**
- Solution: Clear browser cache and cookies
- Deactivate and reactivate the plugin
- Check for plugin conflicts by deactivating other plugins temporarily
- Ensure you have administrator permissions

If you continue to experience issues, please check the plugin support forum or contact support.


== Screenshots ==
1. **All Wheels** – Overview of all created wheels with shortcode, status, and responses.
2. **Wheel Editor – General Settings** – Configure wheel title, description, status, display options, and spin rules.
3. **Wheel Editor – Prize Items** – Add labels, values, probabilities, colors, and manage wheel segments.
4. **Wheel Editor – Design Customization** – Choose templates and customize wheel colors, form layout, and design settings.
5. **Frontend Popup Form** – Users enter their details before spinning the wheel.
6. **Winner Notification** – Success message displayed after a user wins a prize.
7. **Lead & Winner List** – View and export participant data and spin results in CSV format.


== Changelog ==
= 1.0.6 =
* Initial public release.
* Create unlimited spin-to-win wheels with configurable prizes and probabilities.
* Lead capture with email notifications and CSV export.
* Popup, button, and inline display modes.
* Fully customizable wheel and form design.
* Secure data handling and privacy policy integration.
* Works with or without WooCommerce.

== Upgrade Notice ==

= 1.0.6 =
Initial public release.
