=== JNE Shipping - Plugin Ongkos Kirim Resmi Untuk WooCommerce ===
Contributors: jneshipping
Donate link:
Tags: shipping, woocommerce, jne, indonesia, courier
Requires at least: 5.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.8.0
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt

Plugin pengiriman JNE resmi untuk WooCommerce di Indonesia. Menyediakan tarif real-time, pembuatan AWB, dan pelacakan pengiriman.

== Description ==

Plugin WordPress terintegrasi dengan WooCommerce untuk layanan pengiriman JNE di Indonesia.

== External Services ==

Plugin ini terhubung ke API Resmi JNE untuk menyediakan fungsionalitas pengiriman untuk toko WooCommerce di Indonesia. Dengan menggunakan plugin ini, Anda menyetujui bahwa data akan dikirimkan ke layanan API resmi JNE seperti yang dijelaskan di bawah ini.

**Layanan API Resmi JNE**
**URL Layanan:** https://shipping.jne.co.id
**Penyedia Layanan:** PT. Tiki Jalur Nugraha Ekakurir (JNE)

Untuk apa layanan ini digunakan:
- Registrasi toko dan autentikasi dengan layanan JNE
- Mengambil tarif pengiriman real-time dan opsi pengiriman
- Membuat label pengiriman (AWB - Air Waybill)
- Melacak status pengiriman dan pembaruan pengiriman
- Mengelola permintaan penjemputan dan penjadwalan
- Mendapatkan data lokasi asal dan tujuan

Data apa yang dikirim dan kapan:
- **Registrasi toko**: Nama toko, URL, detail kontak, dan informasi PIC (Person in Charge) selama setup dan konfigurasi plugin awal
- **Perhitungan pengiriman**: Alamat pengiriman pelanggan (nama, alamat, kota, kode pos, nomor telepon), berat dan dimensi paket saat menghitung tarif pengiriman selama checkout
- **Pembuatan AWB**: Detail pesanan lengkap termasuk informasi pengirim dan penerima, detail item (nama, jumlah, berat, dimensi), dan layanan pengiriman yang dipilih saat membuat label pengiriman
- **Permintaan pelacakan**: Nomor AWB saat meminta pembaruan status pengiriman
- **Permintaan penjemputan**: Data lokasi penjemputan, penjadwalan yang diinginkan, dan informasi kontak saat meminta penjemputan paket
- **Pencarian lokasi**: Kata kunci pencarian atau kode pos saat mencari asal atau tujuan di antarmuka admin
- **Autentikasi**: Kunci akses API dan token untuk otorisasi layanan

Transmisi data terjadi:
- Selama setup dan konfigurasi plugin (registrasi toko dengan JNE)
- Ketika pelanggan menghitung biaya pengiriman selama proses checkout
- Ketika pemilik toko memproses pesanan dan membuat label AWB
- Ketika melacak status pengiriman melalui antarmuka admin atau pelacakan pelanggan
- Ketika menjadwalkan permintaan penjemputan untuk paket
- Ketika mencari lokasi asal/tujuan di admin

**Keamanan dan Transmisi Data:**
- Semua permintaan dikirim dengan aman melalui enkripsi HTTPS ke shipping.jne.co.id
- Data digunakan semata-mata untuk memfasilitasi operasi pengiriman dengan layanan JNE untuk pesanan Anda
- Plugin tidak menyimpan informasi pembayaran pelanggan yang sensitif
- Anda harus mendapatkan dan mengonfigurasi kredensial akses API JNE di pengaturan plugin

**Ketentuan Layanan dan Kebijakan Privasi:**
- Situs Web Resmi JNE: https://www.jne.co.id
- Ketentuan Layanan JNE: https://www.jne.co.id/id/tentang-jne/syarat-ketentuan
- Kebijakan Privasi JNE: https://www.jne.co.id/id/tentang-jne/kebijakan-privasi
- Dukungan Pelanggan JNE: https://www.jne.co.id/id/hubungi-kami

**Opsi Opt-out:**
- Jika Anda menonaktifkan plugin ini atau tidak mengonfigurasi kredensial API JNE, tidak ada data yang akan dikirim ke JNE
- Anda dapat secara selektif menonaktifkan fitur tertentu (pelacakan, penjadwalan penjemputan) untuk membatasi transmisi data
- Menghapus instalasi plugin akan menghentikan semua transmisi data ke layanan JNE

