=== Lynkig Search ===
Contributors: lynkig
Tags: search, woocommerce, ecommerce, recommendations
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Danish, Swedish and Norwegian WooCommerce search via Lynkig. The store connects only after you paste an install key.

== Description ==

= Dansk =

Lynkig Search er søgning og produktanbefalinger til en WooCommerce-butik. Pluginet er ikke et officielt WooCommerce-produkt.

Butikken forbindes først, når en administrator indsætter en installationsnøgle fra https://lynkig.dk og trykker Forbind. Inden da kalder pluginet ikke Lynkig, og det indsætter ikke noget script.

Pluginet opretter en WooCommerce REST-nøgle, der kun må læse. Lynkig henter produktkataloget fra butikkens REST-API. Når forbindelsen er oprettet, lægges butiksscriptet https://api.lynkig.dk/lynkig.js i footeren. Scriptet er den eneste fjernkode, pluginet henter. Populært i butikken sættes ind før footeren på Storefront-temaet.

Pluginet låser ikke funktioner bag en betaling. Betalte Lynkig-planer administreres i Lynkig-dashboardet, uden for dette plugin. Deaktiveres pluginet, bliver WooCommerce-butikkens egen søgning stående.

Gratis viser et lille link, «Søgning af Lynkig», i bunden af søgefeltet og under anbefalingerne. Søgelog viser det under shoppens eget søgefelt. Linket kan ikke slås fra på de planer. Et klik kan tælles med, når nogen opretter en konto (signup_source=badge). Betalte planer har linket skjult, medmindre butikken selv slår det til.

= English =

Lynkig Search adds Lynkig search and product recommendations to a WooCommerce store. This plugin is not an official WooCommerce product.

The store is connected only when an administrator pastes an install key from https://lynkig.dk and clicks Connect. Before that, the plugin does not call Lynkig and does not insert a script.

The plugin creates a read-only WooCommerce REST key. Lynkig reads the product catalogue from the store's REST API. After the connection succeeds, the storefront script https://api.lynkig.dk/lynkig.js is added in the footer. That script is the only remote code this plugin loads. Popular products are placed before the footer on the Storefront theme.

The plugin does not lock features behind a payment check. Paid Lynkig plans are managed in the Lynkig dashboard, outside this plugin. Deactivating the plugin leaves the store's own WooCommerce search in place.

Gratis shows a small “Søgning af Lynkig” link at the bottom of the search field and under the recommendations. Søgelog shows it under the shop’s own search field. Those plans cannot turn it off. A click can be counted when someone creates an account (signup_source=badge). Paid plans keep the link hidden unless the shop turns it on.

== External services ==

