@eric-emg/symphiq-components 1.2.187 → 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,7 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57279
57318
  const bRelated = b.relatedInd ?? 999;
57280
57319
  return aRelated - bRelated;
57281
57320
  });
57282
- const funnelStages = new Set();
57283
- const relatedMetricsPerStage = new Map();
57284
- sortedFunnelMetrics.forEach((fm) => {
57285
- const funnelInd = fm.funnelInd ?? 0;
57286
- funnelStages.add(funnelInd);
57287
- const isFunnelStage = fm.funnelMetric === fm.relatedMetric;
57288
- if (!isFunnelStage) {
57289
- relatedMetricsPerStage.set(funnelInd, (relatedMetricsPerStage.get(funnelInd) || 0) + 1);
57290
- }
57291
- });
57292
- const numFunnelStages = funnelStages.size;
57321
+ const numFunnelStages = new Set(sortedFunnelMetrics.map((fm) => fm.funnelInd)).size;
57293
57322
  const revenueMultiplier = 1 + revenuePercentageIncrease / 100;
57294
57323
  const perStageMultiplier = Math.pow(revenueMultiplier, 1 / numFunnelStages);
57295
57324
  const funnelStagePercentageIncrease = (perStageMultiplier - 1) * 100;
@@ -57299,21 +57328,24 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57299
57328
  return;
57300
57329
  const currentValue = baselineValues.get(metric) || 0;
57301
57330
  const isFunnelStage = funnelMetric.funnelMetric === metric;
57302
- const funnelInd = funnelMetric.funnelInd ?? 0;
57303
- const isBounceRate = metric === MetricEnum.BOUNCE_RATE;
57331
+ const metricType = getMetricType(metric);
57332
+ const isLocked = lockedMetrics.has(metric);
57304
57333
  let percentageIncrease;
57305
57334
  let targetValue;
57306
- if (isBounceRate) {
57307
- percentageIncrease = -funnelStagePercentageIncrease;
57308
- targetValue = currentValue * (1 + percentageIncrease / 100);
57335
+ if (isLocked) {
57336
+ targetValue = lockedMetrics.get(metric);
57337
+ percentageIncrease = currentValue !== 0 ? ((targetValue - currentValue) / currentValue) * 100 : 0;
57309
57338
  }
57310
- else if (isFunnelStage) {
57311
- percentageIncrease = funnelStagePercentageIncrease;
57339
+ else if (metricType === RelatedMetricType.DERIVED) {
57340
+ percentageIncrease = 0;
57341
+ targetValue = currentValue;
57342
+ }
57343
+ else if (metricType === RelatedMetricType.INVERSE) {
57344
+ percentageIncrease = -funnelStagePercentageIncrease;
57312
57345
  targetValue = currentValue * (1 + percentageIncrease / 100);
57313
57346
  }
57314
57347
  else {
57315
- const numRelatedInStage = relatedMetricsPerStage.get(funnelInd) || 1;
57316
- percentageIncrease = funnelStagePercentageIncrease / numRelatedInStage;
57348
+ percentageIncrease = funnelStagePercentageIncrease;
57317
57349
  targetValue = currentValue * (1 + percentageIncrease / 100);
57318
57350
  }
57319
57351
  metricCalculations.push({
@@ -57323,6 +57355,8 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57323
57355
  targetValue,
57324
57356
  percentageIncrease,
57325
57357
  isFunnelStage,
57358
+ metricType,
57359
+ isLocked,
57326
57360
  funnelInd: funnelMetric.funnelInd,
57327
57361
  relatedInd: funnelMetric.relatedInd,
57328
57362
  description: funnelMetric.relatedMetricDescription
@@ -57334,6 +57368,35 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57334
57368
  metricCalculations
57335
57369
  };
57336
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
+ }
57337
57400
  function generateTargetsFromCalculations(shopId, calculations) {
57338
57401
  const startDate = getCurrentYearStart();
57339
57402
  const endDate = getCurrentYearEnd();
@@ -108702,5 +108765,5 @@ const PROFILE_ANALYSIS_METRIC_SCREEN_PAGE_VIEWS = ({
108702
108765
  * Generated bundle index. Do not edit.
108703
108766
  */
108704
108767
 
108705
- 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 };
108706
108769
  //# sourceMappingURL=symphiq-components.mjs.map