- Add WP Media Library integration for product and variation images - Support images array (URLs) conversion to attachment IDs - Add images array to API responses (Admin & Customer SPA) - Implement drag-and-drop sortable images in Admin product form - Add image gallery thumbnails in Customer SPA product page - Initialize WooCommerce session for guest cart operations - Fix product variations and attributes display in Customer SPA - Add variation image field in Admin SPA Changes: - includes/Api/ProductsController.php: Handle images array, add to responses - includes/Frontend/ShopController.php: Add images array for customer SPA - includes/Frontend/CartController.php: Initialize WC session for guests - admin-spa/src/lib/wp-media.ts: Add openWPMediaGallery function - admin-spa/src/routes/Products/partials/tabs/GeneralTab.tsx: WP Media + sortable images - admin-spa/src/routes/Products/partials/tabs/VariationsTab.tsx: Add variation image field - customer-spa/src/pages/Product/index.tsx: Add gallery thumbnails display
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import react from '@vitejs/plugin-react';
|
|
import { defineConfig } from 'vite';
|
|
import { readFileSync } from 'fs';
|
|
import { resolve, dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const key = readFileSync(resolve(__dirname, '../admin-spa/.cert/woonoow.local-key.pem'));
|
|
const cert = readFileSync(resolve(__dirname, '../admin-spa/.cert/woonoow.local-cert.pem'));
|
|
|
|
export default defineConfig({
|
|
base: '/',
|
|
plugins: [
|
|
react({
|
|
jsxRuntime: 'automatic',
|
|
})
|
|
],
|
|
resolve: { alias: { '@': resolve(__dirname, './src') } },
|
|
server: {
|
|
host: 'woonoow.local',
|
|
port: 5174,
|
|
strictPort: true,
|
|
https: { key, cert },
|
|
cors: {
|
|
origin: ['https://woonoow.local', 'https://woonoow.local:5174'],
|
|
credentials: true,
|
|
},
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
|
},
|
|
hmr: {
|
|
protocol: 'wss',
|
|
host: 'woonoow.local',
|
|
port: 5174,
|
|
clientPort: 5174,
|
|
}
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
input: { app: 'src/main.tsx' },
|
|
output: { entryFileNames: 'app.js', assetFileNames: 'app.[ext]' }
|
|
}
|
|
}
|
|
});
|