@eric-emg/symphiq-components 1.2.195 → 1.2.196
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.
- package/fesm2022/symphiq-components.mjs +27 -1
- package/fesm2022/symphiq-components.mjs.map +1 -1
- package/index.d.ts +22 -22
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3020,12 +3020,21 @@ function calculateMetricTargetsFromRevenueReverse(revenueTarget, priorYearRevenu
|
|
|
3020
3020
|
percentageIncrease = 0;
|
|
3021
3021
|
console.log(` Method: Derived Metric (no change)`);
|
|
3022
3022
|
}
|
|
3023
|
+
else if (isRateMetric(fm.relatedMetric)) {
|
|
3024
|
+
const stageTargetValue = stageTargets.get(funnelStage) || stageBaseline;
|
|
3025
|
+
const stageIncreaseRatio = stageBaseline > 0 ? stageTargetValue / stageBaseline : 1;
|
|
3026
|
+
targetValue = currentValue * stageIncreaseRatio;
|
|
3027
|
+
percentageIncrease = currentValue > 0 ? ((targetValue - currentValue) / currentValue) * 100 : 0;
|
|
3028
|
+
console.log(` Method: Rate Metric (proportional scaling)`);
|
|
3029
|
+
console.log(` Stage Increase Ratio: ${stageIncreaseRatio.toFixed(4)}`);
|
|
3030
|
+
}
|
|
3023
3031
|
else {
|
|
3024
3032
|
const ratioKey = `${fm.relatedMetric}_to_${funnelStage}`;
|
|
3025
3033
|
const impactRatio = relatedRatios.get(ratioKey) || 1;
|
|
3026
3034
|
const relatedMetrics = metrics.filter(m => m.relatedMetric &&
|
|
3027
3035
|
m.relatedMetric !== funnelStage &&
|
|
3028
3036
|
!isDerivedMetric(m.relatedMetric) &&
|
|
3037
|
+
!isRateMetric(m.relatedMetric) &&
|
|
3029
3038
|
m.relatedMetric !== MetricEnum.BOUNCE_RATE);
|
|
3030
3039
|
const numRelatedMetrics = relatedMetrics.length;
|
|
3031
3040
|
if (numRelatedMetrics > 0 && stageBaseline > 0) {
|
|
@@ -3101,11 +3110,28 @@ function calculateMetricTargetsFromRevenueReverse(revenueTarget, priorYearRevenu
|
|
|
3101
3110
|
const DERIVED_METRICS = new Set([
|
|
3102
3111
|
MetricEnum.REVENUE_PER_PRODUCT_VIEW,
|
|
3103
3112
|
MetricEnum.REVENUE_PER_ADD_TO_CART,
|
|
3104
|
-
MetricEnum.REVENUE_PER_CHECKOUT
|
|
3113
|
+
MetricEnum.REVENUE_PER_CHECKOUT,
|
|
3114
|
+
MetricEnum.AVERAGE_ORDER_VALUE
|
|
3115
|
+
]);
|
|
3116
|
+
const RATE_METRICS = new Set([
|
|
3117
|
+
MetricEnum.PRODUCT_VIEW_RATE,
|
|
3118
|
+
MetricEnum.VIEW_TO_PRODUCT_VIEW_CONVERSION_RATE,
|
|
3119
|
+
MetricEnum.ACTIVE_USER_ADD_TO_CART_RATE,
|
|
3120
|
+
MetricEnum.ADD_TO_CART_RATE,
|
|
3121
|
+
MetricEnum.PRODUCT_VIEW_TO_CART_CONVERSION_RATE,
|
|
3122
|
+
MetricEnum.ACTIVE_USER_CHECKOUT_RATE,
|
|
3123
|
+
MetricEnum.CART_TO_CHECKOUT_CONVERSION_RATE,
|
|
3124
|
+
MetricEnum.PRODUCT_VIEW_CONVERSION_RATE,
|
|
3125
|
+
MetricEnum.ADD_TO_CART_CONVERSION_RATE,
|
|
3126
|
+
MetricEnum.CHECKOUT_CONVERSION_RATE,
|
|
3127
|
+
MetricEnum.ECOMMERCE_CONVERSION_RATE
|
|
3105
3128
|
]);
|
|
3106
3129
|
function isDerivedMetric(metric) {
|
|
3107
3130
|
return DERIVED_METRICS.has(metric);
|
|
3108
3131
|
}
|
|
3132
|
+
function isRateMetric(metric) {
|
|
3133
|
+
return RATE_METRICS.has(metric);
|
|
3134
|
+
}
|
|
3109
3135
|
function validateRevenueTarget(targetRevenue, calculations, baselineValues, funnelRatios) {
|
|
3110
3136
|
const stages = calculations
|
|
3111
3137
|
.filter(c => c.isFunnelStage)
|