=== Repetito Reusable Packaging ===
Contributors: repetito
Tags: woocommerce, packaging, sustainability, shipping, reusable
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.8.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add sustainable reusable packaging options to your WooCommerce checkout with Repetito.

== Description ==

Repetito is a WooCommerce plugin that enables customers to choose reusable, returnable packaging for their orders, helping reduce waste from online shopping.

= Key Features =

* **Reusable Packaging Option** - Add a checkbox at checkout for customers to opt-in for reusable packaging
* **Smart Package Selection** - Automatically calculates if products fit into available Repetito packages
* **Flexible Configuration** - Configure fees, weight limits, and available countries
* **API Integration** - Seamlessly integrates with Repetito's API to process orders
* **Privacy Controls** - Optional data anonymization feature for enhanced customer privacy
* **Product Exclusions** - Exclude specific products using the "norepetito" tag
* **Tax Support** - Configurable tax rates for packaging fees
* **Multi-language Ready** - Translation ready with .pot file included

= How It Works =

1. Install and activate the plugin
2. Configure your Repetito API key and settings
3. Set pricing, weight limits, and select available package sizes
4. Customers will see the reusable packaging option at checkout
5. Orders with reusable packaging are automatically sent to Repetito's API

= Available Package Sizes =

* Soft S (35 x 25 x 10 cm)
* Soft M (50 x 35 x 16 cm)
* Soft L (60 x 35 x 22 cm)
* Box S (21 x 11 x 9 cm)
* Box M (28 x 21 x 11 cm)

= Requirements =

