{"_id":"@duabalabs/sellub-pricing","name":"@duabalabs/sellub-pricing","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@duabalabs/sellub-pricing","version":"1.0.0","description":"Central pricing, plan, attribution and commission engine for Sellub. Single source of truth consumed by sellub-server, sellub-dashboard and sellub-storefront.","license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json","test":"npm run build && node --test --experimental-strip-types src/__tests__/*.spec.ts","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.4.0"},"_id":"@duabalabs/sellub-pricing@1.0.0","gitHead":"302e016514e78cc0b97cf43e2cd2cf892e58978f","_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-6ZGdlMZ+2A96YBbaJYHZ2URM1cZYrhsz9mLm2FVYtQ+gACKW3VMUGDqTyBqDaQdLyUSMEkzIz3HM0IzWV3nPSg==","shasum":"03905789794b32f127aa28c8436563c9f100c1d5","tarball":"https://registry.npmjs.org/@duabalabs/sellub-pricing/-/sellub-pricing-1.0.0.tgz","fileCount":34,"unpackedSize":60519,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA0LQn6zIPq+uTdVNV730N6pVPn8hqzGCvTMJSyfn5BpAiBGKDW36VogqXOZtmCrxkI4PUS2pI+g+zskkuv5cekSCA=="}]},"_npmUser":{"name":"bobokeke","email":"duabalabs@gmail.com"},"directories":{},"maintainers":[{"name":"bobokeke","email":"duabalabs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sellub-pricing_1.0.0_1778437505148_0.5407075259099678"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-10T18:25:04.613Z","1.0.0":"2026-05-10T18:25:05.300Z","modified":"2026-05-10T18:25:05.502Z"},"maintainers":[{"name":"bobokeke","email":"duabalabs@gmail.com"}],"description":"Central pricing, plan, attribution and commission engine for Sellub. Single source of truth consumed by sellub-server, sellub-dashboard and sellub-storefront.","license":"MIT","readme":"# @duabalabs/sellub-pricing\n\nSingle source of truth for Sellub plans, attribution sources, commission rates, fees and add-on pricing. Consumed by `sellub-server`, `sellub-dashboard`, `sellub-storefront` and any external integration.\n\n**Do not hardcode plan names, prices, commission rates or attribution sources anywhere else.** Import from this package.\n\n## Quick reference\n\n```ts\nimport {\n  SellerPlan,\n  SellerPlanVariant,\n  AttributionSource,\n  resolveCommissionRate,\n  calculateOrderFees,\n  PLAN_CATALOG,\n  ADDONS,\n  formatMinor,\n} from \"@duabalabs/sellub-pricing\";\n\n// Plan catalog (used to render pricing pages, plan cards, dashboard widgets)\nPLAN_CATALOG[SellerPlan.MARKETPLACE].label;          // \"Sell on Sellub\"\nPLAN_CATALOG[SellerPlan.CUSTOM_DOMAIN].variants;     // [{starter, pro}, ...]\n\n// Commission rate for a single (plan, source) lookup\nresolveCommissionRate({\n  plan: SellerPlan.CUSTOM_DOMAIN,\n  variant: SellerPlanVariant.CUSTOM_DOMAIN_PRO,\n  source: AttributionSource.SELLER_DIRECT_DOMAIN,\n}).ratePercent; // 2\n\n// Full fee breakdown for an order (used at checkout AND persisted)\nconst breakdown = calculateOrderFees({\n  grossAmountPesewas: 100_000,\n  plan: SellerPlan.CUSTOM_DOMAIN,\n  variant: SellerPlanVariant.CUSTOM_DOMAIN_PRO,\n  source: AttributionSource.MARKETPLACE_HOMEPAGE,\n  paymentProcessingFeePesewas: 1_950,\n  sellerOverridePercent: null, // admin override; null = use catalog\n});\n```\n\n## The 3 plans\n\n| Plan | Direct commission | Marketplace-attributed | Monthly |\n|---|---|---|---|\n| `MARKETPLACE` | 5% | n/a (always direct) | Free |\n| `CUSTOM_DOMAIN` | 2–3% (Pro 2%, Starter 3%) | 4.5% | GHS 250–600 |\n| `COMMERCE_API` | 1–1.5% (Growth 1%, Developer 1.5%) | 3.5% | GHS 500 / 1500 / Enterprise |\n\n## Attribution rule\n\nCommission depends on `(sellerPlan, attributionSource)` — not plan alone. Attribution sources `marketplace_search`, `marketplace_homepage`, `marketplace_category`, `marketplace_recommendation` all bill at the marketplace-attributed rate. Everything else (seller-direct, external app/API, campaigns) bills at the direct rate.\n\n## Build & test\n\n```sh\nnpm install\nnpm run build\nnpm test\n```\n","readmeFilename":"README.md","_rev":"1-fdffa46cef7798e94082712a1f645495"}