@eric-emg/symphiq-components 1.2.210 → 1.2.211

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,13 @@ 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)
54712
- return 'ahead';
54713
- if (actualGrowth >= targetGrowth * 0.95)
54714
- return 'on-pace';
54715
- return 'behind';
54716
- }
54717
- if (currentValue >= priorValue * 1.05)
54707
+ function calculatePacingStatus(projectedValue, targetValue) {
54708
+ if (targetValue <= 0)
54709
+ return 'on-pace';
54710
+ const pacingPercent = ((projectedValue - targetValue) / targetValue) * 100;
54711
+ if (pacingPercent >= 5)
54718
54712
  return 'ahead';
54719
- if (currentValue >= priorValue * 0.95)
54713
+ if (pacingPercent >= -5)
54720
54714
  return 'on-pace';
54721
54715
  return 'behind';
54722
54716
  }
@@ -54807,22 +54801,13 @@ function getPacingDisplayInfo(pacingPercentage, status, isDark) {
54807
54801
  displayText
54808
54802
  };
54809
54803
  }
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);
54804
+ function calculateMetricPacing(projectedValue, targetValue) {
54805
+ console.group(`[PACING] calculateMetricPacing`);
54806
+ console.log('[PACING] Input:', { projectedValue, targetValue });
54807
+ const pacingPercentage = targetValue > 0
54808
+ ? ((projectedValue - targetValue) / targetValue) * 100
54809
+ : 0;
54810
+ const status = calculatePacingStatus(projectedValue, targetValue);
54826
54811
  console.log('[PACING] Result:', { pacingPercentage, status, projectedValue });
54827
54812
  console.groupEnd();
54828
54813
  return {
@@ -54831,66 +54816,29 @@ function calculateMetricPacing(metric) {
54831
54816
  projectedValue
54832
54817
  };
54833
54818
  }
54834
- function extractMetricPacing(pacingResponse, metricEnum) {
54835
- console.group(`[PACING] extractMetricPacing for ${metricEnum}`);
54819
+ function extractProjectedValue(pacingResponse, metricEnum) {
54820
+ console.group(`[PACING] extractProjectedValue for ${metricEnum}`);
54836
54821
  if (!pacingResponse) {
54837
54822
  console.log('[PACING] No pacingResponse provided - returning null');
54838
54823
  console.groupEnd();
54839
54824
  return null;
54840
54825
  }
54826
+ const resp = pacingResponse;
54841
54827
  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 }))
54828
+ hasProjectedMetricValues: !!resp.projectedMetricValues,
54829
+ projectedMetricValuesCount: resp.projectedMetricValues?.length ?? 0
54860
54830
  });
54861
- if (!soFarMetric && !projectedMetric) {
54862
- console.log('[PACING] No soFarMetric and no projectedMetric found - returning null');
54831
+ const projectedMetric = resp.projectedMetricValues?.find((m) => m.metric === metricEnum);
54832
+ console.log('[PACING] Found projectedMetric for', metricEnum, ':', projectedMetric ? { metric: projectedMetric.metric, value: projectedMetric.value } : null);
54833
+ if (!projectedMetric?.value) {
54834
+ console.log('[PACING] No projectedMetric found - returning null');
54863
54835
  console.groupEnd();
54864
54836
  return null;
54865
54837
  }
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);
54838
+ const projectedValue = parseFloat(projectedMetric.value);
54839
+ console.log('[PACING] Returning projectedValue:', projectedValue);
54892
54840
  console.groupEnd();
54893
- return result;
54841
+ return projectedValue;
54894
54842
  }
54895
54843
 
54896
54844
  class PacingStatusBadgeComponent {
@@ -55063,7 +55011,7 @@ function FunnelMetricsVisualizationComponent_For_4_Conditional_23_For_6_Template
55063
55011
  i0.ɵɵadvance();
55064
55012
  i0.ɵɵproperty("ngClass", ctx_r1.relatedPercentageBadgeClasses());
55065
55013
  i0.ɵɵadvance();
55066
- i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(metric_r3.calc.metric), "", ctx_r1.formatPercentage(metric_r3.calc.percentageIncrease, 1), " ");
55014
+ i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(metric_r3.calc.metric), "", ctx_r1.formatPercentage(ctx_r1.Math.abs(metric_r3.calc.percentageIncrease), 1), " ");
55067
55015
  i0.ɵɵadvance();
55068
55016
  i0.ɵɵproperty("ngClass", metric_r3.pacingInfo ? "grid-cols-3" : "grid-cols-2");
55069
55017
  i0.ɵɵadvance(2);
