=== Epaka Shipping for WooCommerce ===
Contributors: epaka
Tags: kurier, przesyłki, woocommerce, epaka, shipping
Requires at least: 5.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.7.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce integration with epaka.pl enabling quick creation of courier shipments directly from the store panel.

== Description ==
The "Epaka Shipping for WooCommerce" plugin allows you to integrate your WooCommerce store with the epaka.pl courier platform. With it, you can:

- Create shipments directly from WooCommerce orders (including bulk shipments)
- Automatically retrieve recipient data
- Generate and print shipping labels
- Track shipment status
- Use multiple carriers in a single integration
- Save time and money with competitive shipping rates

Full user manual available here:

https://www.epaka.pl/biznes/integracje/woocommerce

== Installation ==
1. Install the plugin via your WordPress dashboard or upload the ZIP file manually.
2. Activate the plugin.
3. Configure API access in the module settings (Client ID, API Key, Secret).
4. Define the sender details and create shipping templates.

== Screenshots ==
1. Connecting the plugin to your epaka.pl account.
2. Adding a new shipping template.
3. Selecting a carrier and automatically calculating shipping prices via the API.
4. Additional services and price presentation in the store.
5. Viewing the list of available templates.
6. List of shipments and bulk operations.
7. Integration module settings.
8. Configuring the default shipper in templates.
9. The "Orders" tab in the WooCommerce dashboard.
10. Order details and generating shipments.

== Zewnętrzne usługi ==

This plugin connects to external services to provide its functionality:

