=== Amadast Shipping ===

Contributors: amadast, alih70442
Tags: shipping, delivery, online-shipping-calculation, online store, ecommerce
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 3.3.4
Requires PHP: 7.4
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

محاسبه آنلاین هزینه ارسال سفارشات ووکامرس با تیپاکس، باکسیت، دیجی‌اکسپرس و سایر سرویس‌های حمل‌ونقل آمادست.

== Description ==

افزونه آمادست یک راهکار حرفه‌ای برای محاسبه آنلاین هزینه ارسال در ووکامرس است که به فروشگاه شما امکان می‌دهد هزینه ارسال سفارشات را به‌صورت لحظه‌ای و هوشمند محاسبه کرده و در اختیار مشتریان قرار دهد.

با استفاده از آمادست می‌توانید روش‌های مختلف ارسال را مدیریت کرده، هزینه ارسال را بر اساس وزن، ارزش کالا، شهر مبدا و مقصد محاسبه کنید و تجربه خرید بهتری برای مشتریان خود فراهم نمایید.

ویژگی‌های اصلی افزونه:

* محاسبه آنلاین و لحظه‌ای هزینه ارسال
* لیست داینامیک سرویس‌دهندگان از API آمادست (همراه با پیک و تحویل حضوری)
* نمایش هزینه ارسال در صفحه سبد خرید و تسویه حساب
* امکان تعریف روش‌های ارسال سفارشی
* محدودیت وزن برای هر سرویس ارسال
* اولویت‌بندی نمایش روش‌های ارسال
* پشتیبانی از پرداخت در محل (COD)
* تخمین هوشمند هزینه ارسال در صورت عدم دسترسی سرویس اصلی
* تشخیص هوشمند نوع بسته‌بندی با استفاده از هوش مصنوعی
* تست هزینه حمل‌ونقل در پنل مدیریت (چند محصول و مقایسه شهرها)
* ارسال رایگان بر اساس مبلغ سبد یا شهرهای خاص
* غیرفعال‌سازی سرویس‌دهنده برای شهرهای مشخص
* آیکون سرویس‌دهندگان در پنل و (اختیاری) در صفحه پرداخت
* انتخاب موقعیت مکانی مشتری روی نقشه
* سازگاری کامل با ووکامرس و نسخه‌های جدید وردپرس
* ابزارهای مدیریتی، لاگ فعالیت و سوالات متداول

آمادست مناسب فروشگاه‌هایی است که می‌خواهند هزینه ارسال را به‌صورت دقیق، خودکار و بدون نیاز به محاسبات دستی مدیریت کنند.

== Screenshots ==

1. صفحه تنظیمات افزونه
2. نمایش هزینه ارسال در صفحه سبد خرید
3. نمایش هزینه ارسال در صفحه تسویه حساب

== External services ==

این افزونه برای ارائه برخی قابلیت‌ها به سرویس‌های آمادست و سرویس‌های شخص ثالث متصل می‌شود. اطلاعات تنها هنگام استفاده از قابلیت مربوطه ارسال خواهند شد.

= Amadast Shipping Calculator API =

این سرویس برای محاسبه آنلاین هزینه ارسال در صفحه سبد خرید و تسویه حساب استفاده می‌شود.

اطلاعات ارسالی:

* شهر مبدا و مقصد
* وزن، ارزش و نوع بسته
* سرویس‌های حمل‌ونقل انتخاب‌شده
* نسخه افزونه
* آدرس سایت، نام سایت، توضیحات سایت و ایمیل مدیر
* تنظیمات مرتبط افزونه

در صورت عدم پاسخ‌گویی سرویس، افزونه می‌تواند از قیمت‌های جایگزین تعریف‌شده استفاده کند.

Service provider: Amadast
Terms of service: https://amadast.com/terms
Privacy policy: https://amadast.com/terms

= Amadast Couriers List API =

این سرویس برای دریافت لیست به‌روز سرویس‌دهندگان حمل‌ونقل قابل‌استفاده در تنظیمات و محاسبه هزینه ارسال استفاده می‌شود.

