feat(pricing): switch base+EDU prices to AED and unify attire at 5000 AED
- `base` (Basic body) → 77,125 AED (Unitree G1 retail $16k + $5k markup) - new `edu` row → 146,900 AED ($40k flat) - all persona attire (kandura, vest, suit, robot-doctor, security-guard) → 5,000 AED - `custom-color` unchanged at 3,500 AED - PricingEngine now swaps the base line when EDU body is selected - localStorage key bumped to `lootah-pricing-v2` to invalidate stale client caches - Robot Body buttons now describe the variants as `Standard consumer` vs `Open-source education / research` (same chassis GLB, differs in licensing) - New `prisma/update-prices.ts` idempotent script applies the new prices to an existing DB; seed.ts updated for fresh installs - Pricing tests updated to match new defaults Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
03dbc4ac98
commit
52b910ed93
Binary file not shown.
+12
-7
@@ -50,14 +50,19 @@ async function main() {
|
||||
// Seed default pricing items (idempotent — only if table is empty)
|
||||
const pricingCount = await prisma.pricingItem.count();
|
||||
if (pricingCount === 0) {
|
||||
// Prices in AED. USD → AED at 3.6725 (CBUAE peg).
|
||||
// Basic = Unitree G1 retail ($16k) + $5k markup = $21k ≈ 77,125 AED.
|
||||
// EDU = $40k flat ≈ 146,900 AED.
|
||||
// All persona attire = 5,000 AED each.
|
||||
const defaultItems = [
|
||||
{ id: 'base', label: 'G1 Robot Base', price: 250000, sortOrder: 0 },
|
||||
{ id: 'emarati-kandura', label: 'Emarati Kandura', price: 15000, sortOrder: 1 },
|
||||
{ id: 'industrial-vest', label: 'Industrial Vest', price: 8500, sortOrder: 2 },
|
||||
{ id: 'business-suit', label: 'Business Suit', price: 12000, sortOrder: 3 },
|
||||
{ id: 'custom-color', label: 'Custom Color', price: 3500, sortOrder: 4 },
|
||||
{ id: 'robot-doctor', label: 'Robot Doctor', price: 5000, sortOrder: 5 },
|
||||
{ id: 'security-guard', label: 'Security Guard', price: 5000, sortOrder: 6 },
|
||||
{ id: 'base', label: 'G1 Robot Basic', price: 77125, sortOrder: 0 },
|
||||
{ id: 'edu', label: 'G1 Robot EDU', price: 146900, sortOrder: 1 },
|
||||
{ id: 'emarati-kandura', label: 'Emarati Kandura', price: 5000, sortOrder: 2 },
|
||||
{ id: 'industrial-vest', label: 'Industrial Vest', price: 5000, sortOrder: 3 },
|
||||
{ id: 'business-suit', label: 'Business Suit', price: 5000, sortOrder: 4 },
|
||||
{ id: 'custom-color', label: 'Custom Color', price: 3500, sortOrder: 5 },
|
||||
{ id: 'robot-doctor', label: 'Robot Doctor', price: 5000, sortOrder: 6 },
|
||||
{ id: 'security-guard', label: 'Security Guard', price: 5000, sortOrder: 7 },
|
||||
];
|
||||
for (const item of defaultItems) {
|
||||
await prisma.pricingItem.create({ data: item });
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// One-off price refresh. Run with: npx tsx prisma/update-prices.ts
|
||||
// Idempotent: upserts every row, safe to re-run.
|
||||
import { PrismaClient } from '../src/generated/prisma/client.js';
|
||||
import { PrismaLibSql } from '@prisma/adapter-libsql';
|
||||
import path from 'path';
|
||||
|
||||
const dbPath = path.resolve(process.cwd(), 'prisma', 'lootah.db');
|
||||
const adapter = new PrismaLibSql({ url: `file:${dbPath}` });
|
||||
const prisma = new PrismaClient({ adapter } as ConstructorParameters<typeof PrismaClient>[0]);
|
||||
|
||||
const items = [
|
||||
{ id: 'base', label: 'G1 Robot Basic', price: 77125, sortOrder: 0 },
|
||||
{ id: 'edu', label: 'G1 Robot EDU', price: 146900, sortOrder: 1 },
|
||||
{ id: 'emarati-kandura', label: 'Emarati Kandura', price: 5000, sortOrder: 2 },
|
||||
{ id: 'industrial-vest', label: 'Industrial Vest', price: 5000, sortOrder: 3 },
|
||||
{ id: 'business-suit', label: 'Business Suit', price: 5000, sortOrder: 4 },
|
||||
{ id: 'custom-color', label: 'Custom Color', price: 3500, sortOrder: 5 },
|
||||
{ id: 'robot-doctor', label: 'Robot Doctor', price: 5000, sortOrder: 6 },
|
||||
{ id: 'security-guard', label: 'Security Guard', price: 5000, sortOrder: 7 },
|
||||
];
|
||||
|
||||
async function main() {
|
||||
for (const item of items) {
|
||||
await prisma.pricingItem.upsert({
|
||||
where: { id: item.id },
|
||||
create: item,
|
||||
update: { label: item.label, price: item.price, sortOrder: item.sortOrder },
|
||||
});
|
||||
console.log(`✓ ${item.id} → ${item.label} @ ${item.price} AED`);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user