**Epaka.pl API (https://api.epaka.pl)**
- Purpose: Creating shipments, tracking packages, generating labels, managing carriers, and authenticating users
- Data sent: Order details (recipient name, address, phone number), package dimensions and weight, shipping preferences, and authentication details
- When: Every time you create a shipment, check the shipment status, generate labels, or authenticate
- Service provider: Epaka.pl
- Terms and conditions: https://www.epaka.pl/regulamin
- Privacy policy: https://www.epaka.pl/privacy-policy

**Nominatim OpenStreetMap API (https://nominatim.openstreetmap.org)**
- Purpose: Address geocoding and validation for pickup point maps
- Data sent: Address strings for geocoding searches (street names, city names)
- When: When displaying pickup point maps and address validation during the ordering process
- Service provider: OpenStreetMap Foundation
- Terms of use: https://operations.osmfoundation.org/policies/nominatim/
- Privacy policy: https://osmfoundation.org/wiki/Privacy_Policy

**OpenStreetMap Tile Server (https://tile.openstreetmap.org)**
- Purpose: Displaying map tiles for pickup point locations
- Data sent: Requests for map tiles with coordinates
- When: When displaying interactive maps with pickup points
- Service provider: OpenStreetMap Foundation
- Terms of use: https://operations.osmfoundation.org/policies/tiles/
- Privacy policy: https://osmfoundation.org/wiki/Privacy_Policy

== FAQ ==

= Do I need an account on epaka.pl? =
Yes, the plugin requires an active epaka.pl customer account with API access.

= Where can I find the plugin's user manual? =
The full guide is available here:
https://www.epaka.pl/biznes/integracje/woocommerce

= Does the plugin work with multiple carriers? =
Yes, you can ship parcels through multiple couriers available on the epaka.pl platform.

= I don't know how some features work and I've found a bug. Who should I contact? =
Please contact us at integracje@epaka.pl

= How can I contact epaka.pl about a business offer? =
Email us at bok@epaka.pl or call (22) 250-89-37

== Changelog ==

= 1.2.1 =
* Compatibility improvements with WordPress 6.8
* Improved shipping creation interface
* Optimized API error handling
* Added support for Flexible Shipping

= 1.3.1 =
* Improved compatibility with popular plugins

= 1.4.2 =
* Some minor stability fixes

= 1.4.3 =
* Some minor stability fixes

= 1.4.4 =
* Some minor stability fixes

= 1.4.5 =
* Some minor stability fixes

= 1.4.6 =
* Improved shipping method visibility based on cart weight and dimensions limits

= 1.5.0 =
* Some minor stability fixes

= 1.6.0 =
* Added carrier groups feature group multiple carriers together so WooCommerce automatically displays only the cheapest available option from each group at checkout
* Added free shipping threshold setting configure a cart total amount above which all Epaka shipping methods become free
* Improved carrier list view with visual grouping and color-coded badges
* Enhanced frontend display: shipping methods now show group names instead of template names when carriers belong to groups
* Fixed international shipping zone logic: carriers now correctly assigned to destination country zones for proper visibility to international customers
* Fixed zone creation fallback bug that was incorrectly assigning carriers to existing zones instead of creating new ones
* Improved international shipping support: customers now see all available shipping methods to their country regardless of sender location

= 1.6.1 =
* Improved parcel locker map functionality and pickup point selection

= 1.7.0 =
* Added white-label support: configure button background and text colors from plugin settings
* Improved CSS encapsulation on frontend — all plugin classes now use `epakshfo-` prefix to prevent theme style conflicts
* Fixed map search buttons and geolocation button inheriting styles from Astra and other themes
* Added country-based Nominatim geocoding: address search in map now filtered by carrier's receiver country
* Fixed race condition in map initialization using generation counter and requestAnimationFrame
* Fixed WooCommerce Blocks checkout: map state no longer lost when address fields change (MutationObserver)
* Fixed postcode-based map centering on initial map open
* Fixed WC()->session null check and HPOS compatibility for order meta
* Fixed country storage: sender/receiver countries now stored as ISO codes (e.g. PL) instead of numeric index
* Fixed json_decode null protection on additional_options field; soft-deleted carriers now excluded from checkout
* Added SVG geolocation icon with animated loading state instead of text placeholder
* Geolocation button and "Change point" button now use white-label colors
* Security: added .htaccess and index.php protection to logs directory
* Fixed token validation in CronController
* Added last cron status update timestamp in settings
* Improved error logging: replaced context parameter with line number
* Fixed encryption methods to use dynamic keys
* Fixed sslverify to respect WP_DEBUG setting
* Fixed order retrieval with enforced allowed sorting parameters
* Improved admin menu capabilities set to manage_woocommerce
* Added order edit page in plugin admin panel with shipping/billing address fields and form validation
* Added "View in WooCommerce" button in order details linking to native WC order edit page
* Added shipment tracking display in order and shipment details via PHP proxy (CORS-safe)
* Fixed house number meta key for WooCommerce additional checkout fields
* Fixed billing address sync when saving order edits — billing fields now updated from shipping
* Fixed empty column appearing before sender info section in all shipment views
* Fixed parcel locker map returning empty points — corrected form-data encoding of latlng parameters and removed wp_kses stripping JSON response
* Fixed country code case sensitivity in map point requests — country is now normalized to uppercase
* Added InPost marker icon support for courier ID 57
* Fixed critical crash when shipping zone cannot be matched for an order — orders no longer fail to appear in epaka.pl
* Added default sender pickup points per carrier configurable in plugin settings
* Added map modal — pickup point selection now opens in an overlay instead of inline
* Added order edit page in plugin admin panel with shipping and billing address fields
* Added shipment tracking display in order and shipment details
* Added WP-Cron auto-sync scheduling with configurable intervals from plugin settings
* Added processing state lock on shipping section during checkout updates to prevent race conditions
* Added point selection display with full address details at checkout
* Added geocoding support for address fields in map initialization
* Added time display for order and parcel creation dates in admin views
* Improved Polish translations across admin and frontend
* Fixed postal code field mapping in order and shipment controllers

= 1.7.1 =
* Fixed map markers for pickup points — replaced plain logo icons with styled pin markers featuring white background, rounded corners, and drop shadow for improved visibility on the map
* Fixed duplicate "Zmień paczkomat" / "Zmień punkt" buttons appearing after payment method change on classic checkout
* Fixed map reappearing after a pickup point was already selected and payment method changed
* Added pickup point memory when switching between delivery methods — previously selected parcel locker or pickup point is restored automatically when returning to the same carrier
* Fixed pickup point label disappearing when switching between carriers in WooCommerce Blocks checkout (MutationObserver over-restore race condition)
* Added selected pickup point name and address to order shipping address — visible on thank you page, My Account, order emails, and admin order view
* Fixed map centering: after geocoding the address, map now centers and loads points at correct zoom without showing "Pokaż punkty" button

= 1.7.2 =
* Fixed fatal error on order edit screen when an order has a refund — order item value column no longer requires strict WC_Order_Item type, preventing TypeError from WooCommerce's OrderRefund object

= 1.7.3 =
* Added diagnostic logs accordion in the Support tab, grouped by date, so admins can review recent plugin logs directly from the panel
* Added log file download button in the Support tab logs accordion
* Fixed pickup point map showing points from outside the current view instead of the actual visible area — corrected the "direction" parameter sent to epaka.pl's point search
* Fixed pickup point map returning too few or no points when zoomed out over a wide area
* Added marker clustering to the pickup point map so nearby points group into a single badge with a count instead of overlapping pins, splitting apart automatically as you zoom in
* Added automatic point loading as the map is panned/zoomed, replacing the manual "Show points" button
* Added local caching of already-loaded map points so revisiting the same area doesn't trigger a new request
* Fixed pickup point map becoming unresponsive (unable to pan/zoom) while points were loading in the background

= 1.7.4 =
* Added loading spinner next to the address search bar while pickup points are being fetched
* Fixed loading spinner not appearing at checkout — the element was silently stripped by output sanitization before reaching the page
* Fixed search icon in the pickup point map not being centered/sized correctly in its button
* Fixed pickup point map not appearing in WooCommerce Blocks checkout after selecting a shipping method — the script was targeting the wrong button element
* Added server-side validation blocking order placement (both classic and WooCommerce Blocks checkout) when the chosen shipping method requires a pickup point but none was selected
* Fixed customer phone number showing empty in the order list and order details screen when only the billing phone was provided — now falls back to billing phone if shipping phone is empty
* Fixed phone number being effectively optional on WooCommerce Blocks checkout despite appearing required
* Fixed pickup point map in the admin order edit screen loading points for the wrong carrier — it was using the internal carrier row ID instead of the courier type ID

= 1.7.5 =
* Fixed epaka.pl API error messages being replaced with a generic fallback ("Błąd tworzenia zamówienia") whenever the API returned a plain-text message instead of a field-level error list — real error details (e.g. insufficient account balance) are now shown
* Added detailed per-order error messages to the WooCommerce order list bulk action "Wygeneruj przesyłki (epaka.pl)" — previously only an error count was shown, now the actual epaka.pl error is listed for each failed order

= 1.7.6 =
* Fixed label generation failing for international shipments — pickup time slots were requested for the receiver's post code and country instead of the sender's, causing errors like "Dla podanego kodu pocztowego nadawcy niemożliwe jest nadanie przesyłki w tym czasie" and "pickupTime: Podaj godziny odbioru" for foreign delivery addresses
* Fixed "receiver.postCode: Zbyt długi kod pocztowy" API error for post codes written with spaces (e.g. Dutch "1234 AB", Slovak "811 01") — post codes are now normalized to their compact form before being sent to the API

= 1.7.7 =
* Fixed the stored epaka.pl connection being permanently dropped (forcing users to reconnect and re-enter credentials) after a single transient error — such as a brief network hiccup or momentary epaka.pl downtime — during a background token refresh; the connection is now only cleared when epaka.pl explicitly rejects the credentials
* Fixed password and client secret being silently altered by input sanitization on the connection form, which could cause valid credentials to be rejected when they contained certain special characters
* Fixed a critical error that could crash the entire admin panel when the account balance could not be fetched for the sidebar badge — the balance badge is now simply hidden instead of breaking the page
* Fixed selected parcel locker / Orlen Paczka pickup point not being saved on orders paid through payment methods that confirm payment via a server-to-server callback (e.g. BLIK, Przelewy24, PayU, Stripe) — the pickup point is now saved on the order at checkout instead of relying solely on the browser session, which is unavailable during those callbacks

= 1.7.8 =
* Fixed connecting to epaka.pl failing with "Unauthorized client: grant_type is invalid" — the plugin now authenticates using the client_credentials grant (client_id/client_secret only), matching the currently documented epaka.pl API; the password grant it previously relied on is no longer supported by epaka.pl. The connection form no longer asks for your epaka.pl account email/password — only the application's client_id and client_secret are needed