اطلاعات ارسالی:

* درخواست خواندن لیست سرویس‌دهندگان (بدون داده شخصی مشتری)

Service provider: Amadast (api.amadast.com)
Terms of service: https://amadast.com/terms
Privacy policy: https://amadast.com/terms

= Amadast Account API (OTP authentication) =

این سرویس برای ورود مدیر فروشگاه به حساب آمادست از طریق رمز یکبارمصرف استفاده می‌شود.

اطلاعات ارسالی:

* شماره موبایل
* کد تایید یکبارمصرف
* اطلاعات ورود و آدرس سایت

Service provider: Amadast
Terms of service: https://amadast.com/terms
Privacy policy: https://amadast.com/terms

= Amadast Package Detection API =

این سرویس برای تشخیص هوشمند نوع بسته‌بندی موردنیاز سفارش استفاده می‌شود.

اطلاعات ارسالی:

* ابعاد محصولات
* وزن محصولات
* تعداد کالاها
* اطلاعات موردنیاز برای تخمین بسته‌بندی

Service provider: Amadast (shop-integration.amadast.com)
Terms of service: https://amadast.com/terms
Privacy policy: https://amadast.com/terms

= Amadast AI Shipping Price Prediction =

در صورت عدم دسترسی به سرویس اصلی محاسبه هزینه ارسال، این سرویس برای تخمین هوشمند هزینه ارسال مورد استفاده قرار می‌گیرد.

اطلاعات ارسالی:

* شهر فرستنده
* شهر گیرنده
* وزن بسته
* ارزش بسته
* نوع بسته
* سرویس حمل‌ونقل انتخاب‌شده

Service provider: Amadast (predict.amadast.sabz.cloud)
Terms of service: https://amadast.com/terms
Privacy policy: https://amadast.com/terms

= Neshan Maps (optional) =

در صورت فعال بودن قابلیت نقشه، اطلاعات موقعیت مکانی انتخاب‌شده توسط کاربر برای تبدیل مختصات به آدرس ارسال می‌شود.

اطلاعات ارسالی:

* طول و عرض جغرافیایی
* کلید API نشان

Service provider: Neshan (neshan.org)
Terms of service: https://platform.neshan.org/terms
Privacy policy: https://platform.neshan.org/privacy

= Amadast media CDN (admin landing page only) =

برای نمایش ویدئوهای آموزشی و معرفی در پنل مدیریت ممکن است فایل‌های چندرسانه‌ای از سرورهای آمادست بارگذاری شوند.

اطلاعات ارسالی:

* IP کاربر
* User Agent مرورگر
* آدرس فایل درخواستی

Service provider: Amadast (amadast-file.storage.iran.liara.space)
Terms of service: https://amadast.com/terms
Privacy policy: https://amadast.com/terms

== Installation ==

= نصب از طریق پیشخوان وردپرس =

1. وارد بخش افزونه‌ها شوید.
2. روی «افزودن افزونه» کلیک کنید.
3. عبارت Amadast را جستجو کنید.
4. افزونه را نصب و فعال نمایید.

= نصب از طریق فایل ZIP =

1. وارد بخش افزونه‌ها شوید.
2. روی «بارگذاری افزونه» کلیک کنید.
3. فایل amadast-shipping-wp.zip را انتخاب نمایید.
4. روی «نصب» کلیک کنید.
5. افزونه را فعال نمایید.

== Frequently Asked Questions ==

= آیا این افزونه فقط برای ووکامرس است؟ =

بله، این افزونه برای فروشگاه‌های ووکامرسی طراحی شده است.

= چه سرویس‌های حمل‌ونقلی پشتیبانی می‌شوند؟ =

لیست سرویس‌دهندگان به‌صورت آنلاین از آمادست دریافت می‌شود (مانند تیپاکس، باکسیت، پارسی‌پست، دکا‌پست، دیجی‌اکسپرس و موارد جدید). پیک و تحویل حضوری نیز به‌صورت ثابت در افزونه باقی می‌مانند.

= اگر سرویس محاسبه آنلاین در دسترس نباشد چه می‌شود؟ =