**Kepatuhan Hukum dan Tanggung Jawab:**
Sebagai pemilik situs, Anda bertanggung jawab untuk:
- Memastikan Anda memiliki dasar hukum yang tepat dan persetujuan pelanggan untuk mengirimkan data pribadi ke JNE untuk keperluan pengiriman
- Kepatuhan terhadap undang-undang perlindungan data yang berlaku (GDPR, Undang-Undang Perlindungan Data Pribadi Indonesia/UU PDP, dll.)
- Menginformasikan kepada pelanggan bahwa data pengiriman mereka akan diproses oleh JNE untuk layanan pengiriman
- Mempertahankan kebijakan privasi dan ketentuan layanan yang sesuai di situs web Anda

== Installation ==

1. Unggah plugin ke folder `/wp-content/plugins/`
2. Aktifkan plugin melalui menu 'Plugins' di WordPress
3. Konfigurasi pengaturan di Menu JNE Shipping

== Frequently Asked Questions ==

= Apakah plugin ini gratis? =
Ya, plugin ini gratis.

== Screenshots ==

1. Konfigurasi pengiriman JNE
2. Halaman checkout dengan opsi JNE

== Changelog ==

= 1.8.0 =
* Added: Auto-clear webhook logs feature - Webhook logs older than 1 month are automatically deleted daily via WordPress cron job
* Improved: Webhook log management with automatic cleanup to prevent database bloat

= 1.7.1 =
* Fixed: Auto-generate tracking number now triggers when order status matches configured status (WooCommerce status format normalization)
* Fixed: Order status after successful pickup request now updates correctly (WooCommerce status format normalization)

= 1.7.0 =
* Added: Configuration for auto-generate tracking number - Choose which order statuses trigger automatic tracking number generation (default: processing)
* Added: Configuration for pickup success status - Choose which order status to set after successful pickup request (default: completed)
* Added: Minimum purchase parameter for shipping cost adjustments - Set minimum cart total required for adjustment to apply
* Improved: Default values are now clearly displayed and automatically applied in settings page for better user experience

= 1.6.0 =
* Changed: Shipping cost (ongkos kirim) check no longer requires phone number; JNE rates are shown based on postcode and weight only
* Added: Checkout validation - When JNE is selected as shipping method, order must have a phone number in billing or shipping address; checkout is blocked with an error if both are empty

= 1.5.0 =
* Added: Insurance cost charge option - Choose whether insurance cost is charged to buyer or seller (default: buyer)
* Added: Insurance cost is now always saved to order meta for tracking and AWB label display, regardless of who pays

= 1.4.2 =
* Fixed: JNE Actions column and No. Resi column now appear correctly on WooCommerce orders page for users with HPOS disabled or using legacy CPT screen
* Fixed: Bulk actions "JNE - Request Pickup" and "JNE - Cetak Label" now work properly on legacy WooCommerce orders screen (edit-shop_order)
* Improved: Added support for both HPOS (High-Performance Order Storage) and legacy CPT (Custom Post Type) order screens
* Enhanced: Plugin now automatically detects and handles both order screen types, ensuring compatibility across all WooCommerce versions

= 1.4.1 =
* Added: Dimensional weight (volumetric weight) calculation - Weight calculation now compares real weight vs dimensional weight
* Formula: Dimensional weight = (length × width × height) / 6000
* Enhanced: Weight calculation uses the higher value between real weight and dimensional weight for shipping cost calculation
* Added: Automatic dimension unit conversion support (cm, m, in, yd, mm) based on WooCommerce dimension unit settings
* Improved: Shipping cost accuracy by considering both physical weight and package volume
* Fixed: Weight calculation now properly handles products with dimensions but no weight, and vice versa

= 1.4.0 =
* Added: Automatic weight unit conversion based on WooCommerce settings
* Support for converting weight from gram (g), pound (lbs), and ounce (oz) to kilogram (kg) for JNE API
* Improved: Weight calculation now respects WooCommerce weight unit configuration (WooCommerce > Settings > Products > Weight unit)
* Enhanced: Shipping cost calculation accuracy by properly converting product weights to kilograms before API call
* Fixed: Weight calculation now correctly handles different weight units configured in WooCommerce

= 1.3.1 =
* Improved: ETD label formatting for shipping methods - Now displays "1 day" instead of "1 - 1 days" when ETD from and thru values are the same
* Enhanced: Shipping method labels are now more natural and user-friendly
* Fixed: Redundant ETD display when estimated delivery time range has identical start and end values
* Improved: Better handling of singular/plural forms for day/days in ETD labels

