=== Addons Nexo ARG for WooCommerce ===
Contributors: ariolidev
Requires at least: 6.9
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.6.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Paid add-ons for Nexo ARG for WooCommerce. Distributed by arioli.dev, enabled with your license key.

== Description ==

This plugin contains the code of the paid add-ons of Nexo ARG for WooCommerce: online payments, shipping and Correo Argentino, ARCA e-invoicing, Mercado Libre, SEO and Google, catalog filters, size guides, resellers, returns, customers, product feeds and Instagram/Facebook feeds.

It requires the free plugin *Nexo ARG for WooCommerce* and a license key from https://arioli.dev/productos/woonexo. Each add-on you buy is enabled automatically on the next license check (or press "Verify now" under Nexo ARG › License). Updates are delivered from arioli.dev.

== Changelog ==

= 1.6.5 =
* Sales › Provinces (invoiced in ARCA): each province opens Invoicing › Analysis with its invoices for the same period, to audit them.
* Invoicing › Analysis: clicking a province row shows its invoices; each invoice can get a province assigned by hand (kept as «Assigned by hand», automatic searches do not change it) and links to its order when it has one.

= 1.6.4 =
* Sales: the «Invoicing» filter is computed with a single query (it took minutes in stores with thousands of orders and imported invoices).

= 1.6.3 =
* Invoicing › Analysis: imported invoices with no matching order take the province from another invoice of the same DNI/CUIT, or from the province written in the invoice address.

= 1.6.2 =
* Invoicing › Analysis: invoices imported from ARCA are also matched by the customer name on the invoice (same name, same amount with or without shipping, close date), and by name alone to get the province from another purchase of the same customer. Stores whose orders have no DNI/CUIT get far fewer «Sin dato».
* Sales: «Invoiced in ARCA» / «Not invoiced» now count orders matched to an imported invoice (same purchase), not only invoices issued from Nexo ARG. Before, imported invoices made every order look not invoiced.

= 1.6.1 =
* Invoicing: Sales gets an «Invoicing» filter. «Invoiced in ARCA» = orders with an authorized invoice not fully cancelled by credit notes; the Provinces table then comes from the invoices of the period (date of the invoice), including those imported from ARCA history, net of credit notes.

= 1.6.0 =
* Invoicing › Analysis (new tab): invoices and credit notes (issued with Nexo ARG and imported from ARCA history) by province, postal code and month, with filters (provinces, postal code list/prefix/range, voucher type, letter, origin, customer VAT condition, point of sale, customer or document, amount range) and export to Excel of exactly what is shown, including the ARCA CAE and its due date. Credit notes subtract. Imported invoices are located by matching the customer document or a single WooCommerce order with the same total and date; when there is no certain match they stay as «Sin dato» instead of guessing.

= 1.5.19 =
* Invoicing: in stores that do not use WooCommerce taxes, products left with «Tax status: None» (as many imports leave them) are no longer sent to ARCA as non-taxed. They take the VAT rate of the Invoicing settings, so Factura B (and A) discriminate the 21 % to ARCA and the B shows the «IVA contenido» of the Fiscal Transparency regime. Stores that use WooCommerce taxes keep using the product tax status.

= 1.5.18 =
* One-click update: «Update now» waits for the background version check to finish, so it no longer fails with «class not found» while the plugin folder is being replaced.

= 1.5.17 =
* Store filters: each attribute shows up once even if the store has it repeated in the WooCommerce attributes table.
* Store filters: size, color and other attributes come before the (usually long) category list.
* Store filters: the «Filter» button is only shown on phones, even with themes that force every button to be visible.

= 1.5.16 =
* Mercado Libre: when the connection can no longer be renewed (the Mercado Libre app is missing the «Refresh Token» OAuth flow, or the seller revoked access) the panel now says so with the fix and a «Reconnect» button, and the store admin gets one email. Before, the connection silently stopped after 6 hours.
* Mercado Libre: connecting now fails with a clear message if Mercado Libre does not return a refresh token.
* Mercado Libre: sale notifications never cause fatal errors in cron; sales from the time it was disconnected are imported after reconnecting. A network error while renewing no longer disconnects.

= 1.5.15 =
* New «Live statistics» add-on: real-time visitors (who is in the store now, the page they are on, where they came from, device, country with Cloudflare, and stage: browsing, product, cart, checkout, bought), page views per minute for the last 30 minutes, and a summary for today, yesterday, 7 and 30 days (visitors, visits, page views, bounce, duration, orders, conversion, funnel, sources, top pages, landing pages, devices, countries, campaigns). First-party and cookieless: the browser reports to a lightweight endpoint (WordPress SHORTINIT, falls back to admin-ajax), works with page cache, ignores bots and logged-in staff, no IP stored, nothing sent to third parties; 90-day history.

