=== Mill Chat ===
Contributors: millcorn
Tags: live chat, customer support, woocommerce
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your WordPress or WooCommerce website to your Mill live chat inbox and answer customers from the portal or mobile app.

== Description ==

Mill Chat connects your website to the Mill live chat service. Use your existing Mill company, team, widget design and subscription to answer customers from your shared inbox.

Features:

* Connect a website using its public Mill widget key.
* Enable or disable the visitor chat widget.
* Access widget settings from the Mill Chat entry in the WordPress admin menu.
* Open your Mill inbox in a separate browser tab.
* Optionally hide the widget on WooCommerce checkout pages.
* Optionally wait for a consent-manager event before loading Mill.
* Avoid loading a second widget when a supported manual installation is present.

A [Mill account](https://app.mill.chat), a configured website and an allowed domain are required. This plugin is free; the external Mill service is subject to its current subscription plans and limits. Register or sign in to Mill before configuring the plugin. It does not create a subscription or collect payments in WordPress.

The plugin uses your existing Mill backend. It does not create customer accounts, import WordPress users, or automatically send WooCommerce orders, carts or customer profiles. Widget appearance, operators, conversations and service permissions are managed in Mill. WooCommerce is optional; it is needed only for the checkout exclusion setting.

= External services =

This plugin connects to Mill, an external service operated by Millcorn LLC, to provide live chat, visitor presence and conversation delivery. Its local administration assets are included in the plugin. Its visitor widget is loaded from the service because it communicates with your existing Mill account.

After an administrator enters a valid public widget key, explicitly enables the widget and saves, public pages load https://app.mill.chat/widget/loader.js. The loader requests widget configuration from https://app.mill.chat/api/v1/widget/bootstrap and loads https://app.mill.chat/widget/embed. The embedded widget communicates with Mill's widget APIs for sessions, visitor presence, availability, messages and attachments, and with service storage and real-time infrastructure as needed to provide chat. 

Depending on the visitor's use of the widget, data processed by the service includes:

* The public widget key and website origin used to select the correct Mill website.
* Visited page URL, title and referrer, and visitor activity used for presence and conversation context.
* IP address and browser/device information received by the service; approximate location may be derived from network information.
* Visitor/session identifiers used to maintain chat continuity.
* Messages, uploaded attachments and contact details supplied by the visitor.

The embedded service may use browser local storage and session storage to preserve visitor and session continuity. WordPress stores only the public widget key and plugin preferences in this site's options. Conversation data is stored by Mill, not in the WordPress database.

Installing or activating the plugin alone does not load the external widget. No Mill widget is loaded in WordPress administration, and this connector does not add separate plugin usage analytics. Opening an external Mill link connects your browser to that service.

Service information: [Mill](https://mill.chat).
Privacy information: [Mill Privacy Policy](https://mill.chat/privacy).
Help and account/service questions: [Mill Support](https://mill.chat/support).

= Privacy and consent =

Website owners are responsible for informing visitors about their use of Mill and configuring consent where needed. The optional consent integration delays all widget requests until the configured event is dispatched; it does not provide a consent banner or guarantee legal compliance. Consult the service privacy policy and your site's own requirements before enabling the widget.

== Installation ==

1. Create or sign in to your account at https://app.mill.chat and select the appropriate company and website.
2. In WordPress, open Plugins → Add New → Upload Plugin. Upload the Mill Chat ZIP, install and activate it.
3. Open Mill Chat in the left WordPress admin menu.
4. REQUIRED: In the Mill admin portal, open your company → Settings → Installation → Allowed domains. Add your WordPress hostname, such as example.com. Add www.example.com separately if you use it too. Other subdomains must also be allowed explicitly. Do not enter https:// or a URL path. Without this step the chat will not appear.
5. Copy the data-widget-key value from the Mill installation snippet. Paste that value into Public widget key in WordPress. Check Enable Mill Chat and save changes.
6. If desired, enable Hide on WooCommerce checkout. Enable Wait for visitor consent only after configuring the integration described below.
7. Clear any WordPress, hosting or CDN page caches. Visit a public page and send a test message, then check the Mill inbox.

Use only the public key in the format wk_ followed by 32 lowercase hexadecimal characters. Never enter a private API key, password or Supabase service key. Remove an older manual Mill installation to keep configuration clear.

== Frequently Asked Questions ==

= Do I need a Mill account or a paid subscription? =

You need a Mill account and a configured website. The connector is free. Availability of the external service and its features follows the current Mill plans and your account's subscription limits. See https://mill.chat for service information.

= Can I answer chats inside WordPress? =

The plugin connects the visitor widget and provides a link to your secure Mill inbox. Operator conversations open in the Mill portal in a new tab; the operator portal is not embedded in WordPress administration. You can also use the Mill mobile app.

= Does it work with WooCommerce? =

It loads on standard public store pages. The optional checkout exclusion uses WooCommerce's checkout-page detection. Customer identities, cart contents and orders are not imported. 

= The widget does not appear. What should I check? =

Confirm the public key is correct and Enable Mill Chat is checked. In Mill → Settings → Installation → Allowed domains, allow the exact hostname visitors use. Include www and other subdomains separately. If consent mode is enabled, dispatch its event after the plugin script has loaded. Clear page caches after installation or settings changes. Check that security policies and browser/content blockers permit the Mill script, iframe and service connections.

= Does it work with caching and script optimization? =

Clear WordPress, hosting and CDN caches after saving or updating the plugin. If an optimization tool combines or delays scripts and prevents loading, exclude mill-chat-bootstrap and the Mill widget loader from that optimization. This plugin does not manage third-party cache or optimization settings.

= How do I update without losing my key? =

Upload the new ZIP through Plugins → Add New → Upload Plugin and choose Replace current with uploaded. Do not delete the installed plugin first. Deleting runs uninstall and removes its saved settings. Clear page caches after upgrading.

= What happens when I deactivate or delete the plugin? =

Deactivation stops it from adding the widget to newly generated pages and keeps your settings. Deletion removes this site's public key and preferences. Neither action deletes your Mill conversations or contacts. Clear cached pages if an old widget remains visible.

= How does multisite work? =

Each site uses its own public key and preferences. Settings are not shared across the network. Uninstall removes settings for the current site only; remove the mill_chat_settings option on each relevant site if you require complete network cleanup. Network-wide cleanup is not automated.

= How do I get support? =

Visit https://mill.chat/support. Include your WordPress and plugin versions, browser, website URL and the behavior you observed. Do not send passwords or privileged API keys. Account, subscription and service issues are handled through Mill support.

== Consent integration ==

If Wait for visitor consent is enabled, no Mill widget request is made until your consent manager runs:

`window.dispatchEvent(new Event('mill:consent'));`

Dispatch the event after this plugin's script has loaded, including on each page where prior consent has already been granted. Dispatching it repeatedly does not add multiple loaders. 

When consent is revoked, configure your consent manager to reload the page without dispatching the event. Unloading a running chat in place is not supported. Disabling consent mode loads the enabled widget without waiting for this event.

== Source and license ==

The plugin's PHP, JavaScript and CSS sources are included in the distributed ZIP. No build step is required for those files. This plugin and its bundled visual assets are distributed under GPL version 2 or later; see LICENSE. The Mill name and logo identify the service and are trademarks of their respective owner; the software license does not grant trademark rights.

== Changelog ==

= 0.2.1 =
* Explicit allowed-domain setup, current hostname and disabled/consent notices.
* Expanded directory documentation, external-service disclosure and support information. Runtime code and design unchanged by the documentation update.

= 0.2.0 =
* Mill branding, refreshed admin layout and dedicated left sidebar menu.

= 0.1.0 =
* Initial WordPress and WooCommerce widget connector.

== Upgrade Notice ==

= 0.2.1 =
Clear site caches after updating. Add your website hostname to Mill's Allowed domains. Replace the installed plugin rather than deleting it to keep your public key and preferences.
