@eric-emg/symphiq-components 1.2.186 → 1.2.188

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.
@@ -57267,7 +57267,46 @@ var areaChart_component = /*#__PURE__*/Object.freeze({
57267
57267
  AreaChartComponent: AreaChartComponent
57268
57268
  });
57269
57269
 
57270
- function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funnelMetrics, baselineValues) {
57270
+ var RelatedMetricType;
57271
+ (function (RelatedMetricType) {
57272
+ RelatedMetricType["FUNNEL"] = "funnel";
57273
+ RelatedMetricType["VOLUME"] = "volume";
57274
+ RelatedMetricType["RATE"] = "rate";
57275
+ RelatedMetricType["INVERSE"] = "inverse";
57276
+ RelatedMetricType["MULTIPLIER"] = "multiplier";
57277
+ RelatedMetricType["DERIVED"] = "derived";
57278
+ })(RelatedMetricType || (RelatedMetricType = {}));
57279
+ const METRIC_TYPE_MAP = {
57280
+ [MetricEnum.SCREEN_PAGE_VIEWS]: RelatedMetricType.FUNNEL,
57281
+ [MetricEnum.ITEM_VIEW_EVENTS]: RelatedMetricType.FUNNEL,
57282
+ [MetricEnum.ADD_TO_CARTS]: RelatedMetricType.FUNNEL,
57283
+ [MetricEnum.CHECKOUTS]: RelatedMetricType.FUNNEL,
57284
+ [MetricEnum.ECOMMERCE_PURCHASES]: RelatedMetricType.FUNNEL,
57285
+ [MetricEnum.PURCHASE_REVENUE]: RelatedMetricType.FUNNEL,
57286
+ [MetricEnum.SESSIONS]: RelatedMetricType.VOLUME,
57287
+ [MetricEnum.ACTIVE_USERS]: RelatedMetricType.VOLUME,
57288
+ [MetricEnum.NEW_USERS]: RelatedMetricType.VOLUME,
57289
+ [MetricEnum.BOUNCE_RATE]: RelatedMetricType.INVERSE,
57290
+ [MetricEnum.PRODUCT_VIEW_RATE]: RelatedMetricType.RATE,
57291
+ [MetricEnum.VIEW_TO_PRODUCT_VIEW_CONVERSION_RATE]: RelatedMetricType.RATE,
57292
+ [MetricEnum.ACTIVE_USER_ADD_TO_CART_RATE]: RelatedMetricType.RATE,
57293
+ [MetricEnum.ADD_TO_CART_RATE]: RelatedMetricType.RATE,
57294
+ [MetricEnum.PRODUCT_VIEW_TO_CART_CONVERSION_RATE]: RelatedMetricType.RATE,
57295
+ [MetricEnum.CART_TO_CHECKOUT_CONVERSION_RATE]: RelatedMetricType.RATE,
57296
+ [MetricEnum.ACTIVE_USER_CHECKOUT_RATE]: RelatedMetricType.RATE,
57297
+ [MetricEnum.PRODUCT_VIEW_CONVERSION_RATE]: RelatedMetricType.RATE,
57298
+ [MetricEnum.ADD_TO_CART_CONVERSION_RATE]: RelatedMetricType.RATE,
57299
+ [MetricEnum.CHECKOUT_CONVERSION_RATE]: RelatedMetricType.RATE,
57300
+ [MetricEnum.ECOMMERCE_CONVERSION_RATE]: RelatedMetricType.RATE,
57301
+ [MetricEnum.AVERAGE_ORDER_VALUE]: RelatedMetricType.MULTIPLIER,
57302
+ [MetricEnum.REVENUE_PER_PRODUCT_VIEW]: RelatedMetricType.DERIVED,
57303
+ [MetricEnum.REVENUE_PER_ADD_TO_CART]: RelatedMetricType.DERIVED,
57304
+ [MetricEnum.REVENUE_PER_CHECKOUT]: RelatedMetricType.DERIVED
57305
+ };
57306
+ function getMetricType(metric) {
57307
+ return METRIC_TYPE_MAP[metric] || RelatedMetricType.RATE;
57308
+ }
57309
+ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funnelMetrics, baselineValues, lockedMetrics = new Map()) {
57271
57310
  const revenuePercentageIncrease = ((revenueTarget - priorYearRevenue) / priorYearRevenue) * 100;
57272
57311
  const metricCalculations = [];
57273
57312
  const sortedFunnelMetrics = [...funnelMetrics].sort((a, b) => {
@@ -57279,17 +57318,36 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57279
57318
  const bRelated = b.relatedInd ?? 999;
57280
57319
  return aRelated - bRelated;
57281
57320
  });
57321
+ const numFunnelStages = new Set(sortedFunnelMetrics.map((fm) => fm.funnelInd)).size;
57322
+ const revenueMultiplier = 1 + revenuePercentageIncrease / 100;
57323
+ const perStageMultiplier = Math.pow(revenueMultiplier, 1 / numFunnelStages);
57324
+ const funnelStagePercentageIncrease = (perStageMultiplier - 1) * 100;
57282
57325
  sortedFunnelMetrics.forEach((funnelMetric) => {
57283
57326
  const metric = funnelMetric.relatedMetric;
57284
57327
  if (!metric)
57285
57328
  return;
57286
57329
  const currentValue = baselineValues.get(metric) || 0;
57287
- let percentageIncrease = revenuePercentageIncrease;
57288
57330
  const isFunnelStage = funnelMetric.funnelMetric === metric;
57289
- if (!isFunnelStage) {
57290
- percentageIncrease = revenuePercentageIncrease * 0.8;
57331
+ const metricType = getMetricType(metric);
57332
+ const isLocked = lockedMetrics.has(metric);
57333
+ let percentageIncrease;
57334
+ let targetValue;
57335
+ if (isLocked) {
57336
+ targetValue = lockedMetrics.get(metric);
57337
+ percentageIncrease = currentValue !== 0 ? ((targetValue - currentValue) / currentValue) * 100 : 0;
57338
+ }
57339
+ else if (metricType === RelatedMetricType.DERIVED) {
57340
+ percentageIncrease = 0;
57341
+ targetValue = currentValue;
57342
+ }
57343
+ else if (metricType === RelatedMetricType.INVERSE) {
57344
+ percentageIncrease = -funnelStagePercentageIncrease;
57345
+ targetValue = currentValue * (1 + percentageIncrease / 100);
57346
+ }
57347
+ else {
57348
+ percentageIncrease = funnelStagePercentageIncrease;
57349
+ targetValue = currentValue * (1 + percentageIncrease / 100);
57291
57350
  }
57292
- const targetValue = currentValue * (1 + percentageIncrease / 100);
57293
57351
  metricCalculations.push({
57294
57352
  metric,
57295
57353
  funnelMetric: funnelMetric.funnelMetric,
@@ -57297,6 +57355,8 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57297
57355
  targetValue,
57298
57356
  percentageIncrease,
57299
57357
  isFunnelStage,
57358
+ metricType,
57359
+ isLocked,
57300
57360
  funnelInd: funnelMetric.funnelInd,
57301
57361
  relatedInd: funnelMetric.relatedInd,
57302
57362
  description: funnelMetric.relatedMetricDescription
@@ -57308,6 +57368,35 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57308
57368
  metricCalculations
57309
57369
  };
57310
57370
  }
57371
+ function recalculateWithLockedMetrics(revenueTarget, priorYearRevenue, funnelMetrics, baselineValues, lockedMetrics) {
57372
+ const numFunnelStages = new Set(funnelMetrics.map((fm) => fm.funnelInd)).size;
57373
+ const targetRevenueMultiplier = revenueTarget / priorYearRevenue;
57374
+ let lockedContribution = 1;
57375
+ let unlockedStageCount = numFunnelStages;
57376
+ const lockedByStage = new Map();
57377
+ funnelMetrics.forEach((fm) => {
57378
+ const metric = fm.relatedMetric;
57379
+ if (!metric)
57380
+ return;
57381
+ const funnelInd = fm.funnelInd ?? 0;
57382
+ const isFunnelStage = fm.funnelMetric === metric;
57383
+ if (isFunnelStage && lockedMetrics.has(metric)) {
57384
+ const currentValue = baselineValues.get(metric) || 1;
57385
+ const lockedValue = lockedMetrics.get(metric);
57386
+ const multiplier = lockedValue / currentValue;
57387
+ if (!lockedByStage.has(funnelInd)) {
57388
+ lockedByStage.set(funnelInd, []);
57389
+ }
57390
+ lockedByStage.get(funnelInd).push({ metric, multiplier });
57391
+ lockedContribution *= multiplier;
57392
+ }
57393
+ });
57394
+ unlockedStageCount = numFunnelStages - lockedByStage.size;
57395
+ const remainingMultiplier = targetRevenueMultiplier / lockedContribution;
57396
+ const perUnlockedStageMultiplier = unlockedStageCount > 0 ? Math.pow(remainingMultiplier, 1 / unlockedStageCount) : 1;
57397
+ const unlockedPercentageIncrease = (perUnlockedStageMultiplier - 1) * 100;
57398
+ return calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funnelMetrics, baselineValues, lockedMetrics);
57399
+ }
57311
57400
  function generateTargetsFromCalculations(shopId, calculations) {
57312
57401
  const startDate = getCurrentYearStart();
57313
57402
  const endDate = getCurrentYearEnd();
@@ -108676,5 +108765,5 @@ const PROFILE_ANALYSIS_METRIC_SCREEN_PAGE_VIEWS = ({
108676
108765
  * Generated bundle index. Do not edit.
108677
108766
  */
108678
108767
 
108679
- export { AreaChartComponent, BUSINESS_PROFILE, BarChartComponent, BreakdownSectionComponent, BusinessAnalysisModalComponent, BusinessProfileSearchService, ChartCardComponent, ChartContainerComponent, ChartThemeService, CircularProgressComponent, CompetitivePositioningSummaryComponent, CompetitorAnalysisCardComponent, ConfettiService, ConfidenceLevelCardComponent, ContentGenerationProgressComponent, ContentGenerationProgressWithConfettiComponent, CrossDashboardRelationshipsService, FUNNEL_ANALYSIS, FloatingBackButtonComponent, FloatingTocComponent, FocusAreaDetailCardComponent, FocusAreaExecutiveSummaryComponent, FocusAreaQuestionComponent, FocusAreaToolsModalComponent, FunnelOrderService, GradeBadgeComponent, HeaderScrollService, HierarchyDisplayComponent, HorizontalBarComponent, IconService, IndeterminateSpinnerComponent, InsightCardComponent, JourneyProgressIndicatorComponent, JourneyStepIdEnum, LineChartComponent, MetricCardComponent, MetricExecutiveSummaryComponent, MetricFormatterService, MetricListItemComponent, MetricWelcomeBannerComponent, MobileBottomNavComponent, MobileFABComponent, ModalComponent, ModalService, NapkinVisualPlaceholderComponent, NavigationStateService, OpportunityHighlightBannerComponent, OverallAssessmentComponent, PROFILE_ANALYSIS_FOCUS_AREA_AFFILIATE, PROFILE_ANALYSIS_METRIC_SCREEN_PAGE_VIEWS, PROFILE_ANALYSIS_SHOP, PieChartComponent, ProfileItemCardComponent, ProfileSectionComponent, ProfileSubsectionComponent, RelatedContentSidebarComponent, RevenueCalculatorWelcomeBannerComponent, ScrollDepthService, ScrollProgressBarComponent, SearchButtonComponent, SearchModalComponent, SectionDividerComponent, SectionNavigationComponent, ShadowElevationDirective, ShopPlatformEnum, ShopWelcomeBannerComponent, SkeletonBarComponent, SkeletonCardBaseComponent, SkeletonCircleComponent, SkeletonCompetitorCardComponent, SkeletonCustomerSegmentCardComponent, SkeletonFocusAreaCardComponent, SkeletonGenericCardComponent, SkeletonLoaderComponent, SkeletonPriceTierCardComponent, SkeletonProductCategoryCardComponent, SkeletonRegionCardComponent, SkeletonSeasonCardComponent, SymphiqBusinessAnalysisDashboardComponent, SymphiqConnectGaDashboardComponent, SymphiqCreateAccountDashboardComponent, SymphiqFunnelAnalysisDashboardComponent, SymphiqFunnelAnalysisPreviewComponent, SymphiqIconComponent, SymphiqProfileAnalysisDashboardComponent, SymphiqRevenueCalculatorDashboardComponent, SymphiqWelcomeDashboardComponent, TooltipContainerComponent, TooltipDataService, TooltipDirective, TooltipService, ViewModeService, ViewportAnimationDirective, VisualizationContainerComponent, getBadgeLabelClasses, getButtonClasses, getCategoryBadgeClasses, getCategoryColor, getCompetitiveBadgeClasses, getContainerClasses, getFooterClasses, getGradeBadgeClasses, getHeaderClasses, getInsightsBadgeClasses, getInsightsCardClasses, getMetricLabelClasses, getMetricMiniCardClasses, getMetricValueClasses, getNarrativeTextClasses, getRevenueCardClasses, getRevenueIconClasses, getStatusBadgeClasses, getStatusDotClasses, getStatusIconClasses, getStatusSummaryClasses, getSubtitleClasses, getTitleClasses, getTrendClasses, getTrendIconClasses, getTrendValueClasses, isLightMode };
108768
+ export { AreaChartComponent, BUSINESS_PROFILE, BarChartComponent, BreakdownSectionComponent, BusinessAnalysisModalComponent, BusinessProfileSearchService, ChartCardComponent, ChartContainerComponent, ChartThemeService, CircularProgressComponent, CompetitivePositioningSummaryComponent, CompetitorAnalysisCardComponent, ConfettiService, ConfidenceLevelCardComponent, ContentGenerationProgressComponent, ContentGenerationProgressWithConfettiComponent, CrossDashboardRelationshipsService, FUNNEL_ANALYSIS, FloatingBackButtonComponent, FloatingTocComponent, FocusAreaDetailCardComponent, FocusAreaExecutiveSummaryComponent, FocusAreaQuestionComponent, FocusAreaToolsModalComponent, FunnelOrderService, GradeBadgeComponent, HeaderScrollService, HierarchyDisplayComponent, HorizontalBarComponent, IconService, IndeterminateSpinnerComponent, InsightCardComponent, JourneyProgressIndicatorComponent, JourneyStepIdEnum, LineChartComponent, METRIC_TYPE_MAP, MetricCardComponent, MetricExecutiveSummaryComponent, MetricFormatterService, MetricListItemComponent, MetricWelcomeBannerComponent, MobileBottomNavComponent, MobileFABComponent, ModalComponent, ModalService, NapkinVisualPlaceholderComponent, NavigationStateService, OpportunityHighlightBannerComponent, OverallAssessmentComponent, PROFILE_ANALYSIS_FOCUS_AREA_AFFILIATE, PROFILE_ANALYSIS_METRIC_SCREEN_PAGE_VIEWS, PROFILE_ANALYSIS_SHOP, PieChartComponent, ProfileItemCardComponent, ProfileSectionComponent, ProfileSubsectionComponent, RelatedContentSidebarComponent, RelatedMetricType, RevenueCalculatorWelcomeBannerComponent, ScrollDepthService, ScrollProgressBarComponent, SearchButtonComponent, SearchModalComponent, SectionDividerComponent, SectionNavigationComponent, ShadowElevationDirective, ShopPlatformEnum, ShopWelcomeBannerComponent, SkeletonBarComponent, SkeletonCardBaseComponent, SkeletonCircleComponent, SkeletonCompetitorCardComponent, SkeletonCustomerSegmentCardComponent, SkeletonFocusAreaCardComponent, SkeletonGenericCardComponent, SkeletonLoaderComponent, SkeletonPriceTierCardComponent, SkeletonProductCategoryCardComponent, SkeletonRegionCardComponent, SkeletonSeasonCardComponent, SymphiqBusinessAnalysisDashboardComponent, SymphiqConnectGaDashboardComponent, SymphiqCreateAccountDashboardComponent, SymphiqFunnelAnalysisDashboardComponent, SymphiqFunnelAnalysisPreviewComponent, SymphiqIconComponent, SymphiqProfileAnalysisDashboardComponent, SymphiqRevenueCalculatorDashboardComponent, SymphiqWelcomeDashboardComponent, TooltipContainerComponent, TooltipDataService, TooltipDirective, TooltipService, ViewModeService, ViewportAnimationDirective, VisualizationContainerComponent, calculateMetricTargetsFromRevenue, generateTargetsFromCalculations, getBadgeLabelClasses, getButtonClasses, getCategoryBadgeClasses, getCategoryColor, getCompetitiveBadgeClasses, getContainerClasses, getFooterClasses, getFunnelStageMetrics, getGradeBadgeClasses, getHeaderClasses, getInsightsBadgeClasses, getInsightsCardClasses, getMetricLabelClasses, getMetricMiniCardClasses, getMetricType, getMetricValueClasses, getNarrativeTextClasses, getRevenueCardClasses, getRevenueIconClasses, getStatusBadgeClasses, getStatusDotClasses, getStatusIconClasses, getStatusSummaryClasses, getSubtitleClasses, getTitleClasses, getTrendClasses, getTrendIconClasses, getTrendValueClasses, groupMetricsByFunnelStage, isLightMode, recalculateWithLockedMetrics };
108680
108769
  //# sourceMappingURL=symphiq-components.mjs.map