افزونه می‌تواند از قیمت‌های جایگزین یا تخمین هوشمند مبتنی بر هوش مصنوعی استفاده کند.

== Changelog ==

= 3.3.4 - 2026-10-06 =
- New: Calculator initial request always sends `is_plugin: true`.
- New: Each courier shipping method is a separate admin/checkout option (toggle methods independently on the same courier).
- Enhancement: Calculator logs list enabled, returned, and missing shipping method IDs.
- Enhancement: Migration enables sibling shipping methods when a courier's first method was already enabled.
- Fix: Current API methods titled like "پست پیشتاز" are no longer treated as legacy and hidden.
- Fix: AI prediction and COD rates use per-method IDs consistently.

= 3.3.3 - 2026-09-05 =
- New: Dynamic shipping providers list from Amadast couriers API (with cache/fallback); Peyk, in-person pickup, and custom methods remain available.
- New: Admin shipping cost tester — search/select multiple products, destination city, packaging detection source, rates table, and compare with another city.
- New: Free shipping by minimum order amount and related WooCommerce general shipping rules.
- New: Disable specific providers for selected cities.
- New: Provider icons in admin lists; optional icon display on cart/checkout.
- New: Expanded Support & FAQ tab with practical troubleshooting answers.
- New: Duplicate-install guard — if multiple Amadast Shipping copies are active (even with different folder names), the newest version stays active and older copies are auto-deactivated.
- Enhancement: Checkout waits for a complete calculator response before showing rates; clearer logging for missing providers.
- Enhancement: Activity logs now show meaningful events only (settings save, calculator/packaging requests, auth, errors).
- Fix: Mixed carts with free-shipping and paid products no longer force free shipping for the whole cart.
- Fix: Legacy providers (e.g. regular/express post) and duplicate provider rows no longer appear after migrating to the dynamic list.
- Fix: Provider city-selection modal now closes correctly after confirm.
- Fix: Admin test prices formatted in plain currency text (no broken IRT HTML entities).
- Fix: Duplicate provider names on checkout when icons are enabled (empty image alt text).

= 3.3.2 - 2026-08-31 =
- Enhancement: Redesigned admin settings with a right-side sidebar navigation and per-page headers.
- Enhancement: Calculator API wait time is now fixed between 60–120 seconds; the manual setting was removed to prevent misconfiguration.
- Enhancement: Shipping method is created automatically on install/update; a warning banner appears only if auto-creation fails.
- Fix: Only Amadast-related admin notices are shown on plugin settings pages.

= 3.3.1 - 2026-06-28 =
- Fix: OTP login page — mobile number field and form buttons now display and work correctly.
- Fix: Replaced inline auth scripts with enqueued assets/js/auth.js (wp_kses_post was outputting JavaScript as visible page text).

= 3.2.4 - 2026-06-11 =
- Compliance: Renamed plugin display name to remove "WP" per WordPress.org trademark guidelines.
- Compliance: Aligned Requires at least and Requires PHP between plugin header and readme.
- Compliance: Completed External services documentation for all remote endpoints used by the plugin.
- Compliance: Applied escaping and sanitization fixes across admin UI, wizard, auth, and settings screens.
- Compliance: Ensured nonce and server input sanitization follows WordPress security guidelines.

= 3.2.3 - 2026-06-06 =
- New: Per-provider display priority on checkout (lower number = shown first).
- New: Per-provider max cart weight limit in grams.
- New: Custom Amadast shipping methods with province/city/weight/price/product conditions, free or paid cost, and COD support.

= 3.2.2 - 2026-06-02 =
- Compliance: Set WordPress "Tested up to" to major version 7.0 (WordPress.org plugin guidelines).
- Compliance: Removed custom Plugin Update Checker; updates are delivered only via WordPress.org.

= 3.2.1 - 2026-05-28 =
- New: Configurable calculator API wait time on checkout (default 4 seconds) in calculator settings.
- Enhancement: On timeout, fallback to AI price estimation (1 second) when enabled, then fixed rate.
- Enhancement: Faster shipping price polling and deadline-aware HTTP timeouts on checkout.
- Enhancement: Fixed-rate shipping label on checkout shows as "هزینه ارسال:"; admin orders show "هزینه ثابت" as rate source.