= 1.3.0 =
* Added: Priority system for Shipping Cost Adjustments - Rules are now automatically prioritized based on specificity (District > City > Province > Service)
* Added: Information panel in Shipping Cost Adjustments page explaining how rules priority works
* Improved: Character length validation for tracking number generation - All fields now respect API documentation limits and automatically truncate if exceeded
* Fixed: String truncation handles multibyte characters correctly using mb_strcut for proper byte-based truncation
* Enhanced: User experience with collapsible info box showing priority rules explanation

= 1.2.2 =
* Fixed: Changed CTC service label to REG for better clarity
* Fixed: Dashboard calculation issues - improved date range filtering and shipping method detection
* Fixed: SKU field now displays correctly in shipping labels (was showing N/A)
* Fixed: Added validation to check if order has tracking number before requesting pickup
* Improved: Dashboard query performance and accuracy for order filtering

= 1.2.1 =
* Added validation to check if order has tracking number before requesting pickup
* Added validation to check if order has tracking number before generating shipping label (AWB)
* Improved error messages to guide users to generate CNote first when tracking number is missing
* Enhanced bulk AWB generation to skip orders without tracking numbers with clear error messages

= 1.2.0 =
* Added Shipping Cost Adjustments feature - Create and manage adjustment profiles to modify shipping costs
* Support for multiple adjustment types: Free Shipping, Add/Subtract Fixed Amount, Add/Subtract Percentage
* Flexible condition matching based on Services, Provinces, Cities, and Districts
* Date range support for time-limited adjustments
* Active/Inactive toggle for each adjustment profile
* Dual list box interface for selecting cities and districts (add/remove mechanism)
* Automatic application of adjustments as cart fees
* Adjustment rates are displayed as "Shipping Cost Discount" or "Shipping Cost Addition" in cart/checkout

= 1.1.0 =
* Added JNE Shipping Dashboard with comprehensive analytics
* Added Shipping Status Statistics showing distribution of shipping statuses (MENUNGGU PICKUP, SUCCESS PICKUP, FAILED PICKUP, SHIPPED, DELIVERED, SHIPMENT PROBLEM, RETURN TO SHIPPER) with total orders and percentage
* Added Aging Shipment tracking for orders 3-7 days, 8-14 days, and >15 days (excluding DELIVERED and RETURN TO SHIPPER)
* Added Shipping Cost Statistics showing total shipping costs for completed orders, delivered orders, and non-delivered orders
* Added Top Destinations analysis showing most popular shipping destinations by city and province
* Added Top JNE Services analysis showing most used JNE service codes
* Added date range filter (default: current month) and payment type filter (COD/Non-COD) for dashboard
* Dashboard only shows orders with completed status

= 1.0.12 =
* Added fallback to billing phone when shipping phone is empty in AWB and CNote generation
* Added getCustomerBillingPhone() method in order helper class for better phone number handling

= 1.0.11 =
* Adjusted action hooks in Order List for better readability
* Added a check in calculate shipping method to ensure shipping phone is provided, enhancing validation before processing shipping calculations
* Add customer ID handling for JNE shipping methods

= 1.0.10 =
* Enhance COD and Shipping Insurance Logic in JNE WooCommerce Plugin

= 1.0.9 =
* Update support email and enhance shipping method labels

= 1.0.8 =
* Fixed: Missing enqueue_awb_styles() method causing fatal error
* Fixed: AWB CSS file path in method enqueue
* Improved: Added AWB-specific inline styles for better PDF generation

= 1.0.7 =
* Fixed: WordPress.org compliance - All function names, class names, and hooks now use proper 'jneshof_' prefix
* Fixed: Replaced 'jne_' prefixed items with 'jneshof_' prefix to prevent plugin conflicts
* Fixed: Removed duplicate global function definitions
* Fixed: WP_Error codes now use proper plugin prefix
* Improved: Enhanced plugin naming conventions for better WordPress.org compliance

= 1.0.6 =
* Changed: API base domain from https://jne-api.krb.co.id to official JNE API https://shipping.jne.co.id
* Updated: External services documentation with comprehensive data usage disclosure for WordPress.org compliance
* Updated: Plugin headers and documentation to reflect official JNE API integration
* Improved: Plugin compliance with WordPress plugin directory requirements

