fleetAudience.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. /**
  2. * Fleet-size audience split for the sponsor surfaces.
  3. *
  4. * An install with a large fleet is almost certainly a business (print farm,
  5. * workshop, makerspace), and a business has no use for a "chip in $5" ask — it
  6. * wants a support contract, an invoice and a named contact. The sponsor toast
  7. * and the Settings banner therefore swap their copy and CTA above this
  8. * threshold instead of showing the personal ask.
  9. *
  10. * Counts CONFIGURED printers, not active ones: `is_active` is the
  11. * maintenance-mode flag, so a farm with half its machines on the bench must not
  12. * flicker back to the hobbyist pitch.
  13. */
  14. export const BUSINESS_FLEET_THRESHOLD = 5;
  15. export type SponsorAudience = 'personal' | 'business';
  16. export function fleetAudience(printerCount: number): SponsorAudience {
  17. return printerCount >= BUSINESS_FLEET_THRESHOLD ? 'business' : 'personal';
  18. }
  19. /** Landing page for each audience, carrying the Matomo `?from=` attribution. */
  20. export function sponsorHref(audience: SponsorAudience, from: string): string {
  21. const page = audience === 'business' ? 'business.html' : 'sponsors.html';
  22. return `https://bambuddy.cool/${page}?from=${from}`;
  23. }