=== Lueira Embed ===
Contributors: maladeta
Tags: embed, modal, shortcode
Requires at least: 5.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A lightweight shortcode that embeds Lueira marketplace activities inside an accessible modal.

== Description ==
Lueira Embed adds a shortcode that renders a configurable button. The button opens an accessible modal showing an iframe with a Lueira marketplace activity. Administrators can configure the base host URL from the WordPress settings screen.

== Usage ==
=== Basic Shortcode ===
[lueira id="cd2j3bkk7mdnur3r857g" module="school" product_type="private"]

=== Shortcode Parameters ===
| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `id` | Yes | - | The activity ID to embed |
| `module` | Yes | - | The module type (e.g., "school", "rent") |
| `product_type` | No | - | Optional product type (e.g., "private", "group-package") included when available |
| `lang` | No | "es" | Language code for localized content, default is "es" |
| `button_text` | No | "View activity" | Text displayed on the button |
| `class` | No | - | Additional CSS classes for the button |
| `show_details` | No | `true` | Accepts `true` or `false`. When `false`, hides the product header/details by appending `showProductDetails=false` to the iframe URL |
| `success_url` | No | - | Absolute URL the buyer is redirected to after a successful payment. Appended as `embedSuccessUrl`. Defaults to the store's own success page when omitted |
| `cancel_url` | No | - | Absolute URL the buyer is redirected to if they cancel. Appended as `embedCancelUrl` |
| `display` | No | "modal" | `modal` opens the activity in a modal iframe; `newtab` renders a link that opens the activity in a new tab |

The query parameters appended to the iframe URL (`showProductDetails`, `embedSuccessUrl`, `embedCancelUrl`) match exactly what the store reads — they are case-sensitive.

=== Examples ===
* School Activity (Private): `[lueira id="456" module="school" product_type="private" button_text="View Activity"]`
* School Group Package in English: `[lueira id="789" module="school" product_type="group-package" lang="en" class="btn-primary" button_text="Join Group Package"]`
* Rent Bundle with Custom Styling: `[lueira id="101" module="rent" product_type="bundle" lang="es" button_text="Ver Actividad" class="lueira-embed__trigger--accent"]`
* Hide product details: `[lueira id="202" module="school" show_details="false"]`
* Custom redirect URLs: `[lueira id="202" module="shop" success_url="https://tienda.com/gracias" cancel_url="https://tienda.com/carrito"]`

== Installation ==
1. Upload the plugin files to `/wp-content/plugins/lueira/` or install via the WordPress admin.
2. Activate through the “Plugins” screen.
3. Visit **Settings > Lueira Embed** to confirm the marketplace host URL.

== Frequently Asked Questions ==
= How do I embed an activity? =
Use `[lueira id="123" module="school" product_type="private"]` in any post or page.

= Can I localize the embed? =
Yes. Pass the `lang` attribute (for example `lang="es"`) to load the appropriate localized content.

== Changelog ==
= 1.0.7 =
* Fix the `show_details` shortcode attribute: it now appends the correct `showProductDetails` query key the store reads, so hiding the product header/details works (previously it sent `show_details`, which the store ignored).
* Add `success_url` and `cancel_url` shortcode attributes, appended as `embedSuccessUrl` / `embedCancelUrl`, to control the post-checkout redirect.

= 1.0.6 =
* Load the store-hosted redirect bridge (embed.js) so the embedded checkout can redirect the parent page to the payment gateway, fixing a Safari/iOS cross-origin SecurityError that blocked payment from inside the modal. The bridge is shared with non-plugin embeds and served from the configured marketplace host.

= 1.0.5 =
* Simplify modal behavior for improved WebKit (Safari macOS/iOS) iframe scrolling.
* Keep modal layering robust with high `z-index` defaults.

= 1.0.4 =
* Fix mobile modal: full-width dialog and scrollable content on small screens for better UX.

= 1.0.3 =
* Add the optional `show_details` shortcode attribute that passes the matching query flag to the iframe URL.

= 1.0.2 =
* Allow shortcode usage without `product_type` and adjust the embed URL accordingly.

= 1.0.0 =
* Initial release with shortcode, modal UI, and admin configuration page.