= 3.2.0 - 2026-04-08 =
- Compatibility: Added broader compatibility improvements with newer WordPress/WooCommerce versions.
- Enhancement: Added automatic detection and auto-fix tools for city/state checkout fields, including an alternative loading method for improved reliability.
- Fix: Resolved an issue where Post and other courier services could intermittently not appear on the checkout page.
- Enhancement: Improved overall stability and compatibility with newer environments.
- New: AI-based shipping price estimation when Amadast/Post services are unavailable.
- New: Integrated a new AI-powered package type detection service (box_id + packing_id).
- New: Added Boxit shipping provider.
- New: Added in-person pickup option for local customers.
- New: Added advanced fallback customization when Amadast/Post APIs are unavailable (custom message or admin-defined fixed pricing).
- Enhancement: Improved plugin settings UX and added more customization options.
- Enhancement: Improved plugin logging (more structured, safer, and more actionable).
- Dev: In the WooCommerce wc-json order output, packing metadata can be identified via: box_id, packing_id, and source (ai / algo / manual).

= 2.1.2 - 2025-09-01 =
- Compatibility: Tested with WordPress 6.7.1 and WooCommerce 9.5.1. Requires PHP 8.0+ (compatible with 8.2+).
- Fix: Resolved PHP 8.2 deprecations by adding typed properties to AMDSP_Online_Method and removing dynamic property writes.
- Fix: Avoided deprecated intval() usage with null base; now properly handles defaults.
- Enhancement: Treat WooCommerce Cart/Checkout Blocks as compatible to remove false error notices.
- Enhancement: Fallback resolution from city name to city ID with Persian/Arabic character normalization for better Blocks support.
- Enhancement: Admin compatibility notices are now dismissible.
- Dev: Use AMDSP_VERSION for script versioning to improve cache-busting across releases.
- New: Completely redesigned settings panel UI with improved UX and Persian typography.
- New: OTP-based Amadast account authentication inside settings with account info view and logout.
- New: Logs tab with inline viewer (tail) and secure log download.
- New: Export/Import all plugin settings as JSON from the settings page.
- New: Advanced city picker for selecting free-shipping cities with search and multi-select.
- New: Auto-detect WooCommerce weight unit and normalize to grams; manual override option available.
- New: Default product dimensions (cm) setting to improve package-size detection when product dimensions are missing.
- New: Post-payment (pay-on-delivery) toggle with per-carrier options (Post, Tipax).
- New: Admin tool to ensure the Amadast shipping method exists in WooCommerce zones (with AJAX button).
- Change: Added extra-cost (fixed and percent) settings and "hide other methods when free shipping is available" toggle.
- Change: Added fallback shipping price when API is down (base + per-kilo extras) settings.
- Dev: Version upgrades include data migrations (2.1.2 to ensure shipping method; 2.1.3 to convert default dimensions from mm to cm when needed).

== Upgrade Notice ==

= 3.3.4 =
Per-shipping-method checkout options (not only per courier). Recommended before enabling new multi-method couriers from Amadast.

= 3.3.3 =
Dynamic couriers list, admin shipping cost tester, free-shipping rules, per-city provider blocks, provider icons, and important checkout/rate display fixes. Recommended update.

= 3.3.1 =
Fix: OTP login page mobile field and authentication form now work correctly.

= 3.2.3 =
New: shipping display priority, max weight limits per provider, and custom conditional shipping methods.
Required for WordPress.org repository compliance: security escaping, readme metadata, and external services documentation.

= 3.2.2 =
Required for WordPress.org repository compliance: correct tested-up-to header and removal of external update checker.

= 2.1.2 =
Major update: redesigned settings, OTP login, logs and settings import/export, advanced city picker, weight unit auto-detect, post-payment, and admin shipping method tool. Also includes PHP 8.2 fixes and Blocks compatibility improvements. Update recommended.
