=== ProofPass – Datenblätter ===
Contributors: eadigitalsolutions
Tags: safety data sheet, sds, woocommerce, gpsr, datasheet
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show safety data sheets, technical data sheets and declarations of performance from ProofPass on your website and in WooCommerce.

== Description ==

[ProofPass](https://www.proofpass.eu/) is a data sheet portal for manufacturers and dealers. You upload safety data sheets (SDS), technical data sheets, declarations of performance and other product documents once. ProofPass keeps every version, creates a QR code per product and delivers new versions to your customers with proof of delivery.

This plugin shows those documents on your WordPress website. It uses the official ProofPass embed, which works in every ProofPass plan including the free Basis plan, and, if you add an API key, the read-only ProofPass API for a document list rendered in your theme.

**Shortcode**

* `[proofpass]` shows all products of the manufacturer with search and category filter.
* `[proofpass product="art:SN-310"]` shows one product. `product` takes the ProofPass product slug, the QR short code, `art:` plus the article number, or the GTIN.
* `lang="en"` sets the language (15 EU languages), `height="500"` the height in pixels, `mode="script"` or `mode="iframe"` the display mode.

**Block**

The block "ProofPass data sheets" offers the same options in the block editor sidebar. It is rendered on the server and needs no build step.

**WooCommerce (optional)**

Product pages get the tab "Safety data sheets & manufacturer information". The plugin finds the ProofPass product by itself:

1. the field "ProofPass product" in the product data, if you fill it in,
2. the GTIN: the WooCommerce field "GTIN, UPC, EAN or ISBN" (WooCommerce 9.2+), the fields of common GTIN plugins or a meta key you name,
3. the SKU as article number.

With an API key (ProofPass plans from Start) the tab lists the current documents (type, language, revision date, version, PDF link), manufacturer and responsible person and the safety information, rendered in your theme. A product without documents can hide the tab. Without an API key the tab shows the product in the official embed.

**Built with care**

* The API key stays on your server. It is never printed in HTML or passed to JavaScript. You can also define it in `wp-config.php` as `PROOFPASS_API_KEY`.
* API answers are cached (6 hours by default, adjustable). Saving a product clears its entry. If ProofPass is not reachable, the last answer stays visible and the plugin pauses requests for a few minutes.
* Requests run on the server with a timeout of 8 seconds and the user agent `ProofPass-WordPress/1.0.0`.
* The plugin adds no tracking and no cookies, and shows no admin notices outside its settings page.
* The link "Provided via ProofPass" of the Basis and Start plans is part of the embed and controlled by ProofPass according to your plan.
* German translation included.

== Installation ==

1. Install the plugin from the Plugins screen, or upload the folder `proofpass` to `/wp-content/plugins/`.
2. Activate it.
3. Open Settings → ProofPass and enter your manufacturer: your ProofPass address `https://www.proofpass.eu/hersteller/your-company` or only `your-company`.
4. Optional: paste an API key (ProofPass dashboard → Einbinden → API-Schlüssel, plans from Start) and click "Test connection".
5. Add `[proofpass]` or the block "ProofPass data sheets" to a page. With WooCommerce the product tab appears by itself.

== Frequently Asked Questions ==

= Do I need a paid ProofPass plan? =

No. The embed (shortcode, block and the product tab without API key) works in every plan, including Basis. The API key for the document list rendered in your theme needs the Start plan or higher.

= Can I remove the link "Provided via ProofPass"? =

The link belongs to the Basis and Start plans and is set by ProofPass inside the embed. In the Pro and Business plans it is not shown. The plugin does not change it.

= How does the WooCommerce mapping work? =

First the field "ProofPass product" of the product, then the GTIN, then the SKU as article number (`art:<SKU>`). The first identifier ProofPass knows wins. Developers can change the order with the filter `proofpass_product_lookup_keys`.

= Where does the plugin read the GTIN? =

From the WooCommerce field (since WooCommerce 9.2), from the meta keys `_wpm_gtin_code`, `_alg_ean`, `_ts_gtin`, `_gtin`, `_ean` and from a meta key you enter under Settings → ProofPass.

= A new document version does not show up. =

The document list is cached for 6 hours by default. Save the product or click "Clear cache" under Settings → ProofPass. The embed is always current.

= Does the plugin set cookies? =

No. The plugin sets no cookies. The ProofPass embed sets no cookies either. See "External services".

= Does the plugin make my shop compliant? =

No. It shows the documents and information you maintain in ProofPass. It is not legal advice.

== Screenshots ==

1. Settings → ProofPass: manufacturer, API key, display mode, connection test.
2. The whole manufacturer portal embedded with `[proofpass]`.
3. One product with `[proofpass product="art:SN-310"]`.
4. The block "ProofPass data sheets" with its sidebar.
5. WooCommerce product tab "Safety data sheets & manufacturer information".

== External services ==

This plugin connects to ProofPass, a service of EA Digital Solutions e.U., Liebenauer Hauptstraße 41, 8041 Graz, Austria. It cannot show anything without it.

**1. ProofPass embed (visitor's browser)**

* What it is for: shows the documents of the manufacturer or of one product in a frame (iframe) or through the script `widget.js`.
* What is sent: when a page with the shortcode, the block or the product tab (without API key) is viewed, the visitor's browser loads the frame or the script from `www.proofpass.eu`. ProofPass receives the address of the frame (manufacturer, language and, for one product, the product identifier you set: slug, short code, article number or GTIN) and, as with every web request, the visitor's IP address and browser data. The script reads the language of the page (`lang` attribute) and of the browser to pick the language of the frame. Opening a PDF loads it from `www.proofpass.eu`. Inside the frame, ProofPass counts search terms and document opens anonymously for the manufacturer's statistics (no cookie, no identifier).
* No cookies are set.

**2. ProofPass API (your server, only with an API key)**

* What it is for: reads the current documents and manufacturer information of a product for the WooCommerce tab, and the manufacturer for the connection test.
* What is sent: your API key (HTTP header `Authorization: Bearer …`) and the product identifiers being looked up (GTIN, article number/SKU, ProofPass product ID, slug or short code). Your server's IP address is visible to ProofPass. No visitor data is sent.
* When: when a product page is viewed and no cached answer exists (at most once per product per cache duration, 6 hours by default), and when you click "Test connection".
* Address: `https://www.proofpass.eu/api/v1`.

The connection test without API key requests `https://www.proofpass.eu/einbetten/<manufacturer>/widget.js` once from your server.

* Terms of service: https://www.proofpass.eu/agb
* Privacy policy: https://www.proofpass.eu/datenschutz

== Changelog ==

= 1.0.0 =
* First release: settings page with connection test, shortcode `[proofpass]`, block "ProofPass data sheets", WooCommerce product tab with automatic mapping (GTIN, SKU, override field), API v1 document list with cache, embed fallback, German translation.

== Upgrade Notice ==

= 1.0.0 =
First release.
