# PW — Ofertas Avanzadas

WooCommerce marketing-driven discount campaigns. This repository ships **two editions** from the same codebase:

| Entry file                     | Edition | Notes                                      |
| ------------------------------ | ------- | ------------------------------------------ |
| `pw-ofertas-avanzadas.lite.php` | **Lite**| WordPress.org–oriented; broader reach      |
| `pw-ofertas-avanzadas-pro.php`   | **Pro** | Sold separately; full strategies & tooling |

Technical stack: PHP **8.0+**, WordPress **6.0+**, WooCommerce **8.0+**. Namespace `PW\OfertasAvanzadas\`. Autoload via Composer (`vendor/autoload.php`).

Contributors: [pezweb](https://pezweb.com/) · License: GPLv2 or later · [License text](https://www.gnu.org/licenses/gpl-2.0.html)

> **WordPress.org listing** uses `readme.txt` (Stable tag **2.1.5**, tested up to **6.9**). This `README.md` is the developer-oriented overview.

---

## Features (summary)

Guided wizard, stacking behaviour, product badges and shortcodes, HPOS-compatible hooks. The Lite edition includes a fully functional set of strategies with no artificial limits. Pro adds additional strategies and analytics.

---

## Internationalization

Text domain: **`pezweb-ofertas-avanzadas`**. English strings in code (`msgid`); bundled Spanish catalogue:

`languages/pezweb-ofertas-avanzadas-es_ES.mo`

WordPress 6.5+ loads translations by request locale (`load_textdomain()` in `src/Core/I18n.php`).

---

## Build & deploy

From the repo root:

| Command | Purpose |
| ------- | ------- |
| `npm install` | Install toolchain (Tailwind, etc.). |
| `npm run build:tailwind` | Regenerate `assets/css/pwoa-tailwind-admin.css` (no CDN; Backend UI's Tailwind handle is dequeued locally). |
| `composer install --no-dev` | PHP dependencies (e.g. `pw/backend-ui`). |
| `./build-deploy.sh lite` \| `pro` | Full artefact (`releases/…`; runs Tailwind + Composer as documented in `CLAUDE.md`). |
| `npm run build:lite` / `build:pro` | Cross-platform helper → `scripts/run-build-deploy.cjs`. |

Design system dependency is pinned (`composer.json`). Admin screens also enqueue **`assets/css/dashboard-campaigns.css`** for dashboard layout (Lite and Pro builds).

Optional local sync after build: set `PWOA_LOCAL_PLUGIN_DIR` (or per-edition variants) — see `build-support/local-sync.env.example`.

---

## Quality & hygiene

Campaign JSON from admin AJAX (`config` / `conditions`) runs through **`src/Admin/CampaignPostSanitizer.php`** after JSON decode — aligned with Plugin Check guidance on sanitized nested input.

Third-party telemetry: none.

---

## External services & privacy

Bundled CSS/JS only; no remote API calls in normal operation. For directory disclosure wording, mirror **`readme.txt`** → External services.

---

## Changelog highlights

Recent work on **`main`** (not necessarily tagged yet):

- Text domain **`pezweb-ofertas-avanzadas`** (renamed from legacy `pw-ofertas-avanzadas` to avoid clashes with unrelated "PW" branding).
- Structured sanitization for wizard/campaign payloads; dashboard admin markup uses **`dashboard-campaigns.css`** instead of inline styles.

Listed release notes for published versions stay in **`readme.txt`** (`== Changelog ==`) and mirror below where useful:

### 2.1.5

- Removed all artificial feature limits and locked strategies to comply with WordPress.org Plugin Directory Guidelines.
- Lite build no longer includes Pro-only strategy references, upgrade URLs, or campaign count restrictions.

### 2.1.4

- Plugin Check hardening (`wp_unslash`, `absint`, object cache patterns, deprecated `load_plugin_textdomain()` removed per current guidance).
- Lite ZIP naming aligned with WordPress.org slug expectations.

### 2.1.3

- Plugin URI ≠ Author URI; safer Lite/Pro coexistence (notice instead of forcibly deactivating Lite in edge cases).

Older entries: **2.1.2**, **2.1.1**, **2.0.18** — see `readme.txt` for full wording.

---

## Pro edition changelog (excerpt)

Releases bundled from this repo typically share tooling with Lite (`npm run build:tailwind`, `build-deploy.sh`). See internal release notes under `releases/pro/` after a build.

---

## FAQ snippets

**WooCommerce required?** Yes.

**Where data lives:** Custom tables prefixed with `wp_…pwoa_*` plus options/transients keyed with `pwoa_` prefixes (see Activator/Schema).