@@ -55135,7 +55083,7 @@ function FunnelMetricsVisualizationComponent_For_4_Template(rf, ctx) { if (rf &
55135
55083
  i0.ɵɵadvance();
55136
55084
  i0.ɵɵproperty("ngClass", ctx_r1.percentageBadgeClasses());
55137
55085
  i0.ɵɵadvance();
55138
- i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(stage_r1.stageMetric.metric), "", ctx_r1.formatPercentage(stage_r1.stageMetric.percentageIncrease, 1), " ");
55086
+ i0.ɵɵtextInterpolate2(" ", ctx_r1.getGrowthSign(stage_r1.stageMetric.metric), "", ctx_r1.formatPercentage(ctx_r1.Math.abs(stage_r1.stageMetric.percentageIncrease), 1), " ");
55139
55087
  i0.ɵɵadvance(3);
55140
55088
  i0.ɵɵproperty("ngClass", ctx_r1.labelClasses());
55141
55089
  i0.ɵɵadvance();
@@ -55162,6 +55110,7 @@ class FunnelMetricsVisualizationComponent {
55162
55110
  this.viewMode = input(ViewModeEnum.LIGHT, ...(ngDevMode ? [{ debugName: "viewMode" }] : []));
55163
55111
  this.calculations = input([], ...(ngDevMode ? [{ debugName: "calculations" }] : []));
55164
55112
  this.pacingMetrics = input(undefined, ...(ngDevMode ? [{ debugName: "pacingMetrics" }] : []));
55113
+ this.Math = Math;
55165
55114
  this.currentYear = computed(() => new Date().getFullYear(), ...(ngDevMode ? [{ debugName: "currentYear" }] : []));
55166
55115
  this.priorYear = computed(() => new Date().getFullYear() - 1, ...(ngDevMode ? [{ debugName: "priorYear" }] : []));
55167
55116
  this.funnelStages = computed(() => {
@@ -55183,13 +55132,17 @@ class FunnelMetricsVisualizationComponent {
55183
55132
  stageMetrics.forEach(stageMetric => {
55184
55133
  const related = relatedMetrics.filter(rm => rm.funnelMetric === stageMetric.metric);
55185
55134
  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;
55135
+ const stageProjectedValue = extractProjectedValue(pacingResponse, stageMetric.metric);
55136
+ console.log(`[PACING] stageProjectedValue for ${stageMetric.metric}:`, stageProjectedValue);
55137
+ const stagePacingInfo = stageProjectedValue !== null
55138
+ ? calculateMetricPacing(stageProjectedValue, stageMetric.targetValue)
55139
+ : null;
55189
55140
  console.log(`[PACING] stagePacingInfo for ${stageMetric.metric}:`, stagePacingInfo);
55190
55141
  const relatedWithPacing = related.map(relMetric => {
55191
- const relPacingMetric = extractMetricPacing(pacingResponse, relMetric.metric);
55192
- const relPacingInfo = relPacingMetric ? calculateMetricPacing(relPacingMetric) : null;
55142
+ const relProjectedValue = extractProjectedValue(pacingResponse, relMetric.metric);
55143
+ const relPacingInfo = relProjectedValue !== null
55144
+ ? calculateMetricPacing(relProjectedValue, relMetric.targetValue)
55145
+ : null;
55193
55146
  return { calc: relMetric, pacingInfo: relPacingInfo };
55194
55147
  });
55195
55148
  grouped.set(stageMetric.metric, {
@@ -55368,7 +55321,7 @@ class FunnelMetricsVisualizationComponent {
55368
55321
  />
55369
55322
  }
55370
55323
  <div [ngClass]="percentageBadgeClasses()" class="px-4 py-2 rounded-lg font-bold text-sm">
55371
- {{ getGrowthSign(stage.stageMetric.metric) }}{{ formatPercentage(stage.stageMetric.percentageIncrease, 1) }}
55324
+ {{ getGrowthSign(stage.stageMetric.metric) }}{{ formatPercentage(Math.abs(stage.stageMetric.percentageIncrease), 1) }}
55372
55325
  </div>
55373
55326
  </div>
55374
55327
  </div>
@@ -55440,7 +55393,7 @@ class FunnelMetricsVisualizationComponent {
55440
55393
  />
55441
55394
  }
55442
55395
  <span [ngClass]="relatedPercentageBadgeClasses()" class="px-2 py-1 rounded text-xs font-bold">
55443
- {{ getGrowthSign(metric.calc.metric) }}{{ formatPercentage(metric.calc.percentageIncrease, 1) }}
55396
+ {{ getGrowthSign(metric.calc.metric) }}{{ formatPercentage(Math.abs(metric.calc.percentageIncrease), 1) }}
55444
55397
  </span>
55445
55398
  </div>
55446
55399
  </div>