= 1.5.14 =
* New «Advertising on Meta and Google» module (included in «Catalog for Meta and Google»): Meta Pixel plus the Conversions API (purchases are also sent from the server, deduplicated with the Pixel), Google Ads «Purchase» conversion with enhanced conversions and Google Analytics 4, events with the same product IDs as the catalog, sales per channel and campaign for the last 30 days, and a step-by-step guide for Meta and Google with links to each screen. While it is on, the basic Pixel/Analytics of «SEO and Google» stops loading so nothing is counted twice.

= 1.5.13 =
* Mercado Libre: every sale becomes a WooCommerce order again, also the ones received while «each sale is an order» was off or that failed once (they were left out for good). Saving the Mercado Libre settings moves the pending sales to Orders right away; a sale that fails is retried in the next checks. Sales of products that are not linked enter as orders without moving stock.

= 1.5.12 =
* Mercado Pago in the checkout: the card form no longer stays loading when the checkout refreshes several times in a row (classic checkout), and the «pay with my Mercado Pago account» choice is kept after the checkout refreshes.

= 1.5.11 =
* Mercado Pago: new option to take card payments inside the checkout, without leaving the store (Mercado Pago Card Payment Brick). Card data goes straight from the customer's browser to Mercado Pago; the store only receives a one-time token and charges the order total from the server. Customers can still choose to pay with their Mercado Pago account. Works with the classic and the block checkout. Needs the Public Key of your Mercado Pago application.

= 1.5.10 =
* Site health: after Nexo ARG or Addons is updated, arioli.dev gets the new versions and the error summary a minute later, without waiting for the daily license check.

= 1.5.9 =
* Site health: with a license key, Addons shares the error-log summary of Nexo ARG with arioli.dev support (with the license checks and a minute after a new error, at most every 15 minutes), as Nexo ARG did before 1.8.4. No customer, visitor or order data.
* «Verify now» under Nexo ARG › License looks for new versions right away (no 12-hour wait) and installs them: Nexo ARG first when it is also outdated, then Addons (needs Nexo ARG 1.8.4).
* Installing or activating Addons with an outdated Nexo ARG updates Nexo ARG automatically once; if it cannot, the notice with «Update Nexo ARG now» explains why.
* Returns: the script of the «Ask for a return» form in My Account is enqueued (devolucion-cuenta.js) instead of inline, as Nexo ARG 1.8.4 escapes that block.

= 1.5.8 =
* Mercado Libre: every Mercado Libre sale is now a store order («Cada venta de Mercado Libre es un pedido de la tienda», on by default). It shows in Orders with origin «Mercado Libre», counts in WooCommerce statistics and Nexo sales reports, and stock is reduced by the order (returned if Mercado Libre cancels the sale). Products are matched by link, listing or SKU; unknown ones are added as a line without product (they count as sales but do not move stock). Shipping paid by the buyer is included.
* Mercado Libre: sales already imported become orders in the background (25 every 15 minutes): sales from before connecting enter as completed orders without touching stock, and sales whose stock was already reduced are not reduced again.
* Mercado Libre + Invoicing: «Facturar ahora» on a Mercado Libre order uses the buyer tax data from Mercado Libre and uploads the PDF to the sale; the invoice stays on the order. The store automatic invoicing skips Mercado Libre orders (they have their own option) and no invoice email is attempted (Mercado Libre does not share the buyer email).

= 1.5.7 =
* Shipping: the tracking box in emails no longer raises «Attempt to read property id on true» when another plugin (for example CartFlows cart abandonment recovery) renders WooCommerce emails with its own template.

= 1.5.6 =
* Mercado Libre: clothing and footwear categories that require a size chart (SIZE_GRID_ID) now ask for the Mercado Libre size chart number; each variation is matched to its row (SIZE_GRID_ROW_ID) by size, and if the chart lacks a size it says which one.
* Mercado Libre: VAT (VALUE_ADDED_TAX) and import duty (IMPORT_DUTY) are sent automatically when the category has them (21 % and 0 % unless another value is chosen).
* Mercado Libre: when Mercado Libre rejects a listing because an attribute is missing, that attribute is remembered for the category and the form asks for it.
* Mercado Libre: fixed reading the size/color of variations that use a product-level attribute (not a global one).