= 1.0.5 =
* Version bump to 1.0.5
* Minor updates and improvements

= 1.0.4 =
* Fixed WordPress coding standards compliance issues
* Removed debug error_log() calls from production code
* Enhanced security with proper nonce verification
* Improved form processing security
* Fixed README.txt short description length issue
* Better PHPCS compliance and code quality

= 1.0.3 =
* Fixed barcode and logo display issues in AWB generation
* Improved data URL handling for base64 images
* Enhanced security with proper output escaping
* Updated Font Awesome to version 6.6.0
* Fixed WordPress coding standards compliance
* Improved PDF generation with proper CSS handling

= 1.0.2 =
* Fixed class name prefixing to prevent conflicts with other plugins
* Updated all function, class, and constant names to use "jneshof" prefix
* Improved plugin security and code organization
* Enhanced compatibility with WordPress coding standards

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.6.0 =
Shipping and checkout update: Pengecekan ongkos kirim tidak lagi memerlukan nomor telepon. Untuk pesanan dengan pengiriman JNE, nomor telepon wajib diisi di alamat penagihan atau pengiriman saat checkout. Disarankan untuk semua pengguna.

= 1.5.0 =
Major feature update: Added insurance cost charge option allowing you to choose whether insurance is charged to buyer or seller. Default is buyer. Insurance cost is now always saved to order meta for proper tracking and AWB label display. Includes automatic fallback calculation to ensure insurance cost is always available. Fixed issue where insurance cost didn't display in AWB label when charged to seller. Recommended for all users.

= 1.4.2 =
Bug fix update: Fixed critical issue where JNE Actions column, No. Resi column, and bulk actions were not appearing on WooCommerce orders page for users with HPOS disabled or using legacy order screen. Plugin now fully supports both HPOS and legacy CPT order screens. Recommended for all users experiencing missing columns or bulk actions.

= 1.3.1 =
User experience improvement: Enhanced shipping method labels with improved ETD (Estimated Time of Delivery) formatting. Labels now display more naturally, showing "1 day" instead of "1 - 1 days" when the delivery time range is identical. This makes the checkout experience cleaner and more professional. Recommended for all users.

= 1.3.0 =
Major update: Enhanced Shipping Cost Adjustments with intelligent priority system. Rules are now automatically prioritized based on specificity (most specific rule wins). Added character length validation for API compliance. All tracking number fields are now automatically truncated to match API documentation limits. Includes new user-friendly information panel explaining how rules priority works. Recommended for all users.

= 1.2.2 =
Bug fixes and improvements: Fixed CTC service labeling (now displays as REG), improved dashboard calculations, fixed SKU display in shipping labels, and added pickup request validation. Recommended for all users.

= 1.1.0 =
Major update: Added comprehensive JNE Shipping Dashboard with analytics including Shipping Status Statistics, Aging Shipment tracking, Shipping Cost Statistics, Top Destinations, and Top JNE Services. Includes date range and payment type filters. Dashboard provides valuable insights into your shipping operations. Recommended for all users.

= 1.0.12 =
Improved phone number handling: Added automatic fallback to billing phone when shipping phone is not available during AWB and CNote generation. This ensures better data completeness for shipping labels. Recommended for all users.

= 1.0.11 =
Refactored shipping method classes and added customer ID filtering for shipping services. This update improves shipping option accuracy and validation. Recommended for all users.

= 1.0.10 =
Enhanced COD and Shipping Insurance Logic improvements. Recommended for all users.

= 1.0.9 =
Update with support email improvements and enhanced shipping method labels. Recommended for all users.

= 1.0.7 =
Critical WordPress.org compliance update: Fixed function naming conventions to prevent plugin conflicts. Highly recommended for all users.

= 1.0.6 =
Important update: Migrated to official JNE API endpoint and enhanced plugin compliance. Recommended for all users.

= 1.0.5 =
Version update with minor improvements. Recommended for all users.

= 1.0.4 =
Security and code quality improvements: Enhanced nonce verification, removed debug code, improved PHPCS compliance. Recommended for all users.

= 1.0.3 =
Bug fixes and security improvements: Fixed barcode/logo display issues, improved data URL handling, and enhanced security with proper output escaping. Recommended for all users.

= 1.0.2 =
Important update: Fixed potential plugin conflicts by implementing proper class prefixing. Recommended for all users.

= 1.0.0 =
Initial release
