# Junk Removal Cost Calculator

WordPress plugin for adding a customizable junk removal estimate calculator to a page, post, or Elementor layout.

## Features

- Shortcode: `[junkreco_calculator]`
- Specific item pricing with editable categories, items, images, and prices.
- Truck volume pricing with editable load labels, descriptions, images, and prices.
- Optional Junkpath AI Photo Estimator with a server-side API key and visitor photo uploads.
- Client-side image optimization for AI estimator photos before they are uploaded to WordPress.
- Junkpath account tools that automatically load estimator settings and extra fees from WordPress admin after an API key is saved.
- Configurable booking action:
  - Redirect to a booking URL.
  - Open the built-in booking request form.
- Built-in request form with configurable recipient email, required fields, optional ZIP code eligibility, optional photo uploads, and optional success redirect.
- Admin settings under **Settings -> Junk Calculator**:
  - General
  - Design & Branding with live mobile preview
  - Specific Item Pricing
  - Booking Form
  - Truck Volume Pricing
  - AI Photo Estimator
- Optional native Elementor widget when Elementor is active.
- No build step. Junkpath is optional and only used when the AI Photo Estimator is configured and enabled.

## Installation

1. Upload the plugin zip through **Plugins -> Add New -> Upload Plugin**, or copy this folder to `wp-content/plugins/junk-removal-cost-calculator`.
2. Activate **Junk Removal Cost Calculator**.
3. Go to **Settings -> Junk Calculator** and configure pricing, design, and booking behavior.
4. Add `[junkreco_calculator]` to any page or post.

## Shortcode Options

```text
[junkreco_calculator]
[junkreco_calculator booking_url="/book-now/" button_label="Continue to Booking"]
[junkreco_calculator booking_mode="form"]
[junkreco_calculator booking_mode="redirect"]
[junkreco_calculator pricing_methods="specific"]
[junkreco_calculator pricing_methods="volume"]
[junkreco_calculator pricing_methods="specific,volume"]
[junkreco_calculator pricing_methods="ai"]
[junkreco_calculator pricing_methods="specific,volume,ai"]
[junkreco_calculator title="Get an Instant Junk Removal Estimate"]
```

Supported attributes:

- `booking_url`: overrides the admin booking URL when redirect mode is used.
- `booking_mode`: overrides the admin booking action. Use `form` or `redirect`.
- `button_label`: changes the booking CTA label.
- `pricing_methods`: overrides the admin pricing-method setting. Use `specific`, `volume`, `ai`, comma-separated combinations, `both`, or `all`.
- `title`: changes the calculator heading.
- `intro`: changes the intro text under the heading.

## Booking Form Notes

Built-in booking requests are sent through WordPress `wp_mail()`. Production sites should use a reliable mail/SMTP setup if email delivery matters.

Optional photo uploads are attached to the notification email and removed from temporary storage after the email attempt.

## AI Photo Estimator Notes

The AI Photo Estimator is optional. When enabled, visitors can upload photos that are optimized in the browser before WordPress forwards them server-side to the Junkpath API using the saved API key. The key is not exposed to frontend JavaScript.

Detected Junkpath extra fees are shown in the AI estimate result when the API returns them.

The AI Photo Estimator tab automatically loads Junkpath pricing settings and extra fees after an API key is saved. Admins can also update pricing settings and manage extra fees through server-side WordPress AJAX requests.

Junkpath extra fee pricing is entered in the plain-English instruction, such as `$25 per tire you see in the photos`; the plugin derives the API unit price from that instruction when saving the fee.

Junkpath API docs: https://junkpath.com/api-docs

## WordPress.org Submission Notes

- Main plugin header and `readme.txt` declare GPLv2-or-later licensing.
- Default catalog imagery uses bundled WebP item/category photos with SVG placeholders as a fallback.
- The generated submission zip should not include old zip files, `.git`, local build folders, or other unused development artifacts.
