Commit Graph

495 Commits

Author SHA1 Message Date
Dwindi Ramadhana
a52f5fc707 fix(admin): set explicit width for product search dropdown in order form
Prevents the search dropdown from shrinking or overflowing unpredictably
in the flex container. Also ensures better alignment.
2026-01-07 23:34:48 +07:00
Dwindi Ramadhana
5170aea882 fix: hide header wishlist for logged-in users
- Guest users see wishlist icon in header (uses /wishlist page)
- Logged-in users don't see it (they use /my-account/wishlist instead)
- Applied to all 3 layout styles: Classic, Modern, Boutique
2026-01-07 23:15:02 +07:00
Dwindi Ramadhana
d262bd3ae8 fix: license generation not working - hook timing issue
Root cause: LicensingModule::init() was called from within
plugins_loaded but then tried to add ANOTHER plugins_loaded action
for LicenseManager::init(). Since plugins_loaded already fired,
LicenseManager::init() never ran and WooCommerce order hooks
were never registered.

Fix: Call self::maybe_init_manager() directly instead of
scheduling via add_action.
2026-01-07 23:07:45 +07:00
Dwindi Ramadhana
9204189448 fix: add more hooks for license generation on order completion
- Added woocommerce_payment_complete hook
- Added woocommerce_thankyou hook for COD/virtual orders
- Added is_virtual_order helper to detect virtual-only orders
- generate_licenses_for_order now called from multiple hooks
  (safe due to license_exists_for_order_item check)
2026-01-07 22:58:29 +07:00
Dwindi Ramadhana
a4a055a98e feat: add SEOHead to all SPA pages for dynamic page titles
Added SEOHead component to:
- ThankYou page (both template styles)
- Login page
- Account/Dashboard
- Account/Orders
- Account/Downloads
- Account/Addresses
- Account/Wishlist
- Account/Licenses
- Account/AccountDetails
- Public Wishlist page

Also created usePageTitle hook as alternative for non-Helmet usage.
2026-01-07 22:51:47 +07:00
Dwindi Ramadhana
d7b132d9d9 fix: dbDelta separate tables, add SEOHead for page titles
1. License table creation:
   - dbDelta requires separate calls per CREATE TABLE
   - Split into sql_licenses and sql_activations
   - Added 'PRIMARY KEY  (id)' with two spaces (dbDelta requirement)

2. Page titles:
   - Added SEOHead to Cart page (title: Shopping Cart)
   - Added SEOHead to Checkout page (title: Checkout)
   - Shop already had SEOHead

3. usePageTitle hook created (alternative to SEOHead for non-Helmet usage)
2026-01-07 22:40:45 +07:00
Dwindi Ramadhana
3a08e80c1f fix: category selection, checkout redirect, sidebar shipping visibility
1. Category Selection Bug:
   - Added 'id' alias to category/tag API responses
   - Frontend uses cat.id which was undefined (API returned term_id)

2. Checkout Redirect:
   - Changed from window.location.href + reload to navigate()
   - Added !isProcessing check to empty cart condition

3. Sidebar Shipping for Virtual-Only:
   - Hide Shipping Method section when isVirtualOnly
   - Hide Shipping row in totals when isVirtualOnly

4. License Table:
   - Table creation runs via ensure_tables() on plugins_loaded
2026-01-07 22:26:58 +07:00
Dwindi Ramadhana
2cc20ff760 fix: licensing table creation, consistent meta keys, checkout virtual detection
1. License table auto-creation:
   - Added ensure_tables() check on plugins_loaded
   - Tables created automatically if missing

2. Consistent licensing meta keys:
   - ProductsController now uses _woonoow_licensing_enabled
   - Matches LicensingModule and LicenseManager

3. Checkout virtual-only detection:
   - Added needs_shipping to Cart interface
   - Checkout uses cart.needs_shipping from WooCommerce API
   - Fallback to item-level virtual/downloadable check

4. Login redirect for logged-in users added previously
2026-01-07 22:15:51 +07:00
Dwindi Ramadhana
f334e018fa fix: 4 bugs - checkout virtual, login redirect, licensing, categories
1. Virtual-only checkout:
   - Added 'virtual' and 'downloadable' to CartController response
   - Checkout can now detect virtual-only carts

