@the-apparel-lab/pricing-engine 1.0.0

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.
Files changed (58) hide show
  1. package/config/pricing-config.json +23 -0
  2. package/dist/audit/actuals-comparison.d.ts +10 -0
  3. package/dist/audit/actuals-comparison.d.ts.map +1 -0
  4. package/dist/audit/actuals-comparison.js +96 -0
  5. package/dist/audit/actuals-comparison.js.map +1 -0
  6. package/dist/audit/margin.d.ts +20 -0
  7. package/dist/audit/margin.d.ts.map +1 -0
  8. package/dist/audit/margin.js +34 -0
  9. package/dist/audit/margin.js.map +1 -0
  10. package/dist/audit-runner.d.ts +11 -0
  11. package/dist/audit-runner.d.ts.map +1 -0
  12. package/dist/audit-runner.js +277 -0
  13. package/dist/audit-runner.js.map +1 -0
  14. package/dist/calculators/blanks.d.ts +18 -0
  15. package/dist/calculators/blanks.d.ts.map +1 -0
  16. package/dist/calculators/blanks.js +26 -0
  17. package/dist/calculators/blanks.js.map +1 -0
  18. package/dist/calculators/decoration.d.ts +32 -0
  19. package/dist/calculators/decoration.d.ts.map +1 -0
  20. package/dist/calculators/decoration.js +63 -0
  21. package/dist/calculators/decoration.js.map +1 -0
  22. package/dist/calculators/setup-fees.d.ts +27 -0
  23. package/dist/calculators/setup-fees.d.ts.map +1 -0
  24. package/dist/calculators/setup-fees.js +60 -0
  25. package/dist/calculators/setup-fees.js.map +1 -0
  26. package/dist/calculators/shipping.d.ts +14 -0
  27. package/dist/calculators/shipping.d.ts.map +1 -0
  28. package/dist/calculators/shipping.js +17 -0
  29. package/dist/calculators/shipping.js.map +1 -0
  30. package/dist/cli.d.ts +3 -0
  31. package/dist/cli.d.ts.map +1 -0
  32. package/dist/cli.js +192 -0
  33. package/dist/cli.js.map +1 -0
  34. package/dist/config.d.ts +224 -0
  35. package/dist/config.d.ts.map +1 -0
  36. package/dist/config.js +368 -0
  37. package/dist/config.js.map +1 -0
  38. package/dist/index.d.ts +20 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +295 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/types.d.ts +230 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/types.js +4 -0
  45. package/dist/types.js.map +1 -0
  46. package/dist/utils/blanks-lookup.d.ts +42 -0
  47. package/dist/utils/blanks-lookup.d.ts.map +1 -0
  48. package/dist/utils/blanks-lookup.js +99 -0
  49. package/dist/utils/blanks-lookup.js.map +1 -0
  50. package/dist/utils/money.d.ts +21 -0
  51. package/dist/utils/money.d.ts.map +1 -0
  52. package/dist/utils/money.js +38 -0
  53. package/dist/utils/money.js.map +1 -0
  54. package/dist/utils/vendor-lookup.d.ts +49 -0
  55. package/dist/utils/vendor-lookup.d.ts.map +1 -0
  56. package/dist/utils/vendor-lookup.js +308 -0
  57. package/dist/utils/vendor-lookup.js.map +1 -0
  58. package/package.json +28 -0
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateDecoration = calculateDecoration;
4
+ const vendor_lookup_1 = require("../utils/vendor-lookup");
5
+ const money_1 = require("../utils/money");
6
+ function calculateDecoration(input) {
7
+ const { designs, totalQuantity, decorationMethod, decorationMultiplier, vendorData, manualCostPerUnitCents, sublimationProductKey, } = input;
8
+ const warnings = [];
9
+ const perDesignCosts = [];
10
+ for (const design of designs) {
11
+ // Build lookup params based on the design's method-specific fields
12
+ const lookupResult = (0, vendor_lookup_1.lookupDecorationCostPerUnit)(vendorData, {
13
+ method: decorationMethod,
14
+ quantity: totalQuantity,
15
+ colorCount: 'color_count' in design ? design.color_count : undefined,
16
+ stitchCount: 'stitch_count' in design ? design.stitch_count : undefined,
17
+ sublimationProductKey,
18
+ designHeight: design.height,
19
+ designWidth: design.width,
20
+ });
21
+ let perUnitCostCents;
22
+ let vendorId;
23
+ if (lookupResult.perUnitCents != null) {
24
+ perUnitCostCents = lookupResult.perUnitCents;
25
+ vendorId = lookupResult.vendorId;
26
+ if (lookupResult.warning) {
27
+ warnings.push(`${design.location}: ${lookupResult.warning}`);
28
+ }
29
+ if (manualCostPerUnitCents != null) {
30
+ warnings.push(`${design.location}: manual_decoration_cost_per_unit ($${(manualCostPerUnitCents / 100).toFixed(2)}) was provided but ignored — vendor auto-lookup returned $${(perUnitCostCents / 100).toFixed(2)}/unit`);
31
+ }
32
+ }
33
+ else if (manualCostPerUnitCents != null) {
34
+ perUnitCostCents = manualCostPerUnitCents;
35
+ warnings.push(`${design.location}: ${lookupResult.warning ?? 'Vendor pricing unavailable'} — using manual override ($${(manualCostPerUnitCents / 100).toFixed(2)}/unit)`);
36
+ }
37
+ else {
38
+ throw new Error(`Cannot calculate decoration cost for "${design.location}": ${lookupResult.warning ?? 'Vendor pricing unavailable'}. ` +
39
+ `Provide manual_decoration_cost_per_unit to override.`);
40
+ }
41
+ const totalCostCents = perUnitCostCents * totalQuantity;
42
+ perDesignCosts.push({
43
+ location: design.location,
44
+ perUnitCostCents,
45
+ totalCostCents,
46
+ vendorId,
47
+ warning: lookupResult.warning,
48
+ });
49
+ }
50
+ const totalCostCents = (0, money_1.sumCents)(perDesignCosts.map(d => d.totalCostCents));
51
+ const totalMarkedUpCents = (0, money_1.multiplyCents)(totalCostCents, decorationMultiplier);
52
+ const vendorIds = [...new Set(perDesignCosts
53
+ .map(d => d.vendorId)
54
+ .filter((v) => v != null))];
55
+ return {
56
+ perDesignCosts,
57
+ totalCostCents,
58
+ totalMarkedUpCents,
59
+ vendorIds,
60
+ warnings,
61
+ };
62
+ }
63
+ //# sourceMappingURL=decoration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decoration.js","sourceRoot":"","sources":["../../src/calculators/decoration.ts"],"names":[],"mappings":";;AAoCA,kDA+EC;AAjHD,0DAAqE;AACrE,0CAAyD;AAiCzD,SAAgB,mBAAmB,CAAC,KAAsB;IACxD,MAAM,EACJ,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,E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';
2
+ import type { VendorPricingData } from '../config';
3
+ export interface SetupFeesInput {
4
+ decorationMethod: DecorationMethod;
5
+ designs: DesignPlacement[];
6
+ vendorData: VendorPricingData;
7
+ digitizingMultiplier: number;
8
+ screenSetupMultiplier: number;
9
+ }
10
+ export interface SetupFeesResult {
11
+ /** Digitizing: separate customer-visible charge (embroidery only). */
12
+ digitizing: {
13
+ totalCostCents: number;
14
+ totalMarkedUpCents: number;
15
+ perDesignCostCents: number;
16
+ designCount: number;
17
+ } | null;
18
+ /** Screen setup: rolled into per-unit price, hidden from customer. */
19
+ screenSetup: {
20
+ totalCostCents: number;
21
+ totalMarkedUpCents: number;
22
+ totalColors: number;
23
+ costPerColorCents: number;
24
+ } | null;
25
+ }
26
+ export declare function calculateSetupFees(input: SetupFeesInput): SetupFeesResult;
27
+ //# sourceMappingURL=setup-fees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-fees.d.ts","sourceRoot":"","sources":["../../src/calculators/setup-fees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD,MAAM,WAAW,cAAc;IAC7B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,UAAU,EAAE;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI,CAAC;IAET,sEAAsE;IACtE,WAAW,EAAE;QACX,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,GAAG,IAAI,CAAC;CACV;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAgEzE"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateSetupFees = calculateSetupFees;
4
+ const money_1 = require("../utils/money");
5
+ function calculateSetupFees(input) {
6
+ const { decorationMethod, designs, vendorData, digitizingMultiplier, screenSetupMultiplier } = input;
7
+ let digitizing = null;
8
+ let screenSetup = null;
9
+ // Digitizing — embroidery only, charged per design placement
10
+ if (decorationMethod === 'embroidery') {
11
+ const embData = vendorData.methods.embroidery;
12
+ let perDesignCostCents = 0;
13
+ if (embData.status === 'active') {
14
+ const setupFees = embData.setup_fees;
15
+ // Find the first digitizing_* key (currently only digitizing_left_chest;
16
+ // when more placement-specific keys are added, match by design location)
17
+ const digitizingKey = Object.keys(setupFees).find(k => k.startsWith('digitizing_'));
18
+ const digitizingEntry = digitizingKey
19
+ ? setupFees[digitizingKey]
20
+ : undefined;
21
+ if (digitizingEntry) {
22
+ perDesignCostCents = digitizingEntry.min;
23
+ }
24
+ }
25
+ if (perDesignCostCents > 0) {
26
+ const designCount = designs.length;
27
+ const totalCostCents = perDesignCostCents * designCount;
28
+ digitizing = {
29
+ totalCostCents,
30
+ totalMarkedUpCents: (0, money_1.multiplyCents)(totalCostCents, digitizingMultiplier),
31
+ perDesignCostCents,
32
+ designCount,
33
+ };
34
+ }
35
+ }
36
+ // Screen setup — screen printing and screen_print_transfers, per color per placement
37
+ if (decorationMethod === 'screen_printing' || decorationMethod === 'screen_print_transfers') {
38
+ const spData = vendorData.methods.screen_printing;
39
+ let costPerColorCents = 0;
40
+ if (spData.status === 'active') {
41
+ const setupFees = spData.setup_fees;
42
+ const screenEntry = setupFees['screen_setup_per_color'];
43
+ if (screenEntry) {
44
+ costPerColorCents = screenEntry.min;
45
+ }
46
+ }
47
+ if (costPerColorCents > 0) {
48
+ const totalColors = designs.reduce((sum, d) => sum + ('color_count' in d ? d.color_count : 0), 0);
49
+ const totalCostCents = costPerColorCents * totalColors;
50
+ screenSetup = {
51
+ totalCostCents,
52
+ totalMarkedUpCents: (0, money_1.multiplyCents)(totalCostCents, screenSetupMultiplier),
53
+ totalColors,
54
+ costPerColorCents,
55
+ };
56
+ }
57
+ }
58
+ return { digitizing, screenSetup };
59
+ }
60
+ //# sourceMappingURL=setup-fees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-fees.js","sourceRoot":"","sources":["../../src/calculators/setup-fees.ts"],"names":[],"mappings":";;AA8BA,gDAgEC;AA5FD,0CAA+C;AA4B/C,SAAgB,kBAAkB,CAAC,KAAqB;IACtD,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAErG,IAAI,UAAU,GAAkC,IAAI,CAAC;IACrD,IAAI,WAAW,GAAmC,IAAI,CAAC;IAEvD,6DAA6D;IAC7D,IAAI,gBAAgB,KAAK,YAAY,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9C,IAAI,kBAAkB,GAAG,CAAC,CAAC;QAE3B,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAqC,CAAC;YAChE,yEAAyE;YACzE,yEAAyE;YACzE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;YACpF,MAAM,eAAe,GAAG,aAAa;gBACnC,CAAC,CAAE,SAAS,CAAC,aAAa,CAAiC;gBAC3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BAAkB,EAAE,IAAA,qBAAa,EAAC,cAAc,EAAE,qBAAqB,CAAC;gBACxE,WAAW;gBACX,iBAAiB;aAClB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface ShippingInput {
2
+ /** Flat shipping cost in cents (manually entered for v1). */
3
+ shippingCostCents: number;
4
+ shippingMultiplier: number;
5
+ /** Reserved for future use: order subtotal in cents (for free-shipping threshold). */
6
+ orderSubtotalCents?: number;
7
+ }
8
+ export interface ShippingResult {
9
+ costCents: number;
10
+ markedUpCents: number;
11
+ waived: boolean;
12
+ }
13
+ export declare function calculateShipping(input: ShippingInput): ShippingResult;
14
+ //# sourceMappingURL=shipping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipping.d.ts","sourceRoot":"","sources":["../../src/calculators/shipping.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAatE"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateShipping = calculateShipping;
4
+ const money_1 = require("../utils/money");
5
+ function calculateShipping(input) {
6
+ const { shippingCostCents, shippingMultiplier } = input;
7
+ // Future: check free-shipping threshold here using orderSubtotalCents
8
+ // if (input.orderSubtotalCents != null && input.orderSubtotalCents >= FREE_SHIPPING_THRESHOLD) {
9
+ // return { costCents: shippingCostCents, markedUpCents: 0, waived: true };
10
+ // }
11
+ return {
12
+ costCents: shippingCostCents,
13
+ markedUpCents: (0, money_1.multiplyCents)(shippingCostCents, shippingMultiplier),
14
+ waived: false,
15
+ };
16
+ }
17
+ //# sourceMappingURL=shipping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipping.js","sourceRoot":"","sources":["../../src/calculators/shipping.ts"],"names":[],"mappings":";;AAgBA,8CAaC;AA7BD,0CAA+C;AAgB/C,SAAgB,iBAAiB,CAAC,KAAoB;IACpD,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAExD,sEAAsE;IACtE,iGAAiG;IACjG,6EAA6E;IAC7E,IAAI;IAEJ,OAAO;QACL,SAAS,EAAE,iBAAiB;QAC5B,aAAa,EAAE,IAAA,qBAAa,EAAC,iBAAiB,EAAE,kBAAkB,CAAC;QACnE,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ts-node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,192 @@
1
+ #!/usr/bin/env ts-node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const index_1 = require("./index");
40
+ const config_1 = require("./config");
41
+ const money_1 = require("./utils/money");
42
+ // ─── Arg parsing ───
43
+ const args = process.argv.slice(2);
44
+ const inputIdx = args.indexOf('--input');
45
+ if (inputIdx === -1 || !args[inputIdx + 1]) {
46
+ console.error('Usage: npx ts-node src/cli.ts --input <order.json> [--config <pricing-config.json>] [--vendor <vendor-pricing.json>]');
47
+ process.exit(1);
48
+ }
49
+ const inputPath = path.resolve(args[inputIdx + 1]);
50
+ const configIdx = args.indexOf('--config');
51
+ const configPath = configIdx !== -1 && args[configIdx + 1] ? path.resolve(args[configIdx + 1]) : undefined;
52
+ const vendorIdx = args.indexOf('--vendor');
53
+ const vendorPath = vendorIdx !== -1 && args[vendorIdx + 1] ? path.resolve(args[vendorIdx + 1]) : undefined;
54
+ // ─── Load and run ───
55
+ let orderJson;
56
+ try {
57
+ orderJson = fs.readFileSync(inputPath, 'utf-8');
58
+ }
59
+ catch (err) {
60
+ console.error(`Failed to read input file: ${inputPath}`);
61
+ process.exit(1);
62
+ }
63
+ let order;
64
+ try {
65
+ order = (0, config_1.validateOrderInput)(JSON.parse(orderJson));
66
+ }
67
+ catch (err) {
68
+ console.error(`Invalid order input: ${err.message}`);
69
+ process.exit(1);
70
+ }
71
+ let result;
72
+ try {
73
+ result = (0, index_1.calculatePrice)(order, {
74
+ pricingConfigPath: configPath,
75
+ vendorPricingPath: vendorPath,
76
+ });
77
+ }
78
+ catch (err) {
79
+ console.error(`Pricing error: ${err.message}`);
80
+ process.exit(1);
81
+ }
82
+ // ─── Format output ───
83
+ const $ = (cents) => `$${(0, money_1.toDollars)(cents).toFixed(2)}`;
84
+ const SEP = '─'.repeat(60);
85
+ const THIN = '─'.repeat(40);
86
+ console.log('');
87
+ console.log('╔══════════════════════════════════════════════════════════╗');
88
+ console.log('║ CUSTOMER-FACING QUOTE ║');
89
+ console.log('╚══════════════════════════════════════════════════════════╝');
90
+ console.log('');
91
+ for (const li of result.line_items) {
92
+ console.log(` ${li.garment_type}`);
93
+ console.log(` ${li.brand_sku} — ${li.color}`);
94
+ console.log(` Method: ${formatMethod(li.decoration_method)}`);
95
+ if (li.placements.length > 0) {
96
+ console.log(` Placements:`);
97
+ for (const p of li.placements) {
98
+ let detail = p.location;
99
+ if (p.color_count != null)
100
+ detail += ` (${p.color_count} color${p.color_count > 1 ? 's' : ''})`;
101
+ if (p.stitch_count != null)
102
+ detail += ` (${p.stitch_count.toLocaleString()} stitches)`;
103
+ console.log(` - ${detail}`);
104
+ }
105
+ }
106
+ console.log('');
107
+ const cf = li.customer_facing;
108
+ console.log(` ${cf.standard_sizes.label}`);
109
+ console.log(` Qty: ${cf.standard_sizes.quantity} Unit Price: $${cf.standard_sizes.unit_price.toFixed(2)} Line Total: $${cf.standard_sizes.line_total.toFixed(2)}`);
110
+ if (cf.oversized) {
111
+ console.log(` ${cf.oversized.label}`);
112
+ console.log(` Qty: ${cf.oversized.quantity} Unit Price: $${cf.oversized.unit_price.toFixed(2)} Line Total: $${cf.oversized.line_total.toFixed(2)}`);
113
+ }
114
+ console.log('');
115
+ console.log(` ${THIN}`);
116
+ }
117
+ // Additional charges
118
+ const additionalCharges = [];
119
+ if (result.separate_charges.digitizing) {
120
+ additionalCharges.push({ desc: 'Digitizing', amount: $(result.separate_charges.digitizing.customer_price) });
121
+ }
122
+ additionalCharges.push({ desc: 'Shipping', amount: $(result.separate_charges.shipping.customer_price) });
123
+ if (additionalCharges.length > 0) {
124
+ console.log('');
125
+ console.log(' Additional Charges:');
126
+ for (const ch of additionalCharges) {
127
+ console.log(` ${ch.desc.padEnd(30)} ${ch.amount}`);
128
+ }
129
+ }
130
+ console.log('');
131
+ console.log(` ${'ORDER TOTAL'.padEnd(30)} ${$(result.order_summary.total_customer_price)}`);
132
+ console.log('');
133
+ // ─── Internal audit ───
134
+ console.log(SEP);
135
+ console.log('');
136
+ console.log('╔══════════════════════════════════════════════════════════╗');
137
+ console.log('║ INTERNAL AUDIT BREAKDOWN ║');
138
+ console.log('╚══════════════════════════════════════════════════════════╝');
139
+ console.log('');
140
+ for (const li of result.line_items) {
141
+ console.log(` ${li.brand_sku} — ${li.garment_type} (${li.decoration_method})`);
142
+ const totalQty = li.quantity + (li.oversized_quantity ?? 0);
143
+ console.log(` Quantity: ${totalQty}${li.oversized_quantity ? ` (${li.quantity} std + ${li.oversized_quantity} oversized)` : ''}`);
144
+ if (li.blanks_supplier) {
145
+ console.log(` Blanks Supplier: ${li.blanks_supplier}`);
146
+ }
147
+ if (li.decoration_vendors && li.decoration_vendors.length > 0) {
148
+ console.log(` Decoration Vendor${li.decoration_vendors.length > 1 ? 's' : ''}: ${li.decoration_vendors.join(', ')}`);
149
+ }
150
+ console.log('');
151
+ printCostRow('Blanks', li.cost_breakdown.blanks);
152
+ printCostRow('Decoration', li.cost_breakdown.decoration);
153
+ if (li.cost_breakdown.screen_setup) {
154
+ printCostRow('Screen Setup', li.cost_breakdown.screen_setup);
155
+ }
156
+ console.log('');
157
+ console.log(` ${'Est. Cost'.padEnd(18)} ${$(li.line_total_estimated_cost)}`);
158
+ console.log(` ${'Customer Price'.padEnd(18)} ${$(li.line_total_customer_price)}`);
159
+ console.log(` ${THIN}`);
160
+ }
161
+ // Separate charges
162
+ if (result.separate_charges.digitizing) {
163
+ const d = result.separate_charges.digitizing;
164
+ console.log(` Digitizing`);
165
+ console.log(` Cost: ${$(d.estimated_cost)} ×${d.multiplier.toFixed(2)} → ${$(d.customer_price)}`);
166
+ }
167
+ const s = result.separate_charges.shipping;
168
+ console.log(` Shipping`);
169
+ console.log(` Cost: ${$(s.estimated_cost)} ×${s.multiplier.toFixed(2)} → ${$(s.customer_price)}`);
170
+ // Order summary
171
+ console.log('');
172
+ console.log(` ${SEP}`);
173
+ console.log(' ORDER SUMMARY');
174
+ console.log(` ${THIN}`);
175
+ console.log(` ${'Total Customer Price'.padEnd(28)} ${$(result.order_summary.total_customer_price)}`);
176
+ console.log(` ${'Total Estimated Cost'.padEnd(28)} ${$(result.order_summary.total_estimated_cost)}`);
177
+ console.log(` ${'Est. Processing Fee'.padEnd(28)} ${$(result.order_summary.estimated_processing_fee)}`);
178
+ console.log(` ${'True Net Revenue'.padEnd(28)} ${$(result.order_summary.true_net_revenue)}`);
179
+ console.log(` ${'Gross Margin'.padEnd(28)} ${result.order_summary.gross_margin_percent.toFixed(1)}%`);
180
+ console.log(` ${'Net Margin'.padEnd(28)} ${result.order_summary.net_margin_percent.toFixed(1)}%`);
181
+ console.log('');
182
+ // Multipliers used
183
+ console.log(` Multipliers: blanks=${result.multipliers_used.blanks} decoration=${result.multipliers_used.decoration[result.line_items[0].decoration_method]} setup=${result.multipliers_used.setup_fees.screen_setup} shipping=${result.multipliers_used.shipping}`);
184
+ console.log('');
185
+ // ─── Helpers ───
186
+ function printCostRow(label, comp) {
187
+ console.log(` ${label.padEnd(16)} ${$(comp.estimated_cost).padEnd(10)} ×${comp.multiplier.toFixed(2)} → ${$(comp.marked_up)}`);
188
+ }
189
+ function formatMethod(method) {
190
+ return method.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');
191
+ }
192
+ //# sourceMappingURL=cli.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CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACtI,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,224 @@
1
+ import { z } from 'zod';
2
+ import type { PricingConfig, OrderInput } from './types';
3
+ declare const PriceTierSchema: z.ZodObject<{
4
+ avg: z.ZodNumber;
5
+ min: z.ZodNumber;
6
+ max: z.ZodNumber;
7
+ count: z.ZodNumber;
8
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
9
+ }, z.core.$strip>;
10
+ declare const DtfVendorDetailSchema: z.ZodObject<{
11
+ transfer_cents: z.ZodNumber;
12
+ application_cents: z.ZodNumber;
13
+ total_cents: z.ZodNumber;
14
+ application_included: z.ZodBoolean;
15
+ }, z.core.$strip>;
16
+ declare const DtfPriceTierSchema: z.ZodObject<{
17
+ avg: z.ZodNumber;
18
+ min: z.ZodNumber;
19
+ max: z.ZodNumber;
20
+ count: z.ZodNumber;
21
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
22
+ transfer_cents: z.ZodNumber;
23
+ application_cents: z.ZodNumber;
24
+ total_cents: z.ZodNumber;
25
+ application_included: z.ZodBoolean;
26
+ }, z.core.$strip>>>;
27
+ }, z.core.$strip>;
28
+ declare const VendorPricingSchema: z.ZodObject<{
29
+ generated: z.ZodString;
30
+ version: z.ZodNumber;
31
+ description: z.ZodOptional<z.ZodString>;
32
+ methods: z.ZodObject<{
33
+ embroidery: z.ZodUnion<readonly [z.ZodObject<{
34
+ status: z.ZodLiteral<"active">;
35
+ vendor_count: z.ZodNumber;
36
+ vendors: z.ZodArray<z.ZodString>;
37
+ reference_quantities: z.ZodArray<z.ZodNumber>;
38
+ stitch_levels: z.ZodArray<z.ZodNumber>;
39
+ per_piece_cents: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
40
+ avg: z.ZodNumber;
41
+ min: z.ZodNumber;
42
+ max: z.ZodNumber;
43
+ count: z.ZodNumber;
44
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
45
+ }, z.core.$strip>>>;
46
+ setup_fees: z.ZodObject<{}, z.core.$loose>;
47
+ notes: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ status: z.ZodLiteral<"pending">;
50
+ vendor_count: z.ZodNumber;
51
+ notes: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>]>;
53
+ screen_printing: z.ZodUnion<readonly [z.ZodObject<{
54
+ status: z.ZodLiteral<"active">;
55
+ vendor_count: z.ZodNumber;
56
+ vendors: z.ZodArray<z.ZodString>;
57
+ reference_quantities: z.ZodArray<z.ZodNumber>;
58
+ color_levels: z.ZodArray<z.ZodNumber>;
59
+ per_piece_cents: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
60
+ avg: z.ZodNumber;
61
+ min: z.ZodNumber;
62
+ max: z.ZodNumber;
63
+ count: z.ZodNumber;
64
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
65
+ }, z.core.$strip>>>;
66
+ garment_multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
67
+ avg: z.ZodNumber;
68
+ min: z.ZodNumber;
69
+ max: z.ZodNumber;
70
+ count: z.ZodNumber;
71
+ }, z.core.$strip>>>;
72
+ dark_garment_rule: z.ZodOptional<z.ZodString>;
73
+ setup_fees: z.ZodObject<{}, z.core.$loose>;
74
+ notes: z.ZodOptional<z.ZodString>;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ status: z.ZodLiteral<"pending">;
77
+ vendor_count: z.ZodNumber;
78
+ notes: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strip>]>;
80
+ sublimation: z.ZodUnion<readonly [z.ZodObject<{
81
+ status: z.ZodLiteral<"active">;
82
+ vendor_count: z.ZodNumber;
83
+ vendors: z.ZodArray<z.ZodString>;
84
+ pricing_model: z.ZodString;
85
+ products: z.ZodRecord<z.ZodString, z.ZodObject<{
86
+ description: z.ZodString;
87
+ vendor_supplied_garment: z.ZodBoolean;
88
+ avg: z.ZodNumber;
89
+ min: z.ZodNumber;
90
+ max: z.ZodNumber;
91
+ count: z.ZodNumber;
92
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
93
+ }, z.core.$strip>>;
94
+ bulk_discounts: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
95
+ notes: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ status: z.ZodLiteral<"pending">;
98
+ vendor_count: z.ZodNumber;
99
+ notes: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strip>]>;
101
+ dtg: z.ZodUnion<readonly [z.ZodObject<{
102
+ status: z.ZodLiteral<"active">;
103
+ vendor_count: z.ZodNumber;
104
+ vendors: z.ZodArray<z.ZodString>;
105
+ reference_quantities: z.ZodArray<z.ZodNumber>;
106
+ sqin_levels: z.ZodArray<z.ZodNumber>;
107
+ ink_modes: z.ZodArray<z.ZodString>;
108
+ per_piece_cents: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
109
+ avg: z.ZodNumber;
110
+ min: z.ZodNumber;
111
+ max: z.ZodNumber;
112
+ count: z.ZodNumber;
113
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
114
+ }, z.core.$strip>>>>;
115
+ setup_fees: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{}, z.core.$loose>, z.ZodArray<z.ZodObject<{}, z.core.$loose>>]>>;
116
+ notes: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ status: z.ZodLiteral<"pending">;
119
+ vendor_count: z.ZodNumber;
120
+ notes: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strip>]>;
122
+ dtf: z.ZodUnion<readonly [z.ZodObject<{
123
+ status: z.ZodLiteral<"active">;
124
+ vendor_count: z.ZodNumber;
125
+ vendors: z.ZodArray<z.ZodString>;
126
+ reference_quantities: z.ZodArray<z.ZodNumber>;
127
+ sqin_levels: z.ZodArray<z.ZodNumber>;
128
+ per_piece_cents: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
129
+ avg: z.ZodNumber;
130
+ min: z.ZodNumber;
131
+ max: z.ZodNumber;
132
+ count: z.ZodNumber;
133
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
134
+ transfer_cents: z.ZodNumber;
135
+ application_cents: z.ZodNumber;
136
+ total_cents: z.ZodNumber;
137
+ application_included: z.ZodBoolean;
138
+ }, z.core.$strip>>>;
139
+ }, z.core.$strip>>>;
140
+ setup_fees: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
141
+ notes: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$strip>, z.ZodObject<{
143
+ status: z.ZodLiteral<"pending">;
144
+ vendor_count: z.ZodNumber;
145
+ notes: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strip>]>;
147
+ screen_print_transfers: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
148
+ status: z.ZodLiteral<"active">;
149
+ vendor_count: z.ZodNumber;
150
+ vendors: z.ZodArray<z.ZodString>;
151
+ reference_quantities: z.ZodArray<z.ZodNumber>;
152
+ color_levels: z.ZodArray<z.ZodNumber>;
153
+ per_piece_cents: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
154
+ avg: z.ZodNumber;
155
+ min: z.ZodNumber;
156
+ max: z.ZodNumber;
157
+ count: z.ZodNumber;
158
+ vendors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
159
+ }, z.core.$strip>>>;
160
+ setup_fees: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
161
+ notes: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ status: z.ZodLiteral<"pending">;
164
+ vendor_count: z.ZodNumber;
165
+ notes: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$strip>]>>;
167
+ }, z.core.$strip>;
168
+ }, z.core.$strip>;
169
+ declare const BlanksPricingSchema: z.ZodObject<{
170
+ generated: z.ZodString;
171
+ version: z.ZodNumber;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ suppliers: z.ZodArray<z.ZodString>;
174
+ style_count: z.ZodOptional<z.ZodNumber>;
175
+ styles: z.ZodRecord<z.ZodString, z.ZodObject<{
176
+ brand: z.ZodString;
177
+ brand_display: z.ZodString;
178
+ style_number: z.ZodString;
179
+ garment_type: z.ZodString;
180
+ description: z.ZodOptional<z.ZodString>;
181
+ suppliers: z.ZodRecord<z.ZodString, z.ZodObject<{
182
+ supplier_sku: z.ZodString;
183
+ last_updated: z.ZodString;
184
+ }, z.core.$strip>>;
185
+ colors: z.ZodRecord<z.ZodString, z.ZodObject<{
186
+ display_name: z.ZodOptional<z.ZodString>;
187
+ sizes: z.ZodRecord<z.ZodString, z.ZodObject<{
188
+ price_cents: z.ZodNumber;
189
+ supplier: z.ZodString;
190
+ }, z.core.$strip>>;
191
+ }, z.core.$strip>>;
192
+ standard_sizes: z.ZodArray<z.ZodString>;
193
+ oversized_sizes: z.ZodArray<z.ZodString>;
194
+ }, z.core.$strip>>;
195
+ }, z.core.$strip>;
196
+ export type VendorPricingData = z.infer<typeof VendorPricingSchema>;
197
+ export type PriceTier = z.infer<typeof PriceTierSchema>;
198
+ export type DtfVendorDetail = z.infer<typeof DtfVendorDetailSchema>;
199
+ export type DtfPriceTier = z.infer<typeof DtfPriceTierSchema>;
200
+ export type BlanksPricingData = z.infer<typeof BlanksPricingSchema>;
201
+ /**
202
+ * Load and validate pricing-config.json.
203
+ * @param configPath - Absolute or relative path to the config file.
204
+ * Defaults to `<package-root>/config/pricing-config.json` (resolved via __dirname).
205
+ */
206
+ export declare function loadPricingConfig(configPath?: string): PricingConfig;
207
+ /**
208
+ * Load and validate the vendor pricing JSON.
209
+ * @param vendorPricingPath - Absolute or relative path to the vendor pricing file.
210
+ * Defaults to `<project-root>/config/vendor-pricing.json`.
211
+ */
212
+ export declare function loadVendorPricing(vendorPricingPath?: string): VendorPricingData;
213
+ /**
214
+ * Load and validate the blanks pricing JSON.
215
+ * @param blanksPricingPath - Absolute or relative path to the blanks pricing file.
216
+ * Defaults to `<project-root>/config/blanks-pricing.json`.
217
+ */
218
+ export declare function loadBlanksPricing(blanksPricingPath?: string): BlanksPricingData;
219
+ /**
220
+ * Validate an order input object. Throws with field-level errors if invalid.
221
+ */
222
+ export declare function validateOrderInput(order: unknown): OrderInput;
223
+ export {};
224
+ //# sourceMappingURL=config.d.ts.map