@eric-emg/symphiq-components 1.2.188 → 1.2.189

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,46 +57267,7 @@ var areaChart_component = /*#__PURE__*/Object.freeze({
57267
57267
  AreaChartComponent: AreaChartComponent
57268
57268
  });
57269
57269
 
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()) {
57270
+ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funnelMetrics, baselineValues) {
57310
57271
  const revenuePercentageIncrease = ((revenueTarget - priorYearRevenue) / priorYearRevenue) * 100;
57311
57272
  const metricCalculations = [];
57312
57273
  const sortedFunnelMetrics = [...funnelMetrics].sort((a, b) => {
@@ -57318,35 +57279,39 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57318
57279
  const bRelated = b.relatedInd ?? 999;
57319
57280
  return aRelated - bRelated;
57320
57281
  });
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
+ const funnelStages = getUniqueFunnelStages(sortedFunnelMetrics);
57283
+ const numFunnelStages = funnelStages.length;
57284
+ const revenueIncreaseFactor = revenueTarget / priorYearRevenue;
57285
+ const perStageFactor = Math.pow(revenueIncreaseFactor, 1 / numFunnelStages);
57286
+ const funnelStageMetrics = new Map();
57287
+ sortedFunnelMetrics.forEach(fm => {
57288
+ if (fm.funnelMetric) {
57289
+ if (!funnelStageMetrics.has(fm.funnelMetric)) {
57290
+ funnelStageMetrics.set(fm.funnelMetric, []);
57291
+ }
57292
+ funnelStageMetrics.get(fm.funnelMetric).push(fm);
57293
+ }
57294
+ });
57295
+ const stagePercentageIncrease = (perStageFactor - 1) * 100;
57325
57296
  sortedFunnelMetrics.forEach((funnelMetric) => {
57326
57297
  const metric = funnelMetric.relatedMetric;
57327
57298
  if (!metric)
57328
57299
  return;
57329
57300
  const currentValue = baselineValues.get(metric) || 0;
57330
57301
  const isFunnelStage = funnelMetric.funnelMetric === metric;
57331
- const metricType = getMetricType(metric);
57332
- const isLocked = lockedMetrics.has(metric);
57333
57302
  let percentageIncrease;
57334
57303
  let targetValue;
57335
- if (isLocked) {
57336
- targetValue = lockedMetrics.get(metric);
57337
- percentageIncrease = currentValue !== 0 ? ((targetValue - currentValue) / currentValue) * 100 : 0;
57304
+ if (metric === MetricEnum.BOUNCE_RATE) {
57305
+ percentageIncrease = -stagePercentageIncrease;
57306
+ targetValue = currentValue * (1 + percentageIncrease / 100);
57338
57307
  }
57339
- else if (metricType === RelatedMetricType.DERIVED) {
57308
+ else if (isDerivedMetric(metric)) {
57340
57309
  percentageIncrease = 0;
57341
57310
  targetValue = currentValue;
57342
57311
  }
57343
- else if (metricType === RelatedMetricType.INVERSE) {
57344
- percentageIncrease = -funnelStagePercentageIncrease;
57345
- targetValue = currentValue * (1 + percentageIncrease / 100);
57346
- }
57347
57312
  else {
57348
- percentageIncrease = funnelStagePercentageIncrease;
57349
- targetValue = currentValue * (1 + percentageIncrease / 100);
57313
+ percentageIncrease = stagePercentageIncrease;
57314
+ targetValue = currentValue * perStageFactor;
57350
57315
  }
57351
57316
  metricCalculations.push({
57352
57317
  metric,
@@ -57355,8 +57320,6 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57355
57320
  targetValue,
57356
57321
  percentageIncrease,
57357
57322
  isFunnelStage,
57358
- metricType,
57359
- isLocked,
57360
57323
  funnelInd: funnelMetric.funnelInd,
57361
57324
  relatedInd: funnelMetric.relatedInd,
57362
57325
  description: funnelMetric.relatedMetricDescription
@@ -57368,34 +57331,24 @@ function calculateMetricTargetsFromRevenue(revenueTarget, priorYearRevenue, funn
57368
57331
  metricCalculations
57369
57332
  };
57370
57333
  }
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;
57334
+ function getUniqueFunnelStages(funnelMetrics) {
57335
+ const stages = [];
57336
+ const seen = new Set();
57337
+ funnelMetrics.forEach(fm => {
57338
+ if (fm.funnelMetric && fm.funnelMetric === fm.relatedMetric && !seen.has(fm.funnelMetric)) {
57339
+ seen.add(fm.funnelMetric);
57340
+ stages.push(fm.funnelMetric);
57392
57341
  }
57393
57342
  });
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);
57343
+ return stages;
57344
+ }
57345
+ const DERIVED_METRICS = new Set([
57346
+ MetricEnum.REVENUE_PER_PRODUCT_VIEW,
57347
+ MetricEnum.REVENUE_PER_ADD_TO_CART,
57348
+ MetricEnum.REVENUE_PER_CHECKOUT
57349
+ ]);
57350
+ function isDerivedMetric(metric) {
57351
+ return DERIVED_METRICS.has(metric);
57399
57352
  }
57400
57353
  function generateTargetsFromCalculations(shopId, calculations) {
57401
57354
  const startDate = getCurrentYearStart();
@@ -108765,5 +108718,5 @@ const PROFILE_ANALYSIS_METRIC_SCREEN_PAGE_VIEWS = ({
108765
108718
  * Generated bundle index. Do not edit.
108766
108719
  */
108767
108720
 
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 };
108721
+ 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 };
108769
108722
  //# sourceMappingURL=symphiq-components.mjs.map