2. Login redirect:
   - Added useEffect to redirect logged-in users to /my-account

3. License generation:
   - Fixed meta key mismatch (_woonoow_licensing_enabled -> _licensing_enabled)

4. Product categories:
   - Added queryClient.invalidateQueries after creating new category
   - List now refreshes immediately
2026-01-07 21:08:01 +07:00
Dwindi Ramadhana
984f4e2db4 fix: Hide main nav menu in invoice print
- Added data-mainmenu attribute to TopNavBar component
- Added #woonoow-admin-app [data-mainmenu] to print CSS hide rules
- Now hides: header, nav, mainmenu, submenubar, bottomnav
2026-01-06 21:23:36 +07:00
Dwindi Ramadhana
b44c8b767d fix: Perfect invoice print - use specific selectors for app shell
Added specific selectors:
- #woonoow-admin-app header
- #woonoow-admin-app nav
- #woonoow-admin-app [data-submenubar]
- #woonoow-admin-app [data-bottomnav]

These target the exact WooNooW app elements that need hiding.
2026-01-06 21:11:01 +07:00
Dwindi Ramadhana
2b94f26cae fix: Invoice print layout - hide app shell, fix padding
Print CSS:
- Hide WooNooW app nav, header, submenu, bottom nav
- Set print-a4 to absolute positioning for clean print
- Added 15mm padding for print
- Hidden min-height for screen container

Invoice Component:
- Removed inline minHeight to prevent empty second page
- Added max-w-3xl and p-8 for screen display
- Added print:max-w-none print:p-0 for print mode
2026-01-06 21:06:28 +07:00
Dwindi Ramadhana
1cef11a1d2 feat: Create dedicated Invoice and Label pages
Invoice Page (/orders/:id/invoice):
- A4-ready layout (210mm x 297mm)
- Store header, invoice number, QR code
- Billing/shipping address sections
- Styled items table with alternating rows
- Totals summary with conditional display
- Thank you footer
- Back to Order and Print buttons

Label Page (/orders/:id/label):
- 4x6 inch thermal label layout
- Ship To address with phone
- Items list (physical products only)
- Shipping method
- QR code for scanning
- Back to Order and Print buttons

Order Detail:
- Removed print-mode logic
- Removed print-only layouts
- Invoice/Label buttons now link to dedicated pages
- Label button still hidden for virtual-only orders
2026-01-06 20:57:57 +07:00
Dwindi Ramadhana
40aee67c46 feat: Implement A4 invoice layout and hide Label for virtual orders
Invoice:
- Enhanced A4-ready layout with proper structure
- Store header with invoice number
- Billing/shipping address sections
- Styled items table with alternating rows
- Totals summary with conditional display
- Thank you footer

Label:
- Label button now hidden for virtual-only orders
- Uses existing isVirtualOnly detection

Print CSS:
- Added @page A4 size directive
- Print-color-adjust for background colors
- 20mm padding for proper margins

Documentation:
- Updated subscription module plan (comprehensive)
- Updated affiliate module plan (comprehensive)
- Created shipping label standardization plan
2026-01-05 19:16:13 +07:00
Dwindi Ramadhana
2efc6a7605 feat: Add variation-level license duration to product editor
- Added license_duration_days field to ProductVariant type
- Added License Duration input to each variation card
- Backend: ProductsController saves/loads variation-level _license_duration_days meta
- Allows different license periods per variation (e.g., 1-year, 2-year, lifetime)
2026-01-05 17:32:49 +07:00
Dwindi Ramadhana
60d749cd65 feat: Add Copy Cart/Checkout links and licensing settings to product editor
Copy Cart/Checkout Links:
- Added to GeneralTab for simple products (same pattern as variations)
- Link generation with add-to-cart and redirect params

Licensing Settings:
- 'Enable licensing for this product' checkbox in Additional Options
- License settings panel: activation limit, duration (days)
- State management in ProductFormTabbed
- Backend: ProductsController saves/loads licensing meta fields

Backend:
- _licensing_enabled, _license_activation_limit, _license_duration_days post meta
2026-01-05 17:10:04 +07:00
Dwindi Ramadhana
26ab626966 fix: Correct ModuleRegistry method names in ModulesController
Changed enable_module() -> enable()
Changed disable_module() -> disable()

