feat: initialize React admin build pipeline (F2.1-F2.6)

- Add package.json with @wordpress/scripts and React dependencies
- Configure webpack for admin bundle output
- Create src/admin directory structure (api, components, pages)
- Implement API client with nonce handling (ajaxRequest, apiRequest)
- Add API methods for orders, customers, products, forms, coupons, licenses
- Create React App component with page routing
- Add placeholder page components for all admin sections
- Create ReactAdmin PHP class to manage asset enqueuing
- Register ReactAdmin singleton in main plugin file
- Bump version to 2.0.0

Build: Run 'npm install && npm run build' to generate assets
This commit is contained in:
dwindown
2026-04-18 11:17:53 +07:00
parent 306377e8f5
commit f7a149a1c5
14 changed files with 478 additions and 2 deletions

28
src/admin/index.js Normal file
View File

@@ -0,0 +1,28 @@
/**
* Formipay Admin - React Application Entry Point
*/
import { render } from '@wordpress/element';
import App from './components/App';
// Mount the React app to all available mount points
const mountApps = () => {
const mountPoints = document.querySelectorAll('[data-formipay-mount]');
mountPoints.forEach((mountPoint) => {
const page = mountPoint.dataset.formipayMount;
const initialData = window.formipayAdmin?.[page] || {};
render(
<App page={page} initialData={initialData} />,
mountPoint
);
});
};
// Initialize when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', mountApps);
} else {
mountApps();
}