This plugin is a client for Lynkig (https://lynkig.dk). It does not load the storefront script until a store manager pastes an install key and submits the connect form. After Lynkig accepts that key and returns a public key, the plugin registers the storefront script with wp_enqueue_script. It does not print a remote script tag. Nothing is loaded while the install key is empty.

= Activation ping =

On activation the plugin sends one HTTPS POST to `{events}/v1/plugin/activate`. With the default API that host is https://t.lynkig.dk. The body is the site host, the SHA-256 hash of that host, whether the host is a test or staging name, the plugin version, the WordPress version and the WooCommerce version. It does not include an email address or a user name. Lynkig uses the host only to set the test flag and does not store the host. Test hosts (localhost, .local, staging, and *.lynkig-test.example) are kept out of the install counts. The storefront script is not loaded by this ping.

= Connect =

On submit, the plugin sends one HTTPS POST to `{API}/v1/woocommerce/connect`. The default API is https://api.lynkig.dk. A manager can change the API address in the settings; the value must be https and cannot be an IP address or a local hostname.

The request contains:

* the install key, in the Authorization header
* the store home URL
* a new WooCommerce REST consumer key and consumer secret with read permission

Lynkig then reads products from this store's WooCommerce REST API. The fields Lynkig stores from each product are: id, slug, name, description, categories, tags, attributes, permalink, image URL, prices, and stock. The REST credentials are stored encrypted at Lynkig. The read key could technically read other WooCommerce resources; the connection code requests the product list.

= Storefront script and search events =

After a public key has been saved, the plugin enqueues https://api.lynkig.dk/lynkig.js (or `{API}/lynkig.js` if you changed the API address). This is the documented Lynkig storefront script. No other remote JavaScript or CSS is loaded.

With the default API, that script sends search and recommendation events to https://t.lynkig.dk/v1/events. If you set another API address, events are sent to that host instead, not to t.lynkig.dk.

An event can include the search query, how many results were returned, a product id, a widget id, and the event type (search, click, view, add to cart, or widget impression). A persistent visitor id and session id are included only when a consent manager grants statistics consent (Cookiebot, Cookie Information, CookieYes, Complianz, or Shopify customer privacy) or the theme calls `lynkig.consent(true)`. Without that consent those ids are empty. The plugin itself does not set a visitor id.

The search query is sent only after you have connected the store, because that is the search request. Search events are not sent before connect. The activation ping described above is the only call made before connect, and it has no personal data.

= Pages, posts and categories =

After connect, the plugin also sends up to 40 published pages, posts and product categories (title, URL and a short excerpt) to `{API}/v1/content` so they can appear in search. Product data stays on the read-only WooCommerce REST pull described above. This content call does not include customer names, email addresses or orders.

= Product webhooks =

After connect, the plugin registers WooCommerce webhooks for product.created, product.updated, and product.deleted. WooCommerce posts the product payload to `{API}/hooks/woocommerce/{shop_id}` (default host https://api.lynkig.dk). The plugin does not register an order webhook and does not send orders, customer names, or email addresses.

= Terms and privacy =

* Terms: https://lynkig.dk/vilkaar
* Privacy: https://lynkig.dk/privatliv

The Danish terms page is also at https://lynkig.dk/handelsbetingelser. https://lynkig.dk/vilkaar redirects there. The privacy page is https://lynkig.dk/privatliv.

= Eksterne tjenester =

Pluginet henter ikke butiksscriptet, før en administrator indsætter en installationsnøgle og trykker Forbind. Butiksscriptet tilføjes med wp_enqueue_script, først når Lynkig har godkendt nøglen og sendt en offentlig nøgle tilbage. Pluginet udskriver ikke selv et fjernt script-tag. Der hentes intet script, mens installationsnøglen er tom.

Ved aktivering sender pluginet ét HTTPS POST til https://t.lynkig.dk/v1/plugin/activate. Kroppen er sidens host, SHA-256-hash af hosten, om hosten er en test, plugin-versionen, WordPress-versionen og WooCommerce-versionen. Den indeholder ikke en e-mail eller et navn. Lynkig bruger hosten kun til at sætte test-flaget og gemmer ikke hosten. Test-hosts tælles ikke med i install-tallene.

Ved forbindelsen sendes installationsnøglen, butikkens adresse og en ny REST-nøgle med læseadgang til https://api.lynkig.dk/v1/woocommerce/connect. Lynkig henter derefter produktkataloget (id, slug, navn, beskrivelse, kategorier, tags, attributter, permalink, billede, priser og lager) og gemmer REST-nøglen krypteret.

Når butikken er forbundet, indsættes https://api.lynkig.dk/lynkig.js. Det er det eneste script, pluginet henter udefra. Scriptet sender søgninger og anbefalingshændelser til https://t.lynkig.dk/v1/events. En søgehændelse kan indeholde søgeordet, antal resultater, et produkt-id og hændelsestypen. Et vedvarende besøgs-id og sessions-id sendes kun, når en samtykkemanager giver statistik-samtykke, eller temaet kalder `lynkig.consent(true)`. Uden det samtykke er de id'er tomme.

Webhooks sendes for product.created, product.updated og product.deleted til https://api.lynkig.dk/hooks/woocommerce/{shop_id}. Ordrer og kundedata sendes ikke.

Når butikken er forbundet, sender pluginet også op til 40 publicerede sider, indlæg og produktkategorier (titel, URL og et kort uddrag) til `{API}/v1/content`, så de kan vises i søgningen.

= Svenska =

När butiken är ansluten skickar tillägget också upp till 40 publicerade sidor, inlägg och produktkategorier (titel, URL och ett kort utdrag) till `{API}/v1/content`, så att de kan visas i sökningen.

= Norsk =

Når butikken er tilkoblet, sender utvidelsen også opptil 40 publiserte sider, innlegg og produktkategorier (tittel, URL og et kort utdrag) til `{API}/v1/content`, så de kan vises i søket.

Vilkår: https://lynkig.dk/vilkaar
Privatliv: https://lynkig.dk/privatliv

== Installation ==

= Dansk =

1. Plugins, Tilføj ny, Upload plugin. Vælg lynkig-search.zip og aktivér.
2. WooCommerce skal være aktivt. Shoppen skal være online med https. I kan teste på et staging-site.
3. Opret butikken på https://lynkig.dk. Installationsnøglen vises, når butikken er tilsluttet. Kopiér den.
4. Åbn WooCommerce, Lynkig. Indsæt nøglen og tryk Forbind og synkroniser.

= English =

1. Open Plugins, Add New, Upload Plugin. Choose lynkig-search.zip and activate it.
2. WooCommerce must be active. The shop must be online with https. You can test on a staging site.
3. Create the store at https://lynkig.dk. The install key is shown after the store is connected. Copy it.
4. Open WooCommerce, Lynkig. Paste the key and click Connect and sync.

Uninstalling the plugin deletes its options, WooCommerce webhooks whose title starts with "Lynkig ", and REST keys described as "Lynkig Search" or "Lynkig".

== Frequently Asked Questions ==

= Kalder pluginet Lynkig, før jeg forbinder? =

Butiksscriptet indsættes først, når forbindelsen er gemt. Ved aktivering sendes hosten, en hash og tre versionsnumre. Lynkig gemmer ikke hosten. Ingen e-mail.

= Does the plugin call Lynkig before I connect? =

The storefront script is added only after the connection is saved and a public key is stored. Activation sends the host, its hash and three version numbers. Lynkig does not store the host. No email.

= Sendes der et besøgs-id uden samtykke? =

Nej. Søgeordet sendes, når butikken er forbundet, fordi det er selve søgningen. Et vedvarende besøgs-id og sessions-id sendes kun med statistik-samtykke.

= Is a visitor id sent without consent? =

No. The search query is sent after you connect, because that is the search itself. A persistent visitor id and session id are sent only with statistics consent.

= Hvilke ordrer sendes? =

Ingen. Pluginet opretter ikke en ordre-webhook.

= Which orders are sent? =

None. The plugin does not register an order webhook.

= Kan jeg bruge pluginet uden at betale? =

Pluginet tjekker ikke en betaling og slukker ikke WooCommerce-søgningen. Hvad Lynkig-kontoen må, står i dashboardet på https://lynkig.dk.

= Can I use the plugin without paying inside WordPress? =

The plugin does not check a payment and does not turn off WooCommerce search. What the Lynkig account includes is managed in the dashboard at https://lynkig.dk.

== Changelog ==

= 1.0.7 =

* The connect button says "Prøv Vækst gratis i 14 dage" and can be translated. The signup link includes platform=woocommerce and plan=vaekst.
* Forbind-knappen siger «Prøv Vækst gratis i 14 dage» og kan oversættes. Linket har platform=woocommerce og plan=vaekst.

= 1.0.6 =

* The activation ping includes the site host and is_test. Lynkig stores the hash and the test flag, not the host. Test and staging hosts are left out of the install counts. The connect button opens /opret?plan=vaekst.
* Aktiveringskaldet sender host og is_test. Lynkig gemmer hashen og test-flaget, ikke hosten.

= 1.0.5 =

* Without an install key, the settings page and an admin notice show a button to https://lynkig.dk/opret?plan=vaekst with the shop address, src=wp-plugin and a return URL.
* Activation sends one anonymous ping to POST /v1/plugin/activate: SHA-256 of the site host, plugin version, WordPress version and WooCommerce version. No email and no site URL.
* Uden installationsnøgle viser indstillingerne og en admin-note knappen Opret gratis konto. Aktivering sender ét anonymt kald med hash af hosten og tre versionsnumre. Ingen e-mail og ingen adresse.

= 1.0.4 =

* After connect, the plugin sends up to 40 published pages, posts and product categories (title, URL and a short excerpt) to `{API}/v1/content` so they can appear in search.
* Når butikken er forbundet, sender pluginet op til 40 publicerede sider, indlæg og produktkategorier (titel, URL og et kort uddrag) til `{API}/v1/content`.
* När butiken är ansluten skickar tillägget upp till 40 publicerade sidor, inlägg och produktkategorier (titel, URL och ett kort utdrag) till `{API}/v1/content`.
* Når butikken er tilkoblet, sender utvidelsen opptil 40 publiserte sider, innlegg og produktkategorier (tittel, URL og et kort utdrag) til `{API}/v1/content`.

= 1.0.3 =

* The short description names Danish, Swedish and Norwegian search. Swedish (sv_SE) and Norwegian (nb_NO) translations are in languages/.
* Den korte beskrivelse nævner dansk, svensk og norsk søgning. Svensk og norsk oversættelse ligger i languages/.

= 1.0.2 =

* Requires WordPress 6.2, which is the WordPress version WooCommerce 8.2 requires. The plugin does not use a WordPress function added after 6.2. The storefront script is registered with wp_enqueue_script and the boolean footer argument. Defer is added only on WordPress 6.3 and newer.
* Tested up to WordPress 7.1, the current release line (7.1.3).
* The plugin zip uses one top-level folder, lynkig-search/, and a 2026-10-24 12:00 timestamp on every entry.
* Kræver WordPress 6.2, som er den WordPress-version WooCommerce 8.2 kræver. Pluginet bruger ikke en WordPress-funktion, der er tilføjet efter 6.2. Butiksscriptet registreres med wp_enqueue_script og det booleske footer-argument. Defer tilføjes kun på WordPress 6.3 og nyere.
* Testet op til WordPress 7.1, den aktuelle udgivelseslinje (7.1.3).
* Plugin-zippen har én mappe i roden, lynkig-search/, og tidsstemplet 2026-10-24 12:00 på alle filer.

= 1.0.1 =

* Popular products are placed before the footer on Storefront, not under it. Other slots use WooCommerce hooks.
* Leftover read-only REST keys from a failed connect are removed. A working key is kept until the new connect succeeds.
* The settings page says install key, and the https hint says the shop must be online. A staging site with https is fine.
* Requires WordPress 6.4.
* Populære varer placeres før footeren på Storefront. Andre felter bruger WooCommerce-hooks.
* REST-nøgler fra en mislykket forbindelse slettes. En nøgle, der virker, beholdes, indtil den nye forbindelse lykkes.
* Siden siger installationsnøgle, og https-teksten siger, at shoppen skal være online. Et staging-site med https er fint.
* Kræver WordPress 6.4.

= 1.0.0 =

* First release for the WordPress.org plugin directory.
* Read-only catalogue sync, product webhooks, and the documented storefront script.
* Første udgave til WordPress.org. Katalogsynk, produkt-webhooks og det dokumenterede butiksscript.