This fixes the module toggle functionality in the admin settings.
2026-01-05 16:53:45 +07:00
Dwindi Ramadhana
3d2bab90ec feat: Complete licensing module with admin and customer UIs
Admin SPA:
- Licenses list page with search, filter, pagination
- License detail page with activation history
- Copy license key, view details, revoke functionality

Customer SPA:
- My Account > Licenses page
- View licenses with activation info
- Copy license key
- Deactivate devices

Backend integration:
- Routes registered in App.tsx and Account/index.tsx
- License nav item in account sidebar (conditional on module enabled)
2026-01-05 16:29:37 +07:00
Dwindi Ramadhana
b367c1fcf8 feat: Add licensing module backend
- LicensingSettings.php with key format, activation limits, expiry settings
- LicenseManager.php with key generation, activation/deactivation, validation
- LicensingModule.php with WooCommerce product meta integration
- LicensesController.php with admin, customer, and public API endpoints
- Database tables: woonoow_licenses, woonoow_license_activations
- has_settings enabled in ModuleRegistry
2026-01-05 16:20:32 +07:00
Dwindi Ramadhana
663e6c13e6 fix: Sync avatar to account sidebar
- Fetch avatar settings in AccountLayout on mount
- Display custom avatar or gravatar in sidebar
- Dispatch woonoow:avatar-updated event on upload/remove
- Listen for event in AccountLayout for real-time sync
2026-01-05 00:31:16 +07:00
Dwindi Ramadhana
86dca3e9c2 fix: Address issues with all 4 features
1. Admin Store Link - Add to WP admin bar (Menu.php) with proper option check
2. Activity Log - Fix Loading text to show correct state after data loads
3. Avatar Upload - Use correct option key woonoow_allow_custom_avatar
4. Downloadable Files - Connect to WooCommerce native:
   - Add downloads array to format_product_full
   - Add downloads/download_limit/download_expiry handling in update_product
   - Add downloads handling in create_product
2026-01-05 00:22:08 +07:00
Dwindi Ramadhana
51c759a4f5 feat: Add customer avatar upload and product downloadable files
Customer Avatar Upload:
- Add /account/avatar endpoint for upload/delete
- Add /account/avatar-settings endpoint for settings
- Update AccountDetails.tsx with avatar upload UI
- Support base64 image upload with validation