* WooCommerce 3.0 or higher
* Repetito API key (obtain from https://www.repetito.sk)

= Privacy & Data Handling =

This plugin sends order data to Repetito's API (https://api.repetito.sk/orders) when a customer selects reusable packaging.

**Data Anonymization Option:**
The plugin includes a configurable anonymization feature in the settings. Store owners can choose to partially anonymize customer data before transmission.

**Always Sent (Regardless of Anonymization):**
* Order number (required for tracking)
* Customer email address (required for service communication)
* Order completion date (for service scheduling)

**With Anonymization Disabled (Default):**
* Customer phone number (if provided, for delivery coordination)
* Full billing address (street, town, postal code, country)
* Full shipping address (street, town, postal code, country)

**With Anonymization Enabled:**
* Phone number: Partially anonymized - only last 2 characters visible (e.g., +421900123456 → ************56)
* Street: Partially anonymized - only last 2 characters visible (e.g., Main Street 123 → *************23)
* Town: Partially anonymized - only last 2 characters visible (e.g., Bratislava → ********va)
* Postal code: Partially anonymized - only last 2 characters visible (e.g., 81101 → ***01)
* Country: Partially anonymized - only last 2 characters visible (e.g., SK → *K)

No product details, payment information, or tracking data is collected by this plugin.

== Installation ==

= Automatic Installation =

1. Log in to your WordPress admin panel
2. Navigate to Plugins > Add New
3. Search for "Repetito"
4. Click "Install Now" and then "Activate"

= Manual Installation =

1. Download the plugin zip file
2. Log in to your WordPress admin panel
3. Navigate to Plugins > Add New > Upload Plugin
4. Choose the downloaded zip file and click "Install Now"
5. Activate the plugin

= Configuration =

1. Navigate to Repetito settings in your WordPress admin menu
2. Enter your Repetito API key
3. Configure your preferred settings:
   * Enable/disable the service
   * Set the country where the service is available
   * Configure packaging fee price
   * Set maximum weight threshold
   * Select tax rate class
   * Choose available package sizes
   * Enable dimension fitting (optional)
   * Enable data anonymization (optional, for enhanced privacy)
4. Save your settings

== Frequently Asked Questions ==

= Do I need a Repetito account? =

Yes, you need to register at https://www.repetito.sk and obtain an API key to use this plugin.

= How are packaging fees calculated? =

You set a fixed fee in the plugin settings, which can include tax based on your WooCommerce tax configuration.

= Can I exclude certain products? =

Yes, add the "norepetito" tag to any products that shouldn't offer reusable packaging. If any product in the cart has this tag, the reusable packaging option won't be shown.

= What happens if products don't fit? =

If dimension fitting is enabled and products don't fit into any selected package size, the reusable packaging option won't be offered at checkout.

= Does this work with WooCommerce Blocks checkout? =

Yes, the plugin supports both classic WooCommerce checkout and the new block-based checkout.

= Is the packaging fee refundable? =

Packaging fee refunds are handled according to your store's refund policy. Consult Repetito's terms of service for their packaging return policy.

= How can I customize the appearance of the Repetito checkbox? =

You can customize the look and feel of the Repetito checkout elements using WordPress's built-in CSS editors:

* **Block themes (e.g., Twenty Twenty-Five):** Go to Appearance > Editor > Styles > Additional CSS.
* **Classic themes:** Go to Appearance > Customize > Additional CSS.

Target the `#repetito` container and its child elements (`.name`, `.desc`, `.inner`).

= Which languages are supported? =

The plugin is translation-ready and includes Slovak (sk_SK) translations. You can add additional translations using the provided .pot file.

= What does the data anonymization feature do? =

When enabled in the plugin settings, the anonymization feature partially anonymizes customer phone numbers and address details before sending to Repetito's API. Only the last 2 characters of each field remain visible, while all other characters are replaced with asterisks (*). For example, "+421900123456" becomes "************56" and "Bratislava" becomes "********va". This provides enhanced privacy while still allowing some basic service functionality. Order number and email address are always sent in full as they're essential for the service.

== Screenshots ==

1. Checkout page with Repetito reusable packaging option
2. Plugin settings page - General settings
3. Plugin settings page - Fee configuration
4. Plugin settings page - Package selection
5. Admin order list with Repetito column

== Changelog ==

= 1.8.4 =
* Add WordPress.org SVN deployment via GitLab CI (manual trigger)
* Add plugin directory assets (icons, banners, screenshots)
* Revert to PHP 7.4 minimum and downgrade boxpacker to 3.x for WordPress.org SVN compatibility

= 1.8.3 =
* WordPress Plugin Review compliance fixes
* Replace inline script/style tags with wp_enqueue system
* Prefix AJAX actions with repetito_ namespace
* Remove custom CSS feature (use WordPress Additional CSS instead)
* Fix file path resolution using plugin URL constant
* Upgrade dvdoug/boxpacker to 4.1.1 and psr/log to 3.0.2
* Raise minimum PHP version to 8.2
* Add source code repository link to readme

= 1.8.2 =
* Rename plugin to "Repetito Reusable Packaging" for wp.org submission
* WordPress.org plugin directory compliance
* License changed to GPL v2 or later
* Security hardening: ABSPATH guards, strict comparisons, output escaping
* English as primary language with Slovak translation
* Updated readme.txt with external services disclosure
* Removed unused npm dependencies
* Plugin check: zero source code errors

= 1.7.0 =
* Added REPETITO_SEED environment variable to control test product seeding
* Test products are now only created when REPETITO_SEED is enabled
* Updated .wp-env.json to support REPETITO_SEED for local development

= 1.6.3 =
* Fix API url

= 1.6.2 =
* Updated license to MIT

= 1.6.1 =
* Plubin liveness is always sent

= 1.6.0 =
* Added Integration Status feature - optional periodic status updates to Repetito API for troubleshooting and support
* Added Integration Status settings section with detailed explanation of data sent
* Improved error handling for API responses - now properly detects 401 and other HTTP error codes
* Enhanced admin settings page with new Integration Status section
* Added Slovak translations for all new features

= 1.5.0 =
* Fixed order fee detection - improved reliability when checking if orders have Repetito fees
* Fixed unit conversion for dimensions - properly converts between different WooCommerce dimension units (cm, m, mm, in, yd) in admin display and packing calculations
* Improved dimension fitting algorithm - fixed unit conversion issues when checking if products fit into packages
* Enhanced admin page - packages now display on separate lines for better readability
* Added OrderUtils trait - centralized order and cart fee detection logic

= 1.4.6 =
* Bug fixes and improvements

= 1.4.0 =
* WooCommerce.org plugin compatibility

= 1.3.2 =
* WooCommerce 8.x compatibility
* WordPress 6.7 compatibility

= 1.3.x =
* Enhanced dimension fitting algorithm
* Improved package selection logic
* Better WooCommerce Blocks integration

= 1.2.x =
* Added product exclusion via tags
* Improved API integration
* Enhanced settings page UI
* Bug fixes and performance improvements

= 1.0.0 =
* Initial release
* Basic reusable packaging functionality
* WooCommerce integration
* Repetito API support

== Upgrade Notice ==

= 1.8.4 =
Adds WordPress.org SVN deployment pipeline and plugin directory assets.

= 1.8.3 =
Recommended update. WordPress Plugin Review compliance fixes, PHP 8.2 minimum, updated dependencies.

= 1.8.2 =
Recommended update. WordPress.org plugin directory compliance with security hardening, GPL v2+ license, and English as primary language.

= 1.7.0 =
Recommended update. Test product seeding is now controlled by REPETITO_SEED environment variable to prevent test data in production.

= 1.6.2 =
Recommended update. License updated to MIT.

= 1.6.1 =
Recommended update. Plugin liveness is always sent.

= 1.6.0 =
Recommended update. Adds integration status feature for better support and improved API error handling.

= 1.5.0 =
Recommended update. Fixes critical unit conversion issues in dimension fitting and improves order fee detection reliability.

== Additional Info ==

For more information about Repetito's reusable packaging service, visit [https://www.repetito.sk](https://www.repetito.sk)

For support, feature requests, or bug reports, please contact us through the plugin support forum.

= Source Code & Build Tools =

The full source code, including unminified JavaScript and SCSS source files, is available at:
[https://gitlab.com/repetito/repetito-wordpress-plugin](https://gitlab.com/repetito/repetito-wordpress-plugin)

The compiled JavaScript in `assets/website/dist/` is built from the source files in `assets/website/shortcodes/` using Webpack. To build from source:

1. Install dependencies: `npm install`
2. Development build with watch: `npm run dev`
3. Production build: `npm run build`

== External Services ==

This plugin connects to the Repetito API ([https://api.repetito.sk](https://api.repetito.sk)) to process reusable packaging orders.

= When data is sent =

* **Order reporting** (`POST /orders`): When a WooCommerce order containing a Repetito packaging fee is marked as completed, the plugin sends order details (order number, email, phone, addresses, completion date) to the Repetito API. Address and phone data can be optionally anonymized via the plugin settings.
* **Integration status** (`POST /integration/status`): When enabled in settings, the plugin sends environment metadata (WordPress version, WooCommerce version, plugin version, last error) to help with troubleshooting and support.

Data is only sent after the store owner has configured their Repetito API key in the plugin settings.

= Service links =

* Service website: [https://repetito.sk](https://repetito.sk)
* Terms of Service: [https://repetito.sk/terms](https://repetito.sk/terms)
* Privacy Policy: [https://repetito.sk/privacy](https://repetito.sk/privacy)

