| 1 | const categories = [ |
| 2 | 'Electronics', |
| 3 | 'Clothing', |
| 4 | 'Home & Garden', |
| 5 | 'Sports', |
| 6 | 'Books', |
| 7 | 'Toys', |
| 8 | 'Food', |
| 9 | 'Health', |
| 10 | ]; |
| 11 | const statuses = ['In Stock', 'Low Stock', 'Out of Stock', 'Discontinued']; |
| 12 | const activityTypes = [ |
| 13 | 'order_placed', |
| 14 | 'order_shipped', |
| 15 | 'order_delivered', |
| 16 | 'refund_requested', |
| 17 | 'review_posted', |
| 18 | 'product_added', |
| 19 | 'stock_alert', |
| 20 | 'payment_received', |
| 21 | ]; |
| 22 | const userNames = [ |
| 23 | 'Alice Johnson', |
| 24 | 'Bob Williams', |
| 25 | 'Carol Davis', |
| 26 | 'Dan Miller', |
| 27 | 'Eve Wilson', |
| 28 | 'Frank Moore', |
| 29 | 'Grace Taylor', |
| 30 | 'Henry Anderson', |
| 31 | 'Iris Thomas', |
| 32 | 'Jack Jackson', |
| 33 | ]; |
| 34 | const reviewTexts = [ |
| 35 | 'Great product, exactly what I needed. The quality exceeded my expectations and shipping was fast.', |
| 36 | 'Decent value for the price. Some minor issues with packaging but the product itself works well.', |
| 37 | 'Not what I expected based on the description. Returning this item for a refund.', |
| 38 | 'Outstanding quality and craftsmanship. Would highly recommend to anyone looking for this type of item.', |
| 39 | 'Average product, nothing special. Does what it says but nothing more than that.', |
| 40 | ]; |
| 41 | |
| 42 | export function generateProducts(count) { |
| 43 | const products = []; |
| 44 | for (let i = 0; i < count; i++) { |
| 45 | products.push({ |
| 46 | id: i, |
| 47 | name: 'Product ' + i, |
| 48 | sku: 'SKU-' + String(i).padStart(6, '0'), |
| 49 | price: (((i * 17 + 3) % 9999) / 100).toFixed(2), |
| 50 | category: categories[i % categories.length], |
| 51 | status: statuses[i % statuses.length], |
| 52 | stock: (i * 7 + 13) % 500, |
| 53 | rating: (((i * 3 + 1) % 50) / 10).toFixed(1), |
| 54 | reviewCount: (i * 13 + 5) % 200, |
| 55 | description: |
| 56 | 'This is a detailed description for product ' + |
| 57 | i + |
| 58 | '. It includes specifications, features, and other relevant information that a customer might need.', |
| 59 | tags: [ |
| 60 | categories[(i + 1) % categories.length].toLowerCase(), |
| 61 | i % 2 === 0 ? 'featured' : 'new', |
| 62 | i % 3 === 0 ? 'sale' : 'regular', |
| 63 | ], |
| 64 | dimensions: { |
| 65 | weight: ((i * 3 + 1) % 100) / 10, |
| 66 | width: ((i * 7 + 2) % 50) + 5, |
| 67 | height: ((i * 11 + 3) % 40) + 5, |
| 68 | depth: ((i * 13 + 4) % 30) + 2, |
| 69 | unit: 'cm', |
| 70 | }, |
| 71 | supplier: { |
| 72 | name: 'Supplier ' + (i % 20), |
| 73 | leadTime: (i % 14) + 1 + ' days', |
| 74 | minOrder: ((i * 3) % 50) + 10, |
| 75 | contact: 'supplier' + (i % 20) + '@example.com', |
| 76 | address: { |
| 77 | street: ((100 + i * 7) % 9999) + ' Industrial Blvd', |
| 78 | city: ['Portland', 'Austin', 'Denver', 'Seattle', 'Boston'][i % 5], |
| 79 | state: ['OR', 'TX', 'CO', 'WA', 'MA'][i % 5], |
| 80 | zip: String(10000 + ((i * 37) % 89999)), |
| 81 | }, |
| 82 | }, |
| 83 | specifications: { |
| 84 | material: ['Aluminum', 'Plastic', 'Steel', 'Wood', 'Carbon Fiber'][ |
| 85 | i % 5 |
| 86 | ], |
| 87 | color: ['Black', 'White', 'Silver', 'Blue', 'Red', 'Green'][i % 6], |
| 88 | warranty: (i % 3) + 1 + ' years', |
| 89 | certifications: [ |
| 90 | i % 2 === 0 ? 'CE' : 'FCC', |
| 91 | i % 3 === 0 ? 'RoHS' : 'UL', |
| 92 | 'ISO 9001', |
| 93 | ], |
| 94 | }, |
| 95 | reviews: [ |
| 96 | { |
| 97 | author: userNames[(i * 3) % userNames.length], |
| 98 | rating: ((i * 7 + 3) % 5) + 1, |
| 99 | date: |
| 100 | '2026-0' + |
| 101 | ((i % 3) + 1) + |
| 102 | '-' + |
| 103 | String((i % 28) + 1).padStart(2, '0'), |
| 104 | text: reviewTexts[i % reviewTexts.length], |
| 105 | helpful: (i * 11 + 2) % 50, |
| 106 | }, |
| 107 | { |
| 108 | author: userNames[(i * 3 + 1) % userNames.length], |
| 109 | rating: ((i * 11 + 1) % 5) + 1, |
| 110 | date: |
| 111 | '2026-0' + |
| 112 | ((i % 3) + 1) + |
| 113 | '-' + |
| 114 | String(((i + 5) % 28) + 1).padStart(2, '0'), |
| 115 | text: reviewTexts[(i + 2) % reviewTexts.length], |
| 116 | helpful: (i * 7 + 5) % 30, |
| 117 | }, |
| 118 | { |
| 119 | author: userNames[(i * 3 + 2) % userNames.length], |
| 120 | rating: ((i * 13 + 2) % 5) + 1, |
| 121 | date: |
| 122 | '2026-0' + |
| 123 | ((i % 3) + 1) + |
| 124 | '-' + |
| 125 | String(((i + 10) % 28) + 1).padStart(2, '0'), |
| 126 | text: reviewTexts[(i + 4) % reviewTexts.length], |
| 127 | helpful: (i * 3 + 1) % 20, |
| 128 | }, |
| 129 | ], |
| 130 | }); |
| 131 | } |
| 132 | return products; |
| 133 | } |
| 134 | |
| 135 | export function generateActivities(count) { |
| 136 | const activities = []; |
| 137 | for (let i = 0; i < count; i++) { |
| 138 | activities.push({ |
| 139 | id: i, |
| 140 | type: activityTypes[i % activityTypes.length], |
| 141 | user: userNames[i % userNames.length], |
| 142 | timestamp: |
| 143 | '2026-03-' + |
| 144 | String((i % 28) + 1).padStart(2, '0') + |
| 145 | 'T' + |
| 146 | String((i * 7) % 24).padStart(2, '0') + |
| 147 | ':' + |
| 148 | String((i * 13) % 60).padStart(2, '0') + |
| 149 | ':00Z', |
| 150 | details: { |
| 151 | orderId: '#' + String(10000 + i), |
| 152 | amount: '$' + ((i * 23 + 7) % 999).toFixed(2), |
| 153 | items: ((i * 3 + 1) % 5) + 1, |
| 154 | shippingMethod: ['Standard', 'Express', 'Overnight', 'Economy'][i % 4], |
| 155 | paymentMethod: ['Credit Card', 'PayPal', 'Apple Pay', 'Wire Transfer'][ |
| 156 | i % 4 |
| 157 | ], |
| 158 | }, |
| 159 | message: |
| 160 | userNames[i % userNames.length] + |
| 161 | ' ' + |
| 162 | activityTypes[i % activityTypes.length].replace(/_/g, ' ') + |
| 163 | ' for order #' + |
| 164 | (10000 + i), |
| 165 | }); |
| 166 | } |
| 167 | return activities; |
| 168 | } |
| 169 | |
| 170 | export function generateStats() { |
| 171 | return { |
| 172 | totalRevenue: '$1,284,320.50', |
| 173 | totalOrders: 8432, |
| 174 | totalCustomers: 3841, |
| 175 | conversionRate: '3.2%', |
| 176 | avgOrderValue: '$152.30', |
| 177 | returnsRate: '2.1%', |
| 178 | cards: [ |
| 179 | { |
| 180 | title: 'Total Revenue', |
| 181 | value: '$1,284,320', |
| 182 | change: '+12.5%', |
| 183 | trend: 'up', |
| 184 | sparkline: [65, 59, 80, 81, 56, 55, 72, 84, 91, 88, 95, 102], |
| 185 | }, |
| 186 | { |
| 187 | title: 'Orders', |
| 188 | value: '8,432', |
| 189 | change: '+8.2%', |
| 190 | trend: 'up', |
| 191 | sparkline: [28, 48, 40, 19, 86, 27, 90, 65, 72, 81, 56, 88], |
| 192 | }, |
| 193 | { |
| 194 | title: 'Customers', |
| 195 | value: '3,841', |
| 196 | change: '+4.1%', |
| 197 | trend: 'up', |
| 198 | sparkline: [12, 19, 25, 32, 28, 35, 42, 38, 45, 51, 48, 55], |
| 199 | }, |
| 200 | { |
| 201 | title: 'Conversion Rate', |
| 202 | value: '3.2%', |
| 203 | change: '-0.3%', |
| 204 | trend: 'down', |
| 205 | sparkline: [3.8, 3.5, 3.2, 3.6, 3.1, 3.4, 3.0, 3.3, 3.5, 3.2, 3.1, 3.2], |
| 206 | }, |
| 207 | ], |
| 208 | revenueByMonth: [ |
| 209 | {month: 'Jan 25', value: 72000, orders: 480, returns: 24}, |
| 210 | {month: 'Feb 25', value: 78000, orders: 520, returns: 31}, |
| 211 | {month: 'Mar 25', value: 85000, orders: 567, returns: 28}, |
| 212 | {month: 'Apr 25', value: 92000, orders: 613, returns: 35}, |
| 213 | {month: 'May 25', value: 88000, orders: 587, returns: 29}, |
| 214 | {month: 'Jun 25', value: 105000, orders: 700, returns: 42}, |
| 215 | {month: 'Jul 25', value: 112000, orders: 747, returns: 38}, |
| 216 | {month: 'Aug 25', value: 98000, orders: 653, returns: 33}, |
| 217 | {month: 'Sep 25', value: 115000, orders: 767, returns: 41}, |
| 218 | {month: 'Oct 25', value: 108000, orders: 720, returns: 36}, |
| 219 | {month: 'Nov 25', value: 120000, orders: 800, returns: 44}, |
| 220 | {month: 'Dec 25', value: 118320, orders: 789, returns: 39}, |
| 221 | {month: 'Jan 26', value: 85000, orders: 567, returns: 28}, |
| 222 | {month: 'Feb 26', value: 92000, orders: 613, returns: 32}, |
| 223 | {month: 'Mar 26', value: 95000, orders: 633, returns: 30}, |
| 224 | {month: 'Apr 26', value: 110000, orders: 733, returns: 37}, |
| 225 | {month: 'May 26', value: 118000, orders: 787, returns: 40}, |
| 226 | {month: 'Jun 26', value: 105000, orders: 700, returns: 35}, |
| 227 | {month: 'Jul 26', value: 122000, orders: 813, returns: 43}, |
| 228 | {month: 'Aug 26', value: 115000, orders: 767, returns: 38}, |
| 229 | {month: 'Sep 26', value: 128000, orders: 853, returns: 45}, |
| 230 | {month: 'Oct 26', value: 125000, orders: 833, returns: 42}, |
| 231 | {month: 'Nov 26', value: 135000, orders: 900, returns: 47}, |
| 232 | {month: 'Dec 26', value: 130000, orders: 867, returns: 44}, |
| 233 | ], |
| 234 | topCategories: [ |
| 235 | { |
| 236 | name: 'Electronics', |
| 237 | revenue: 420000, |
| 238 | orders: 2800, |
| 239 | avgPrice: 150, |
| 240 | growth: '+15.2%', |
| 241 | }, |
| 242 | { |
| 243 | name: 'Clothing', |
| 244 | revenue: 310000, |
| 245 | orders: 2100, |
| 246 | avgPrice: 147.6, |
| 247 | growth: '+8.7%', |
| 248 | }, |
| 249 | { |
| 250 | name: 'Home & Garden', |
| 251 | revenue: 225000, |
| 252 | orders: 1500, |
| 253 | avgPrice: 150, |
| 254 | growth: '+12.1%', |
| 255 | }, |
| 256 | { |
| 257 | name: 'Sports', |
| 258 | revenue: 180000, |
| 259 | orders: 1200, |
| 260 | avgPrice: 150, |
| 261 | growth: '+5.3%', |
| 262 | }, |
| 263 | { |
| 264 | name: 'Books', |
| 265 | revenue: 149320, |
| 266 | orders: 832, |
| 267 | avgPrice: 179.5, |
| 268 | growth: '+2.1%', |
| 269 | }, |
| 270 | { |
| 271 | name: 'Toys', |
| 272 | revenue: 95000, |
| 273 | orders: 680, |
| 274 | avgPrice: 139.7, |
| 275 | growth: '+18.4%', |
| 276 | }, |
| 277 | { |
| 278 | name: 'Food', |
| 279 | revenue: 82000, |
| 280 | orders: 1640, |
| 281 | avgPrice: 50, |
| 282 | growth: '+6.8%', |
| 283 | }, |
| 284 | { |
| 285 | name: 'Health', |
| 286 | revenue: 73000, |
| 287 | orders: 520, |
| 288 | avgPrice: 140.4, |
| 289 | growth: '+22.1%', |
| 290 | }, |
| 291 | ], |
| 292 | }; |
| 293 | } |