Product Downloadable Files:
- Create DownloadsTab component for file management
- Add downloads state to ProductFormTabbed
- Show Downloads tab when 'downloadable' is checked
- Support file name, URL, download limit, and expiry
2026-01-05 00:05:18 +07:00
Dwindi Ramadhana
6c8cbb93e6 feat: Add Store link to admin header and notification activity log
- Add Store link to admin header (visible when customer SPA is enabled)
- Add storeUrl and customerSpaEnabled to WNW_CONFIG in Assets.php and StandaloneAdmin.php
- Update window.d.ts with new WNW_CONFIG properties
- Create ActivityLog.tsx component with search, filters, and pagination
- Add /notifications/logs API endpoint to NotificationsController
- Update Notifications.tsx to link to activity log page
- Add ActivityLog route to App.tsx
2026-01-04 23:51:54 +07:00
Dwindi Ramadhana
0f542ad452 feat: Multiple fixes and features
1. Add allow_custom_avatar toggle to Customer Settings
2. Implement coupon apply/remove in Cart and Checkout pages
3. Update Cart interface with coupons array and discount_total
4. Implement Downloads page to fetch from /account/downloads API
2026-01-04 20:03:33 +07:00
Dwindi Ramadhana
befacf9d29 fix: Remove old Newsletter.tsx (conflicting with Newsletter/index.tsx)
The old file was being resolved by Vite instead of the new
Newsletter/index.tsx folder, preventing the tabs from appearing.
2026-01-04 19:11:28 +07:00
Dwindi Ramadhana
d9878c8b20 feat: Refactor Newsletter with horizontal tabs (Subscribers | Campaigns)
- Created Newsletter/index.tsx as tabs container
- Extracted Newsletter/Subscribers.tsx (from old Newsletter.tsx)
- Moved Campaigns to Newsletter/Campaigns.tsx
- Updated App.tsx routes (campaigns now under newsletter)
- Removed separate Campaigns card from Marketing index
- Follows Customer Notifications tab pattern for consistency
2026-01-04 19:06:18 +07:00
Dwindi Ramadhana
d65259db8a fix: Simplify Help page layout (remove sticky)
- Sticky not possible when page is inside overflow-auto container
- Using standard flexbox layout where sidebar and content scroll together
- Separate mobile (fixed overlay) and desktop (inline) sidebars
- Clean, simple layout matching typical documentation patterns
2026-01-04 12:37:40 +07:00
Dwindi Ramadhana
54a1ec1c88 fix: Separate mobile/desktop sidebar components
- Mobile: fixed overlay sidebar with proper z-index
- Desktop: sticky sidebar with correct top offset
- Extracted SidebarContent component to avoid duplication
- Matches App.tsx submenu bar positioning logic
2026-01-04 12:33:46 +07:00
Dwindi Ramadhana
3a8c436839 fix: Sidebar positioning - remove inset-y-0 conflict
- Fixed sidebar to not use inset-y-0 (was overriding top offset)
- Mobile: fixed positioning with sidebarTopClass
- Desktop: lg:sticky for proper sticky behavior
2026-01-04 12:30:46 +07:00
Dwindi Ramadhana
bfb961ccbe fix: Help page scroll and sidebar positioning
- Remove internal overflow (use wp-admin page scroll)
- Sidebar sticky under topbar with correct positioning
- Standalone mode: top-16 (below 64px header)
- WP Admin mode: top-[calc(7rem+32px)] (header+topnav+wp-admin bar)
- Uses useApp() to detect mode
2026-01-04 12:27:51 +07:00
Dwindi Ramadhana
f49dde9484 feat: Add Help to main navigation (no submenu bar)
- Added Help item to NavigationRegistry::get_base_tree
- Empty children array means no submenu bar displayed
- Incremented NAV_VERSION to 1.0.9 to trigger cache rebuild
- Help icon: help-circle
2026-01-04 12:01:18 +07:00
Dwindi Ramadhana
b64a979a61 fix: Use correct WOONOOW_PATH constant in DocsController
WOONOOW_PLUGIN_DIR was undefined, causing 500 errors.
The actual constant defined in woonoow.php is WOONOOW_PATH.
2026-01-04 11:55:15 +07:00
Dwindi Ramadhana
0e38b0eb5f fix: Documentation API authentication and build script
- Added X-WP-Nonce header to docs API fetch calls in Help page
- Fixed build-production.sh to include docs/ folder (changed --exclude='*.md' to --exclude='/*.md')
- This allows root-level docs like README.md to be excluded while keeping docs/ folder
2026-01-04 11:53:33 +07:00
Dwindi Ramadhana
68c3423f50 feat: Add in-app documentation system
Phase 1: Core Documentation
- Created docs/ folder with 8 markdown documentation files
- Getting Started, Installation, Troubleshooting, FAQ
- Configuration docs (Appearance, SPA Mode)
- Feature docs (Shop, Checkout)
- PHP registry with filter hook for addon extensibility

Phase 2: Documentation Viewer
- DocsController.php with REST API endpoints
- GET /woonoow/v1/docs - List all docs (with addon hook)
- GET /woonoow/v1/docs/{slug} - Get document content
- Admin SPA /help route with sidebar navigation
- Markdown rendering with react-markdown
- Added Help & Docs to More page for mobile access

Filter Hook: woonoow_docs_registry
Addons can register their own documentation sections.
2026-01-04 11:43:32 +07:00
Dwindi Ramadhana
1206117df1 fix: plugin activation no longer modifies WooCommerce pages
- Removed shortcode replacement for Cart, Checkout, My Account pages
- WooCommerce pages now keep their original [woocommerce_*] shortcodes
- Plugin only creates dedicated SPA page (/store) with [woonoow_spa]
- Auto-sets spa_page in appearance settings