= 1.5.5 =
* Invoicing: «Anular y volver a facturar» on an authorized invoice that came out wrong (customer, CUIT, letter, amounts). It issues a credit note for the full invoice in ARCA with the reason, emails the credit note to the customer (optional, even with automatic emails off) and opens the order to invoice it again correctly. An invoice cancelled in full no longer blocks the order: it shows «Anulada con nota de crédito» and «Facturar ahora». Automatic invoicing never re-invoices a cancelled order by itself.
* Orders: the invoicing card links to «¿Salió mal? Anular y volver a facturar».
* Mercado Libre › Sales: «¿Salió mal? Anular» on an invoiced sale; after invoicing again, the new PDF replaces the old one on the Mercado Libre sale.

= 1.5.4 =
* Mercado Libre: «Vincular publicaciones que ya tenés» links the listings you already have on Mercado Libre to store products by SKU (item SKU, or each variation's SKU), instead of publishing new ones. Linked listings keep their history, sales, questions and reputation: the store only sends stock (only when the product manages stock) and, if you choose so, price with the surcharge and rounding from Settings. Title, photos and description stay as they are on Mercado Libre.
* Mercado Libre: variations of a linked listing that are not in the store are sent untouched on every update (Mercado Libre deletes the variations that are left out). Several listings with the same SKU (for example classic and premium) share the store stock, and a sale on one updates the others. Full (fulfillment) listings are not linked.
* Mercado Libre: before linking, a review shows each match (stock and price on Mercado Libre → store) and why the others cannot be linked. A linked product cannot be published again from the store (it would duplicate the listing); «Desvincular» leaves the listings on Mercado Libre as they are.
* Mercado Libre: listings that are not in the store (no SKU, or a SKU the store does not have) can be created in the store from the same review: name, description, photos, price, stock and variations (Color, Size…) come from Mercado Libre, as a draft or published, and stay linked. The listing on Mercado Libre is not touched; without a SKU the product gets ML-<listing id>.
* Mercado Libre › Sales: «Facturar» (with the ARCA Invoicing add-on) makes the invoice of a Mercado Libre sale with the buyer's tax data from Mercado Libre (DNI/CUIT, VAT condition, address; A or B by the buyer's condition, C for Monotributo sellers), authorizes it with ARCA and uploads the PDF to the sale on Mercado Libre, where the buyer sees it (Mercado Libre does not share the buyer's email). A cart (pack) with several orders gets one invoice, as Mercado Libre requires. Products in the store use their own VAT rate; shipping paid by the buyer is included.
* Mercado Libre › Connection: the Secret Key field is no longer filled in by the browser's saved passwords, and the steps name the current Mercado Libre app options (Authorization Code + Refresh Token, no PKCE).
* Mercado Libre › Settings: «Facturar solas las ventas de Mercado Libre» invoices and uploads each paid sale automatically (never sales from before connecting). If Mercado Libre already has an invoice on the sale, it says so and offers «Subir a ML»; a cancelled sale that was invoiced offers a credit note.

= 1.5.3 =
* Coupons & promotions and Sales reports moved to the free plugin (Nexo ARG for WooCommerce 1.8.3), now free. Requires Nexo ARG 1.8.3 or newer.

= 1.5.1 =
* Invoicing: order discounts (coupons, negative fees, the «Descuento» adjustment) are now prorated across the VAT rates of the products sold, as ARCA requires, instead of being sent as their own VAT rate. Fixes ARCA rejections 10020, 10045 and 10047 on orders with a discount and products at 10.5 %.
* Invoicing: before sending to ARCA, Nexo ARG checks that no VAT rate is zero or negative and that the net equals the sum of the VAT bases; if a discount is larger than what was sold, it says so instead of sending it.
* Invoicing: the invoice card says how much discount was prorated, and ARCA codes 10020, 10045, 10047 and 10048 are explained in plain Spanish with what to do.

= 1.4.1 =
* Invoicing › ARCA history: a «What is brought and what is not» card explains it plainly — connecting the certificate brings nothing by itself; everything issued through web services with this CUIT (with Nexo ARG or any other system) comes straight from ARCA; vouchers made on the ARCA website and customer names come with the Mis Comprobantes file; item detail, fiscal-printer tickets, export invoices and other CUITs are not brought.
* Requires Nexo ARG 1.7.1.

= 1.4.0 =
* Invoicing › ARCA history: brings the invoices, credit notes and debit notes the business already issued. Everything issued through ARCA web services (with Nexo ARG or another system) is fetched one by one in the background from every point of sale (including closed ones) and type, newest first, with progress, pause and resume; it keeps going if the panel is closed and waits when ARCA is down. Choose everything, the last year, from a date or only what is new since the last time. Vouchers made in Comprobantes en línea / Facturador come in by uploading the Mis Comprobantes file (CSV, ZIP or Excel), which also fills in customer names.
* Nothing already registered is duplicated; credit notes are linked to their invoice; brought vouchers show up in the list (filter by origin), the summary and the IVA sales book, can be printed, and accept credit and debit notes (a full credit note is built from the ARCA amounts).
* Factura de Crédito Electrónica MiPyME types are recognised in the history.
* Requires Nexo ARG 1.7.0.

= 1.3.2 =
* Fixed: updating Addons while Nexo ARG (free) stayed on an old version could stop a screen with «Class … not found». Addons now checks the Nexo ARG version: if it is older than the one it needs (1.5.3), the add-ons pause (no errors) and every admin screen, including Nexo ARG, shows a notice with a one-click «Update Nexo ARG now» button. Your data and settings are untouched.

= 1.3.1 =
* Invoicing in Orders: per order, invoice type, number and date, email status (sent with date and address, not sent, automatic sending off, no customer email, failed with the reason), whether the customer opened or downloaded the invoice, credit notes, and why ARCA rejected it. New states «Rejected by ARCA» and «Voided with a credit note».
* Orders filter by invoicing with counts, and «Send invoices by email» for several orders at once.
* Order sheet: who the invoice is issued to (name, CUIT/DNI, VAT condition), net + VAT for Factura A, email status and whether the customer opened it, and the ARCA rejection message.
* A failed invoice email is recorded on the order and in the error log; it clears when it is sent.
* The orders page loads invoicing data in a single query.

= 1.3.0 =
* Invoicing: invoice many orders at once. Select them in Orders or in Invoicing › Unbilled orders and press «Invoice selected»; a progress window shows each result, and any order that could not be invoiced (missing data, rejected by ARCA) gets a «Complete and invoice» button.
* Invoicing: choose Factura A or B when the business is Responsable Inscripto. The dialog validates the customer CUIT (check digit), offers only the VAT conditions allowed for each letter, asks for the business name and commercial address that a Factura A requires, says exactly what is missing and which invoice will be issued, and warns when the business data is incomplete. Monotributo and Exento businesses are told the invoice will be a C.
* Invoicing: the customer business name and commercial address are saved on the order and reused next time.
* Unbilled orders shows which letter each order will get.

= 1.2.0 =
* Sales redesigned like WooCommerce Analytics: compare with the previous period or the same period last year, group by day, week or month, choose which order statuses count as a sale (paid ones by default, including your own statuses), filter by payment method, delivery type, province and category, eleven metrics (collected, net and gross sales, orders, average ticket, units, customers, new customers, shipping, discounts, refunds) with the chart switching to the one you pick and showing both periods, and sortable, searchable tables by product, category, payment method, delivery, status, province and customer with CSV download. The orders CSV uses the same filters. Your choices are remembered per user.

= 1.1.1 =
* ARCA invoicing: "Test connection" now saves the points of sale ARCA has enabled for web services and uses one of them when the configured one is not enabled (the default 1 was rejected by ARCA with error 11002, "point of sale not enabled"). Drafts created with a disabled point of sale are corrected before being sent, and the error message says which points of sale are enabled.
* ARCA rejections are recorded in the Registro.

= 1.1.0 =
* ARCA invoicing: the invoice is generated as a PDF (with the RG 4291 QR) and attached to the email the customer receives as soon as ARCA authorizes it, sent to the purchase email whether or not the customer has an account; customers with an account also download it from My Account (Orders list and order page). "Download PDF" in the invoicing panel and in the order panel.
* The invoicing email always reaches the buyer: if the invoice has no email, the order billing email is used. An order note records each send.
* Orders panel: invoicing status per order (not invoiced, invoiced but not sent, invoiced and sent) with CAE, email date and actions.
* Store-side errors (ARCA connection, Chatia, updates) are recorded in the new Registro screen of the free plugin.

= 1.0.2 =
* Electronic invoicing (ARCA): fixes "cURL error 35: dh key too small" when connecting to the production WSFE on servers with OpenSSL 3. The lower TLS security level applies only to the connection with ARCA.

= 1.0.1 =
* Updates for the free plugin Nexo ARG for WooCommerce are also offered from arioli.dev while WordPress.org does not provide them, so a store with the add-ons updates both from the Plugins screen.

= 1.0.0 =
* First release as a separate plugin.
