@eric-emg/symphiq-components 1.2.210 → 1.2.212

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.
@@ -54704,19 +54704,20 @@ class RevenueCalculatorWelcomeBannerComponent {
54704
54704
  }], null, { viewMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewMode", required: false }] }], dataLoadStatus: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataLoadStatus", required: false }] }], hasTargets: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasTargets", required: false }] }] }); })();
54705
54705
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RevenueCalculatorWelcomeBannerComponent, { className: "RevenueCalculatorWelcomeBannerComponent", filePath: "lib/components/revenue-calculator-dashboard/revenue-calculator-welcome-banner.component.ts", lineNumber: 85 }); })();
54706
54706
 
54707
- function calculatePacingStatus(currentValue, priorValue, targetValue) {
54708
- if (targetValue !== undefined && targetValue > 0) {
54709
- const targetGrowth = ((targetValue - priorValue) / priorValue) * 100;
54710
- const actualGrowth = ((currentValue - priorValue) / priorValue) * 100;
54711
- if (actualGrowth >= targetGrowth * 1.05)
54707
+ function calculatePacingStatus(projectedValue, targetValue, increaseBad = false) {
54708
+ if (targetValue <= 0)
54709
+ return 'on-pace';
54710
+ const pacingPercent = ((projectedValue - targetValue) / targetValue) * 100;
54711
+ if (increaseBad) {
54712
+ if (pacingPercent <= -5)
54712
54713
  return 'ahead';
54713
- if (actualGrowth >= targetGrowth * 0.95)
54714
+ if (pacingPercent <= 5)
54714
54715
  return 'on-pace';
54715
54716
  return 'behind';
54716
54717
  }
54717
- if (currentValue >= priorValue * 1.05)
54718
+ if (pacingPercent >= 5)
54718
54719
  return 'ahead';
54719
- if (currentValue >= priorValue * 0.95)
54720
+ if (pacingPercent >= -5)
54720
54721
  return 'on-pace';
54721
54722
  return 'behind';
54722
54723
  }
@@ -54807,22 +54808,16 @@ function getPacingDisplayInfo(pacingPercentage, status, isDark) {
54807
54808
  displayText
54808
54809
  };
54809
54810
  }
54810
- function calculateMetricPacing(metric) {
54811
- console.group(`[PACING] calculateMetricPacing for ${metric.metric}`);
54812
- console.log('[PACING] Input metric:', JSON.stringify(metric, null, 2));
54813
- const currentValue = metric.currentValue || 0;
54814
- const priorYtdValue = metric.priorYtdValue || 0;
54815
- const targetValue = metric.targetValue;
54816
- console.log('[PACING] Extracted values:', { currentValue, priorYtdValue, targetValue });
54817
- const calculatedPacingPct = priorYtdValue > 0 ? ((currentValue - priorYtdValue) / priorYtdValue) * 100 : 0;
54818
- const pacingPercentage = metric.pacingPercentage || calculatedPacingPct;
54819
- console.log('[PACING] Pacing calculation:', {
54820
- 'metric.pacingPercentage (pre-calculated)': metric.pacingPercentage,
54821
- 'calculatedPacingPct': calculatedPacingPct,
54822
- 'final pacingPercentage': pacingPercentage
54823
- });
54824
- const projectedValue = metric.projectedValue || currentValue;
54825
- const status = calculatePacingStatus(currentValue, priorYtdValue, targetValue);
54811
+ function calculateMetricPacing(projectedValue, targetValue, increaseBad = false) {
54812
+ console.group(`[PACING] calculateMetricPacing`);
54813
+ console.log('[PACING] Input:', { projectedValue, targetValue, increaseBad });
54814
+ let pacingPercentage = targetValue > 0
54815
+ ? ((projectedValue - targetValue) / targetValue) * 100
54816
+ : 0;
54817
+ if (increaseBad) {
54818
+ pacingPercentage = -pacingPercentage;
54819
+ }
54820
+ const status = calculatePacingStatus(projectedValue, targetValue, increaseBad);
54826
54821
  console.log('[PACING] Result:', { pacingPercentage, status, projectedValue });
54827
54822
  console.groupEnd();
54828
54823
  return {
@@ -54831,66 +54826,29 @@ function calculateMetricPacing(metric) {
54831
54826
  projectedValue
54832
54827
  };
54833
54828
  }
54834
- function extractMetricPacing(pacingResponse, metricEnum) {
54835
- console.group(`[PACING] extractMetricPacing for ${metricEnum}`);
54829
+ function extractProjectedValue(pacingResponse, metricEnum) {
54830
+ console.group(`[PACING] extractProjectedValue for ${metricEnum}`);
54836
54831
  if (!pacingResponse) {
54837
54832
  console.log('[PACING] No pacingResponse provided - returning null');
54838
54833
  console.groupEnd();
54839
54834
  return null;
54840
54835
  }
54836
+ const resp = pacingResponse;
54841
54837
  console.log('[PACING] pacingResponse structure:', {
54842
- hasSoFarMetricValues: !!pacingResponse.soFarMetricValues,
54843
- soFarMetricValuesCount: pacingResponse.soFarMetricValues?.length ?? 0,
54844
- soFarMetrics: pacingResponse.soFarMetricValues?.map(m => m.metric),
54845
- hasProjectedMetricValues: !!pacingResponse.projectedMetricValues,
54846
- projectedMetricValuesCount: pacingResponse.projectedMetricValues?.length ?? 0,
54847
- projectedMetrics: pacingResponse.projectedMetricValues?.map(m => m.metric),
54848
- hasLastYearMetricValuesMonthly: !!pacingResponse.lastYearMetricValuesMonthly,
54849
- lastYearMetricValuesMonthlyCount: pacingResponse.lastYearMetricValuesMonthly?.length ?? 0,
54850
- lastYearMetrics: [...new Set(pacingResponse.lastYearMetricValuesMonthly?.map(m => m.metric))]
54851
- });
54852
- const soFarMetric = pacingResponse.soFarMetricValues?.find(m => m.metric === metricEnum);
54853
- const projectedMetric = pacingResponse.projectedMetricValues?.find(m => m.metric === metricEnum);
54854
- const lastYearMetrics = pacingResponse.lastYearMetricValuesMonthly?.filter(m => m.metric === metricEnum) || [];
54855
- console.log('[PACING] Found metrics for', metricEnum, ':', {
54856
- soFarMetric: soFarMetric ? { metric: soFarMetric.metric, value: soFarMetric.value } : null,
54857
- projectedMetric: projectedMetric ? { metric: projectedMetric.metric, value: projectedMetric.value } : null,
54858
- lastYearMetricsCount: lastYearMetrics.length,
54859
- lastYearMetricsValues: lastYearMetrics.map(m => ({ metric: m.metric, value: m.value }))
54838
+ hasProjectedMetricValues: !!resp.projectedMetricValues,
54839
+ projectedMetricValuesCount: resp.projectedMetricValues?.length ?? 0
54860
54840
  });
54861
- if (!soFarMetric && !projectedMetric) {
54862
- console.log('[PACING] No soFarMetric and no projectedMetric found - returning null');
54841
+ const projectedMetric = resp.projectedMetricValues?.find((m) => m.metric === metricEnum);
54842
+ console.log('[PACING] Found projectedMetric for', metricEnum, ':', projectedMetric ? { metric: projectedMetric.metric, value: projectedMetric.value } : null);
54843
+ if (!projectedMetric?.value) {
54844
+ console.log('[PACING] No projectedMetric found - returning null');
54863
54845
  console.groupEnd();
54864
54846
  return null;
54865
54847
  }
54866
- const currentValue = soFarMetric?.value ? parseFloat(soFarMetric.value) : 0;
54867
- const projectedValue = projectedMetric?.value ? parseFloat(projectedMetric.value) : 0;
54868
- const priorYtdValue = lastYearMetrics.reduce((sum, m) => {
54869
- return sum + (m.value ? parseFloat(m.value) : 0);
54870
- }, 0);
54871
- console.log('[PACING] Calculated values:', {
54872
- currentValue,
54873
- projectedValue,
54874
- priorYtdValue,
54875
- 'priorYtdValue === 0': priorYtdValue === 0
54876
- });
54877
- if (priorYtdValue === 0) {
54878
- console.log('[PACING] priorYtdValue is 0 - returning null (no prior year data to compare)');
54879
- console.groupEnd();
54880
- return null;
54881
- }
54882
- const pacingPercentage = ((currentValue - priorYtdValue) / priorYtdValue) * 100;
54883
- const result = {
54884
- metric: metricEnum,
54885
- currentValue,
54886
- priorYtdValue,
54887
- projectedValue,
54888
- pacingPercentage,
54889
- ytdVariancePercent: pacingPercentage
54890
- };
54891
- console.log('[PACING] Returning PerformanceMetricInterface:', result);
54848
+ const projectedValue = parseFloat(projectedMetric.value);
54849
+ console.log('[PACING] Returning projectedValue:', projectedValue);
54892
54850
  console.groupEnd();
54893
- return result;
54851
+ return projectedValue;
54894
54852
  }
54895
54853
 
54896
54854
  class PacingStatusBadgeComponent {
@@ -55063,7 +55021,7 @@ function FunnelMetricsVisualizationComponent_For_4_Conditional_23_For_6_Template
55063
55021
  i0.ɵɵadvance();
55064
55022
  i0.ɵɵproperty("ngClass", ctx_r1.relatedPercentageBadgeClasses());
55065
55023
  i0.ɵɵadvance();
55066
- i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(metric_r3.calc.metric), "", ctx_r1.formatPercentage(metric_r3.calc.percentageIncrease, 1), " ");
55024
+ i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(metric_r3.calc.metric), "", ctx_r1.formatPercentage(ctx_r1.Math.abs(metric_r3.calc.percentageIncrease), 1), " ");
55067
55025
  i0.ɵɵadvance();
55068
55026
  i0.ɵɵproperty("ngClass", metric_r3.pacingInfo ? "grid-cols-3" : "grid-cols-2");
55069
55027
  i0.ɵɵadvance(2);
@@ -55075,7 +55033,7 @@ function FunnelMetricsVisualizationComponent_For_4_Conditional_23_For_6_Template
55075
55033
  i0.ɵɵadvance(2);
55076
55034
  i0.ɵɵproperty("ngClass", ctx_r1.relatedLabelClasses());
55077
55035
  i0.ɵɵadvance();
55078
- i0.ɵɵtextInterpolate1("Target: ", ctx_r1.formatMetricValue(metric_r3.calc.targetValue, metric_r3.calc.metric));
55036
+ i0.ɵɵtextInterpolate1("Target: ", ctx_r1.formatMetricValue(metric_r3.calc.targetValue, metric_r3.calc.metric, false));
55079
55037
  } }
55080
55038
  function FunnelMetricsVisualizationComponent_For_4_Conditional_23_Template(rf, ctx) { if (rf & 1) {
55081
55039
  i0.ɵɵelement(0, "div", 16);
@@ -55135,7 +55093,7 @@ function FunnelMetricsVisualizationComponent_For_4_Template(rf, ctx) { if (rf &
55135
55093
  i0.ɵɵadvance();
55136
55094
  i0.ɵɵproperty("ngClass", ctx_r1.percentageBadgeClasses());
55137
55095
  i0.ɵɵadvance();
55138
- i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(stage_r1.stageMetric.metric), "", ctx_r1.formatPercentage(stage_r1.stageMetric.percentageIncrease, 1), " ");
55096
+ i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(stage_r1.stageMetric.metric), "", ctx_r1.formatPercentage(ctx_r1.Math.abs(stage_r1.stageMetric.percentageIncrease), 1), " ");
55139
55097
  i0.ɵɵadvance(3);
55140
55098
  i0.ɵɵproperty("ngClass", ctx_r1.labelClasses());
55141
55099
  i0.ɵɵadvance();
@@ -55153,7 +55111,7 @@ function FunnelMetricsVisualizationComponent_For_4_Template(rf, ctx) { if (rf &
55153
55111
  i0.ɵɵadvance();
55154
55112
  i0.ɵɵproperty("ngClass", ctx_r1.targetValueClasses());
55155
55113
  i0.ɵɵadvance();
55156
- i0.ɵɵtextInterpolate1(" ", ctx_r1.formatMetricValue(stage_r1.stageMetric.targetValue, stage_r1.stageMetric.metric), " ");
55114
+ i0.ɵɵtextInterpolate1(" ", ctx_r1.formatMetricValue(stage_r1.stageMetric.targetValue, stage_r1.stageMetric.metric, false), " ");
55157
55115
  i0.ɵɵadvance();
55158
55116
  i0.ɵɵconditional(stage_r1.relatedMetrics.length > 0 ? 23 : -1);
55159
55117
  } }
@@ -55162,6 +55120,7 @@ class FunnelMetricsVisualizationComponent {
55162
55120
  this.viewMode = input(ViewModeEnum.LIGHT, ...(ngDevMode ? [{ debugName: "viewMode" }] : []));
55163
55121
  this.calculations = input([], ...(ngDevMode ? [{ debugName: "calculations" }] : []));
55164
55122
  this.pacingMetrics = input(undefined, ...(ngDevMode ? [{ debugName: "pacingMetrics" }] : []));
55123
+ this.Math = Math;
55165
55124
  this.currentYear = computed(() => new Date().getFullYear(), ...(ngDevMode ? [{ debugName: "currentYear" }] : []));
55166
55125
  this.priorYear = computed(() => new Date().getFullYear() - 1, ...(ngDevMode ? [{ debugName: "priorYear" }] : []));
55167
55126
  this.funnelStages = computed(() => {
@@ -55183,13 +55142,19 @@ class FunnelMetricsVisualizationComponent {
55183
55142
  stageMetrics.forEach(stageMetric => {
55184
55143
  const related = relatedMetrics.filter(rm => rm.funnelMetric === stageMetric.metric);
55185
55144
  console.log(`[PACING] Processing stage: ${stageMetric.metric}`);
55186
- const stagePacingMetric = extractMetricPacing(pacingResponse, stageMetric.metric);
55187
- console.log(`[PACING] stagePacingMetric for ${stageMetric.metric}:`, stagePacingMetric);
55188
- const stagePacingInfo = stagePacingMetric ? calculateMetricPacing(stagePacingMetric) : null;
55145
+ const stageProjectedValue = extractProjectedValue(pacingResponse, stageMetric.metric);
55146
+ console.log(`[PACING] stageProjectedValue for ${stageMetric.metric}:`, stageProjectedValue);
55147
+ const stageIncreaseBad = MetricEnumUtil.increaseBad(stageMetric.metric);
55148
+ const stagePacingInfo = stageProjectedValue !== null
55149
+ ? calculateMetricPacing(stageProjectedValue, stageMetric.targetValue, stageIncreaseBad)
55150
+ : null;
55189
55151
  console.log(`[PACING] stagePacingInfo for ${stageMetric.metric}:`, stagePacingInfo);
55190
55152
  const relatedWithPacing = related.map(relMetric => {
55191
- const relPacingMetric = extractMetricPacing(pacingResponse, relMetric.metric);
55192
- const relPacingInfo = relPacingMetric ? calculateMetricPacing(relPacingMetric) : null;
55153
+ const relProjectedValue = extractProjectedValue(pacingResponse, relMetric.metric);
55154
+ const relIncreaseBad = MetricEnumUtil.increaseBad(relMetric.metric);
55155
+ const relPacingInfo = relProjectedValue !== null
55156
+ ? calculateMetricPacing(relProjectedValue, relMetric.targetValue, relIncreaseBad)
55157
+ : null;
55193
55158
  return { calc: relMetric, pacingInfo: relPacingInfo };
55194
55159
  });
55195
55160
  grouped.set(stageMetric.metric, {
@@ -55368,7 +55333,7 @@ class FunnelMetricsVisualizationComponent {
55368
55333
  />
55369
55334
  }
55370
55335
  <div [ngClass]="percentageBadgeClasses()" class="px-4 py-2 rounded-lg font-bold text-sm">
55371
- {{ getGrowthSign(stage.stageMetric.metric) }}{{ formatPercentage(stage.stageMetric.percentageIncrease, 1) }}
55336
+ {{ getGrowthSign(stage.stageMetric.metric) }}{{ formatPercentage(Math.abs(stage.stageMetric.percentageIncrease), 1) }}
55372
55337
  </div>
55373
55338
  </div>
55374
55339
  </div>
@@ -55397,7 +55362,7 @@ class FunnelMetricsVisualizationComponent {
55397
55362
  {{ currentYear() }} Target
55398
55363
  </p>
55399
55364
  <p [ngClass]="targetValueClasses()" class="text-2xl font-bold">
55400
- {{ formatMetricValue(stage.stageMetric.targetValue, stage.stageMetric.metric) }}
55365
+ {{ formatMetricValue(stage.stageMetric.targetValue, stage.stageMetric.metric, false) }}
55401
55366
  </p>
55402
55367
  </div>
55403
55368
  </div>
@@ -55440,7 +55405,7 @@ class FunnelMetricsVisualizationComponent {
55440
55405
  />
55441
55406
  }
55442
55407
  <span [ngClass]="relatedPercentageBadgeClasses()" class="px-2 py-1 rounded text-xs font-bold">
55443
- {{ getGrowthSign(metric.calc.metric) }}{{ formatPercentage(metric.calc.percentageIncrease, 1) }}
55408
+ {{ getGrowthSign(metric.calc.metric) }}{{ formatPercentage(Math.abs(metric.calc.percentageIncrease), 1) }}
55444
55409
  </span>
55445
55410
  </div>
55446
55411
  </div>
@@ -55454,7 +55419,7 @@ class FunnelMetricsVisualizationComponent {
55454
55419
  </div>
55455
55420
  }
55456
55421
  <div>
55457
- <p [ngClass]="relatedLabelClasses()">Target: {{ formatMetricValue(metric.calc.targetValue, metric.calc.metric) }}</p>
55422
+ <p [ngClass]="relatedLabelClasses()">Target: {{ formatMetricValue(metric.calc.targetValue, metric.calc.metric, false) }}</p>
55458
55423
  </div>
55459
55424
  </div>
55460
55425
  </div>