This aligns with template override approach - WC pages render normally
when SPA is disabled, and redirect to SPA when mode is 'full'.
2026-01-04 11:15:52 +07:00
Dwindi Ramadhana
7c2f21f7a2 fix: SPA disabled mode now returns original template immediately
- Added spa_mode check at the BEGINNING of use_spa_template()
- When spa_mode = 'disabled', returns original template immediately
- Removed legacy woonoow_customer_spa_settings checks
- Simplified template override logic
2026-01-04 11:08:10 +07:00
Dwindi Ramadhana
7c15850c8f fix: SPA disabled mode now renders WooCommerce templates properly
- Updated should_use_spa() to check correct setting (woonoow_appearance_settings['general']['spa_mode'])
- Updated is_spa_page() to also check spa_mode
- Updated should_remove_theme_elements() to use appearance settings
- When spa_mode = 'disabled', WooCommerce templates render normally
2026-01-04 10:57:14 +07:00
Dwindi Ramadhana
670bd7d351 fix: PHP errors and clean up error_log statements
- Fixed redirect_wc_pages_to_spa: added spa_mode check (only redirect when 'full')
- Fixed PHP fatal error: use get_queried_object() instead of global $product
- Removed all error_log debug statements from codebase
- Fixed broken syntax in PaymentGatewaysProvider.php after error_log removal
2026-01-04 10:49:47 +07:00
Dwindi Ramadhana
75a82cf16c feat: add dynamic meta tags for social sharing (Phase 4-5)
Phase 4: Dynamic Meta Tags
- Added react-helmet-async dependency
- Created SEOHead component with Open Graph and Twitter Card support
- Added HelmetProvider wrapper to App.tsx
- Integrated SEOHead in Product page (title, description, image, product info)
- Integrated SEOHead in Shop page (basic meta tags)

Phase 5: Auto-Flush Permalinks
- Enhanced settings change handler to only flush when spa_mode,
  spa_page, or use_browser_router changes
- Plugin already flushes on activation (Installer.php)

