All files / marketing-platform/presentation/utils getPromotionDisplayInfo.ts

100% Statements 11/11
100% Branches 12/12
100% Functions 1/1
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49      1x     4x 4x 4x   4x 1x                 3x 1x                 2x 1x                 1x                
import type { PromotionApplication } from "../../domain";
import type { PromotionTypeInfo } from "../components";
 
export const getPromotionDisplayInfo = (
  application: PromotionApplication
): PromotionTypeInfo => {
  const promotion = application.getPromotion();
  const promotionType = promotion.getPromotionType();
  const distributionType = promotion.getDistributionType();
 
  if (promotionType === "POINT_PROMOTION" && distributionType === "NA") {
    return {
      type: "Point Promotion",
      bgColor: "bg-gradient-to-br from-blue-50 to-cyan-50",
      borderColor: "border-blue-400",
      badgeColor: "bg-gradient-to-r from-blue-500 to-cyan-600",
      icon: "💎",
    };
  }
 
  if (promotionType === "POINT_COUPON" && distributionType === "DOWNLOAD") {
    return {
      type: "Download Coupon",
      bgColor: "bg-gradient-to-br from-green-50 to-emerald-50",
      borderColor: "border-green-400",
      badgeColor: "bg-gradient-to-r from-green-500 to-emerald-600",
      icon: "🎫",
    };
  }
 
  if (promotionType === "POINT_COUPON" && distributionType === "REWARD") {
    return {
      type: "Reward",
      bgColor: "bg-gradient-to-br from-purple-50 to-violet-50",
      borderColor: "border-purple-400",
      badgeColor: "bg-gradient-to-r from-purple-500 to-violet-600",
      icon: "🎁",
    };
  }
 
  return {
    type: "Unknown",
    bgColor: "bg-gradient-to-br from-gray-50 to-slate-50",
    borderColor: "border-gray-400",
    badgeColor: "bg-gradient-to-r from-gray-500 to-slate-600",
    icon: "📋",
  };
};