@open-mercato/core 0.10.1-develop.8004.1.a8a79ee43f → 0.10.1-develop.8022.1.b6753de892
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/modules/audit_logs/components/AuditLogsActions.js +80 -50
- package/dist/modules/audit_logs/components/AuditLogsActions.js.map +3 -3
- package/dist/modules/audit_logs/lib/rowPresentation.js +82 -0
- package/dist/modules/audit_logs/lib/rowPresentation.js.map +7 -0
- package/dist/modules/catalog/commands/variants.js +89 -16
- package/dist/modules/catalog/commands/variants.js.map +2 -2
- package/dist/modules/catalog/seed/examples.js +7 -0
- package/dist/modules/catalog/seed/examples.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +2 -2
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/components/detail/AssignRoleDialog.js +10 -21
- package/dist/modules/customers/components/detail/AssignRoleDialog.js.map +2 -2
- package/dist/modules/customers/migrations/Migration20260825140000_customers.js +17 -10
- package/dist/modules/customers/migrations/Migration20260825140000_customers.js.map +2 -2
- package/dist/modules/entities/cli.js +138 -66
- package/dist/modules/entities/cli.js.map +3 -3
- package/dist/modules/promotions/commands/codes.js +18 -3
- package/dist/modules/promotions/commands/codes.js.map +2 -2
- package/dist/modules/query_index/cli.js +17 -1
- package/dist/modules/query_index/cli.js.map +2 -2
- package/dist/modules/query_index/lib/reindexer.js +23 -5
- package/dist/modules/query_index/lib/reindexer.js.map +2 -2
- package/dist/modules/sales/commands/configuration.js +30 -16
- package/dist/modules/sales/commands/configuration.js.map +2 -2
- package/dist/modules/sales/components/documents/AddressesSection.js +36 -15
- package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
- package/dist/modules/sales/seed/examples.js +35 -6
- package/dist/modules/sales/seed/examples.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/audit_logs/components/AuditLogsActions.tsx +85 -48
- package/src/modules/audit_logs/i18n/de.json +16 -0
- package/src/modules/audit_logs/i18n/en.json +16 -0
- package/src/modules/audit_logs/i18n/es.json +16 -0
- package/src/modules/audit_logs/i18n/ko.json +16 -0
- package/src/modules/audit_logs/i18n/pl.json +16 -0
- package/src/modules/audit_logs/lib/rowPresentation.ts +92 -0
- package/src/modules/catalog/commands/variants.ts +96 -17
- package/src/modules/catalog/seed/examples.ts +7 -0
- package/src/modules/customers/api/interactions/route.ts +2 -2
- package/src/modules/customers/components/detail/AssignRoleDialog.tsx +9 -12
- package/src/modules/customers/i18n/de.json +2 -1
- package/src/modules/customers/i18n/en.json +2 -1
- package/src/modules/customers/i18n/es.json +2 -1
- package/src/modules/customers/i18n/ko.json +2 -1
- package/src/modules/customers/i18n/pl.json +2 -1
- package/src/modules/customers/migrations/Migration20260825140000_customers.ts +21 -10
- package/src/modules/entities/cli.ts +144 -65
- package/src/modules/promotions/commands/codes.ts +19 -4
- package/src/modules/query_index/cli.ts +17 -1
- package/src/modules/query_index/lib/reindexer.ts +55 -6
- package/src/modules/sales/commands/configuration.ts +35 -16
- package/src/modules/sales/components/documents/AddressesSection.tsx +51 -20
- package/src/modules/sales/i18n/de.json +3 -0
- package/src/modules/sales/i18n/en.json +3 -0
- package/src/modules/sales/i18n/es.json +3 -0
- package/src/modules/sales/i18n/ko.json +3 -0
- package/src/modules/sales/i18n/pl.json +4 -1
- package/src/modules/sales/seed/examples.ts +41 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/sales/seed/examples.ts"],
|
|
4
|
-
"sourcesContent": ["import { randomUUID } from 'crypto'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { AppContainer } from '@open-mercato/shared/lib/di/container'\nimport {\n SalesOrder,\n SalesOrderLine,\n SalesOrderAdjustment,\n SalesQuote,\n SalesQuoteLine,\n SalesQuoteAdjustment,\n SalesShipment,\n SalesShipmentItem,\n SalesPayment,\n SalesPaymentAllocation,\n SalesDocumentAddress,\n SalesNote,\n SalesChannel,\n SalesPaymentMethod,\n SalesShippingMethod,\n type SalesAdjustmentKind,\n type SalesLineKind,\n} from '../data/entities'\nimport { seedSalesDictionaries } from '../lib/dictionaries'\nimport { refreshShipmentItemsSnapshot } from '../lib/shipments/snapshots'\nimport { toNumericString } from '../commands/shared'\nimport type { SalesCalculationService } from '../services/salesCalculationService'\nimport { ensureExamplePaymentMethods, ensureExampleShippingMethods, type SeedScope } from './examples-data'\nimport {\n CatalogProduct,\n CatalogProductPrice,\n CatalogProductVariant,\n} from '@open-mercato/core/modules/catalog/data/entities'\nimport {\n CustomerAddress,\n CustomerEntity,\n CustomerPersonProfile,\n} from '@open-mercato/core/modules/customers/data/entities'\nimport { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('sales')\n\ntype ExampleAddress = {\n role: 'billing' | 'shipping'\n companyName?: string | null\n name?: string | null\n addressLine1: string\n addressLine2?: string | null\n city?: string | null\n region?: string | null\n postalCode?: string | null\n country?: string | null\n latitude?: number | null\n longitude?: number | null\n customerAddressId?: string | null\n}\n\ntype ExampleLine = {\n kind?: SalesLineKind\n name: string\n description?: string\n quantity: number\n unitPriceNet: number\n unitPriceGross?: number\n taxRate?: number\n discountPercent?: number\n quantityUnit?: string\n comment?: string\n productHandle?: string\n variantSku?: string\n}\n\ntype ExampleAdjustment = {\n scope: 'order' | 'line'\n kind: SalesAdjustmentKind\n label?: string\n amountNet: number\n amountGross?: number\n rate?: number\n lineIndex?: number\n position?: number\n}\n\ntype ExampleNote = {\n body: string\n createdAt?: Date\n appearanceIcon?: string | null\n appearanceColor?: string | null\n}\n\ntype ExampleShipment = {\n shipmentNumber?: string\n methodCode?: string\n status?: string\n shippedAt?: Date\n deliveredAt?: Date\n trackingNumbers?: string[]\n weightKg?: number\n declaredValue?: number\n currencyCode?: string\n notes?: string\n items: Array<{ lineIndex: number; quantity: number }>\n}\n\ntype ExamplePayment = {\n reference?: string\n methodCode?: string\n status?: string\n amount: number\n currencyCode: string\n receivedAt?: Date\n capturedAt?: Date\n}\n\ntype ExampleQuote = {\n quoteNumber: string\n status?: string\n comments?: string\n validFrom?: Date\n validUntil?: Date\n currencyCode: string\n shippingMethodCode?: string\n paymentMethodCode?: string\n addresses?: ExampleAddress[]\n lines: ExampleLine[]\n adjustments?: ExampleAdjustment[]\n notes?: ExampleNote[]\n metadata?: Record<string, unknown>\n channelCode?: string\n customerKey?: string\n}\n\ntype ExampleOrder = {\n orderNumber: string\n status?: string\n fulfillmentStatus?: string\n paymentStatus?: string\n comments?: string\n internalNotes?: string\n placedAt?: Date\n expectedDeliveryAt?: Date\n currencyCode: string\n shippingMethodCode?: string\n paymentMethodCode?: string\n channelCode?: string\n addresses?: ExampleAddress[]\n lines: ExampleLine[]\n adjustments?: ExampleAdjustment[]\n notes?: ExampleNote[]\n shipments?: ExampleShipment[]\n payments?: ExamplePayment[]\n metadata?: Record<string, unknown>\n customerKey?: string\n}\n\nconst CHANNEL_SEEDS = [\n { code: 'online', name: 'Online Store', description: 'Orders captured from the storefront.' },\n {\n code: 'field-sales',\n name: 'Field Sales',\n description: 'Quotes negotiated by the sales team and converted offline.',\n },\n] as const\n\nconst CUSTOMER_LINKS: CustomerLookup[] = [\n { key: 'brightside', displayName: 'Brightside Solar' },\n { key: 'harborview', displayName: 'Harborview Analytics' },\n { key: 'copperleaf', displayName: 'Copperleaf Design Co.' },\n] as const\n\nconst QUOTE_SEEDS: ExampleQuote[] = [\n {\n quoteNumber: 'SQ-DEMO-1001',\n status: 'draft',\n comments: 'Pricing reflects bundled onboarding; valid for 30 days.',\n validFrom: daysFromNow(-2),\n validUntil: daysFromNow(28),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n lines: [\n {\n name: 'Remote onboarding package',\n description: 'Kick-off, workflow design, and training for distributed teams.',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 10,\n },\n {\n name: 'Implementation workshop (4h)',\n description: 'Hands-on configuration session with stakeholders.',\n quantity: 1,\n unitPriceNet: 320,\n taxRate: 0,\n comment: 'Can be split into two shorter sessions on request.',\n },\n ],\n adjustments: [\n { scope: 'order', kind: 'discount', label: 'Pilot discount', amountNet: 45, position: 1 },\n {\n scope: 'order',\n kind: 'shipping',\n label: 'Expedited shipping',\n amountNet: 25,\n amountGross: 27.5,\n position: 2,\n },\n ],\n addresses: [\n {\n role: 'billing',\n companyName: 'Northwind Ventures',\n name: 'Nora Winters',\n addressLine1: '200 Pine St',\n addressLine2: 'Suite 900',\n city: 'Seattle',\n region: 'WA',\n postalCode: '98101',\n country: 'US',\n },\n {\n role: 'shipping',\n companyName: 'Northwind Ventures',\n name: 'Receiving Dock',\n addressLine1: '4124 4th Ave S',\n city: 'Seattle',\n region: 'WA',\n postalCode: '98134',\n country: 'US',\n },\n ],\n notes: [\n {\n body: 'Requested weekend training option if schedules slip.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:calendar-clock',\n appearanceColor: '#0ea5e9',\n },\n {\n body: 'Prefers invoicing after acceptance instead of deposit.',\n createdAt: daysFromNow(0),\n appearanceIcon: 'lucide:receipt',\n appearanceColor: '#f97316',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n quoteNumber: 'SQ-DEMO-1002',\n status: 'draft',\n comments: 'Footwear replenishment and event outfits pulled from catalog offers.',\n validFrom: daysFromNow(-1),\n validUntil: daysFromNow(21),\n currencyCode: 'USD',\n shippingMethodCode: 'standard-ground',\n paymentMethodCode: 'card',\n channelCode: 'online',\n customerKey: 'brightside',\n lines: [\n {\n name: 'Atlas Runner Sneaker',\n quantity: 3,\n unitPriceNet: 120,\n taxRate: 10,\n variantSku: 'ATLAS-RUN-NAVY-8',\n },\n {\n name: 'Aurora Wrap Dress',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 10,\n variantSku: 'AURORA-ROSE-M',\n discountPercent: 5,\n },\n ],\n adjustments: [\n { scope: 'order', kind: 'discount', label: 'Preferred customer', amountNet: 35, position: 1 },\n ],\n notes: [\n {\n body: 'Requested quick turn on delivery dates for press shoot.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:camera',\n appearanceColor: '#0ea5e9',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n quoteNumber: 'SQ-DEMO-1003',\n status: 'sent',\n comments: 'Bundle of apparel and on-site styling block for the studio launch.',\n validFrom: daysFromNow(-3),\n validUntil: daysFromNow(10),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n customerKey: 'copperleaf',\n lines: [\n {\n name: 'Aurora Wrap Dress',\n quantity: 2,\n unitPriceNet: 180,\n taxRate: 10,\n variantSku: 'AURORA-CELESTIAL-L',\n comment: 'Alternate colorway accepted if Celestial runs out.',\n },\n {\n name: 'Signature Haircut & Finish',\n quantity: 4,\n unitPriceNet: 95,\n taxRate: 0,\n variantSku: 'SERV-HAIR-60',\n quantityUnit: 'hour',\n comment: 'Styling sessions during opening week.',\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'discount',\n label: 'Launch partner credit',\n amountNet: 60,\n position: 1,\n },\n ],\n notes: [\n {\n body: 'Prefers consolidated invoicing after the event.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:file-text',\n appearanceColor: '#f97316',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n]\n\nconst ORDER_SEEDS: ExampleOrder[] = [\n {\n orderNumber: 'SO-DEMO-2001',\n status: 'confirmed',\n fulfillmentStatus: 'in_fulfillment',\n comments: 'White-glove delivery requested for the larger items.',\n internalNotes: 'Coordinate with facilities for access badges.',\n placedAt: daysFromNow(-3),\n expectedDeliveryAt: daysFromNow(4),\n currencyCode: 'USD',\n shippingMethodCode: 'standard-ground',\n paymentMethodCode: 'card',\n channelCode: 'online',\n lines: [\n {\n name: 'Modular desk system',\n quantity: 1,\n unitPriceNet: 640,\n taxRate: 10,\n description: 'Corner configuration with cable routing.',\n },\n {\n name: 'Acoustic panel set',\n quantity: 3,\n unitPriceNet: 85,\n taxRate: 10,\n description: 'Charcoal grey finish, adhesive mount.',\n discountPercent: 5,\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'shipping',\n label: 'White-glove delivery',\n amountNet: 60,\n amountGross: 66,\n position: 1,\n },\n { scope: 'order', kind: 'discount', label: 'New office promo', amountNet: 75, position: 2 },\n {\n scope: 'order',\n kind: 'surcharge',\n label: 'After-hours install',\n amountNet: 35,\n amountGross: 38.5,\n position: 3,\n },\n ],\n shipments: [\n {\n shipmentNumber: 'SHIP-2001-1',\n methodCode: 'standard-ground',\n status: 'shipped',\n shippedAt: daysFromNow(-1),\n trackingNumbers: ['1Z-234-ACOUSTICS'],\n weightKg: 38,\n declaredValue: 720,\n currencyCode: 'USD',\n notes: 'Panels shipped separately to avoid freight delay.',\n items: [\n { lineIndex: 1, quantity: 2 },\n ],\n },\n {\n shipmentNumber: 'SHIP-2001-2',\n methodCode: 'express-air',\n status: 'in_transit',\n shippedAt: daysFromNow(0),\n trackingNumbers: ['1Z-987-DESK'],\n weightKg: 72,\n declaredValue: 560,\n currencyCode: 'USD',\n notes: 'Desk ships via express due to size.',\n items: [{ lineIndex: 0, quantity: 1 }],\n },\n ],\n payments: [\n {\n reference: 'AUTH-2001-CC',\n methodCode: 'card',\n status: 'captured',\n amount: 600,\n currencyCode: 'USD',\n receivedAt: daysFromNow(-2),\n capturedAt: daysFromNow(-1),\n },\n {\n reference: 'WIRE-2001',\n methodCode: 'bank-transfer',\n status: 'received',\n amount: 414,\n currencyCode: 'USD',\n receivedAt: daysFromNow(1),\n },\n ],\n addresses: [\n {\n role: 'billing',\n companyName: 'Harborview Analytics',\n name: 'Accounts Payable',\n addressLine1: '355 Atlantic Ave Floor 6',\n city: 'Boston',\n region: 'MA',\n postalCode: '02210',\n country: 'US',\n },\n {\n role: 'shipping',\n companyName: 'Harborview Analytics',\n name: 'Loading Dock',\n addressLine1: '9 Drydock Ave',\n city: 'Boston',\n region: 'MA',\n postalCode: '02210',\n country: 'US',\n },\n ],\n notes: [\n {\n body: 'Facilities requested 2-hour delivery window notice.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:bell-ring',\n appearanceColor: '#0ea5e9',\n },\n {\n body: 'Panels can be staged in conference room A.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:warehouse',\n appearanceColor: '#22c55e',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n orderNumber: 'SO-DEMO-2002',\n status: 'confirmed',\n fulfillmentStatus: 'fulfilled',\n paymentStatus: 'partial',\n comments: 'Subscription setup aligns with fiscal Q3 start.',\n placedAt: daysFromNow(-6),\n expectedDeliveryAt: daysFromNow(1),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n lines: [\n {\n name: 'On-site enablement',\n quantity: 1,\n unitPriceNet: 280,\n taxRate: 0,\n description: 'Day of workshops across two teams.',\n },\n {\n name: 'Support retainer (Q3)',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 0,\n description: 'Response SLA with named TAM.',\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'shipping',\n label: 'Travel & lodging',\n amountNet: 20,\n amountGross: 22,\n position: 1,\n },\n {\n scope: 'order',\n kind: 'discount',\n label: 'Multi-team starter',\n amountNet: 25,\n position: 2,\n },\n ],\n shipments: [\n {\n shipmentNumber: 'SHIP-2002-1',\n methodCode: 'express-air',\n status: 'delivered',\n shippedAt: daysFromNow(-4),\n deliveredAt: daysFromNow(-2),\n trackingNumbers: ['AIR-22002-KIT'],\n declaredValue: 150,\n currencyCode: 'USD',\n notes: 'Enablement kit delivered to training room.',\n items: [\n { lineIndex: 0, quantity: 1 },\n { lineIndex: 1, quantity: 1 },\n ],\n },\n ],\n payments: [\n {\n reference: 'WIRE-2002',\n methodCode: 'bank-transfer',\n status: 'received',\n amount: 250,\n currencyCode: 'USD',\n receivedAt: daysFromNow(-1),\n },\n ],\n addresses: [\n {\n role: 'billing',\n companyName: 'Brightside Solar',\n name: 'Finance',\n addressLine1: '245 Market St Suite 400',\n city: 'San Francisco',\n region: 'CA',\n postalCode: '94105',\n country: 'US',\n },\n {\n role: 'shipping',\n companyName: 'Brightside Solar',\n name: 'Training Room B',\n addressLine1: '245 Market St Suite 410',\n city: 'San Francisco',\n region: 'CA',\n postalCode: '94105',\n country: 'US',\n },\n ],\n notes: [\n {\n body: 'TAM onboarding scheduled next Tuesday.',\n createdAt: daysFromNow(-3),\n appearanceIcon: 'lucide:users',\n appearanceColor: '#a855f7',\n },\n {\n body: 'Retainer renewal review in mid-Q4.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:clock-3',\n appearanceColor: '#f97316',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n orderNumber: 'SO-DEMO-2003',\n status: 'confirmed',\n fulfillmentStatus: 'in_fulfillment',\n paymentStatus: 'partial',\n comments: 'Equipment refresh for analytics field team with matching footwear.',\n internalNotes: 'Coordinate delivery around team offsite schedule.',\n placedAt: daysFromNow(-2),\n expectedDeliveryAt: daysFromNow(5),\n currencyCode: 'USD',\n shippingMethodCode: 'standard-ground',\n paymentMethodCode: 'card',\n channelCode: 'online',\n customerKey: 'harborview',\n lines: [\n {\n name: 'Atlas Runner Sneaker',\n quantity: 4,\n unitPriceNet: 120,\n taxRate: 10,\n variantSku: 'ATLAS-RUN-GLACIER-10',\n comment: 'Size mix handled via catalog variants.',\n },\n {\n name: 'Aurora Wrap Dress',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 10,\n variantSku: 'AURORA-ROSE-M',\n discountPercent: 10,\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'shipping',\n label: 'Ground shipping',\n amountNet: 25,\n amountGross: 27.5,\n position: 1,\n },\n ],\n shipments: [\n {\n shipmentNumber: 'SHIP-2003-1',\n methodCode: 'standard-ground',\n status: 'pending',\n shippedAt: undefined,\n trackingNumbers: [],\n weightKg: 12,\n declaredValue: 0,\n currencyCode: 'USD',\n notes: 'Bundle footwear and apparel together.',\n items: [\n { lineIndex: 0, quantity: 4 },\n { lineIndex: 1, quantity: 1 },\n ],\n },\n ],\n payments: [\n {\n reference: 'CARD-2003',\n methodCode: 'card',\n status: 'authorized',\n amount: 300,\n currencyCode: 'USD',\n receivedAt: daysFromNow(-1),\n },\n ],\n notes: [\n {\n body: 'Leadership wants tracking shared in Slack channel.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:message-circle',\n appearanceColor: '#22c55e',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n orderNumber: 'SO-DEMO-2004',\n status: 'confirmed',\n fulfillmentStatus: 'pending',\n paymentStatus: 'unpaid',\n comments: 'On-site styling block for studio launch week.',\n placedAt: daysFromNow(-4),\n expectedDeliveryAt: daysFromNow(1),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n customerKey: 'copperleaf',\n lines: [\n {\n name: 'Signature Haircut & Finish',\n quantity: 6,\n unitPriceNet: 95,\n taxRate: 0,\n variantSku: 'SERV-HAIR-60',\n quantityUnit: 'hour',\n comment: 'Block book stylists for staggered sessions.',\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'discount',\n label: 'Launch week courtesy',\n amountNet: 45,\n position: 1,\n },\n ],\n payments: [\n {\n reference: 'WIRE-2004',\n methodCode: 'bank-transfer',\n status: 'pending',\n amount: 0,\n currencyCode: 'USD',\n },\n ],\n notes: [\n {\n body: 'Confirm stylist roster by Friday.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:check-circle',\n appearanceColor: '#0ea5e9',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n]\n\nfunction daysFromNow(offset: number): Date {\n const now = new Date()\n const copy = new Date(now)\n copy.setUTCDate(now.getUTCDate() + offset)\n return copy\n}\n\nfunction toAmount(value: number | null | undefined): string {\n if (value === null || value === undefined || Number.isNaN(value)) return '0'\n return toNumericString(Math.round((value + Number.EPSILON) * 10000) / 10000) ?? '0'\n}\n\nfunction toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n\nfunction normalizeKey(value: string | null | undefined): string {\n return (value ?? '').trim().toLowerCase()\n}\n\nfunction asNumber(value: unknown): number {\n if (typeof value === 'number') return value\n if (typeof value === 'string') {\n const parsed = Number(value)\n return Number.isFinite(parsed) ? parsed : 0\n }\n return 0\n}\n\ntype CatalogLookup = {\n productsByHandle: Map<string, CatalogProduct>\n variantsBySku: Map<string, CatalogProductVariant>\n variantPrices: Map<string, { net: number; gross: number; currency: string }>\n}\n\nasync function loadCatalogLookups(em: EntityManager, scope: SeedScope): Promise<CatalogLookup> {\n const [products, variants, prices] = await Promise.all([\n em.find(CatalogProduct, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n }),\n em.find(\n CatalogProductVariant,\n { organizationId: scope.organizationId, tenantId: scope.tenantId, deletedAt: null },\n { populate: ['product'] }\n ),\n em.find(CatalogProductPrice, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n }),\n ])\n\n const productsByHandle = new Map<string, CatalogProduct>()\n products.forEach((product) => {\n const key = normalizeKey(product.handle ?? product.sku ?? product.title)\n if (key) productsByHandle.set(key, product)\n })\n\n const variantsBySku = new Map<string, CatalogProductVariant>()\n variants.forEach((variant) => {\n const key = normalizeKey(variant.sku)\n if (key) variantsBySku.set(key, variant)\n })\n\n const variantPrices = new Map<string, { net: number; gross: number; currency: string }>()\n for (const price of prices) {\n const variantId =\n typeof price.variant === 'string' ? price.variant : price.variant?.id ?? (price as any)?.variant_id ?? null\n if (!variantId) continue\n const gross = asNumber((price as any).unitPriceGross ?? price.unitPriceGross)\n const net = asNumber((price as any).unitPriceNet ?? price.unitPriceNet ?? gross)\n const currency = typeof price.currencyCode === 'string' ? price.currencyCode : 'USD'\n const isSale = normalizeKey((price as any).kind) === 'sale' || normalizeKey((price as any)?.priceKind?.code) === 'sale'\n const existing = variantPrices.get(variantId)\n if (!existing || isSale) {\n variantPrices.set(variantId, { net, gross, currency })\n }\n }\n\n return { productsByHandle, variantsBySku, variantPrices }\n}\n\nfunction buildCatalogSnapshot(\n product: CatalogProduct | null,\n variant: CatalogProductVariant | null,\n price: { net: number; gross: number; currency: string } | null\n): Record<string, unknown> | null {\n if (!product) return null\n const productThumbnail =\n (product as any).defaultMediaUrl ??\n (product as any).thumbnailUrl ??\n (product.metadata && typeof product.metadata === 'object'\n ? ((product.metadata as any).thumbnailUrl as string | null | undefined)\n : null) ??\n null\n const variantThumbnail =\n variant && variant.metadata && typeof variant.metadata === 'object'\n ? ((variant.metadata as any).thumbnailUrl as string | null | undefined) ?? null\n : null\n return {\n product: {\n id: product.id,\n title: product.title,\n handle: product.handle ?? null,\n sku: product.sku ?? null,\n thumbnailUrl: productThumbnail,\n },\n variant: variant\n ? {\n id: variant.id,\n name: variant.name ?? product.title,\n sku: variant.sku ?? null,\n optionValues: variant.optionValues ?? null,\n thumbnailUrl: variantThumbnail,\n }\n : null,\n price: price\n ? {\n currencyCode: price.currency,\n unitPriceNet: price.net,\n unitPriceGross: price.gross,\n }\n : null,\n }\n}\n\nfunction resolveCatalogLine(\n line: ExampleLine,\n catalog: CatalogLookup\n): {\n productId: string | null\n variantId: string | null\n unitPriceNet: number | null\n unitPriceGross: number | null\n currencyCode: string | null\n snapshot: Record<string, unknown> | null\n productThumbnail: string | null\n variantThumbnail: string | null\n} {\n const variant =\n line.variantSku && catalog.variantsBySku.size\n ? catalog.variantsBySku.get(normalizeKey(line.variantSku))\n : null\n const product =\n variant?.product ??\n (line.productHandle ? catalog.productsByHandle.get(normalizeKey(line.productHandle)) ?? null : null)\n const price = variant ? catalog.variantPrices.get(variant.id) ?? null : null\n const snapshot = buildCatalogSnapshot(product ?? null, variant ?? null, price ?? null)\n const productThumbnail =\n (snapshot as any)?.product?.thumbnailUrl ??\n (product as any)?.defaultMediaUrl ??\n (product as any)?.thumbnailUrl ??\n null\n const variantThumbnail = (snapshot as any)?.variant?.thumbnailUrl ?? null\n return {\n productId: product ? product.id : null,\n variantId: variant ? variant.id : null,\n unitPriceNet: price?.net ?? null,\n unitPriceGross: price?.gross ?? null,\n currencyCode: price?.currency ?? null,\n snapshot,\n productThumbnail: productThumbnail ?? null,\n variantThumbnail: variantThumbnail ?? null,\n }\n}\n\ntype CustomerLookup = {\n key: string\n displayName: string\n}\n\ntype CustomerLookupSpec = CustomerLookup & { normalizedName: string }\n\ntype CustomerContext = {\n entity: CustomerEntity\n contact: CustomerPersonProfile | null\n contactId: string | null\n snapshot: Record<string, unknown> | null\n addresses: ExampleAddress[]\n}\n\nfunction buildCustomerSnapshot(\n entity: CustomerEntity,\n contact: CustomerPersonProfile | null\n): Record<string, unknown> | null {\n const base = {\n id: entity.id,\n kind: entity.kind,\n displayName: entity.displayName,\n primaryEmail: entity.primaryEmail ?? null,\n primaryPhone: entity.primaryPhone ?? null,\n personProfile: entity.personProfile\n ? {\n id: entity.personProfile.id,\n firstName: entity.personProfile.firstName ?? null,\n lastName: entity.personProfile.lastName ?? null,\n preferredName: entity.personProfile.preferredName ?? null,\n jobTitle: entity.personProfile.jobTitle ?? null,\n department: entity.personProfile.department ?? null,\n seniority: entity.personProfile.seniority ?? null,\n timezone: entity.personProfile.timezone ?? null,\n }\n : null,\n companyProfile: entity.companyProfile\n ? {\n id: entity.companyProfile.id,\n legalName: entity.companyProfile.legalName ?? null,\n brandName: entity.companyProfile.brandName ?? null,\n domain: entity.companyProfile.domain ?? null,\n websiteUrl: entity.companyProfile.websiteUrl ?? null,\n }\n : null,\n }\n const contactSnapshot = contact\n ? {\n id: contact.id,\n firstName: contact.firstName ?? null,\n lastName: contact.lastName ?? null,\n email: contact.entity?.primaryEmail ?? null,\n phone: contact.entity?.primaryPhone ?? null,\n companyId: contact.company ? (typeof contact.company === 'string' ? contact.company : contact.company.id) : null,\n }\n : null\n return { customer: base, contact: contactSnapshot }\n}\n\nfunction toExampleAddresses(customer: CustomerEntity, address: CustomerAddress | null): ExampleAddress[] {\n if (!address) return []\n const base = {\n companyName: address.companyName ?? customer.displayName ?? null,\n name: address.name ?? address.companyName ?? customer.displayName ?? null,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2 ?? null,\n city: address.city ?? null,\n region: address.region ?? null,\n postalCode: address.postalCode ?? null,\n country: address.country ?? null,\n latitude: address.latitude ?? null,\n longitude: address.longitude ?? null,\n customerAddressId: address.id,\n }\n return [\n { role: 'billing', ...base },\n { role: 'shipping', ...base },\n ]\n}\n\nasync function loadCustomerLookups(\n em: EntityManager,\n scope: SeedScope,\n lookups: CustomerLookup[]\n): Promise<Map<string, CustomerContext>> {\n const map = new Map<string, CustomerContext>()\n if (lookups.length === 0) return map\n const lookupSpecs: CustomerLookupSpec[] = lookups.map((lookup) => ({\n ...lookup,\n normalizedName: normalizeKey(lookup.displayName),\n }))\n const unresolved = new Map<string, CustomerLookupSpec>()\n for (const spec of lookupSpecs) {\n unresolved.set(spec.key, spec)\n }\n\n const customers = await findWithDecryption(\n em,\n CustomerEntity,\n {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n },\n { populate: ['personProfile', 'companyProfile'] },\n { tenantId: scope.tenantId, organizationId: scope.organizationId }\n )\n\n const doesMatch = (candidate: string, spec: CustomerLookupSpec): boolean => {\n if (!candidate) return false\n return (\n candidate === spec.normalizedName ||\n candidate.includes(spec.normalizedName) ||\n spec.normalizedName.includes(candidate)\n )\n }\n\n const matchedPairs: Array<{ spec: CustomerLookupSpec; customer: CustomerEntity }> = []\n\n for (const customer of customers) {\n if (unresolved.size === 0) break\n const tokens = new Set<string>()\n tokens.add(normalizeKey(customer.displayName))\n if (customer.companyProfile) {\n tokens.add(normalizeKey(customer.companyProfile.legalName ?? ''))\n tokens.add(normalizeKey(customer.companyProfile.brandName ?? ''))\n tokens.add(normalizeKey(customer.companyProfile.domain ?? ''))\n }\n if (customer.personProfile) {\n tokens.add(normalizeKey(customer.personProfile.firstName ?? ''))\n tokens.add(normalizeKey(customer.personProfile.lastName ?? ''))\n const fullName = [customer.personProfile.firstName, customer.personProfile.lastName]\n .filter((part) => (part ?? '').trim().length > 0)\n .join(' ')\n tokens.add(normalizeKey(fullName))\n }\n\n const matchedSpec = lookupSpecs.find(\n (spec) => unresolved.has(spec.key) && Array.from(tokens).some((token) => doesMatch(token, spec))\n )\n if (!matchedSpec) continue\n matchedPairs.push({ spec: matchedSpec, customer })\n unresolved.delete(matchedSpec.key)\n }\n\n const matchIds = matchedPairs.map(({ customer }) => customer.id)\n\n const addresses = matchIds.length\n ? await findWithDecryption(\n em,\n CustomerAddress,\n { organizationId: scope.organizationId, tenantId: scope.tenantId, entity: { $in: matchIds } },\n { orderBy: { isPrimary: 'desc', createdAt: 'asc' } as any },\n { tenantId: scope.tenantId, organizationId: scope.organizationId }\n )\n : []\n const addressByCustomer = new Map<string, CustomerAddress>()\n for (const address of addresses) {\n const entityId = typeof address.entity === 'string' ? address.entity : address.entity?.id\n if (!entityId || addressByCustomer.has(entityId)) continue\n addressByCustomer.set(entityId, address)\n }\n\n const contacts = matchIds.length\n ? await findWithDecryption(\n em,\n CustomerPersonProfile,\n { organizationId: scope.organizationId, tenantId: scope.tenantId, company: { $in: matchIds } },\n { populate: ['entity', 'company'] },\n { tenantId: scope.tenantId, organizationId: scope.organizationId }\n )\n : []\n const contactByCompany = new Map<string, CustomerPersonProfile>()\n for (const contact of contacts) {\n const companyId = typeof contact.company === 'string' ? contact.company : contact.company?.id\n if (!companyId || contactByCompany.has(companyId)) continue\n contactByCompany.set(companyId, contact)\n }\n\n for (const { spec, customer } of matchedPairs) {\n const contact = contactByCompany.get(customer.id) ?? null\n const snapshot = buildCustomerSnapshot(customer, contact)\n const addresses = toExampleAddresses(customer, addressByCustomer.get(customer.id) ?? null)\n map.set(spec.key, {\n entity: customer,\n contact,\n contactId: contact?.id ?? null,\n snapshot,\n addresses,\n })\n }\n\n for (const lookup of lookups) {\n if (!map.has(lookup.key)) {\n logger.warn('sales.examples customer not found; skipping seeded linkage', { displayName: lookup.displayName })\n }\n }\n\n return map\n}\n\nasync function ensureChannels(\n em: EntityManager,\n scope: SeedScope\n): Promise<Map<string, SalesChannel>> {\n const existing = await em.find(SalesChannel, {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n deletedAt: null,\n })\n const map = new Map<string, SalesChannel>()\n existing.forEach((entry) => map.set((entry.code ?? '').toLowerCase(), entry))\n const now = new Date()\n for (const seed of CHANNEL_SEEDS) {\n const code = seed.code.toLowerCase()\n if (map.has(code)) continue\n const record = em.create(SalesChannel, {\n id: randomUUID(),\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n name: seed.name,\n code: seed.code,\n description: seed.description,\n isActive: true,\n createdAt: now,\n updatedAt: now,\n })\n em.persist(record)\n map.set(code, record)\n }\n return map\n}\n\nfunction buildAddressSnapshot(address: ExampleAddress) {\n return {\n companyName: address.companyName ?? null,\n name: address.name ?? null,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2 ?? null,\n city: address.city ?? null,\n region: address.region ?? null,\n postalCode: address.postalCode ?? null,\n country: address.country ?? null,\n latitude: address.latitude ?? null,\n longitude: address.longitude ?? null,\n }\n}\n\nfunction buildShippingMethodSnapshot(method?: SalesShippingMethod | null) {\n if (!method) return null\n return {\n id: method.id,\n code: method.code,\n name: method.name,\n providerKey: method.providerKey ?? null,\n serviceLevel: method.serviceLevel ?? null,\n estimatedTransitDays: method.estimatedTransitDays ?? null,\n baseRateNet: method.baseRateNet,\n baseRateGross: method.baseRateGross,\n currencyCode: method.currencyCode,\n metadata: method.metadata ?? null,\n }\n}\n\nfunction buildPaymentMethodSnapshot(method?: SalesPaymentMethod | null) {\n if (!method) return null\n return {\n id: method.id,\n code: method.code,\n name: method.name,\n providerKey: method.providerKey ?? null,\n terms: method.terms ?? null,\n metadata: method.metadata ?? null,\n }\n}\n\nfunction attachDocumentAddresses(\n em: EntityManager,\n scope: SeedScope,\n params: {\n documentId: string\n documentKind: 'order' | 'quote'\n addresses: ExampleAddress[]\n order?: SalesOrder\n quote?: SalesQuote\n }\n): void {\n const { documentId, documentKind, addresses, order, quote } = params\n for (const entry of addresses) {\n const now = new Date()\n const record = em.create(SalesDocumentAddress, {\n id: randomUUID(),\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n documentId,\n documentKind,\n customerAddressId: entry.customerAddressId ?? null,\n name: entry.name ?? null,\n companyName: entry.companyName ?? null,\n purpose: entry.role,\n addressLine1: entry.addressLine1,\n addressLine2: entry.addressLine2 ?? null,\n city: entry.city ?? null,\n region: entry.region ?? null,\n postalCode: entry.postalCode ?? null,\n country: entry.country ?? null,\n latitude: entry.latitude ?? null,\n longitude: entry.longitude ?? null,\n buildingNumber: null,\n flatNumber: null,\n order: documentKind === 'order' ? order ?? null : null,\n quote: documentKind === 'quote' ? quote ?? null : null,\n createdAt: now,\n updatedAt: now,\n })\n em.persist(record)\n }\n}\n\nfunction attachNotes(\n em: EntityManager,\n scope: SeedScope,\n params: {\n contextId: string\n contextType: 'order' | 'quote'\n notes: ExampleNote[]\n order?: SalesOrder\n quote?: SalesQuote\n }\n) {\n const { contextId, contextType, notes, order, quote } = params\n for (const note of notes) {\n const record = em.create(SalesNote, {\n id: randomUUID(),\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n contextType,\n contextId,\n body: note.body,\n appearanceIcon: note.appearanceIcon ?? null,\n appearanceColor: note.appearanceColor ?? null,\n createdAt: note.createdAt ?? new Date(),\n updatedAt: note.createdAt ?? new Date(),\n })\n record.order = contextType === 'order' ? order ?? null : null\n record.quote = contextType === 'quote' ? quote ?? null : null\n em.persist(record)\n }\n}\n\nfunction mapPaymentStatus(outstanding: number): string | null {\n if (outstanding <= 0.01) return 'paid'\n if (outstanding > 0) return 'partial'\n return null\n}\n\nexport async function seedSalesExamples(\n em: EntityManager,\n container: AppContainer,\n scope: SeedScope\n): Promise<boolean> {\n const hasOrders =\n ORDER_SEEDS.length > 0\n ? await em.count(SalesOrder, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n orderNumber: { $in: ORDER_SEEDS.map((item) => item.orderNumber) as any },\n })\n : 0\n const hasQuotes =\n QUOTE_SEEDS.length > 0\n ? await em.count(SalesQuote, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n quoteNumber: { $in: QUOTE_SEEDS.map((item) => item.quoteNumber) as any },\n })\n : 0\n\n if (hasOrders > 0 || hasQuotes > 0) {\n return false\n }\n\n await seedSalesDictionaries(em, scope)\n const [shippingMethods, paymentMethods, channels] = await Promise.all([\n ensureExampleShippingMethods(em, scope, { skipFlush: true }),\n ensureExamplePaymentMethods(em, scope, { skipFlush: true }),\n ensureChannels(em, scope),\n ])\n await em.flush()\n const catalogLookups = await loadCatalogLookups(em, scope)\n const customerLookups = await loadCustomerLookups(em, scope, [...CUSTOMER_LINKS])\n\n const calculationService = container.resolve<SalesCalculationService>('salesCalculationService')\n\n for (const seed of QUOTE_SEEDS) {\n const quoteId = randomUUID()\n const customer = seed.customerKey ? customerLookups.get(seed.customerKey) ?? null : null\n if (seed.customerKey && !customer) {\n logger.warn('sales.examples skipping quote because customer is missing', { quoteNumber: seed.quoteNumber, customerKey: seed.customerKey })\n continue\n }\n const shippingMethod = seed.shippingMethodCode\n ? shippingMethods.get(seed.shippingMethodCode.toLowerCase()) ?? null\n : null\n const paymentMethod = seed.paymentMethodCode\n ? paymentMethods.get(seed.paymentMethodCode.toLowerCase()) ?? null\n : null\n const channel = seed.channelCode ? channels.get(seed.channelCode.toLowerCase()) ?? null : null\n\n const lineSnapshots = seed.lines.map((line) => {\n const catalogRef = resolveCatalogLine(line, catalogLookups)\n if ((line.kind ?? 'product') === 'product' && !catalogRef.productId) {\n logger.warn('sales.examples missing catalog match for quote line', { line: line.name ?? line.variantSku ?? line.productHandle ?? 'unknown' })\n }\n const unitPriceNet = line.unitPriceNet ?? catalogRef.unitPriceNet ?? 0\n const unitPriceGross = line.unitPriceGross ?? catalogRef.unitPriceGross ?? unitPriceNet\n const currencyCode = catalogRef.currencyCode ?? seed.currencyCode\n const metadata: Record<string, unknown> = {}\n if (catalogRef.productThumbnail) metadata.productThumbnail = catalogRef.productThumbnail\n if (catalogRef.variantThumbnail) metadata.variantThumbnail = catalogRef.variantThumbnail\n return {\n id: randomUUID(),\n kind: line.kind ?? 'product',\n name: line.name,\n description: line.description ?? null,\n comment: line.comment ?? null,\n quantity: line.quantity,\n quantityUnit: line.quantityUnit ?? null,\n normalizedQuantity: line.quantity,\n normalizedUnit: line.quantityUnit ?? null,\n uomSnapshot: null,\n currencyCode,\n unitPriceNet,\n unitPriceGross,\n taxRate: line.taxRate ?? 0,\n discountPercent: line.discountPercent ?? null,\n productId: catalogRef.productId,\n productVariantId: catalogRef.variantId,\n catalogSnapshot: catalogRef.snapshot,\n metadata: Object.keys(metadata).length ? metadata : null,\n }\n })\n\n const adjustmentDrafts =\n seed.adjustments?.map((adj) => ({\n id: randomUUID(),\n scope: adj.scope,\n kind: adj.kind,\n code: adj.label ?? null,\n label: adj.label ?? null,\n rate: adj.rate ?? null,\n amountNet: adj.amountNet,\n amountGross: adj.amountGross ?? adj.amountNet,\n currencyCode: seed.currencyCode,\n position: adj.position ?? 0,\n metadata: adj.lineIndex !== undefined ? { lineIndex: adj.lineIndex } : null,\n })) ?? []\n\n const calculation = await calculationService.calculateDocumentTotals({\n documentKind: 'quote',\n lines: lineSnapshots,\n adjustments: adjustmentDrafts,\n context: {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n currencyCode: seed.currencyCode,\n },\n })\n\n const totals = calculation.totals\n const quoteNumber = seed.quoteNumber ?? `SQ-${quoteId.slice(0, 8).toUpperCase()}`\n const quote = em.create(SalesQuote, {\n id: quoteId,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n quoteNumber,\n status: seed.status ?? 'draft',\n customerEntityId: customer?.entity.id ?? null,\n customerContactId: customer?.contactId ?? null,\n customerSnapshot: customer?.snapshot ? toSnapshot(customer.snapshot) : null,\n currencyCode: seed.currencyCode,\n validFrom: seed.validFrom ?? null,\n validUntil: seed.validUntil ?? null,\n comments: seed.comments ?? null,\n shippingMethodId: shippingMethod?.id ?? null,\n shippingMethodCode: shippingMethod?.code ?? seed.shippingMethodCode ?? null,\n paymentMethodId: paymentMethod?.id ?? null,\n paymentMethodCode: paymentMethod?.code ?? seed.paymentMethodCode ?? null,\n channelId: channel?.id ?? null,\n shippingMethodSnapshot: buildShippingMethodSnapshot(shippingMethod),\n paymentMethodSnapshot: buildPaymentMethodSnapshot(paymentMethod),\n metadata: seed.metadata ?? { seed: 'sales.examples' },\n subtotalNetAmount: toAmount(totals.subtotalNetAmount),\n subtotalGrossAmount: toAmount(totals.subtotalGrossAmount),\n discountTotalAmount: toAmount(totals.discountTotalAmount),\n taxTotalAmount: toAmount(totals.taxTotalAmount),\n grandTotalNetAmount: toAmount(totals.grandTotalNetAmount),\n grandTotalGrossAmount: toAmount(totals.grandTotalGrossAmount),\n totalsSnapshot: toSnapshot(totals),\n lineItemCount: seed.lines.length,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(quote)\n\n calculation.lines.forEach((lineResult, idx) => {\n const source = lineSnapshots[idx]\n const line = em.create(SalesQuoteLine, {\n id: source.id,\n quote,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n lineNumber: idx + 1,\n kind: source.kind ?? 'product',\n name: source.name,\n description: source.description,\n comment: source.comment,\n quantity: toAmount(source.quantity),\n quantityUnit: source.quantityUnit ?? null,\n normalizedQuantity: toAmount(source.normalizedQuantity ?? source.quantity),\n normalizedUnit: source.normalizedUnit ?? source.quantityUnit ?? null,\n uomSnapshot:\n source.uomSnapshot && typeof source.uomSnapshot === 'object'\n ? (toSnapshot(source.uomSnapshot as Record<string, unknown>) as typeof source.uomSnapshot)\n : null,\n currencyCode: source.currencyCode,\n unitPriceNet: toAmount(source.unitPriceNet ?? 0),\n unitPriceGross: toAmount(source.unitPriceGross ?? source.unitPriceNet ?? 0),\n discountAmount: toAmount(lineResult.discountAmount),\n discountPercent:\n source.discountPercent !== null && source.discountPercent !== undefined\n ? toAmount(source.discountPercent)\n : '0',\n taxRate: toAmount(source.taxRate ?? 0),\n taxAmount: toAmount(lineResult.taxAmount),\n totalNetAmount: toAmount(lineResult.netAmount),\n totalGrossAmount: toAmount(lineResult.grossAmount),\n productId: source.productId ?? null,\n productVariantId: source.productVariantId ?? null,\n catalogSnapshot: source.catalogSnapshot ? toSnapshot(source.catalogSnapshot) : null,\n metadata: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(line)\n })\n\n calculation.adjustments.forEach((adj, idx) => {\n const adjMeta = adj.metadata && typeof adj.metadata === 'object' ? (adj.metadata as Record<string, unknown>) : null\n const lineIndex = adjMeta ? (adjMeta.lineIndex as number | null) : null\n const lineRef =\n typeof lineIndex === 'number' && lineIndex >= 0 && lineIndex < seed.lines.length\n ? lineSnapshots[lineIndex]?.id ?? null\n : null\n const adjustment = em.create(SalesQuoteAdjustment, {\n id: adj.id ?? randomUUID(),\n quote,\n quoteLine: lineRef ? (lineRef as unknown as SalesQuoteLine) : null,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n scope: adj.scope,\n kind: adj.kind,\n code: adj.code ?? adj.label ?? null,\n label: adj.label ?? adj.code ?? null,\n calculatorKey: adj.calculatorKey ?? null,\n promotionId: adj.promotionId ?? null,\n rate: adj.rate !== null && adj.rate !== undefined ? toAmount(adj.rate) : '0',\n amountNet: toAmount(adj.amountNet ?? 0),\n amountGross: toAmount(adj.amountGross ?? adj.amountNet ?? 0),\n currencyCode: adj.currencyCode ?? seed.currencyCode,\n metadata: adj.metadata ?? null,\n position: adj.position ?? idx,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(adjustment)\n })\n\n quote.subtotalNetAmount = toAmount(calculation.totals.subtotalNetAmount)\n quote.subtotalGrossAmount = toAmount(calculation.totals.subtotalGrossAmount)\n quote.discountTotalAmount = toAmount(calculation.totals.discountTotalAmount)\n quote.taxTotalAmount = toAmount(calculation.totals.taxTotalAmount)\n quote.grandTotalNetAmount = toAmount(calculation.totals.grandTotalNetAmount)\n quote.grandTotalGrossAmount = toAmount(calculation.totals.grandTotalGrossAmount)\n quote.totalsSnapshot = toSnapshot(calculation.totals)\n quote.lineItemCount = seed.lines.length\n\n const quoteAddresses = seed.addresses ?? customer?.addresses ?? []\n if (quoteAddresses.length) {\n attachDocumentAddresses(em, scope, {\n documentId: quoteId,\n documentKind: 'quote',\n addresses: quoteAddresses,\n quote,\n })\n const billing = quoteAddresses.find((a) => a.role === 'billing')\n const shipping = quoteAddresses.find((a) => a.role === 'shipping')\n quote.billingAddressId = billing?.customerAddressId ?? null\n quote.shippingAddressId = shipping?.customerAddressId ?? null\n quote.billingAddressSnapshot = billing ? buildAddressSnapshot(billing) : null\n quote.shippingAddressSnapshot = shipping ? buildAddressSnapshot(shipping) : null\n }\n if (seed.notes?.length) {\n attachNotes(em, scope, {\n contextId: quoteId,\n contextType: 'quote',\n notes: seed.notes,\n quote,\n })\n }\n }\n\n for (const seed of ORDER_SEEDS) {\n const orderId = randomUUID()\n const customer = seed.customerKey ? customerLookups.get(seed.customerKey) ?? null : null\n if (seed.customerKey && !customer) {\n logger.warn('sales.examples skipping order because customer is missing', { orderNumber: seed.orderNumber, customerKey: seed.customerKey })\n continue\n }\n const shippingMethod = seed.shippingMethodCode\n ? shippingMethods.get(seed.shippingMethodCode.toLowerCase()) ?? null\n : null\n const paymentMethod = seed.paymentMethodCode\n ? paymentMethods.get(seed.paymentMethodCode.toLowerCase()) ?? null\n : null\n const channel = seed.channelCode ? channels.get(seed.channelCode.toLowerCase()) ?? null : null\n\n const lineSnapshots = seed.lines.map((line) => {\n const catalogRef = resolveCatalogLine(line, catalogLookups)\n if ((line.kind ?? 'product') === 'product' && !catalogRef.productId) {\n logger.warn('sales.examples missing catalog match for order line', { line: line.name ?? line.variantSku ?? line.productHandle ?? 'unknown' })\n }\n const unitPriceNet = line.unitPriceNet ?? catalogRef.unitPriceNet ?? 0\n const unitPriceGross = line.unitPriceGross ?? catalogRef.unitPriceGross ?? unitPriceNet\n const currencyCode = catalogRef.currencyCode ?? seed.currencyCode\n const metadata: Record<string, unknown> = {}\n if (catalogRef.productThumbnail) metadata.productThumbnail = catalogRef.productThumbnail\n if (catalogRef.variantThumbnail) metadata.variantThumbnail = catalogRef.variantThumbnail\n return {\n id: randomUUID(),\n kind: line.kind ?? 'product',\n name: line.name,\n description: line.description ?? null,\n comment: line.comment ?? null,\n quantity: line.quantity,\n quantityUnit: line.quantityUnit ?? null,\n normalizedQuantity: line.quantity,\n normalizedUnit: line.quantityUnit ?? null,\n uomSnapshot: null,\n currencyCode,\n unitPriceNet,\n unitPriceGross,\n taxRate: line.taxRate ?? 0,\n discountPercent: line.discountPercent ?? null,\n productId: catalogRef.productId,\n productVariantId: catalogRef.variantId,\n catalogSnapshot: catalogRef.snapshot,\n metadata: Object.keys(metadata).length ? metadata : null,\n }\n })\n\n const adjustmentDrafts =\n seed.adjustments?.map((adj) => ({\n id: randomUUID(),\n scope: adj.scope,\n kind: adj.kind,\n code: adj.label ?? null,\n label: adj.label ?? null,\n rate: adj.rate ?? null,\n amountNet: adj.amountNet,\n amountGross: adj.amountGross ?? adj.amountNet,\n currencyCode: seed.currencyCode,\n position: adj.position ?? 0,\n metadata: adj.lineIndex !== undefined ? { lineIndex: adj.lineIndex } : null,\n })) ?? []\n\n const calculation = await calculationService.calculateDocumentTotals({\n documentKind: 'order',\n lines: lineSnapshots,\n adjustments: adjustmentDrafts,\n context: {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n currencyCode: seed.currencyCode,\n },\n })\n\n const totals = calculation.totals\n const order = em.create(SalesOrder, {\n id: orderId,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n orderNumber: seed.orderNumber,\n status: seed.status ?? 'confirmed',\n fulfillmentStatus: seed.fulfillmentStatus ?? null,\n paymentStatus: seed.paymentStatus ?? null,\n customerEntityId: customer?.entity.id ?? null,\n customerContactId: customer?.contactId ?? null,\n customerSnapshot: customer?.snapshot ? toSnapshot(customer.snapshot) : null,\n currencyCode: seed.currencyCode,\n placedAt: seed.placedAt ?? null,\n expectedDeliveryAt: seed.expectedDeliveryAt ?? null,\n comments: seed.comments ?? null,\n internalNotes: seed.internalNotes ?? null,\n shippingMethodId: shippingMethod?.id ?? null,\n shippingMethodCode: shippingMethod?.code ?? seed.shippingMethodCode ?? null,\n paymentMethodId: paymentMethod?.id ?? null,\n paymentMethodCode: paymentMethod?.code ?? seed.paymentMethodCode ?? null,\n channelId: channel?.id ?? null,\n shippingMethodSnapshot: buildShippingMethodSnapshot(shippingMethod),\n paymentMethodSnapshot: buildPaymentMethodSnapshot(paymentMethod),\n metadata: seed.metadata ?? { seed: 'sales.examples' },\n subtotalNetAmount: toAmount(totals.subtotalNetAmount),\n subtotalGrossAmount: toAmount(totals.subtotalGrossAmount),\n discountTotalAmount: toAmount(totals.discountTotalAmount),\n taxTotalAmount: toAmount(totals.taxTotalAmount),\n shippingNetAmount: toAmount(totals.shippingNetAmount ?? 0),\n shippingGrossAmount: toAmount(totals.shippingGrossAmount ?? 0),\n surchargeTotalAmount: toAmount(totals.surchargeTotalAmount ?? 0),\n grandTotalNetAmount: toAmount(totals.grandTotalNetAmount),\n grandTotalGrossAmount: toAmount(totals.grandTotalGrossAmount),\n paidTotalAmount: toAmount(totals.paidTotalAmount ?? 0),\n refundedTotalAmount: toAmount(totals.refundedTotalAmount ?? 0),\n outstandingAmount: toAmount(totals.outstandingAmount ?? totals.grandTotalGrossAmount),\n totalsSnapshot: toSnapshot(totals),\n lineItemCount: seed.lines.length,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(order)\n\n const lineEntities: SalesOrderLine[] = []\n calculation.lines.forEach((lineResult, idx) => {\n const source = lineSnapshots[idx]\n const entity = em.create(SalesOrderLine, {\n id: source.id,\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n lineNumber: idx + 1,\n kind: source.kind ?? 'product',\n name: source.name,\n description: source.description,\n comment: source.comment,\n quantity: toAmount(source.quantity),\n quantityUnit: source.quantityUnit ?? null,\n normalizedQuantity: toAmount(source.normalizedQuantity ?? source.quantity),\n normalizedUnit: source.normalizedUnit ?? source.quantityUnit ?? null,\n uomSnapshot:\n source.uomSnapshot && typeof source.uomSnapshot === 'object'\n ? (toSnapshot(source.uomSnapshot as Record<string, unknown>) as typeof source.uomSnapshot)\n : null,\n reservedQuantity: '0',\n fulfilledQuantity: '0',\n invoicedQuantity: '0',\n returnedQuantity: '0',\n currencyCode: source.currencyCode,\n unitPriceNet: toAmount(source.unitPriceNet ?? 0),\n unitPriceGross: toAmount(source.unitPriceGross ?? source.unitPriceNet ?? 0),\n discountAmount: toAmount(lineResult.discountAmount),\n discountPercent:\n source.discountPercent !== null && source.discountPercent !== undefined\n ? toAmount(source.discountPercent)\n : '0',\n taxRate: toAmount(source.taxRate ?? 0),\n taxAmount: toAmount(lineResult.taxAmount),\n totalNetAmount: toAmount(lineResult.netAmount),\n totalGrossAmount: toAmount(lineResult.grossAmount),\n productId: source.productId ?? null,\n productVariantId: source.productVariantId ?? null,\n catalogSnapshot: source.catalogSnapshot ? toSnapshot(source.catalogSnapshot) : null,\n metadata: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(entity)\n lineEntities.push(entity)\n })\n\n calculation.adjustments.forEach((adj, idx) => {\n const lineIndex = adj.metadata && typeof adj.metadata === 'object' ? (adj.metadata as any).lineIndex : null\n const lineRef =\n typeof lineIndex === 'number' && lineIndex >= 0 && lineIndex < seed.lines.length\n ? lineEntities[lineIndex] ?? null\n : null\n const adjustment = em.create(SalesOrderAdjustment, {\n id: adj.id ?? randomUUID(),\n order,\n orderLine: lineRef,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n scope: adj.scope,\n kind: adj.kind,\n code: adj.code ?? adj.label ?? null,\n label: adj.label ?? adj.code ?? null,\n calculatorKey: adj.calculatorKey ?? null,\n promotionId: adj.promotionId ?? null,\n rate: adj.rate !== null && adj.rate !== undefined ? toAmount(adj.rate) : '0',\n amountNet: toAmount(adj.amountNet ?? 0),\n amountGross: toAmount(adj.amountGross ?? adj.amountNet ?? 0),\n currencyCode: adj.currencyCode ?? seed.currencyCode,\n metadata: adj.metadata ?? null,\n position: adj.position ?? idx,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(adjustment)\n })\n\n order.subtotalNetAmount = toAmount(calculation.totals.subtotalNetAmount)\n order.subtotalGrossAmount = toAmount(calculation.totals.subtotalGrossAmount)\n order.discountTotalAmount = toAmount(calculation.totals.discountTotalAmount)\n order.taxTotalAmount = toAmount(calculation.totals.taxTotalAmount)\n order.shippingNetAmount = toAmount(calculation.totals.shippingNetAmount ?? 0)\n order.shippingGrossAmount = toAmount(calculation.totals.shippingGrossAmount ?? 0)\n order.surchargeTotalAmount = toAmount(calculation.totals.surchargeTotalAmount ?? 0)\n order.grandTotalNetAmount = toAmount(calculation.totals.grandTotalNetAmount)\n order.grandTotalGrossAmount = toAmount(calculation.totals.grandTotalGrossAmount)\n order.paidTotalAmount = toAmount(calculation.totals.paidTotalAmount ?? 0)\n order.refundedTotalAmount = toAmount(calculation.totals.refundedTotalAmount ?? 0)\n order.outstandingAmount = toAmount(calculation.totals.outstandingAmount ?? calculation.totals.grandTotalGrossAmount)\n order.totalsSnapshot = toSnapshot(calculation.totals)\n order.lineItemCount = seed.lines.length\n\n const lineMap = new Map(lineEntities.map((line) => [line.id, line]))\n if (seed.shipments?.length) {\n for (const shipmentSeed of seed.shipments) {\n const shipment = em.create(SalesShipment, {\n id: randomUUID(),\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n shipmentNumber: shipmentSeed.shipmentNumber ?? null,\n shippingMethodId: shipmentSeed.methodCode\n ? shippingMethods.get(shipmentSeed.methodCode.toLowerCase())?.id ?? null\n : null,\n status: shipmentSeed.status ?? null,\n carrierName: null,\n trackingNumbers: shipmentSeed.trackingNumbers ?? null,\n shippedAt: shipmentSeed.shippedAt ?? null,\n deliveredAt: shipmentSeed.deliveredAt ?? null,\n weightValue: shipmentSeed.weightKg ? toAmount(shipmentSeed.weightKg) : null,\n weightUnit: shipmentSeed.weightKg ? 'kg' : null,\n declaredValueNet: shipmentSeed.declaredValue ? toAmount(shipmentSeed.declaredValue) : null,\n declaredValueGross: shipmentSeed.declaredValue ? toAmount(shipmentSeed.declaredValue) : null,\n currencyCode: shipmentSeed.currencyCode ?? seed.currencyCode,\n notesText: shipmentSeed.notes ?? null,\n metadata: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(shipment)\n\n const shipmentItems: SalesShipmentItem[] = []\n for (const item of shipmentSeed.items) {\n const line = lineEntities[item.lineIndex]\n if (!line) continue\n line.fulfilledQuantity = toAmount(\n Number(line.fulfilledQuantity ?? '0') + Math.max(item.quantity, 0)\n )\n const shipmentItem = em.create(SalesShipmentItem, {\n id: randomUUID(),\n shipment,\n orderLine: line,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n quantity: toAmount(item.quantity),\n metadata: null,\n })\n shipmentItems.push(shipmentItem)\n em.persist(shipmentItem)\n }\n await refreshShipmentItemsSnapshot(em, shipment, { items: shipmentItems, lineMap })\n }\n }\n\n let paymentTotal = 0\n if (seed.payments?.length) {\n for (const paymentSeed of seed.payments) {\n paymentTotal += paymentSeed.amount\n const method = paymentSeed.methodCode\n ? paymentMethods.get(paymentSeed.methodCode.toLowerCase()) ?? null\n : paymentMethod\n const payment = em.create(SalesPayment, {\n id: randomUUID(),\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n paymentMethod: method ?? null,\n paymentReference: paymentSeed.reference ?? null,\n status: paymentSeed.status ?? null,\n amount: toAmount(paymentSeed.amount),\n currencyCode: paymentSeed.currencyCode,\n capturedAmount: toAmount(paymentSeed.capturedAt ? paymentSeed.amount : 0),\n refundedAmount: '0',\n receivedAt: paymentSeed.receivedAt ?? null,\n capturedAt: paymentSeed.capturedAt ?? null,\n metadata: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(payment)\n const allocation = em.create(SalesPaymentAllocation, {\n id: randomUUID(),\n payment,\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n amount: toAmount(paymentSeed.amount),\n currencyCode: paymentSeed.currencyCode,\n metadata: null,\n })\n em.persist(allocation)\n }\n }\n\n const orderAddresses = seed.addresses ?? customer?.addresses ?? []\n if (orderAddresses.length) {\n attachDocumentAddresses(em, scope, {\n documentId: orderId,\n documentKind: 'order',\n addresses: orderAddresses,\n order,\n })\n const billing = orderAddresses.find((a) => a.role === 'billing')\n const shipping = orderAddresses.find((a) => a.role === 'shipping')\n order.billingAddressId = billing?.customerAddressId ?? null\n order.shippingAddressId = shipping?.customerAddressId ?? null\n order.billingAddressSnapshot = billing ? buildAddressSnapshot(billing) : null\n order.shippingAddressSnapshot = shipping ? buildAddressSnapshot(shipping) : null\n }\n if (seed.notes?.length) {\n attachNotes(em, scope, {\n contextId: orderId,\n contextType: 'order',\n notes: seed.notes,\n order,\n })\n }\n\n const grandTotal = Number(order.grandTotalGrossAmount ?? '0')\n order.paidTotalAmount = toAmount(paymentTotal)\n order.outstandingAmount = toAmount(Math.max(grandTotal - paymentTotal, 0))\n order.paymentStatus = seed.paymentStatus ?? mapPaymentStatus(grandTotal - paymentTotal)\n const isFullyFulfilled = lineEntities.every((line, idx) => {\n const expected = Number(seed.lines[idx]?.quantity ?? 0)\n const fulfilled = Number(line.fulfilledQuantity ?? '0')\n return fulfilled >= expected\n })\n order.fulfillmentStatus = seed.fulfillmentStatus ?? (isFullyFulfilled ? 'fulfilled' : 'in_fulfillment')\n }\n\n await em.flush()\n return true\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAG3B;AAAA,EACE;AAAA,EACA;AAAA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,WAAW,eAAe,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AACjE,YAAM,mBAAmB,SAAS,qBAAqB;AACvD,YAAM,oBAAoB,UAAU,qBAAqB;AACzD,YAAM,yBAAyB,UAAU,qBAAqB,OAAO,IAAI;AACzE,YAAM,0BAA0B,WAAW,qBAAqB,QAAQ,IAAI;AAAA,IAC9E;AACA,QAAI,KAAK,OAAO,QAAQ;AACtB,kBAAY,IAAI,OAAO;AAAA,QACrB,WAAW;AAAA,QACX,aAAa;AAAA,QACb,OAAO,KAAK;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACH;AAEA,UAAM,aAAa,OAAO,MAAM,yBAAyB,GAAG;AAC5D,UAAM,kBAAkB,SAAS,YAAY;AAC7C,UAAM,oBAAoB,SAAS,KAAK,IAAI,aAAa,cAAc,CAAC,CAAC;AACzE,UAAM,gBAAgB,KAAK,iBAAiB,iBAAiB,aAAa,YAAY;AACtF,UAAM,mBAAmB,aAAa,MAAM,CAAC,MAAM,QAAQ;AACzD,YAAM,WAAW,OAAO,KAAK,MAAM,GAAG,GAAG,YAAY,CAAC;AACtD,YAAM,YAAY,OAAO,KAAK,qBAAqB,GAAG;AACtD,aAAO,aAAa;AAAA,IACtB,CAAC;AACD,UAAM,oBAAoB,KAAK,sBAAsB,mBAAmB,cAAc;AAAA,EACxF;AAEA,QAAM,GAAG,MAAM;AACf,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import { randomUUID } from 'crypto'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { AppContainer } from '@open-mercato/shared/lib/di/container'\nimport {\n SalesOrder,\n SalesOrderLine,\n SalesOrderAdjustment,\n SalesQuote,\n SalesQuoteLine,\n SalesQuoteAdjustment,\n SalesShipment,\n SalesShipmentItem,\n SalesPayment,\n SalesPaymentAllocation,\n SalesDocumentAddress,\n SalesNote,\n SalesChannel,\n SalesPaymentMethod,\n SalesShippingMethod,\n type SalesAdjustmentKind,\n type SalesLineKind,\n} from '../data/entities'\nimport { seedSalesDictionaries } from '../lib/dictionaries'\nimport { refreshShipmentItemsSnapshot } from '../lib/shipments/snapshots'\nimport { toNumericString } from '../commands/shared'\nimport type { SalesCalculationService } from '../services/salesCalculationService'\nimport { ensureExamplePaymentMethods, ensureExampleShippingMethods, type SeedScope } from './examples-data'\nimport {\n CatalogProduct,\n CatalogProductPrice,\n CatalogProductVariant,\n} from '@open-mercato/core/modules/catalog/data/entities'\nimport {\n CustomerAddress,\n CustomerEntity,\n CustomerPersonProfile,\n} from '@open-mercato/core/modules/customers/data/entities'\nimport { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('sales')\n\ntype ExampleAddress = {\n role: 'billing' | 'shipping'\n companyName?: string | null\n name?: string | null\n addressLine1: string\n addressLine2?: string | null\n city?: string | null\n region?: string | null\n postalCode?: string | null\n country?: string | null\n latitude?: number | null\n longitude?: number | null\n customerAddressId?: string | null\n}\n\ntype ExampleLine = {\n kind?: SalesLineKind\n name: string\n description?: string\n quantity: number\n unitPriceNet: number\n unitPriceGross?: number\n taxRate?: number\n discountPercent?: number\n quantityUnit?: string\n comment?: string\n productHandle?: string\n variantSku?: string\n custom?: boolean\n}\n\ntype ExampleAdjustment = {\n scope: 'order' | 'line'\n kind: SalesAdjustmentKind\n label?: string\n amountNet: number\n amountGross?: number\n rate?: number\n lineIndex?: number\n position?: number\n}\n\ntype ExampleNote = {\n body: string\n createdAt?: Date\n appearanceIcon?: string | null\n appearanceColor?: string | null\n}\n\ntype ExampleShipment = {\n shipmentNumber?: string\n methodCode?: string\n status?: string\n shippedAt?: Date\n deliveredAt?: Date\n trackingNumbers?: string[]\n weightKg?: number\n declaredValue?: number\n currencyCode?: string\n notes?: string\n items: Array<{ lineIndex: number; quantity: number }>\n}\n\ntype ExamplePayment = {\n reference?: string\n methodCode?: string\n status?: string\n amount: number\n currencyCode: string\n receivedAt?: Date\n capturedAt?: Date\n}\n\ntype ExampleQuote = {\n quoteNumber: string\n status?: string\n comments?: string\n validFrom?: Date\n validUntil?: Date\n currencyCode: string\n shippingMethodCode?: string\n paymentMethodCode?: string\n addresses?: ExampleAddress[]\n lines: ExampleLine[]\n adjustments?: ExampleAdjustment[]\n notes?: ExampleNote[]\n metadata?: Record<string, unknown>\n channelCode?: string\n customerKey?: string\n}\n\ntype ExampleOrder = {\n orderNumber: string\n status?: string\n fulfillmentStatus?: string\n paymentStatus?: string\n comments?: string\n internalNotes?: string\n placedAt?: Date\n expectedDeliveryAt?: Date\n currencyCode: string\n shippingMethodCode?: string\n paymentMethodCode?: string\n channelCode?: string\n addresses?: ExampleAddress[]\n lines: ExampleLine[]\n adjustments?: ExampleAdjustment[]\n notes?: ExampleNote[]\n shipments?: ExampleShipment[]\n payments?: ExamplePayment[]\n metadata?: Record<string, unknown>\n customerKey?: string\n}\n\nconst CHANNEL_SEEDS = [\n { code: 'online', name: 'Online Store', description: 'Orders captured from the storefront.' },\n {\n code: 'field-sales',\n name: 'Field Sales',\n description: 'Quotes negotiated by the sales team and converted offline.',\n },\n] as const\n\nconst CUSTOMER_LINKS: CustomerLookup[] = [\n { key: 'brightside', displayName: 'Brightside Solar' },\n { key: 'harborview', displayName: 'Harborview Analytics' },\n { key: 'copperleaf', displayName: 'Copperleaf Design Co.' },\n] as const\n\nconst QUOTE_SEEDS: ExampleQuote[] = [\n {\n quoteNumber: 'SQ-DEMO-1001',\n status: 'draft',\n comments: 'Pricing reflects bundled onboarding; valid for 30 days.',\n validFrom: daysFromNow(-2),\n validUntil: daysFromNow(28),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n lines: [\n {\n name: 'Remote onboarding package',\n custom: true,\n description: 'Kick-off, workflow design, and training for distributed teams.',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 10,\n },\n {\n name: 'Implementation workshop (4h)',\n custom: true,\n description: 'Hands-on configuration session with stakeholders.',\n quantity: 1,\n unitPriceNet: 320,\n taxRate: 0,\n comment: 'Can be split into two shorter sessions on request.',\n },\n ],\n adjustments: [\n { scope: 'order', kind: 'discount', label: 'Pilot discount', amountNet: 45, position: 1 },\n {\n scope: 'order',\n kind: 'shipping',\n label: 'Expedited shipping',\n amountNet: 25,\n amountGross: 27.5,\n position: 2,\n },\n ],\n addresses: [\n {\n role: 'billing',\n companyName: 'Northwind Ventures',\n name: 'Nora Winters',\n addressLine1: '200 Pine St',\n addressLine2: 'Suite 900',\n city: 'Seattle',\n region: 'WA',\n postalCode: '98101',\n country: 'US',\n },\n {\n role: 'shipping',\n companyName: 'Northwind Ventures',\n name: 'Receiving Dock',\n addressLine1: '4124 4th Ave S',\n city: 'Seattle',\n region: 'WA',\n postalCode: '98134',\n country: 'US',\n },\n ],\n notes: [\n {\n body: 'Requested weekend training option if schedules slip.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:calendar-clock',\n appearanceColor: '#0ea5e9',\n },\n {\n body: 'Prefers invoicing after acceptance instead of deposit.',\n createdAt: daysFromNow(0),\n appearanceIcon: 'lucide:receipt',\n appearanceColor: '#f97316',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n quoteNumber: 'SQ-DEMO-1002',\n status: 'draft',\n comments: 'Footwear replenishment and event outfits pulled from catalog offers.',\n validFrom: daysFromNow(-1),\n validUntil: daysFromNow(21),\n currencyCode: 'USD',\n shippingMethodCode: 'standard-ground',\n paymentMethodCode: 'card',\n channelCode: 'online',\n customerKey: 'brightside',\n lines: [\n {\n name: 'Atlas Runner Sneaker',\n quantity: 3,\n unitPriceNet: 120,\n taxRate: 10,\n variantSku: 'ATLAS-RUN-NAVY-8',\n },\n {\n name: 'Aurora Wrap Dress',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 10,\n variantSku: 'AURORA-ROSE-M',\n discountPercent: 5,\n },\n ],\n adjustments: [\n { scope: 'order', kind: 'discount', label: 'Preferred customer', amountNet: 35, position: 1 },\n ],\n notes: [\n {\n body: 'Requested quick turn on delivery dates for press shoot.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:camera',\n appearanceColor: '#0ea5e9',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n quoteNumber: 'SQ-DEMO-1003',\n status: 'sent',\n comments: 'Bundle of apparel and on-site styling block for the studio launch.',\n validFrom: daysFromNow(-3),\n validUntil: daysFromNow(10),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n customerKey: 'copperleaf',\n lines: [\n {\n name: 'Aurora Wrap Dress',\n quantity: 2,\n unitPriceNet: 180,\n taxRate: 10,\n variantSku: 'AURORA-CELESTIAL-L',\n comment: 'Alternate colorway accepted if Celestial runs out.',\n },\n {\n name: 'Signature Haircut & Finish',\n quantity: 4,\n unitPriceNet: 95,\n taxRate: 0,\n variantSku: 'SERV-HAIR-60-SENIOR',\n quantityUnit: 'hour',\n comment: 'Styling sessions during opening week.',\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'discount',\n label: 'Launch partner credit',\n amountNet: 60,\n position: 1,\n },\n ],\n notes: [\n {\n body: 'Prefers consolidated invoicing after the event.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:file-text',\n appearanceColor: '#f97316',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n]\n\nconst ORDER_SEEDS: ExampleOrder[] = [\n {\n orderNumber: 'SO-DEMO-2001',\n status: 'confirmed',\n fulfillmentStatus: 'in_fulfillment',\n comments: 'White-glove delivery requested for the larger items.',\n internalNotes: 'Coordinate with facilities for access badges.',\n placedAt: daysFromNow(-3),\n expectedDeliveryAt: daysFromNow(4),\n currencyCode: 'USD',\n shippingMethodCode: 'standard-ground',\n paymentMethodCode: 'card',\n channelCode: 'online',\n lines: [\n {\n name: 'Modular desk system',\n custom: true,\n quantity: 1,\n unitPriceNet: 640,\n taxRate: 10,\n description: 'Corner configuration with cable routing.',\n },\n {\n name: 'Acoustic panel set',\n custom: true,\n quantity: 3,\n unitPriceNet: 85,\n taxRate: 10,\n description: 'Charcoal grey finish, adhesive mount.',\n discountPercent: 5,\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'shipping',\n label: 'White-glove delivery',\n amountNet: 60,\n amountGross: 66,\n position: 1,\n },\n { scope: 'order', kind: 'discount', label: 'New office promo', amountNet: 75, position: 2 },\n {\n scope: 'order',\n kind: 'surcharge',\n label: 'After-hours install',\n amountNet: 35,\n amountGross: 38.5,\n position: 3,\n },\n ],\n shipments: [\n {\n shipmentNumber: 'SHIP-2001-1',\n methodCode: 'standard-ground',\n status: 'shipped',\n shippedAt: daysFromNow(-1),\n trackingNumbers: ['1Z-234-ACOUSTICS'],\n weightKg: 38,\n declaredValue: 720,\n currencyCode: 'USD',\n notes: 'Panels shipped separately to avoid freight delay.',\n items: [\n { lineIndex: 1, quantity: 2 },\n ],\n },\n {\n shipmentNumber: 'SHIP-2001-2',\n methodCode: 'express-air',\n status: 'in_transit',\n shippedAt: daysFromNow(0),\n trackingNumbers: ['1Z-987-DESK'],\n weightKg: 72,\n declaredValue: 560,\n currencyCode: 'USD',\n notes: 'Desk ships via express due to size.',\n items: [{ lineIndex: 0, quantity: 1 }],\n },\n ],\n payments: [\n {\n reference: 'AUTH-2001-CC',\n methodCode: 'card',\n status: 'captured',\n amount: 600,\n currencyCode: 'USD',\n receivedAt: daysFromNow(-2),\n capturedAt: daysFromNow(-1),\n },\n {\n reference: 'WIRE-2001',\n methodCode: 'bank-transfer',\n status: 'received',\n amount: 414,\n currencyCode: 'USD',\n receivedAt: daysFromNow(1),\n },\n ],\n addresses: [\n {\n role: 'billing',\n companyName: 'Harborview Analytics',\n name: 'Accounts Payable',\n addressLine1: '355 Atlantic Ave Floor 6',\n city: 'Boston',\n region: 'MA',\n postalCode: '02210',\n country: 'US',\n },\n {\n role: 'shipping',\n companyName: 'Harborview Analytics',\n name: 'Loading Dock',\n addressLine1: '9 Drydock Ave',\n city: 'Boston',\n region: 'MA',\n postalCode: '02210',\n country: 'US',\n },\n ],\n notes: [\n {\n body: 'Facilities requested 2-hour delivery window notice.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:bell-ring',\n appearanceColor: '#0ea5e9',\n },\n {\n body: 'Panels can be staged in conference room A.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:warehouse',\n appearanceColor: '#22c55e',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n orderNumber: 'SO-DEMO-2002',\n status: 'confirmed',\n fulfillmentStatus: 'fulfilled',\n paymentStatus: 'partial',\n comments: 'Subscription setup aligns with fiscal Q3 start.',\n placedAt: daysFromNow(-6),\n expectedDeliveryAt: daysFromNow(1),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n lines: [\n {\n name: 'On-site enablement',\n custom: true,\n quantity: 1,\n unitPriceNet: 280,\n taxRate: 0,\n description: 'Day of workshops across two teams.',\n },\n {\n name: 'Support retainer (Q3)',\n custom: true,\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 0,\n description: 'Response SLA with named TAM.',\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'shipping',\n label: 'Travel & lodging',\n amountNet: 20,\n amountGross: 22,\n position: 1,\n },\n {\n scope: 'order',\n kind: 'discount',\n label: 'Multi-team starter',\n amountNet: 25,\n position: 2,\n },\n ],\n shipments: [\n {\n shipmentNumber: 'SHIP-2002-1',\n methodCode: 'express-air',\n status: 'delivered',\n shippedAt: daysFromNow(-4),\n deliveredAt: daysFromNow(-2),\n trackingNumbers: ['AIR-22002-KIT'],\n declaredValue: 150,\n currencyCode: 'USD',\n notes: 'Enablement kit delivered to training room.',\n items: [\n { lineIndex: 0, quantity: 1 },\n { lineIndex: 1, quantity: 1 },\n ],\n },\n ],\n payments: [\n {\n reference: 'WIRE-2002',\n methodCode: 'bank-transfer',\n status: 'received',\n amount: 250,\n currencyCode: 'USD',\n receivedAt: daysFromNow(-1),\n },\n ],\n addresses: [\n {\n role: 'billing',\n companyName: 'Brightside Solar',\n name: 'Finance',\n addressLine1: '245 Market St Suite 400',\n city: 'San Francisco',\n region: 'CA',\n postalCode: '94105',\n country: 'US',\n },\n {\n role: 'shipping',\n companyName: 'Brightside Solar',\n name: 'Training Room B',\n addressLine1: '245 Market St Suite 410',\n city: 'San Francisco',\n region: 'CA',\n postalCode: '94105',\n country: 'US',\n },\n ],\n notes: [\n {\n body: 'TAM onboarding scheduled next Tuesday.',\n createdAt: daysFromNow(-3),\n appearanceIcon: 'lucide:users',\n appearanceColor: '#a855f7',\n },\n {\n body: 'Retainer renewal review in mid-Q4.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:clock-3',\n appearanceColor: '#f97316',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n orderNumber: 'SO-DEMO-2003',\n status: 'confirmed',\n fulfillmentStatus: 'in_fulfillment',\n paymentStatus: 'partial',\n comments: 'Equipment refresh for analytics field team with matching footwear.',\n internalNotes: 'Coordinate delivery around team offsite schedule.',\n placedAt: daysFromNow(-2),\n expectedDeliveryAt: daysFromNow(5),\n currencyCode: 'USD',\n shippingMethodCode: 'standard-ground',\n paymentMethodCode: 'card',\n channelCode: 'online',\n customerKey: 'harborview',\n lines: [\n {\n name: 'Atlas Runner Sneaker',\n quantity: 4,\n unitPriceNet: 120,\n taxRate: 10,\n variantSku: 'ATLAS-RUN-GLACIER-10',\n comment: 'Size mix handled via catalog variants.',\n },\n {\n name: 'Aurora Wrap Dress',\n quantity: 1,\n unitPriceNet: 180,\n taxRate: 10,\n variantSku: 'AURORA-ROSE-M',\n discountPercent: 10,\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'shipping',\n label: 'Ground shipping',\n amountNet: 25,\n amountGross: 27.5,\n position: 1,\n },\n ],\n shipments: [\n {\n shipmentNumber: 'SHIP-2003-1',\n methodCode: 'standard-ground',\n status: 'pending',\n shippedAt: undefined,\n trackingNumbers: [],\n weightKg: 12,\n declaredValue: 0,\n currencyCode: 'USD',\n notes: 'Bundle footwear and apparel together.',\n items: [\n { lineIndex: 0, quantity: 4 },\n { lineIndex: 1, quantity: 1 },\n ],\n },\n ],\n payments: [\n {\n reference: 'CARD-2003',\n methodCode: 'card',\n status: 'authorized',\n amount: 300,\n currencyCode: 'USD',\n receivedAt: daysFromNow(-1),\n },\n ],\n notes: [\n {\n body: 'Leadership wants tracking shared in Slack channel.',\n createdAt: daysFromNow(-1),\n appearanceIcon: 'lucide:message-circle',\n appearanceColor: '#22c55e',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n {\n orderNumber: 'SO-DEMO-2004',\n status: 'confirmed',\n fulfillmentStatus: 'pending',\n paymentStatus: 'unpaid',\n comments: 'On-site styling block for studio launch week.',\n placedAt: daysFromNow(-4),\n expectedDeliveryAt: daysFromNow(1),\n currencyCode: 'USD',\n shippingMethodCode: 'express-air',\n paymentMethodCode: 'bank-transfer',\n channelCode: 'field-sales',\n customerKey: 'copperleaf',\n lines: [\n {\n name: 'Signature Haircut & Finish',\n quantity: 6,\n unitPriceNet: 95,\n taxRate: 0,\n variantSku: 'SERV-HAIR-60-SENIOR',\n quantityUnit: 'hour',\n comment: 'Block book stylists for staggered sessions.',\n },\n ],\n adjustments: [\n {\n scope: 'order',\n kind: 'discount',\n label: 'Launch week courtesy',\n amountNet: 45,\n position: 1,\n },\n ],\n payments: [\n {\n reference: 'WIRE-2004',\n methodCode: 'bank-transfer',\n status: 'pending',\n amount: 0,\n currencyCode: 'USD',\n },\n ],\n notes: [\n {\n body: 'Confirm stylist roster by Friday.',\n createdAt: daysFromNow(-2),\n appearanceIcon: 'lucide:check-circle',\n appearanceColor: '#0ea5e9',\n },\n ],\n metadata: { seed: 'sales.examples' },\n },\n]\n\nfunction daysFromNow(offset: number): Date {\n const now = new Date()\n const copy = new Date(now)\n copy.setUTCDate(now.getUTCDate() + offset)\n return copy\n}\n\nfunction toAmount(value: number | null | undefined): string {\n if (value === null || value === undefined || Number.isNaN(value)) return '0'\n return toNumericString(Math.round((value + Number.EPSILON) * 10000) / 10000) ?? '0'\n}\n\nfunction toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n\nfunction normalizeKey(value: string | null | undefined): string {\n return (value ?? '').trim().toLowerCase()\n}\n\nfunction asNumber(value: unknown): number {\n if (typeof value === 'number') return value\n if (typeof value === 'string') {\n const parsed = Number(value)\n return Number.isFinite(parsed) ? parsed : 0\n }\n return 0\n}\n\ntype CatalogLookup = {\n productsByHandle: Map<string, CatalogProduct>\n variantsBySku: Map<string, CatalogProductVariant>\n variantPrices: Map<string, { net: number; gross: number; currency: string }>\n}\n\nasync function loadCatalogLookups(em: EntityManager, scope: SeedScope): Promise<CatalogLookup> {\n const [products, variants, prices] = await Promise.all([\n em.find(CatalogProduct, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n }),\n em.find(\n CatalogProductVariant,\n { organizationId: scope.organizationId, tenantId: scope.tenantId, deletedAt: null },\n { populate: ['product'] }\n ),\n em.find(CatalogProductPrice, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n }),\n ])\n\n const productsByHandle = new Map<string, CatalogProduct>()\n products.forEach((product) => {\n const key = normalizeKey(product.handle ?? product.sku ?? product.title)\n if (key) productsByHandle.set(key, product)\n })\n\n const variantsBySku = new Map<string, CatalogProductVariant>()\n variants.forEach((variant) => {\n const key = normalizeKey(variant.sku)\n if (key) variantsBySku.set(key, variant)\n })\n\n const variantPrices = new Map<string, { net: number; gross: number; currency: string }>()\n for (const price of prices) {\n const variantId =\n typeof price.variant === 'string' ? price.variant : price.variant?.id ?? (price as any)?.variant_id ?? null\n if (!variantId) continue\n const gross = asNumber((price as any).unitPriceGross ?? price.unitPriceGross)\n const net = asNumber((price as any).unitPriceNet ?? price.unitPriceNet ?? gross)\n const currency = typeof price.currencyCode === 'string' ? price.currencyCode : 'USD'\n const isSale = normalizeKey((price as any).kind) === 'sale' || normalizeKey((price as any)?.priceKind?.code) === 'sale'\n const existing = variantPrices.get(variantId)\n if (!existing || isSale) {\n variantPrices.set(variantId, { net, gross, currency })\n }\n }\n\n return { productsByHandle, variantsBySku, variantPrices }\n}\n\nfunction buildCatalogSnapshot(\n product: CatalogProduct | null,\n variant: CatalogProductVariant | null,\n price: { net: number; gross: number; currency: string } | null\n): Record<string, unknown> | null {\n if (!product) return null\n const productThumbnail =\n (product as any).defaultMediaUrl ??\n (product as any).thumbnailUrl ??\n (product.metadata && typeof product.metadata === 'object'\n ? ((product.metadata as any).thumbnailUrl as string | null | undefined)\n : null) ??\n null\n const variantThumbnail =\n variant && variant.metadata && typeof variant.metadata === 'object'\n ? ((variant.metadata as any).thumbnailUrl as string | null | undefined) ?? null\n : null\n return {\n product: {\n id: product.id,\n title: product.title,\n handle: product.handle ?? null,\n sku: product.sku ?? null,\n thumbnailUrl: productThumbnail,\n },\n variant: variant\n ? {\n id: variant.id,\n name: variant.name ?? product.title,\n sku: variant.sku ?? null,\n optionValues: variant.optionValues ?? null,\n thumbnailUrl: variantThumbnail,\n }\n : null,\n price: price\n ? {\n currencyCode: price.currency,\n unitPriceNet: price.net,\n unitPriceGross: price.gross,\n }\n : null,\n }\n}\n\nconst CUSTOM_LINE_METADATA = { customLine: true, lineMode: 'custom' } as const\n\nexport function isMissingCatalogMatch(\n line: Pick<ExampleLine, 'kind' | 'custom'>,\n catalogRef: { productId: string | null }\n): boolean {\n if (line.custom) return false\n if ((line.kind ?? 'product') !== 'product') return false\n return !catalogRef.productId\n}\n\nexport function listExampleCatalogReferences(): Array<{ document: string; line: string; variantSku?: string; productHandle?: string; custom: boolean }> {\n const collect = (document: string, lines: ExampleLine[]) =>\n lines.map((line) => ({\n document,\n line: line.name,\n variantSku: line.variantSku,\n productHandle: line.productHandle,\n custom: line.custom === true,\n }))\n return [\n ...QUOTE_SEEDS.flatMap((seed) => collect(seed.quoteNumber, seed.lines)),\n ...ORDER_SEEDS.flatMap((seed) => collect(seed.orderNumber, seed.lines)),\n ]\n}\n\nfunction resolveCatalogLine(\n line: ExampleLine,\n catalog: CatalogLookup\n): {\n productId: string | null\n variantId: string | null\n unitPriceNet: number | null\n unitPriceGross: number | null\n currencyCode: string | null\n snapshot: Record<string, unknown> | null\n productThumbnail: string | null\n variantThumbnail: string | null\n} {\n const variant =\n line.variantSku && catalog.variantsBySku.size\n ? catalog.variantsBySku.get(normalizeKey(line.variantSku))\n : null\n const product =\n variant?.product ??\n (line.productHandle ? catalog.productsByHandle.get(normalizeKey(line.productHandle)) ?? null : null)\n const price = variant ? catalog.variantPrices.get(variant.id) ?? null : null\n const snapshot = buildCatalogSnapshot(product ?? null, variant ?? null, price ?? null)\n const productThumbnail =\n (snapshot as any)?.product?.thumbnailUrl ??\n (product as any)?.defaultMediaUrl ??\n (product as any)?.thumbnailUrl ??\n null\n const variantThumbnail = (snapshot as any)?.variant?.thumbnailUrl ?? null\n return {\n productId: product ? product.id : null,\n variantId: variant ? variant.id : null,\n unitPriceNet: price?.net ?? null,\n unitPriceGross: price?.gross ?? null,\n currencyCode: price?.currency ?? null,\n snapshot,\n productThumbnail: productThumbnail ?? null,\n variantThumbnail: variantThumbnail ?? null,\n }\n}\n\ntype CustomerLookup = {\n key: string\n displayName: string\n}\n\ntype CustomerLookupSpec = CustomerLookup & { normalizedName: string }\n\ntype CustomerContext = {\n entity: CustomerEntity\n contact: CustomerPersonProfile | null\n contactId: string | null\n snapshot: Record<string, unknown> | null\n addresses: ExampleAddress[]\n}\n\nfunction buildCustomerSnapshot(\n entity: CustomerEntity,\n contact: CustomerPersonProfile | null\n): Record<string, unknown> | null {\n const base = {\n id: entity.id,\n kind: entity.kind,\n displayName: entity.displayName,\n primaryEmail: entity.primaryEmail ?? null,\n primaryPhone: entity.primaryPhone ?? null,\n personProfile: entity.personProfile\n ? {\n id: entity.personProfile.id,\n firstName: entity.personProfile.firstName ?? null,\n lastName: entity.personProfile.lastName ?? null,\n preferredName: entity.personProfile.preferredName ?? null,\n jobTitle: entity.personProfile.jobTitle ?? null,\n department: entity.personProfile.department ?? null,\n seniority: entity.personProfile.seniority ?? null,\n timezone: entity.personProfile.timezone ?? null,\n }\n : null,\n companyProfile: entity.companyProfile\n ? {\n id: entity.companyProfile.id,\n legalName: entity.companyProfile.legalName ?? null,\n brandName: entity.companyProfile.brandName ?? null,\n domain: entity.companyProfile.domain ?? null,\n websiteUrl: entity.companyProfile.websiteUrl ?? null,\n }\n : null,\n }\n const contactSnapshot = contact\n ? {\n id: contact.id,\n firstName: contact.firstName ?? null,\n lastName: contact.lastName ?? null,\n email: contact.entity?.primaryEmail ?? null,\n phone: contact.entity?.primaryPhone ?? null,\n companyId: contact.company ? (typeof contact.company === 'string' ? contact.company : contact.company.id) : null,\n }\n : null\n return { customer: base, contact: contactSnapshot }\n}\n\nfunction toExampleAddresses(customer: CustomerEntity, address: CustomerAddress | null): ExampleAddress[] {\n if (!address) return []\n const base = {\n companyName: address.companyName ?? customer.displayName ?? null,\n name: address.name ?? address.companyName ?? customer.displayName ?? null,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2 ?? null,\n city: address.city ?? null,\n region: address.region ?? null,\n postalCode: address.postalCode ?? null,\n country: address.country ?? null,\n latitude: address.latitude ?? null,\n longitude: address.longitude ?? null,\n customerAddressId: address.id,\n }\n return [\n { role: 'billing', ...base },\n { role: 'shipping', ...base },\n ]\n}\n\nasync function loadCustomerLookups(\n em: EntityManager,\n scope: SeedScope,\n lookups: CustomerLookup[]\n): Promise<Map<string, CustomerContext>> {\n const map = new Map<string, CustomerContext>()\n if (lookups.length === 0) return map\n const lookupSpecs: CustomerLookupSpec[] = lookups.map((lookup) => ({\n ...lookup,\n normalizedName: normalizeKey(lookup.displayName),\n }))\n const unresolved = new Map<string, CustomerLookupSpec>()\n for (const spec of lookupSpecs) {\n unresolved.set(spec.key, spec)\n }\n\n const customers = await findWithDecryption(\n em,\n CustomerEntity,\n {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n },\n { populate: ['personProfile', 'companyProfile'] },\n { tenantId: scope.tenantId, organizationId: scope.organizationId }\n )\n\n const doesMatch = (candidate: string, spec: CustomerLookupSpec): boolean => {\n if (!candidate) return false\n return (\n candidate === spec.normalizedName ||\n candidate.includes(spec.normalizedName) ||\n spec.normalizedName.includes(candidate)\n )\n }\n\n const matchedPairs: Array<{ spec: CustomerLookupSpec; customer: CustomerEntity }> = []\n\n for (const customer of customers) {\n if (unresolved.size === 0) break\n const tokens = new Set<string>()\n tokens.add(normalizeKey(customer.displayName))\n if (customer.companyProfile) {\n tokens.add(normalizeKey(customer.companyProfile.legalName ?? ''))\n tokens.add(normalizeKey(customer.companyProfile.brandName ?? ''))\n tokens.add(normalizeKey(customer.companyProfile.domain ?? ''))\n }\n if (customer.personProfile) {\n tokens.add(normalizeKey(customer.personProfile.firstName ?? ''))\n tokens.add(normalizeKey(customer.personProfile.lastName ?? ''))\n const fullName = [customer.personProfile.firstName, customer.personProfile.lastName]\n .filter((part) => (part ?? '').trim().length > 0)\n .join(' ')\n tokens.add(normalizeKey(fullName))\n }\n\n const matchedSpec = lookupSpecs.find(\n (spec) => unresolved.has(spec.key) && Array.from(tokens).some((token) => doesMatch(token, spec))\n )\n if (!matchedSpec) continue\n matchedPairs.push({ spec: matchedSpec, customer })\n unresolved.delete(matchedSpec.key)\n }\n\n const matchIds = matchedPairs.map(({ customer }) => customer.id)\n\n const addresses = matchIds.length\n ? await findWithDecryption(\n em,\n CustomerAddress,\n { organizationId: scope.organizationId, tenantId: scope.tenantId, entity: { $in: matchIds } },\n { orderBy: { isPrimary: 'desc', createdAt: 'asc' } as any },\n { tenantId: scope.tenantId, organizationId: scope.organizationId }\n )\n : []\n const addressByCustomer = new Map<string, CustomerAddress>()\n for (const address of addresses) {\n const entityId = typeof address.entity === 'string' ? address.entity : address.entity?.id\n if (!entityId || addressByCustomer.has(entityId)) continue\n addressByCustomer.set(entityId, address)\n }\n\n const contacts = matchIds.length\n ? await findWithDecryption(\n em,\n CustomerPersonProfile,\n { organizationId: scope.organizationId, tenantId: scope.tenantId, company: { $in: matchIds } },\n { populate: ['entity', 'company'] },\n { tenantId: scope.tenantId, organizationId: scope.organizationId }\n )\n : []\n const contactByCompany = new Map<string, CustomerPersonProfile>()\n for (const contact of contacts) {\n const companyId = typeof contact.company === 'string' ? contact.company : contact.company?.id\n if (!companyId || contactByCompany.has(companyId)) continue\n contactByCompany.set(companyId, contact)\n }\n\n for (const { spec, customer } of matchedPairs) {\n const contact = contactByCompany.get(customer.id) ?? null\n const snapshot = buildCustomerSnapshot(customer, contact)\n const addresses = toExampleAddresses(customer, addressByCustomer.get(customer.id) ?? null)\n map.set(spec.key, {\n entity: customer,\n contact,\n contactId: contact?.id ?? null,\n snapshot,\n addresses,\n })\n }\n\n for (const lookup of lookups) {\n if (!map.has(lookup.key)) {\n logger.warn('sales.examples customer not found; skipping seeded linkage', { displayName: lookup.displayName })\n }\n }\n\n return map\n}\n\nasync function ensureChannels(\n em: EntityManager,\n scope: SeedScope\n): Promise<Map<string, SalesChannel>> {\n const existing = await em.find(SalesChannel, {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n deletedAt: null,\n })\n const map = new Map<string, SalesChannel>()\n existing.forEach((entry) => map.set((entry.code ?? '').toLowerCase(), entry))\n const now = new Date()\n for (const seed of CHANNEL_SEEDS) {\n const code = seed.code.toLowerCase()\n if (map.has(code)) continue\n const record = em.create(SalesChannel, {\n id: randomUUID(),\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n name: seed.name,\n code: seed.code,\n description: seed.description,\n isActive: true,\n createdAt: now,\n updatedAt: now,\n })\n em.persist(record)\n map.set(code, record)\n }\n return map\n}\n\nfunction buildAddressSnapshot(address: ExampleAddress) {\n return {\n companyName: address.companyName ?? null,\n name: address.name ?? null,\n addressLine1: address.addressLine1,\n addressLine2: address.addressLine2 ?? null,\n city: address.city ?? null,\n region: address.region ?? null,\n postalCode: address.postalCode ?? null,\n country: address.country ?? null,\n latitude: address.latitude ?? null,\n longitude: address.longitude ?? null,\n }\n}\n\nfunction buildShippingMethodSnapshot(method?: SalesShippingMethod | null) {\n if (!method) return null\n return {\n id: method.id,\n code: method.code,\n name: method.name,\n providerKey: method.providerKey ?? null,\n serviceLevel: method.serviceLevel ?? null,\n estimatedTransitDays: method.estimatedTransitDays ?? null,\n baseRateNet: method.baseRateNet,\n baseRateGross: method.baseRateGross,\n currencyCode: method.currencyCode,\n metadata: method.metadata ?? null,\n }\n}\n\nfunction buildPaymentMethodSnapshot(method?: SalesPaymentMethod | null) {\n if (!method) return null\n return {\n id: method.id,\n code: method.code,\n name: method.name,\n providerKey: method.providerKey ?? null,\n terms: method.terms ?? null,\n metadata: method.metadata ?? null,\n }\n}\n\nfunction attachDocumentAddresses(\n em: EntityManager,\n scope: SeedScope,\n params: {\n documentId: string\n documentKind: 'order' | 'quote'\n addresses: ExampleAddress[]\n order?: SalesOrder\n quote?: SalesQuote\n }\n): void {\n const { documentId, documentKind, addresses, order, quote } = params\n for (const entry of addresses) {\n const now = new Date()\n const record = em.create(SalesDocumentAddress, {\n id: randomUUID(),\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n documentId,\n documentKind,\n customerAddressId: entry.customerAddressId ?? null,\n name: entry.name ?? null,\n companyName: entry.companyName ?? null,\n purpose: entry.role,\n addressLine1: entry.addressLine1,\n addressLine2: entry.addressLine2 ?? null,\n city: entry.city ?? null,\n region: entry.region ?? null,\n postalCode: entry.postalCode ?? null,\n country: entry.country ?? null,\n latitude: entry.latitude ?? null,\n longitude: entry.longitude ?? null,\n buildingNumber: null,\n flatNumber: null,\n order: documentKind === 'order' ? order ?? null : null,\n quote: documentKind === 'quote' ? quote ?? null : null,\n createdAt: now,\n updatedAt: now,\n })\n em.persist(record)\n }\n}\n\nfunction attachNotes(\n em: EntityManager,\n scope: SeedScope,\n params: {\n contextId: string\n contextType: 'order' | 'quote'\n notes: ExampleNote[]\n order?: SalesOrder\n quote?: SalesQuote\n }\n) {\n const { contextId, contextType, notes, order, quote } = params\n for (const note of notes) {\n const record = em.create(SalesNote, {\n id: randomUUID(),\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n contextType,\n contextId,\n body: note.body,\n appearanceIcon: note.appearanceIcon ?? null,\n appearanceColor: note.appearanceColor ?? null,\n createdAt: note.createdAt ?? new Date(),\n updatedAt: note.createdAt ?? new Date(),\n })\n record.order = contextType === 'order' ? order ?? null : null\n record.quote = contextType === 'quote' ? quote ?? null : null\n em.persist(record)\n }\n}\n\nfunction mapPaymentStatus(outstanding: number): string | null {\n if (outstanding <= 0.01) return 'paid'\n if (outstanding > 0) return 'partial'\n return null\n}\n\nexport async function seedSalesExamples(\n em: EntityManager,\n container: AppContainer,\n scope: SeedScope\n): Promise<boolean> {\n const hasOrders =\n ORDER_SEEDS.length > 0\n ? await em.count(SalesOrder, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n orderNumber: { $in: ORDER_SEEDS.map((item) => item.orderNumber) as any },\n })\n : 0\n const hasQuotes =\n QUOTE_SEEDS.length > 0\n ? await em.count(SalesQuote, {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n quoteNumber: { $in: QUOTE_SEEDS.map((item) => item.quoteNumber) as any },\n })\n : 0\n\n if (hasOrders > 0 || hasQuotes > 0) {\n return false\n }\n\n await seedSalesDictionaries(em, scope)\n const [shippingMethods, paymentMethods, channels] = await Promise.all([\n ensureExampleShippingMethods(em, scope, { skipFlush: true }),\n ensureExamplePaymentMethods(em, scope, { skipFlush: true }),\n ensureChannels(em, scope),\n ])\n await em.flush()\n const catalogLookups = await loadCatalogLookups(em, scope)\n const customerLookups = await loadCustomerLookups(em, scope, [...CUSTOMER_LINKS])\n\n const calculationService = container.resolve<SalesCalculationService>('salesCalculationService')\n\n for (const seed of QUOTE_SEEDS) {\n const quoteId = randomUUID()\n const customer = seed.customerKey ? customerLookups.get(seed.customerKey) ?? null : null\n if (seed.customerKey && !customer) {\n logger.warn('sales.examples skipping quote because customer is missing', { quoteNumber: seed.quoteNumber, customerKey: seed.customerKey })\n continue\n }\n const shippingMethod = seed.shippingMethodCode\n ? shippingMethods.get(seed.shippingMethodCode.toLowerCase()) ?? null\n : null\n const paymentMethod = seed.paymentMethodCode\n ? paymentMethods.get(seed.paymentMethodCode.toLowerCase()) ?? null\n : null\n const channel = seed.channelCode ? channels.get(seed.channelCode.toLowerCase()) ?? null : null\n\n const lineSnapshots = seed.lines.map((line) => {\n const catalogRef = resolveCatalogLine(line, catalogLookups)\n if (isMissingCatalogMatch(line, catalogRef)) {\n logger.warn('sales.examples missing catalog match for quote line', { line: line.name ?? line.variantSku ?? line.productHandle ?? 'unknown' })\n }\n const unitPriceNet = line.unitPriceNet ?? catalogRef.unitPriceNet ?? 0\n const unitPriceGross = line.unitPriceGross ?? catalogRef.unitPriceGross ?? unitPriceNet\n const currencyCode = catalogRef.currencyCode ?? seed.currencyCode\n const metadata: Record<string, unknown> = {}\n if (catalogRef.productThumbnail) metadata.productThumbnail = catalogRef.productThumbnail\n if (catalogRef.variantThumbnail) metadata.variantThumbnail = catalogRef.variantThumbnail\n if (line.custom) Object.assign(metadata, CUSTOM_LINE_METADATA)\n return {\n id: randomUUID(),\n kind: line.kind ?? 'product',\n name: line.name,\n description: line.description ?? null,\n comment: line.comment ?? null,\n quantity: line.quantity,\n quantityUnit: line.quantityUnit ?? null,\n normalizedQuantity: line.quantity,\n normalizedUnit: line.quantityUnit ?? null,\n uomSnapshot: null,\n currencyCode,\n unitPriceNet,\n unitPriceGross,\n taxRate: line.taxRate ?? 0,\n discountPercent: line.discountPercent ?? null,\n productId: catalogRef.productId,\n productVariantId: catalogRef.variantId,\n catalogSnapshot: catalogRef.snapshot,\n metadata: Object.keys(metadata).length ? metadata : null,\n }\n })\n\n const adjustmentDrafts =\n seed.adjustments?.map((adj) => ({\n id: randomUUID(),\n scope: adj.scope,\n kind: adj.kind,\n code: adj.label ?? null,\n label: adj.label ?? null,\n rate: adj.rate ?? null,\n amountNet: adj.amountNet,\n amountGross: adj.amountGross ?? adj.amountNet,\n currencyCode: seed.currencyCode,\n position: adj.position ?? 0,\n metadata: adj.lineIndex !== undefined ? { lineIndex: adj.lineIndex } : null,\n })) ?? []\n\n const calculation = await calculationService.calculateDocumentTotals({\n documentKind: 'quote',\n lines: lineSnapshots,\n adjustments: adjustmentDrafts,\n context: {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n currencyCode: seed.currencyCode,\n },\n })\n\n const totals = calculation.totals\n const quoteNumber = seed.quoteNumber ?? `SQ-${quoteId.slice(0, 8).toUpperCase()}`\n const quote = em.create(SalesQuote, {\n id: quoteId,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n quoteNumber,\n status: seed.status ?? 'draft',\n customerEntityId: customer?.entity.id ?? null,\n customerContactId: customer?.contactId ?? null,\n customerSnapshot: customer?.snapshot ? toSnapshot(customer.snapshot) : null,\n currencyCode: seed.currencyCode,\n validFrom: seed.validFrom ?? null,\n validUntil: seed.validUntil ?? null,\n comments: seed.comments ?? null,\n shippingMethodId: shippingMethod?.id ?? null,\n shippingMethodCode: shippingMethod?.code ?? seed.shippingMethodCode ?? null,\n paymentMethodId: paymentMethod?.id ?? null,\n paymentMethodCode: paymentMethod?.code ?? seed.paymentMethodCode ?? null,\n channelId: channel?.id ?? null,\n shippingMethodSnapshot: buildShippingMethodSnapshot(shippingMethod),\n paymentMethodSnapshot: buildPaymentMethodSnapshot(paymentMethod),\n metadata: seed.metadata ?? { seed: 'sales.examples' },\n subtotalNetAmount: toAmount(totals.subtotalNetAmount),\n subtotalGrossAmount: toAmount(totals.subtotalGrossAmount),\n discountTotalAmount: toAmount(totals.discountTotalAmount),\n taxTotalAmount: toAmount(totals.taxTotalAmount),\n grandTotalNetAmount: toAmount(totals.grandTotalNetAmount),\n grandTotalGrossAmount: toAmount(totals.grandTotalGrossAmount),\n totalsSnapshot: toSnapshot(totals),\n lineItemCount: seed.lines.length,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(quote)\n\n calculation.lines.forEach((lineResult, idx) => {\n const source = lineSnapshots[idx]\n const line = em.create(SalesQuoteLine, {\n id: source.id,\n quote,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n lineNumber: idx + 1,\n kind: source.kind ?? 'product',\n name: source.name,\n description: source.description,\n comment: source.comment,\n quantity: toAmount(source.quantity),\n quantityUnit: source.quantityUnit ?? null,\n normalizedQuantity: toAmount(source.normalizedQuantity ?? source.quantity),\n normalizedUnit: source.normalizedUnit ?? source.quantityUnit ?? null,\n uomSnapshot:\n source.uomSnapshot && typeof source.uomSnapshot === 'object'\n ? (toSnapshot(source.uomSnapshot as Record<string, unknown>) as typeof source.uomSnapshot)\n : null,\n currencyCode: source.currencyCode,\n unitPriceNet: toAmount(source.unitPriceNet ?? 0),\n unitPriceGross: toAmount(source.unitPriceGross ?? source.unitPriceNet ?? 0),\n discountAmount: toAmount(lineResult.discountAmount),\n discountPercent:\n source.discountPercent !== null && source.discountPercent !== undefined\n ? toAmount(source.discountPercent)\n : '0',\n taxRate: toAmount(source.taxRate ?? 0),\n taxAmount: toAmount(lineResult.taxAmount),\n totalNetAmount: toAmount(lineResult.netAmount),\n totalGrossAmount: toAmount(lineResult.grossAmount),\n productId: source.productId ?? null,\n productVariantId: source.productVariantId ?? null,\n catalogSnapshot: source.catalogSnapshot ? toSnapshot(source.catalogSnapshot) : null,\n metadata: source.metadata ? toSnapshot(source.metadata) : null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(line)\n })\n\n calculation.adjustments.forEach((adj, idx) => {\n const adjMeta = adj.metadata && typeof adj.metadata === 'object' ? (adj.metadata as Record<string, unknown>) : null\n const lineIndex = adjMeta ? (adjMeta.lineIndex as number | null) : null\n const lineRef =\n typeof lineIndex === 'number' && lineIndex >= 0 && lineIndex < seed.lines.length\n ? lineSnapshots[lineIndex]?.id ?? null\n : null\n const adjustment = em.create(SalesQuoteAdjustment, {\n id: adj.id ?? randomUUID(),\n quote,\n quoteLine: lineRef ? (lineRef as unknown as SalesQuoteLine) : null,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n scope: adj.scope,\n kind: adj.kind,\n code: adj.code ?? adj.label ?? null,\n label: adj.label ?? adj.code ?? null,\n calculatorKey: adj.calculatorKey ?? null,\n promotionId: adj.promotionId ?? null,\n rate: adj.rate !== null && adj.rate !== undefined ? toAmount(adj.rate) : '0',\n amountNet: toAmount(adj.amountNet ?? 0),\n amountGross: toAmount(adj.amountGross ?? adj.amountNet ?? 0),\n currencyCode: adj.currencyCode ?? seed.currencyCode,\n metadata: adj.metadata ?? null,\n position: adj.position ?? idx,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(adjustment)\n })\n\n quote.subtotalNetAmount = toAmount(calculation.totals.subtotalNetAmount)\n quote.subtotalGrossAmount = toAmount(calculation.totals.subtotalGrossAmount)\n quote.discountTotalAmount = toAmount(calculation.totals.discountTotalAmount)\n quote.taxTotalAmount = toAmount(calculation.totals.taxTotalAmount)\n quote.grandTotalNetAmount = toAmount(calculation.totals.grandTotalNetAmount)\n quote.grandTotalGrossAmount = toAmount(calculation.totals.grandTotalGrossAmount)\n quote.totalsSnapshot = toSnapshot(calculation.totals)\n quote.lineItemCount = seed.lines.length\n\n const quoteAddresses = seed.addresses ?? customer?.addresses ?? []\n if (quoteAddresses.length) {\n attachDocumentAddresses(em, scope, {\n documentId: quoteId,\n documentKind: 'quote',\n addresses: quoteAddresses,\n quote,\n })\n const billing = quoteAddresses.find((a) => a.role === 'billing')\n const shipping = quoteAddresses.find((a) => a.role === 'shipping')\n quote.billingAddressId = billing?.customerAddressId ?? null\n quote.shippingAddressId = shipping?.customerAddressId ?? null\n quote.billingAddressSnapshot = billing ? buildAddressSnapshot(billing) : null\n quote.shippingAddressSnapshot = shipping ? buildAddressSnapshot(shipping) : null\n }\n if (seed.notes?.length) {\n attachNotes(em, scope, {\n contextId: quoteId,\n contextType: 'quote',\n notes: seed.notes,\n quote,\n })\n }\n }\n\n for (const seed of ORDER_SEEDS) {\n const orderId = randomUUID()\n const customer = seed.customerKey ? customerLookups.get(seed.customerKey) ?? null : null\n if (seed.customerKey && !customer) {\n logger.warn('sales.examples skipping order because customer is missing', { orderNumber: seed.orderNumber, customerKey: seed.customerKey })\n continue\n }\n const shippingMethod = seed.shippingMethodCode\n ? shippingMethods.get(seed.shippingMethodCode.toLowerCase()) ?? null\n : null\n const paymentMethod = seed.paymentMethodCode\n ? paymentMethods.get(seed.paymentMethodCode.toLowerCase()) ?? null\n : null\n const channel = seed.channelCode ? channels.get(seed.channelCode.toLowerCase()) ?? null : null\n\n const lineSnapshots = seed.lines.map((line) => {\n const catalogRef = resolveCatalogLine(line, catalogLookups)\n if (isMissingCatalogMatch(line, catalogRef)) {\n logger.warn('sales.examples missing catalog match for order line', { line: line.name ?? line.variantSku ?? line.productHandle ?? 'unknown' })\n }\n const unitPriceNet = line.unitPriceNet ?? catalogRef.unitPriceNet ?? 0\n const unitPriceGross = line.unitPriceGross ?? catalogRef.unitPriceGross ?? unitPriceNet\n const currencyCode = catalogRef.currencyCode ?? seed.currencyCode\n const metadata: Record<string, unknown> = {}\n if (catalogRef.productThumbnail) metadata.productThumbnail = catalogRef.productThumbnail\n if (catalogRef.variantThumbnail) metadata.variantThumbnail = catalogRef.variantThumbnail\n if (line.custom) Object.assign(metadata, CUSTOM_LINE_METADATA)\n return {\n id: randomUUID(),\n kind: line.kind ?? 'product',\n name: line.name,\n description: line.description ?? null,\n comment: line.comment ?? null,\n quantity: line.quantity,\n quantityUnit: line.quantityUnit ?? null,\n normalizedQuantity: line.quantity,\n normalizedUnit: line.quantityUnit ?? null,\n uomSnapshot: null,\n currencyCode,\n unitPriceNet,\n unitPriceGross,\n taxRate: line.taxRate ?? 0,\n discountPercent: line.discountPercent ?? null,\n productId: catalogRef.productId,\n productVariantId: catalogRef.variantId,\n catalogSnapshot: catalogRef.snapshot,\n metadata: Object.keys(metadata).length ? metadata : null,\n }\n })\n\n const adjustmentDrafts =\n seed.adjustments?.map((adj) => ({\n id: randomUUID(),\n scope: adj.scope,\n kind: adj.kind,\n code: adj.label ?? null,\n label: adj.label ?? null,\n rate: adj.rate ?? null,\n amountNet: adj.amountNet,\n amountGross: adj.amountGross ?? adj.amountNet,\n currencyCode: seed.currencyCode,\n position: adj.position ?? 0,\n metadata: adj.lineIndex !== undefined ? { lineIndex: adj.lineIndex } : null,\n })) ?? []\n\n const calculation = await calculationService.calculateDocumentTotals({\n documentKind: 'order',\n lines: lineSnapshots,\n adjustments: adjustmentDrafts,\n context: {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n currencyCode: seed.currencyCode,\n },\n })\n\n const totals = calculation.totals\n const order = em.create(SalesOrder, {\n id: orderId,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n orderNumber: seed.orderNumber,\n status: seed.status ?? 'confirmed',\n fulfillmentStatus: seed.fulfillmentStatus ?? null,\n paymentStatus: seed.paymentStatus ?? null,\n customerEntityId: customer?.entity.id ?? null,\n customerContactId: customer?.contactId ?? null,\n customerSnapshot: customer?.snapshot ? toSnapshot(customer.snapshot) : null,\n currencyCode: seed.currencyCode,\n placedAt: seed.placedAt ?? null,\n expectedDeliveryAt: seed.expectedDeliveryAt ?? null,\n comments: seed.comments ?? null,\n internalNotes: seed.internalNotes ?? null,\n shippingMethodId: shippingMethod?.id ?? null,\n shippingMethodCode: shippingMethod?.code ?? seed.shippingMethodCode ?? null,\n paymentMethodId: paymentMethod?.id ?? null,\n paymentMethodCode: paymentMethod?.code ?? seed.paymentMethodCode ?? null,\n channelId: channel?.id ?? null,\n shippingMethodSnapshot: buildShippingMethodSnapshot(shippingMethod),\n paymentMethodSnapshot: buildPaymentMethodSnapshot(paymentMethod),\n metadata: seed.metadata ?? { seed: 'sales.examples' },\n subtotalNetAmount: toAmount(totals.subtotalNetAmount),\n subtotalGrossAmount: toAmount(totals.subtotalGrossAmount),\n discountTotalAmount: toAmount(totals.discountTotalAmount),\n taxTotalAmount: toAmount(totals.taxTotalAmount),\n shippingNetAmount: toAmount(totals.shippingNetAmount ?? 0),\n shippingGrossAmount: toAmount(totals.shippingGrossAmount ?? 0),\n surchargeTotalAmount: toAmount(totals.surchargeTotalAmount ?? 0),\n grandTotalNetAmount: toAmount(totals.grandTotalNetAmount),\n grandTotalGrossAmount: toAmount(totals.grandTotalGrossAmount),\n paidTotalAmount: toAmount(totals.paidTotalAmount ?? 0),\n refundedTotalAmount: toAmount(totals.refundedTotalAmount ?? 0),\n outstandingAmount: toAmount(totals.outstandingAmount ?? totals.grandTotalGrossAmount),\n totalsSnapshot: toSnapshot(totals),\n lineItemCount: seed.lines.length,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(order)\n\n const lineEntities: SalesOrderLine[] = []\n calculation.lines.forEach((lineResult, idx) => {\n const source = lineSnapshots[idx]\n const entity = em.create(SalesOrderLine, {\n id: source.id,\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n lineNumber: idx + 1,\n kind: source.kind ?? 'product',\n name: source.name,\n description: source.description,\n comment: source.comment,\n quantity: toAmount(source.quantity),\n quantityUnit: source.quantityUnit ?? null,\n normalizedQuantity: toAmount(source.normalizedQuantity ?? source.quantity),\n normalizedUnit: source.normalizedUnit ?? source.quantityUnit ?? null,\n uomSnapshot:\n source.uomSnapshot && typeof source.uomSnapshot === 'object'\n ? (toSnapshot(source.uomSnapshot as Record<string, unknown>) as typeof source.uomSnapshot)\n : null,\n reservedQuantity: '0',\n fulfilledQuantity: '0',\n invoicedQuantity: '0',\n returnedQuantity: '0',\n currencyCode: source.currencyCode,\n unitPriceNet: toAmount(source.unitPriceNet ?? 0),\n unitPriceGross: toAmount(source.unitPriceGross ?? source.unitPriceNet ?? 0),\n discountAmount: toAmount(lineResult.discountAmount),\n discountPercent:\n source.discountPercent !== null && source.discountPercent !== undefined\n ? toAmount(source.discountPercent)\n : '0',\n taxRate: toAmount(source.taxRate ?? 0),\n taxAmount: toAmount(lineResult.taxAmount),\n totalNetAmount: toAmount(lineResult.netAmount),\n totalGrossAmount: toAmount(lineResult.grossAmount),\n productId: source.productId ?? null,\n productVariantId: source.productVariantId ?? null,\n catalogSnapshot: source.catalogSnapshot ? toSnapshot(source.catalogSnapshot) : null,\n metadata: source.metadata ? toSnapshot(source.metadata) : null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(entity)\n lineEntities.push(entity)\n })\n\n calculation.adjustments.forEach((adj, idx) => {\n const lineIndex = adj.metadata && typeof adj.metadata === 'object' ? (adj.metadata as any).lineIndex : null\n const lineRef =\n typeof lineIndex === 'number' && lineIndex >= 0 && lineIndex < seed.lines.length\n ? lineEntities[lineIndex] ?? null\n : null\n const adjustment = em.create(SalesOrderAdjustment, {\n id: adj.id ?? randomUUID(),\n order,\n orderLine: lineRef,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n scope: adj.scope,\n kind: adj.kind,\n code: adj.code ?? adj.label ?? null,\n label: adj.label ?? adj.code ?? null,\n calculatorKey: adj.calculatorKey ?? null,\n promotionId: adj.promotionId ?? null,\n rate: adj.rate !== null && adj.rate !== undefined ? toAmount(adj.rate) : '0',\n amountNet: toAmount(adj.amountNet ?? 0),\n amountGross: toAmount(adj.amountGross ?? adj.amountNet ?? 0),\n currencyCode: adj.currencyCode ?? seed.currencyCode,\n metadata: adj.metadata ?? null,\n position: adj.position ?? idx,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(adjustment)\n })\n\n order.subtotalNetAmount = toAmount(calculation.totals.subtotalNetAmount)\n order.subtotalGrossAmount = toAmount(calculation.totals.subtotalGrossAmount)\n order.discountTotalAmount = toAmount(calculation.totals.discountTotalAmount)\n order.taxTotalAmount = toAmount(calculation.totals.taxTotalAmount)\n order.shippingNetAmount = toAmount(calculation.totals.shippingNetAmount ?? 0)\n order.shippingGrossAmount = toAmount(calculation.totals.shippingGrossAmount ?? 0)\n order.surchargeTotalAmount = toAmount(calculation.totals.surchargeTotalAmount ?? 0)\n order.grandTotalNetAmount = toAmount(calculation.totals.grandTotalNetAmount)\n order.grandTotalGrossAmount = toAmount(calculation.totals.grandTotalGrossAmount)\n order.paidTotalAmount = toAmount(calculation.totals.paidTotalAmount ?? 0)\n order.refundedTotalAmount = toAmount(calculation.totals.refundedTotalAmount ?? 0)\n order.outstandingAmount = toAmount(calculation.totals.outstandingAmount ?? calculation.totals.grandTotalGrossAmount)\n order.totalsSnapshot = toSnapshot(calculation.totals)\n order.lineItemCount = seed.lines.length\n\n const lineMap = new Map(lineEntities.map((line) => [line.id, line]))\n if (seed.shipments?.length) {\n for (const shipmentSeed of seed.shipments) {\n const shipment = em.create(SalesShipment, {\n id: randomUUID(),\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n shipmentNumber: shipmentSeed.shipmentNumber ?? null,\n shippingMethodId: shipmentSeed.methodCode\n ? shippingMethods.get(shipmentSeed.methodCode.toLowerCase())?.id ?? null\n : null,\n status: shipmentSeed.status ?? null,\n carrierName: null,\n trackingNumbers: shipmentSeed.trackingNumbers ?? null,\n shippedAt: shipmentSeed.shippedAt ?? null,\n deliveredAt: shipmentSeed.deliveredAt ?? null,\n weightValue: shipmentSeed.weightKg ? toAmount(shipmentSeed.weightKg) : null,\n weightUnit: shipmentSeed.weightKg ? 'kg' : null,\n declaredValueNet: shipmentSeed.declaredValue ? toAmount(shipmentSeed.declaredValue) : null,\n declaredValueGross: shipmentSeed.declaredValue ? toAmount(shipmentSeed.declaredValue) : null,\n currencyCode: shipmentSeed.currencyCode ?? seed.currencyCode,\n notesText: shipmentSeed.notes ?? null,\n metadata: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(shipment)\n\n const shipmentItems: SalesShipmentItem[] = []\n for (const item of shipmentSeed.items) {\n const line = lineEntities[item.lineIndex]\n if (!line) continue\n line.fulfilledQuantity = toAmount(\n Number(line.fulfilledQuantity ?? '0') + Math.max(item.quantity, 0)\n )\n const shipmentItem = em.create(SalesShipmentItem, {\n id: randomUUID(),\n shipment,\n orderLine: line,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n quantity: toAmount(item.quantity),\n metadata: null,\n })\n shipmentItems.push(shipmentItem)\n em.persist(shipmentItem)\n }\n await refreshShipmentItemsSnapshot(em, shipment, { items: shipmentItems, lineMap })\n }\n }\n\n let paymentTotal = 0\n if (seed.payments?.length) {\n for (const paymentSeed of seed.payments) {\n paymentTotal += paymentSeed.amount\n const method = paymentSeed.methodCode\n ? paymentMethods.get(paymentSeed.methodCode.toLowerCase()) ?? null\n : paymentMethod\n const payment = em.create(SalesPayment, {\n id: randomUUID(),\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n paymentMethod: method ?? null,\n paymentReference: paymentSeed.reference ?? null,\n status: paymentSeed.status ?? null,\n amount: toAmount(paymentSeed.amount),\n currencyCode: paymentSeed.currencyCode,\n capturedAmount: toAmount(paymentSeed.capturedAt ? paymentSeed.amount : 0),\n refundedAmount: '0',\n receivedAt: paymentSeed.receivedAt ?? null,\n capturedAt: paymentSeed.capturedAt ?? null,\n metadata: null,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n em.persist(payment)\n const allocation = em.create(SalesPaymentAllocation, {\n id: randomUUID(),\n payment,\n order,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n amount: toAmount(paymentSeed.amount),\n currencyCode: paymentSeed.currencyCode,\n metadata: null,\n })\n em.persist(allocation)\n }\n }\n\n const orderAddresses = seed.addresses ?? customer?.addresses ?? []\n if (orderAddresses.length) {\n attachDocumentAddresses(em, scope, {\n documentId: orderId,\n documentKind: 'order',\n addresses: orderAddresses,\n order,\n })\n const billing = orderAddresses.find((a) => a.role === 'billing')\n const shipping = orderAddresses.find((a) => a.role === 'shipping')\n order.billingAddressId = billing?.customerAddressId ?? null\n order.shippingAddressId = shipping?.customerAddressId ?? null\n order.billingAddressSnapshot = billing ? buildAddressSnapshot(billing) : null\n order.shippingAddressSnapshot = shipping ? buildAddressSnapshot(shipping) : null\n }\n if (seed.notes?.length) {\n attachNotes(em, scope, {\n contextId: orderId,\n contextType: 'order',\n notes: seed.notes,\n order,\n })\n }\n\n const grandTotal = Number(order.grandTotalGrossAmount ?? '0')\n order.paidTotalAmount = toAmount(paymentTotal)\n order.outstandingAmount = toAmount(Math.max(grandTotal - paymentTotal, 0))\n order.paymentStatus = seed.paymentStatus ?? mapPaymentStatus(grandTotal - paymentTotal)\n const isFullyFulfilled = lineEntities.every((line, idx) => {\n const expected = Number(seed.lines[idx]?.quantity ?? 0)\n const fulfilled = Number(line.fulfilledQuantity ?? '0')\n return fulfilled >= expected\n })\n order.fulfillmentStatus = seed.fulfillmentStatus ?? (isFullyFulfilled ? 'fulfilled' : 'in_fulfillment')\n }\n\n await em.flush()\n return true\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAG3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,6BAA6B;AACtC,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B,oCAAoD;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,OAAO;AAoHnC,MAAM,gBAAgB;AAAA,EACpB,EAAE,MAAM,UAAU,MAAM,gBAAgB,aAAa,uCAAuC;AAAA,EAC5F;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF;AAEA,MAAM,iBAAmC;AAAA,EACvC,EAAE,KAAK,cAAc,aAAa,mBAAmB;AAAA,EACrD,EAAE,KAAK,cAAc,aAAa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
|
+
"version": "0.10.1-develop.8022.1.b6753de892",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -266,16 +266,16 @@
|
|
|
266
266
|
"zod": "^4.6.6"
|
|
267
267
|
},
|
|
268
268
|
"peerDependencies": {
|
|
269
|
-
"@open-mercato/ai-assistant": "0.10.1-develop.
|
|
270
|
-
"@open-mercato/shared": "0.10.1-develop.
|
|
271
|
-
"@open-mercato/ui": "0.10.1-develop.
|
|
269
|
+
"@open-mercato/ai-assistant": "0.10.1-develop.8022.1.b6753de892",
|
|
270
|
+
"@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892",
|
|
271
|
+
"@open-mercato/ui": "0.10.1-develop.8022.1.b6753de892",
|
|
272
272
|
"react": "^19.0.0",
|
|
273
273
|
"react-dom": "^19.0.0"
|
|
274
274
|
},
|
|
275
275
|
"devDependencies": {
|
|
276
|
-
"@open-mercato/ai-assistant": "0.10.1-develop.
|
|
277
|
-
"@open-mercato/shared": "0.10.1-develop.
|
|
278
|
-
"@open-mercato/ui": "0.10.1-develop.
|
|
276
|
+
"@open-mercato/ai-assistant": "0.10.1-develop.8022.1.b6753de892",
|
|
277
|
+
"@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892",
|
|
278
|
+
"@open-mercato/ui": "0.10.1-develop.8022.1.b6753de892",
|
|
279
279
|
"@testing-library/dom": "^10.4.1",
|
|
280
280
|
"@testing-library/jest-dom": "^7.0.1",
|
|
281
281
|
"@testing-library/react": "^16.3.3",
|