This enables proper link previews when sharing product URLs
on Facebook, Twitter, Slack, etc.
2026-01-04 10:40:10 +07:00
Dwindi Ramadhana
45fcbf9d29 feat: migrate from HashRouter to BrowserRouter for SEO
Phase 1: WordPress Rewrite Rules
- Add rewrite rule for /store/* to serve SPA page
- Add use_browser_router setting toggle (default: true)
- Flush rewrite rules on settings change

Phase 2: React Router Migration
- Add BrowserRouter with basename from WordPress config
- Pass basePath and useBrowserRouter to frontend
- Conditional router based on setting

Phase 3: Hash Route Migration
- Update EmailManager.php reset password URL
- Update EmailRenderer.php login URL
- Update TemplateOverride.php WC redirects
- All routes now use path format by default

This enables proper SEO indexing as search engines
can now crawl individual product/page URLs.
2026-01-03 20:01:32 +07:00
Dwindi Ramadhana
0421e5010f fix: use SPA page (store) for reset password URL
Changed from /my-account to /store page URL:
- Now reads spa_page from woonoow_appearance_settings
- Uses get_permalink() on the configured SPA page ID
- Fallback to home_url if SPA not configured
- Reset URL format: /store/#/reset-password?key=...&login=...
v1.0-pre-seo-migration
2026-01-03 17:45:51 +07:00
Dwindi Ramadhana
da6255dd0c fix: remove emoji from TipTap button, add subtle background
- Removed 🔘 emoji prefix from button text
- Button now shows text with subtle purple background pill
- Added padding and border-radius to differentiate from regular links
- Hover tooltip still shows 'Button: text → url' for clarity
2026-01-03 17:40:44 +07:00
Dwindi Ramadhana
91ae4956e0 chore: update build scripts for both SPAs
- build:admin: builds admin-spa
- build:customer: builds customer-spa
- build: builds both admin and customer SPAs
- dev:customer: added dev server for customer-spa
2026-01-03 17:36:50 +07:00
Dwindi Ramadhana
b010a88619 feat: simplify TipTap button styling + add click-to-edit
Button Styling:
- Buttons now render as simple links with 🔘 prefix in editor
- No more styled button appearance in TipTap (was inconsistent)
- Actual button styling still happens in email (EmailRenderer.php)

Click-to-Edit:
- Click any button in the editor to open edit dialog
- Edit button text, link URL, and style (solid/outline)
- Delete button option in edit mode
- Updates button in-place instead of requiring recreation

Dialog improvements:
- Shows 'Edit Button' title in edit mode
- Shows 'Update Button' vs 'Insert Button' based on mode
- Delete button (red) appears only in edit mode
2026-01-03 17:22:34 +07:00
Dwindi Ramadhana
a98217897c fix: use customer-spa for password reset page
Changed reset link URL from admin SPA to customer-spa:
- Old: /wp-admin/admin.php?page=woonoow#/reset-password?key=...
- New: /my-account#/reset-password?key=...

This fixes the login redirect issue - the customer-spa is publicly
accessible so users can reset their password without logging in first.

Added:
- customer-spa/src/pages/ResetPassword/index.tsx
- Route /reset-password in customer-spa App.tsx

EmailManager.php now:
- Uses wc_get_page_id('myaccount') to get my-account page URL
- Falls back to home_url if my-account page not found
2026-01-03 17:09:00 +07:00
Dwindi Ramadhana
316fcbf2f0 feat: SPA-based password reset page
- Created ResetPassword.tsx with:
  - Password reset form with strength indicator
  - Key validation on load
  - Show/hide password toggle
  - Success/error states
  - Redirect to login on success

- Updated EmailManager.php:
  - Changed reset_link from wp-login.php to SPA route
  - Format: /wp-admin/admin.php?page=woonoow#/reset-password?key=KEY&login=LOGIN

- Added AuthController API methods:
  - validate_reset_key: Validates reset key before showing form
  - reset_password: Performs actual password reset

- Registered new REST routes in Routes.php:
  - POST /auth/validate-reset-key
  - POST /auth/reset-password

Password reset emails now link to the SPA instead of native WordPress.
2026-01-03 16:59:05 +07:00
Dwindi Ramadhana
3f8d15de61 fix: remove left borders from cards - use background color only
Per user request, removed border-left from success/info/warning cards.
Cards now distinguished by background color only, preserving border-radius.

Updated in:
- EmailRenderer.php: removed border-left from inline styles
- EditTemplate.tsx: removed border-left from CSS classes
- TemplateEditor.tsx: removed border-left from CSS classes

Card styling now:
- Success: #f0fdf4 (light green)
- Info: #f0f7ff (light blue)
- Warning: #fff8e1 (light yellow/cream)
- Hero: gradient background
2026-01-02 00:04:30 +07:00
Dwindi Ramadhana
930e525421 fix: card ordering - process cards in document order
OLD BEHAVIOR (broken):
parse_cards processed ALL [card:type] syntax FIRST, then [card type=...]
This caused cards to render out of order when syntaxes were mixed.

NEW BEHAVIOR (fixed):
Using a unified regex that matches BOTH syntaxes simultaneously:
/\[card(?::(\w+)|([^\]]*)?)\](.*?)\[\/card\]/s

Each match includes:
- Group 1: Card type from new syntax [card:type]
- Group 2: Attributes from old syntax [card type='...']
- Group 3: Card content

Cards now render in exact document order regardless of syntax used.
2026-01-01 23:57:12 +07:00
Dwindi Ramadhana
802b64db9f fix: card CSS consistency between preview and email
Updated card CSS in EditTemplate.tsx and TemplateEditor.tsx to exactly
match backend EmailRenderer inline styles:

BEFORE (inconsistent):
- Preview: border: 1px solid (all sides, rounded corners)
- Email: border-left: 4px solid (left side only)

AFTER (consistent):
- Success: background-color: #f0fdf4; border-left: 4px solid #22c55e
- Info: background-color: #f0f7ff; border-left: 4px solid #0071e3
- Warning: background-color: #fff8e1; border-left: 4px solid #ff9800

Hero/Highlight cards still use gradient backgrounds.
2026-01-01 23:55:52 +07:00
Dwindi Ramadhana
8959af8270 fix: remove hardcoded center alignment from button preview
parseCardsForPreview was forcing text-align: center on all buttons
regardless of user alignment choice. Removed the hardcoded style
so buttons follow natural document flow alignment.
2026-01-01 23:49:33 +07:00