@levi-gemcommerce/analytics 3.0.1-dev.3 → 3.0.1-dev.5
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/dist/esm/components/OrderAnalytic/types/order.d.ts +1 -1
- package/package.json +38 -15
- package/src/api/graphql/fragments/pathAnalytic.generated.ts +0 -26
- package/src/assets/img/all-sessions.png +0 -0
- package/src/assets/img/analytic-empty.png +0 -0
- package/src/assets/img/first-session.png +0 -0
- package/src/assets/img/page-only.png +0 -0
- package/src/assets/svg/gemx-skeleton.svg +0 -12
- package/src/assets/svg/product.svg +0 -18
- package/src/components/AnalyticMode/AnalyticModeSelector.tsx +0 -50
- package/src/components/AnalyticMode/index.ts +0 -2
- package/src/components/CardPathAnalysis/CardJourneyAnalysis.tsx +0 -33
- package/src/components/CardPathAnalysis/assets/img/analytic-gemx.png +0 -0
- package/src/components/CardPathAnalysis/assets/styles/PathAnalysis.scss +0 -60
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/CardAnalyticEmpty.tsx +0 -45
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/CardPathAnalysis.tsx +0 -53
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/CardPathAnalysisContent.tsx +0 -65
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/CardPathAnalysisEmpty.tsx +0 -29
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/CardPathAnalysisSkeleton.tsx +0 -12
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/CardPathAnalysisWrapper.tsx +0 -43
- package/src/components/CardPathAnalysis/components/CardPathAnalysis/index.ts +0 -1
- package/src/components/CardPathAnalysis/components/PathAnalysisChart.tsx +0 -55
- package/src/components/CardPathAnalysis/components/index.ts +0 -1
- package/src/components/CardPathAnalysis/configs/index.ts +0 -2
- package/src/components/CardPathAnalysis/constants/index.ts +0 -1
- package/src/components/CardPathAnalysis/constants/path-analysis.ts +0 -162
- package/src/components/CardPathAnalysis/contexts/PathAnalysisConfigProvider.tsx +0 -66
- package/src/components/CardPathAnalysis/contexts/PathAnalysisProvider.tsx +0 -130
- package/src/components/CardPathAnalysis/contexts/index.ts +0 -2
- package/src/components/CardPathAnalysis/helpers/index.ts +0 -2
- package/src/components/CardPathAnalysis/helpers/metricHelpers.ts +0 -13
- package/src/components/CardPathAnalysis/helpers/pathAnalysis.ts +0 -96
- package/src/components/CardPathAnalysis/helpers/pathAnalysisChart.ts +0 -128
- package/src/components/CardPathAnalysis/helpers/treeUtils.ts +0 -38
- package/src/components/CardPathAnalysis/hooks/usePathAnalysisChart.tsx +0 -292
- package/src/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.ts +0 -206
- package/src/components/CardPathAnalysis/hooks/usePathAnalyticsMerger.ts +0 -43
- package/src/components/CardPathAnalysis/index.ts +0 -5
- package/src/components/CardPathAnalysis/stores/funnel-chart.ts +0 -30
- package/src/components/CardPathAnalysis/stores/index.ts +0 -3
- package/src/components/CardPathAnalysis/stores/path-analysis-campaign.ts +0 -16
- package/src/components/CardPathAnalysis/stores/path-analysis.ts +0 -11
- package/src/components/CardPathAnalysis/types/index.ts +0 -1
- package/src/components/CardPathAnalysis/types/path-analysis.ts +0 -10
- package/src/components/CurrencySelector/CurrencySelector.tsx +0 -127
- package/src/components/CurrencySelector/index.ts +0 -2
- package/src/components/GModalOrderJourney/GModalOrderJourney.tsx +0 -131
- package/src/components/GModalOrderJourney/components/OrderJourneySkeleton.tsx +0 -93
- package/src/components/GModalOrderJourney/components/index.ts +0 -1
- package/src/components/GModalOrderJourney/context/OrderJourneyContext.tsx +0 -17
- package/src/components/GModalOrderJourney/context/index.ts +0 -1
- package/src/components/GModalOrderJourney/hooks/index.ts +0 -1
- package/src/components/GModalOrderJourney/hooks/useGModalOrderJourney.ts +0 -25
- package/src/components/GModalOrderJourney/index.ts +0 -5
- package/src/components/GModalOrderJourney/types/index.ts +0 -4
- package/src/components/GModalOrderJourney/utils/index.ts +0 -75
- package/src/components/GSelectableMetricChartCard/GSelectableMetricChartCard.tsx +0 -83
- package/src/components/GSelectableMetricChartCard/MetricChartTab.tsx +0 -56
- package/src/components/GSelectableMetricChartCard/index.ts +0 -2
- package/src/components/GTimePicker/GTimePicker.tsx +0 -31
- package/src/components/GTimePicker/components/BaseTimePicker.tsx +0 -249
- package/src/components/GTimePicker/components/CompareTimePicker.tsx +0 -41
- package/src/components/GTimePicker/components/DateTimeFilterAddition.tsx +0 -84
- package/src/components/GTimePicker/components/DateTimeFilterInputs.tsx +0 -124
- package/src/components/GTimePicker/components/DateTimeFilters.tsx +0 -86
- package/src/components/GTimePicker/components/MainTimePicker.tsx +0 -47
- package/src/components/GTimePicker/components/index.ts +0 -2
- package/src/components/GTimePicker/constants/compareDateTimePicker.ts +0 -68
- package/src/components/GTimePicker/constants/datePicker.ts +0 -14
- package/src/components/GTimePicker/constants/index.ts +0 -2
- package/src/components/GTimePicker/constants/mainDataTimePicker.ts +0 -88
- package/src/components/GTimePicker/contexts/DateTimePickerProvider.tsx +0 -125
- package/src/components/GTimePicker/contexts/index.ts +0 -1
- package/src/components/GTimePicker/helpers/date-range-info.ts +0 -84
- package/src/components/GTimePicker/helpers/index.ts +0 -4
- package/src/components/GTimePicker/helpers/parse-date.ts +0 -127
- package/src/components/GTimePicker/helpers/time-picker.ts +0 -123
- package/src/components/GTimePicker/helpers/version.ts +0 -36
- package/src/components/GTimePicker/hooks/index.ts +0 -3
- package/src/components/GTimePicker/hooks/useCompareDateTimePicker.tsx +0 -79
- package/src/components/GTimePicker/hooks/useDateTimeFilter.ts +0 -83
- package/src/components/GTimePicker/hooks/useDateTimePicker.tsx +0 -99
- package/src/components/GTimePicker/hooks/useVersionDateTimeFilters.ts +0 -30
- package/src/components/GTimePicker/index.ts +0 -7
- package/src/components/GTimePicker/types/index.ts +0 -43
- package/src/components/MetricDonutChartCard/MetricDonutChartCard.tsx +0 -121
- package/src/components/MetricDonutChartCard/index.ts +0 -2
- package/src/components/MetricDonutChartCard/utils/donut-chart.ts +0 -75
- package/src/components/MetricDonutChartCard/utils/index.ts +0 -1
- package/src/components/OrderAnalytic/OrderListingLatestTable.tsx +0 -111
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/OrderListingTableSkeleton.tsx +0 -40
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/SkeletonCellContent.tsx +0 -77
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/SkeletonHeader.tsx +0 -35
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/SkeletonRow.tsx +0 -35
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/SkeletonSummaryRow.tsx +0 -36
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/constants.ts +0 -11
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingSkeleton/index.ts +0 -1
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingTable.tsx +0 -159
- package/src/components/OrderAnalytic/components/OrderListing/OrderListingTableEmpty.tsx +0 -29
- package/src/components/OrderAnalytic/components/OrderListing/index.ts +0 -2
- package/src/components/OrderAnalytic/components/index.ts +0 -1
- package/src/components/OrderAnalytic/constants/index.ts +0 -2
- package/src/components/OrderAnalytic/constants/order-columns.ts +0 -51
- package/src/components/OrderAnalytic/constants/order-listing.ts +0 -199
- package/src/components/OrderAnalytic/helpers/index.ts +0 -1
- package/src/components/OrderAnalytic/helpers/order-listing.ts +0 -48
- package/src/components/OrderAnalytic/hooks/index.ts +0 -1
- package/src/components/OrderAnalytic/hooks/useOrderListingData.ts +0 -55
- package/src/components/OrderAnalytic/index.ts +0 -5
- package/src/components/OrderAnalytic/stores/index.ts +0 -2
- package/src/components/OrderAnalytic/stores/order-columns-selector.ts +0 -24
- package/src/components/OrderAnalytic/stores/order-control.ts +0 -15
- package/src/components/OrderAnalytic/types/index.ts +0 -3
- package/src/components/OrderAnalytic/types/order.ts +0 -89
- package/src/components/OrderAnalytic/types/orderListing.ts +0 -4
- package/src/components/OrderAnalytic/types/report.ts +0 -14
- package/src/components/SingleMetricChartCard/SingleMetricChartCard.tsx +0 -56
- package/src/components/SingleMetricChartCard/index.tsx +0 -2
- package/src/components/common/chart/GChartSkeleton.tsx +0 -5
- package/src/components/common/chart/MetricChart.tsx +0 -62
- package/src/components/common/chart/MetricChartEmpty.tsx +0 -35
- package/src/components/common/chart/MetricChartTooltip.tsx +0 -74
- package/src/components/common/chart/MetricDonutChartSkeleton.tsx +0 -14
- package/src/components/common/chart/MetricInfoBlock.tsx +0 -66
- package/src/components/common/chart/MetricInfoSkeleton.tsx +0 -25
- package/src/components/common/chart/MetricValueSummary.tsx +0 -23
- package/src/components/common/chart/index.ts +0 -8
- package/src/components/common/icons/DownIcon8px.tsx +0 -14
- package/src/components/common/icons/UpIcon8px.tsx +0 -14
- package/src/components/common/icons/index.ts +0 -2
- package/src/components/common/percent/MetricPercentage.tsx +0 -42
- package/src/components/common/percent/index.ts +0 -1
- package/src/components/index.ts +0 -9
- package/src/constants/analytic-metric-tooltip.tsx +0 -164
- package/src/constants/breakdown-targets.ts +0 -25
- package/src/constants/campaign.ts +0 -4
- package/src/constants/chart.ts +0 -17
- package/src/constants/currency.ts +0 -3
- package/src/constants/index.ts +0 -6
- package/src/constants/thumbnail.ts +0 -3
- package/src/core/gemxql/api/index.ts +0 -2
- package/src/core/gemxql/api/useCustomGemXQlQuery.ts +0 -35
- package/src/core/gemxql/api/useGemxQlNamedQuery.ts +0 -34
- package/src/core/gemxql/builder/build-gemxql-query.ts +0 -81
- package/src/core/gemxql/builder/clauses/condition-query.ts +0 -74
- package/src/core/gemxql/builder/clauses/from-query.ts +0 -18
- package/src/core/gemxql/builder/clauses/group-query.ts +0 -43
- package/src/core/gemxql/builder/clauses/index.ts +0 -11
- package/src/core/gemxql/builder/clauses/limit-query.ts +0 -15
- package/src/core/gemxql/builder/clauses/mode-query.ts +0 -14
- package/src/core/gemxql/builder/clauses/offset-query.ts +0 -15
- package/src/core/gemxql/builder/clauses/order-by-query.ts +0 -37
- package/src/core/gemxql/builder/clauses/show-query.ts +0 -18
- package/src/core/gemxql/builder/clauses/time-query.ts +0 -67
- package/src/core/gemxql/builder/clauses/time-series-query.ts +0 -15
- package/src/core/gemxql/builder/clauses/timezone-query.ts +0 -17
- package/src/core/gemxql/builder/configs/date-formats.ts +0 -1
- package/src/core/gemxql/builder/configs/index.ts +0 -3
- package/src/core/gemxql/builder/configs/keywords.ts +0 -16
- package/src/core/gemxql/builder/configs/query-defaults.ts +0 -1
- package/src/core/gemxql/builder/filters/build-extra-conditions.ts +0 -69
- package/src/core/gemxql/builder/filters/build-filter-conditions.ts +0 -161
- package/src/core/gemxql/builder/filters/index.ts +0 -2
- package/src/core/gemxql/builder/helpers/date-query-helpers.ts +0 -41
- package/src/core/gemxql/builder/helpers/index.ts +0 -1
- package/src/core/gemxql/builder/helpers/is-valid-query-input.ts +0 -8
- package/src/core/gemxql/builder/index.ts +0 -6
- package/src/core/gemxql/builder/parse-gemxql-query.ts +0 -43
- package/src/core/gemxql/constants/analytic-data.ts +0 -2
- package/src/core/gemxql/constants/column-keys.ts +0 -4
- package/src/core/gemxql/constants/index.ts +0 -4
- package/src/core/gemxql/constants/operators.ts +0 -2
- package/src/core/gemxql/constants/row-reader-mode.ts +0 -9
- package/src/core/gemxql/graphql/fragments/gemxql.generated.ts +0 -80
- package/src/core/gemxql/graphql/fragments/gemxql.gql +0 -18
- package/src/core/gemxql/graphql/index.ts +0 -2
- package/src/core/gemxql/graphql/queries/gemxql.generated.ts +0 -26
- package/src/core/gemxql/graphql/queries/gemxql.gql +0 -5
- package/src/core/gemxql/helpers/columnKeys.ts +0 -8
- package/src/core/gemxql/helpers/extractQueryData.ts +0 -18
- package/src/core/gemxql/helpers/formatAnalyticData.ts +0 -92
- package/src/core/gemxql/helpers/formatAnalyticDate.ts +0 -29
- package/src/core/gemxql/helpers/getTimeDimension.ts +0 -11
- package/src/core/gemxql/helpers/hasMetricData.ts +0 -6
- package/src/core/gemxql/helpers/index.ts +0 -8
- package/src/core/gemxql/helpers/parseJsonFields.ts +0 -36
- package/src/core/gemxql/helpers/readNumeric.ts +0 -25
- package/src/core/gemxql/hooks/index.ts +0 -2
- package/src/core/gemxql/hooks/useAnalyticData.ts +0 -67
- package/src/core/gemxql/hooks/useGemXQlPagination.ts +0 -79
- package/src/core/gemxql/index.ts +0 -8
- package/src/core/gemxql/types/analytic-data.ts +0 -26
- package/src/core/gemxql/types/analytic-source.ts +0 -4
- package/src/core/gemxql/types/extra-condition.ts +0 -40
- package/src/core/gemxql/types/field-filters.ts +0 -18
- package/src/core/gemxql/types/field-operators.ts +0 -8
- package/src/core/gemxql/types/filter-types.ts +0 -33
- package/src/core/gemxql/types/group-with-clause.ts +0 -12
- package/src/core/gemxql/types/index.ts +0 -11
- package/src/core/gemxql/types/order-by.ts +0 -13
- package/src/core/gemxql/types/page-fields.ts +0 -25
- package/src/core/gemxql/types/row-reader-mode.ts +0 -6
- package/src/core/gemxql/types/time-dimension.ts +0 -8
- package/src/global.d.ts +0 -38
- package/src/hooks/index.ts +0 -7
- package/src/hooks/publish/index.ts +0 -2
- package/src/hooks/publish/useStickyDetectById.ts +0 -39
- package/src/hooks/publish/useStickyFilterBoxProps.ts +0 -26
- package/src/hooks/publish/useWindowSize.ts +0 -54
- package/src/hooks/useEnhancedEffect.ts +0 -3
- package/src/hooks/useFetchCurrencyRates.ts +0 -48
- package/src/hooks/useFormatLineChartData.ts +0 -28
- package/src/hooks/usePopoverResizeObserver.ts +0 -43
- package/src/hooks/usePreventBodyScroll.ts +0 -15
- package/src/hooks/useSearchParams.ts +0 -7
- package/src/hooks/useToggle.ts +0 -23
- package/src/index.ts +0 -10
- package/src/modules/analytics/constants/index.ts +0 -124
- package/src/modules/analytics/index.ts +0 -3
- package/src/modules/analytics/types/index.ts +0 -43
- package/src/modules/analytics/utils/formatMetric.ts +0 -42
- package/src/modules/analytics/utils/getPAMetricValue.ts +0 -11
- package/src/modules/analytics/utils/index.ts +0 -3
- package/src/modules/analytics/utils/metric.ts +0 -172
- package/src/providers/ConvertMoneyProvider.tsx +0 -68
- package/src/providers/MetricChartProvider.tsx +0 -50
- package/src/providers/TimezoneProvider.tsx +0 -31
- package/src/providers/index.ts +0 -5
- package/src/shared/charts/components/ComboChart.tsx +0 -108
- package/src/shared/charts/components/GBarChart.tsx +0 -96
- package/src/shared/charts/components/GComboChart.tsx +0 -15
- package/src/shared/charts/components/GDonutChart.tsx +0 -25
- package/src/shared/charts/components/GFunnelChart/GFunnelChart.tsx +0 -34
- package/src/shared/charts/components/GFunnelChart/components/FunnelChartAction.tsx +0 -67
- package/src/shared/charts/components/GFunnelChart/components/FunnelChartActionIcon.tsx +0 -60
- package/src/shared/charts/components/GFunnelChart/components/FunnelChartActionWrapper.tsx +0 -100
- package/src/shared/charts/components/GFunnelChart/components/FunnelSelection/FunnelSelectionContent.tsx +0 -92
- package/src/shared/charts/components/GFunnelChart/components/FunnelSelection/FunnelSelectionHeader.tsx +0 -54
- package/src/shared/charts/components/GFunnelChart/components/FunnelSelection/FunnelSelectionItem.tsx +0 -51
- package/src/shared/charts/components/GFunnelChart/components/FunnelSelection/FunnelSelectionPopover.tsx +0 -95
- package/src/shared/charts/components/GFunnelChart/components/FunnelSelection/index.ts +0 -1
- package/src/shared/charts/components/GFunnelChart/components/FunnelSelection/type.ts +0 -7
- package/src/shared/charts/components/GFunnelChart/components/types.ts +0 -24
- package/src/shared/charts/components/GFunnelChart/index.ts +0 -4
- package/src/shared/charts/components/GFunnelChart/types.ts +0 -11
- package/src/shared/charts/components/GPolarisViz/components/Arc/Arc.module.scss +0 -7
- package/src/shared/charts/components/GPolarisViz/components/Arc/Arc.tsx +0 -135
- package/src/shared/charts/components/GPolarisViz/components/Arc/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartContainer/ChartContainer.module.scss +0 -39
- package/src/shared/charts/components/GPolarisViz/components/ChartContainer/ChartContainer.tsx +0 -150
- package/src/shared/charts/components/GPolarisViz/components/ChartContainer/hooks/useContainerBounds.ts +0 -113
- package/src/shared/charts/components/GPolarisViz/components/ChartContainer/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartElements/ChartDiv.tsx +0 -18
- package/src/shared/charts/components/GPolarisViz/components/ChartElements/ChartElements.module.scss +0 -21
- package/src/shared/charts/components/GPolarisViz/components/ChartElements/ChartSVG.tsx +0 -40
- package/src/shared/charts/components/GPolarisViz/components/ChartElements/index.ts +0 -7
- package/src/shared/charts/components/GPolarisViz/components/ChartErrorBoundary/ChartErrorBoundary.tsx +0 -56
- package/src/shared/charts/components/GPolarisViz/components/ChartErrorBoundary/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartErrorBoundary/utilities/checkForMismatchedData.ts +0 -34
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/ChartSkeleton.module.scss +0 -6
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/ChartSkeleton.tsx +0 -96
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/DonutSkeleton/DonutSkeleton.module.scss +0 -41
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/DonutSkeleton/DonutSkeleton.tsx +0 -193
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/DonutSkeleton/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/ErrorText/ErrorText.tsx +0 -40
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/ErrorText/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/FunnelSkeleton/FunnelSkeleton.tsx +0 -69
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/FunnelSkeleton/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/GridSkeleton/GridSkeleton.tsx +0 -155
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/GridSkeleton/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/Shimmer/Shimmer.module.scss +0 -33
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/Shimmer/Shimmer.tsx +0 -34
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/Shimmer/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SimpleBarSkeleton/SimpleBarSkeleton.module.scss +0 -15
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SimpleBarSkeleton/SimpleBarSkeleton.tsx +0 -53
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SimpleBarSkeleton/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton.module.scss +0 -35
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton.tsx +0 -75
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SimpleNormalizedSkeleton/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SparkSkeleton/SparkSkeleton.tsx +0 -27
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/SparkSkeleton/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/components/index.ts +0 -8
- package/src/shared/charts/components/GPolarisViz/components/ChartSkeleton/index.ts +0 -9
- package/src/shared/charts/components/GPolarisViz/components/ConicGradientWithStops/ConicGradientWithStops.tsx +0 -27
- package/src/shared/charts/components/GPolarisViz/components/ConicGradientWithStops/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/DefaultPreview/DefaultPreview.module.scss +0 -8
- package/src/shared/charts/components/GPolarisViz/components/DefaultPreview/DefaultPreview.tsx +0 -25
- package/src/shared/charts/components/GPolarisViz/components/DefaultPreview/index.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/Chart.tsx +0 -209
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/FunnelChart.tsx +0 -72
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/components/FunnelChartXAxisArrows.tsx +0 -52
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/components/FunnelChartXAxisLabels.tsx +0 -66
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/components/FunnelSegment.tsx +0 -121
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/components/Label.module.scss +0 -23
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/components/Label.tsx +0 -67
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/components/index.ts +0 -4
- package/src/shared/charts/components/GPolarisViz/components/FunnelChart/index.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/Chart.tsx +0 -259
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/FunnelChartNext.tsx +0 -104
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/FunnelChartLabels/FunnelChartLabels.tsx +0 -387
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/FunnelChartLabels/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/FunnelTooltip/FunnelTooltip.scss +0 -8
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/FunnelTooltip/FunnelTooltip.tsx +0 -37
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/FunnelTooltip/index.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/ScaleIcon.tsx +0 -20
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/ScaleIconTooltip.tsx +0 -31
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/Tooltip/CustomTooltip.tsx +0 -68
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/Tooltip/Tooltip.scss +0 -52
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/Tooltip/Tooltip.tsx +0 -149
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/Tooltip/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/TooltipOverlay.tsx +0 -117
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/TooltipWithPortal.tsx +0 -12
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/components/index.ts +0 -8
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/constants.ts +0 -28
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/hooks/useTooltipInteraction.ts +0 -59
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/hooks/useTooltipPlacement.ts +0 -113
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/index.ts +0 -6
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/types.ts +0 -13
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/utilities/calculate-dropoff.ts +0 -4
- package/src/shared/charts/components/GPolarisViz/components/FunnelChartNext/utilities/useBuildFunnelTrends.ts +0 -108
- package/src/shared/charts/components/GPolarisViz/components/HorizontalGridLines/HorizontalGridLines.tsx +0 -27
- package/src/shared/charts/components/GPolarisViz/components/HorizontalGridLines/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/Labels/SingleTextLine.tsx +0 -64
- package/src/shared/charts/components/GPolarisViz/components/Labels/hooks/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/Labels/hooks/useLabels.tsx +0 -131
- package/src/shared/charts/components/GPolarisViz/components/Labels/index.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/endLineTruncate.ts +0 -23
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/endWordTruncate.ts +0 -34
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/estimateTextHeight.ts +0 -31
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/formatAndAddEllipsis.ts +0 -12
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/getDiagonalLabels.ts +0 -70
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/getHorizontalLabels.ts +0 -90
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/getVerticalLabels.ts +0 -58
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/getWidestLabel.ts +0 -15
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/shouldSkipLabel.ts +0 -11
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/tests/endWordTruncate.test.ts +0 -16
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/tests/estimateTextHeight.test.ts +0 -19
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/tests/formatAndAddEllipsis.test.ts +0 -9
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/tests/truncateLastLine.test.ts +0 -22
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/tests/truncateSingleLine.test.ts +0 -15
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/truncateLabels.ts +0 -75
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/truncateLastLine.ts +0 -61
- package/src/shared/charts/components/GPolarisViz/components/Labels/utilities/truncateSingleLine.ts +0 -39
- package/src/shared/charts/components/GPolarisViz/components/LinePreview/LinePreview.module.scss +0 -8
- package/src/shared/charts/components/GPolarisViz/components/LinePreview/LinePreview.tsx +0 -105
- package/src/shared/charts/components/GPolarisViz/components/LinePreview/constants.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/components/LinePreview/index.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/components/SwallowErrors/SwallowErrors.tsx +0 -32
- package/src/shared/charts/components/GPolarisViz/components/SwallowErrors/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TextLine/TextLine.tsx +0 -88
- package/src/shared/charts/components/GPolarisViz/components/TextLine/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/TooltipContent.tsx +0 -109
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer.module.scss +0 -10
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer.tsx +0 -67
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipContentContainer/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipRow/TooltipRow.module.scss +0 -26
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipRow/TooltipRow.tsx +0 -57
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipRow/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipSeries/TooltipSeries.module.scss +0 -4
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipSeries/TooltipSeries.tsx +0 -26
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipSeries/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipSeriesName/TooltipSeriesName.module.scss +0 -4
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipSeriesName/TooltipSeriesName.tsx +0 -20
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipSeriesName/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipTitle/TooltipTitle.module.scss +0 -7
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipTitle/TooltipTitle.tsx +0 -15
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/TooltipTitle/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/components/index.ts +0 -5
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/constants.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/hooks/useGetLongestLabelFromData.ts +0 -56
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/index.ts +0 -4
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/utilities/get-tooltip-template-content-column-count.ts +0 -10
- package/src/shared/charts/components/GPolarisViz/components/TooltipContent/utilities/tests/get-tooltip-template-content-column-count.test.ts +0 -48
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/TooltipWrapper.tsx +0 -338
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/components/TooltipAnimatedContainer.module.scss +0 -6
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/components/TooltipAnimatedContainer.tsx +0 -139
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/constants.ts +0 -18
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/index.ts +0 -5
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/types.ts +0 -62
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/eventPoint.ts +0 -84
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getAlteredHorizontalBarPosition.ts +0 -110
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getAlteredLineChartPosition.ts +0 -115
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getAlteredVerticalBarPosition.ts +0 -105
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getDonutChartTooltipPosition.ts +0 -64
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getHorizontalBarChartTooltipPosition.ts +0 -79
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getLineChartTooltipPosition.ts +0 -68
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/getVerticalBarChartTooltipPosition.ts +0 -123
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities/shouldBlockTooltipEvents.ts +0 -6
- package/src/shared/charts/components/GPolarisViz/components/TooltipWrapper/utilities.ts +0 -162
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/TrendIndicator.tsx +0 -72
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/Arrows/ArrowDown.tsx +0 -12
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/Arrows/ArrowUp.tsx +0 -12
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/Arrows/index.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/Svg/Svg.scss +0 -7
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/Svg/Svg.tsx +0 -27
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/Svg/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/components/index.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/constants.ts +0 -12
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/index.ts +0 -6
- package/src/shared/charts/components/GPolarisViz/components/TrendIndicator/utilities/estimateTrendIndicatorWidth.ts +0 -9
- package/src/shared/charts/components/GPolarisViz/components/VerticalBarChart/utilities/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/VerticalBarChart/utilities/sortBarChartData.ts +0 -20
- package/src/shared/charts/components/GPolarisViz/components/VerticalGridLines/VerticalGridLines.tsx +0 -32
- package/src/shared/charts/components/GPolarisViz/components/VerticalGridLines/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/components/index.ts +0 -6
- package/src/shared/charts/components/GPolarisViz/constants.ts +0 -72
- package/src/shared/charts/components/GPolarisViz/data/character-width-offsets.json +0 -65
- package/src/shared/charts/components/GPolarisViz/data/character-widths.json +0 -1
- package/src/shared/charts/components/GPolarisViz/hooks/index.ts +0 -5
- package/src/shared/charts/components/GPolarisViz/hooks/useBarSpringConfig.ts +0 -21
- package/src/shared/charts/components/GPolarisViz/hooks/useBrowserCheck.ts +0 -13
- package/src/shared/charts/components/GPolarisViz/hooks/useCallbackRef.tsx +0 -39
- package/src/shared/charts/components/GPolarisViz/hooks/useDataForHorizontalChart.ts +0 -69
- package/src/shared/charts/components/GPolarisViz/hooks/useDebouncedCallback.ts +0 -197
- package/src/shared/charts/components/GPolarisViz/hooks/useFormattedLabels.ts +0 -31
- package/src/shared/charts/components/GPolarisViz/hooks/useFunnelBarScaling.ts +0 -53
- package/src/shared/charts/components/GPolarisViz/hooks/useHorizontalBarSizes.ts +0 -70
- package/src/shared/charts/components/GPolarisViz/hooks/useHorizontalStackedValues.ts +0 -34
- package/src/shared/charts/components/GPolarisViz/hooks/useHorizontalTicksAndScale.ts +0 -67
- package/src/shared/charts/components/GPolarisViz/hooks/useHorizontalXScale.ts +0 -48
- package/src/shared/charts/components/GPolarisViz/hooks/useIndexForLabels.ts +0 -16
- package/src/shared/charts/components/GPolarisViz/hooks/usePrefersReducedMotion.ts +0 -6
- package/src/shared/charts/components/GPolarisViz/hooks/usePrintResizing.ts +0 -94
- package/src/shared/charts/components/GPolarisViz/hooks/useReducedLabelIndexes.ts +0 -21
- package/src/shared/charts/components/GPolarisViz/hooks/useResizeObserver.ts +0 -39
- package/src/shared/charts/components/GPolarisViz/hooks/useRootContainer.ts +0 -20
- package/src/shared/charts/components/GPolarisViz/hooks/useWatchColorVisionEvents.tsx +0 -35
- package/src/shared/charts/components/GPolarisViz/index.ts +0 -10
- package/src/shared/charts/components/GPolarisViz/shared/Bar/Bar.tsx +0 -89
- package/src/shared/charts/components/GPolarisViz/shared/Bar/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartConnector/FunnelChartConnector.tsx +0 -46
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartConnector/FunnelChartConnectorGradient.tsx +0 -21
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartConnector/constants.ts +0 -11
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartConnector/index.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartSegment/FunnelChartSegment.tsx +0 -100
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartSegment/components/AnimatedSegment.tsx +0 -50
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartSegment/components/InteractiveOverlay.tsx +0 -34
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartSegment/components/ScaledSegment.tsx +0 -218
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartSegment/constants.ts +0 -4
- package/src/shared/charts/components/GPolarisViz/shared/FunnelChartSegment/index.ts +0 -2
- package/src/shared/charts/components/GPolarisViz/shared/SeriesIcon/SeriesIcon.tsx +0 -22
- package/src/shared/charts/components/GPolarisViz/shared/SeriesIcon/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/shared/ZeroValueLine/ZeroValueLine.tsx +0 -45
- package/src/shared/charts/components/GPolarisViz/shared/ZeroValueLine/index.ts +0 -1
- package/src/shared/charts/components/GPolarisViz/shared/index.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/styles/_common.scss +0 -15
- package/src/shared/charts/components/GPolarisViz/styles/shared/_accessibility.scss +0 -41
- package/src/shared/charts/components/GPolarisViz/styles/shared/_chart-container.scss +0 -8
- package/src/shared/charts/components/GPolarisViz/styles/shared/_variables.scss +0 -322
- package/src/shared/charts/components/GPolarisViz/types.ts +0 -261
- package/src/shared/charts/components/GPolarisViz/utilities/base.ts +0 -13
- package/src/shared/charts/components/GPolarisViz/utilities/classnames.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/utilities/createCssConicGradient.ts +0 -12
- package/src/shared/charts/components/GPolarisViz/utilities/createCssGradient.ts +0 -7
- package/src/shared/charts/components/GPolarisViz/utilities/estimateStringWidthWithOffset.ts +0 -15
- package/src/shared/charts/components/GPolarisViz/utilities/getAxisOptions.ts +0 -26
- package/src/shared/charts/components/GPolarisViz/utilities/getCSSBackgroundFromColor.ts +0 -8
- package/src/shared/charts/components/GPolarisViz/utilities/getChartId.ts +0 -3
- package/src/shared/charts/components/GPolarisViz/utilities/getFontSize.ts +0 -7
- package/src/shared/charts/components/GPolarisViz/utilities/getStackedMinMax.ts +0 -43
- package/src/shared/charts/components/GPolarisViz/utilities/getStackedValues.ts +0 -35
- package/src/shared/charts/components/GPolarisViz/utilities/getStackedValuesFromDataSeries.tsx +0 -30
- package/src/shared/charts/components/GPolarisViz/utilities/getTrendIndicatorData.ts +0 -22
- package/src/shared/charts/components/GPolarisViz/utilities/hasHiddenComparisonSeries.ts +0 -26
- package/src/shared/charts/components/GPolarisViz/utilities/index.ts +0 -6
- package/src/shared/charts/components/GSimpleBarChart.tsx +0 -32
- package/src/shared/charts/components/index.ts +0 -7
- package/src/shared/charts/constants/chart.ts +0 -14
- package/src/shared/charts/constants/index.ts +0 -1
- package/src/shared/charts/contexts/GChartProvider.tsx +0 -48
- package/src/shared/charts/contexts/index.ts +0 -1
- package/src/shared/charts/index.ts +0 -4
- package/src/shared/charts/types/chart.ts +0 -36
- package/src/shared/charts/types/index.ts +0 -1
- package/src/shared/components/GActivatorPopover/GActivatorPopover.tsx +0 -107
- package/src/shared/components/GActivatorPopover/index.ts +0 -1
- package/src/shared/components/GBlockCenter/GBlockCenter.scss +0 -19
- package/src/shared/components/GBlockCenter/GBlockCenter.tsx +0 -72
- package/src/shared/components/GBlockCenter/index.ts +0 -1
- package/src/shared/components/GBox/GBox.scss +0 -25
- package/src/shared/components/GBox/GBox.tsx +0 -15
- package/src/shared/components/GBox/index.ts +0 -1
- package/src/shared/components/GBoxCard/GBoxCard.tsx +0 -27
- package/src/shared/components/GBoxCard/index.ts +0 -1
- package/src/shared/components/GButton/GButton.scss +0 -41
- package/src/shared/components/GButton/GButton.tsx +0 -73
- package/src/shared/components/GButton/index.ts +0 -1
- package/src/shared/components/GCheckbox/GCheckbox.tsx +0 -176
- package/src/shared/components/GCheckbox/index.ts +0 -1
- package/src/shared/components/GChoice/ChoiceHelpText.tsx +0 -25
- package/src/shared/components/GChoice/GChoice.scss +0 -14
- package/src/shared/components/GChoice/GChoice.tsx +0 -165
- package/src/shared/components/GChoice/index.ts +0 -2
- package/src/shared/components/GClickable/GClickable.tsx +0 -43
- package/src/shared/components/GClickable/index.ts +0 -1
- package/src/shared/components/GDiv/GDiv.tsx +0 -27
- package/src/shared/components/GDiv/index.ts +0 -1
- package/src/shared/components/GDotInline/GDotInline.tsx +0 -20
- package/src/shared/components/GDotInline/index.ts +0 -1
- package/src/shared/components/GFeatureLocked/GFeatureLocked.tsx +0 -85
- package/src/shared/components/GFeatureLocked/assets/images/empty-analytics.png +0 -0
- package/src/shared/components/GFeatureLocked/assets/images/empty-campaign-group-template-illustration.png +0 -0
- package/src/shared/components/GFeatureLocked/assets/images/empty-campaign-group-template.png +0 -0
- package/src/shared/components/GFeatureLocked/assets/images/empty-page-listing-illustration.png +0 -0
- package/src/shared/components/GFeatureLocked/assets/images/empty-page-listing.png +0 -0
- package/src/shared/components/GFeatureLocked/constants.ts +0 -33
- package/src/shared/components/GFeatureLocked/index.ts +0 -2
- package/src/shared/components/GFeatureLocked/types.ts +0 -16
- package/src/shared/components/GI18NText/GI18NText.tsx +0 -37
- package/src/shared/components/GI18NText/index.ts +0 -2
- package/src/shared/components/GI18NText/types.ts +0 -7
- package/src/shared/components/GInlineCenter/GInlineCenter.scss +0 -17
- package/src/shared/components/GInlineCenter/GInlineCenter.tsx +0 -39
- package/src/shared/components/GInlineCenter/index.ts +0 -1
- package/src/shared/components/GMockDataTooltip/GMockDataTooltip.tsx +0 -30
- package/src/shared/components/GMockDataTooltip/index.ts +0 -1
- package/src/shared/components/GModal/GModal.tsx +0 -49
- package/src/shared/components/GModal/index.ts +0 -1
- package/src/shared/components/GOptionList/GOptionList.tsx +0 -63
- package/src/shared/components/GOptionList/index.ts +0 -1
- package/src/shared/components/GPagination/GPagination.tsx +0 -44
- package/src/shared/components/GPagination/hooks/useGPagination.ts +0 -42
- package/src/shared/components/GPagination/index.ts +0 -2
- package/src/shared/components/GSelector/GSelector.tsx +0 -198
- package/src/shared/components/GSelector/index.ts +0 -1
- package/src/shared/components/GSkeletonDisplayText/GSkeletonDisplayText.tsx +0 -14
- package/src/shared/components/GSkeletonDisplayText/index.ts +0 -1
- package/src/shared/components/GSpinner/GSpinner.tsx +0 -16
- package/src/shared/components/GSpinner/index.ts +0 -1
- package/src/shared/components/GTextLink/GTextLink.tsx +0 -26
- package/src/shared/components/GTextLink/index.ts +0 -1
- package/src/shared/components/GTextTooltip/GTextTooltip.tsx +0 -18
- package/src/shared/components/GTextTooltip/index.ts +0 -1
- package/src/shared/components/GTextTruncated/GTextTruncated.tsx +0 -80
- package/src/shared/components/GTextTruncated/index.ts +0 -1
- package/src/shared/components/GThumbnail/GThumbnail.scss +0 -5
- package/src/shared/components/GThumbnail/GThumbnail.tsx +0 -69
- package/src/shared/components/GThumbnail/index.ts +0 -1
- package/src/shared/components/GTooltip/GTooltip.tsx +0 -34
- package/src/shared/components/GTooltip/components/GTooltipCard.tsx +0 -164
- package/src/shared/components/GTooltip/index.ts +0 -3
- package/src/shared/components/GTooltipCard/GTooltipCard.tsx +0 -161
- package/src/shared/components/GTooltipCard/index.ts +0 -7
- package/src/shared/components/GVariantBadge/GVariant.tsx +0 -55
- package/src/shared/components/GVariantBadge/GVariantBadge.scss +0 -10
- package/src/shared/components/GVariantBadge/GVariantBadge.tsx +0 -82
- package/src/shared/components/GVariantBadge/index.ts +0 -4
- package/src/shared/components/GVariantBadge/types.ts +0 -20
- package/src/shared/components/GViewBySelector/GViewBySelector.tsx +0 -114
- package/src/shared/components/GViewBySelector/index.ts +0 -1
- package/src/shared/components/index.ts +0 -26
- package/src/shared/index.ts +0 -1
- package/src/shared/journey/common/JourneyContainer/components/JourneyContainer.tsx +0 -140
- package/src/shared/journey/common/JourneyContainer/components/JourneyTimeline.tsx +0 -18
- package/src/shared/journey/common/JourneyContainer/components/index.ts +0 -2
- package/src/shared/journey/common/JourneyContainer/index.ts +0 -1
- package/src/shared/journey/common/index.ts +0 -1
- package/src/shared/journey/index.ts +0 -2
- package/src/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/AcceptedPostPurchaseOffer.tsx +0 -24
- package/src/shared/journey/ui/JourneyEvents/components/AcceptedPostPurchaseOffer/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/CheckoutCompleted.tsx +0 -64
- package/src/shared/journey/ui/JourneyEvents/components/CheckoutCompleted/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/components/CheckoutItems.tsx +0 -27
- package/src/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStarted.tsx +0 -25
- package/src/shared/journey/ui/JourneyEvents/components/CheckoutStarted/CheckoutStartedDetail.tsx +0 -79
- package/src/shared/journey/ui/JourneyEvents/components/CheckoutStarted/index.ts +0 -2
- package/src/shared/journey/ui/JourneyEvents/components/PageViewed/PageViewed.tsx +0 -116
- package/src/shared/journey/ui/JourneyEvents/components/PageViewed/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/ProductAddedToCart.tsx +0 -24
- package/src/shared/journey/ui/JourneyEvents/components/ProductAddedToCart/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/components/ProductQuantity/ProductQuantity.tsx +0 -33
- package/src/shared/journey/ui/JourneyEvents/components/ProductQuantity/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/ProductRemovedFromCart.tsx +0 -24
- package/src/shared/journey/ui/JourneyEvents/components/ProductRemovedFromCart/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/components/index.ts +0 -6
- package/src/shared/journey/ui/JourneyEvents/constants/event.ts +0 -38
- package/src/shared/journey/ui/JourneyEvents/constants/index.ts +0 -1
- package/src/shared/journey/ui/JourneyEvents/index.ts +0 -2
- package/src/shared/journey/ui/JourneyEvents/types.ts +0 -2
- package/src/shared/journey/ui/JourneyGroup/JourneyGroup.tsx +0 -41
- package/src/shared/journey/ui/JourneyGroup/index.ts +0 -1
- package/src/shared/journey/ui/JourneyItem/components/EventMarkerIcon.tsx +0 -28
- package/src/shared/journey/ui/JourneyItem/components/JourneyDetail.tsx +0 -24
- package/src/shared/journey/ui/JourneyItem/components/JourneyItem.tsx +0 -27
- package/src/shared/journey/ui/JourneyItem/components/JourneyTime.tsx +0 -33
- package/src/shared/journey/ui/JourneyItem/components/QuantityWrapper.tsx +0 -17
- package/src/shared/journey/ui/JourneyItem/components/index.ts +0 -3
- package/src/shared/journey/ui/JourneyItem/index.ts +0 -2
- package/src/shared/journey/ui/JourneyItem/types/events.ts +0 -33
- package/src/shared/journey/ui/JourneyItem/types/index.ts +0 -1
- package/src/shared/journey/ui/JourneyTitle/components/GemxIdBadge.tsx +0 -38
- package/src/shared/journey/ui/JourneyTitle/components/JourneyDateBadge.tsx +0 -18
- package/src/shared/journey/ui/JourneyTitle/components/JourneyIdBadge.tsx +0 -65
- package/src/shared/journey/ui/JourneyTitle/components/JourneyLoadMore.tsx +0 -43
- package/src/shared/journey/ui/JourneyTitle/components/JourneyTitle.tsx +0 -42
- package/src/shared/journey/ui/JourneyTitle/components/index.ts +0 -2
- package/src/shared/journey/ui/JourneyTitle/constants/idBadge.ts +0 -1
- package/src/shared/journey/ui/JourneyTitle/constants/index.ts +0 -1
- package/src/shared/journey/ui/JourneyTitle/index.ts +0 -1
- package/src/shared/journey/ui/index.ts +0 -3
- package/src/shared/journey/ui/type.ts +0 -2
- package/src/shared/reports/common/Visualization/constants/columns.ts +0 -6
- package/src/shared/reports/common/Visualization/constants/index.ts +0 -2
- package/src/shared/reports/common/Visualization/constants/version.ts +0 -8
- package/src/shared/reports/common/Visualization/index.ts +0 -2
- package/src/shared/reports/common/Visualization/types/chart.ts +0 -5
- package/src/shared/reports/common/Visualization/types/index.ts +0 -3
- package/src/shared/reports/common/Visualization/types/report-metric.ts +0 -21
- package/src/shared/reports/common/Visualization/types/report.ts +0 -42
- package/src/shared/reports/common/Visualization/utils/index.ts +0 -2
- package/src/shared/reports/common/Visualization/utils/version.ts +0 -9
- package/src/shared/reports/common/Visualization/utils/visualization.ts +0 -58
- package/src/shared/reports/common/index.ts +0 -1
- package/src/shared/reports/ui/ReportTable/ReportTable.tsx +0 -194
- package/src/shared/reports/ui/ReportTable/ReportTableSkeleton.tsx +0 -73
- package/src/shared/reports/ui/ReportTable/assets/styles/ReportTable.scss +0 -288
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/CampaignsCell/CampaignsCell.tsx +0 -102
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/CampaignsCell/CampaignsCellVersion.tsx +0 -11
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/CampaignsCell/index.ts +0 -1
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/Cell.tsx +0 -93
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/CellRenderers.tsx +0 -72
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/DateCell.tsx +0 -9
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/DefaultCell.tsx +0 -32
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/GemxIdCell.tsx +0 -18
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/ItemsCell/CheckoutStartedDetail.tsx +0 -79
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/ItemsCell/ItemsCell.tsx +0 -56
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/ItemsCell/index.ts +0 -1
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/NoneCell.tsx +0 -11
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/LoadingData.tsx +0 -10
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/NoData.tsx +0 -13
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCell.tsx +0 -78
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCellBase.tsx +0 -55
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderCellContainer.tsx +0 -43
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/OrderItem.tsx +0 -79
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderCell/index.ts +0 -2
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/OrderIdCell.tsx +0 -70
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/PreviousCell.tsx +0 -17
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/TotalCell.tsx +0 -14
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/VersionCell.tsx +0 -31
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/WrapperCell.tsx +0 -31
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/index.ts +0 -1
- package/src/shared/reports/ui/ReportTable/components/Body/Cell/type.ts +0 -18
- package/src/shared/reports/ui/ReportTable/components/Body/Row.tsx +0 -85
- package/src/shared/reports/ui/ReportTable/components/Body/index.ts +0 -2
- package/src/shared/reports/ui/ReportTable/components/Footer/Pagination.tsx +0 -76
- package/src/shared/reports/ui/ReportTable/components/Footer/ScrollBar.tsx +0 -19
- package/src/shared/reports/ui/ReportTable/components/Footer/WrapperFooter.tsx +0 -39
- package/src/shared/reports/ui/ReportTable/components/Footer/index.ts +0 -1
- package/src/shared/reports/ui/ReportTable/components/Header/Header.tsx +0 -68
- package/src/shared/reports/ui/ReportTable/components/Header/SortableHeader.tsx +0 -49
- package/src/shared/reports/ui/ReportTable/components/Header/SortableHeaderWithTooltip.tsx +0 -60
- package/src/shared/reports/ui/ReportTable/components/Header/SummaryCell.tsx +0 -26
- package/src/shared/reports/ui/ReportTable/components/Header/SummaryRow.tsx +0 -69
- package/src/shared/reports/ui/ReportTable/components/Header/WrapperHeader.tsx +0 -54
- package/src/shared/reports/ui/ReportTable/components/Header/index.ts +0 -1
- package/src/shared/reports/ui/ReportTable/components/index.ts +0 -2
- package/src/shared/reports/ui/ReportTable/constants/index.ts +0 -2
- package/src/shared/reports/ui/ReportTable/constants/order.ts +0 -30
- package/src/shared/reports/ui/ReportTable/constants/table.ts +0 -17
- package/src/shared/reports/ui/ReportTable/context/ReportTableActionsContext.tsx +0 -28
- package/src/shared/reports/ui/ReportTable/helpers/format.ts +0 -29
- package/src/shared/reports/ui/ReportTable/helpers/index.ts +0 -2
- package/src/shared/reports/ui/ReportTable/helpers/report.ts +0 -7
- package/src/shared/reports/ui/ReportTable/hooks/index.ts +0 -3
- package/src/shared/reports/ui/ReportTable/hooks/useReportTable.ts +0 -172
- package/src/shared/reports/ui/ReportTable/hooks/useReportTableCell.tsx +0 -28
- package/src/shared/reports/ui/ReportTable/hooks/useSyncedScroll.ts +0 -81
- package/src/shared/reports/ui/ReportTable/index.ts +0 -4
- package/src/shared/reports/ui/ReportTable/types/dimension.ts +0 -8
- package/src/shared/reports/ui/ReportTable/types/index.ts +0 -43
- package/src/shared/reports/ui/ReportTable/types/order.ts +0 -15
- package/src/shared/reports/ui/ReportTable/types/report-columns.ts +0 -11
- package/src/shared/reports/ui/ReportTable/utils/format.ts +0 -100
- package/src/shared/reports/ui/ReportTable/utils/index.ts +0 -2
- package/src/shared/reports/ui/ReportTable/utils/order.ts +0 -8
- package/src/shared/reports/ui/ReportTable/utils/table.ts +0 -19
- package/src/shared/reports/ui/ReportTable/utils/visualization.ts +0 -56
- package/src/shared/reports/ui/index.ts +0 -0
- package/src/stores/currencyRatesStore.ts +0 -13
- package/src/stores/index.ts +0 -2
- package/src/styles/index.scss +0 -9
- package/src/types/analytic-mode.ts +0 -5
- package/src/types/breakdown-items.ts +0 -21
- package/src/types/campaign.ts +0 -13
- package/src/types/chart.ts +0 -42
- package/src/types/currency.ts +0 -329
- package/src/types/index.ts +0 -8
- package/src/types/metric.ts +0 -81
- package/src/types/pricing.ts +0 -38
- package/src/types/report-columns.ts +0 -1
- package/src/types/template.ts +0 -19
- package/src/utils/analytics.ts +0 -75
- package/src/utils/array.ts +0 -13
- package/src/utils/cls.ts +0 -18
- package/src/utils/currency.ts +0 -42
- package/src/utils/date-time.ts +0 -7
- package/src/utils/dayjs.ts +0 -52
- package/src/utils/deep-copy.ts +0 -4
- package/src/utils/index.ts +0 -12
- package/src/utils/is-browser.ts +0 -3
- package/src/utils/number.ts +0 -19
- package/src/utils/percentage.ts +0 -40
- package/src/utils/sort.ts +0 -87
- package/src/utils/string.ts +0 -20
- package/src/utils/template-type.ts +0 -30
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { useChartContext, estimateStringWidth, isInfinity } from '@shopify/polaris-viz-core';
|
|
2
|
-
import type { DataSeries, LabelFormatter } from '@shopify/polaris-viz-core';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
|
|
5
|
-
import { HORIZONTAL_BAR_LABEL_OFFSET } from '../constants';
|
|
6
|
-
|
|
7
|
-
export interface Props {
|
|
8
|
-
data: DataSeries[];
|
|
9
|
-
isSimple: boolean;
|
|
10
|
-
isStacked: boolean;
|
|
11
|
-
labelFormatter: LabelFormatter;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function useDataForHorizontalChart({ data, isSimple, isStacked, labelFormatter }: Props) {
|
|
15
|
-
const { characterWidths } = useChartContext();
|
|
16
|
-
|
|
17
|
-
const allNumbers = useMemo(() => {
|
|
18
|
-
return data.reduce<number[]>((prev, cur) => {
|
|
19
|
-
const numbers = cur.data.map(({ value }) => value).filter((value) => value !== null) as number[];
|
|
20
|
-
return prev.concat(...numbers);
|
|
21
|
-
}, []);
|
|
22
|
-
}, [data]);
|
|
23
|
-
|
|
24
|
-
const lowestNegative = useMemo(() => Math.min(0, ...allNumbers), [allNumbers]);
|
|
25
|
-
const highestPositive = useMemo(() => Math.max(0, ...allNumbers), [allNumbers]);
|
|
26
|
-
|
|
27
|
-
if (isInfinity(lowestNegative) || isInfinity(highestPositive)) {
|
|
28
|
-
throw new Error('Data must be finite');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const longestLabel = useMemo(() => {
|
|
32
|
-
if (!isSimple && !isStacked) {
|
|
33
|
-
return { positive: 0, negative: 0 };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const negativeTextSize =
|
|
37
|
-
lowestNegative === 0
|
|
38
|
-
? 0
|
|
39
|
-
: estimateStringWidth(`${labelFormatter(lowestNegative)}`, characterWidths) + HORIZONTAL_BAR_LABEL_OFFSET;
|
|
40
|
-
|
|
41
|
-
const positiveTextSize =
|
|
42
|
-
highestPositive === 0
|
|
43
|
-
? 0
|
|
44
|
-
: estimateStringWidth(`${labelFormatter(highestPositive)}`, characterWidths) + HORIZONTAL_BAR_LABEL_OFFSET;
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
negative: negativeTextSize,
|
|
48
|
-
positive: positiveTextSize,
|
|
49
|
-
};
|
|
50
|
-
}, [labelFormatter, isSimple, isStacked, highestPositive, lowestNegative, characterWidths]);
|
|
51
|
-
|
|
52
|
-
const areAllZero = useMemo(() => {
|
|
53
|
-
return !allNumbers.some((num) => num !== null && num !== 0);
|
|
54
|
-
}, [allNumbers]);
|
|
55
|
-
|
|
56
|
-
const areAllNegative = useMemo(() => {
|
|
57
|
-
if (areAllZero) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return !allNumbers.some((num) => num !== null && num > 0);
|
|
62
|
-
}, [areAllZero, allNumbers]);
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
allNumbers,
|
|
66
|
-
areAllNegative,
|
|
67
|
-
longestLabel,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect, useMemo, type Dispatch, type SetStateAction } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface CallOptions {
|
|
4
|
-
leading?: boolean;
|
|
5
|
-
trailing?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface Options extends CallOptions {
|
|
9
|
-
maxWait?: number;
|
|
10
|
-
debounceOnServer?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ControlFunctions<ReturnT> {
|
|
14
|
-
cancel: () => void;
|
|
15
|
-
flush: () => ReturnT | undefined;
|
|
16
|
-
isPending: () => boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Subsequent calls to the debounced function return the result of the last func invocation.
|
|
21
|
-
* Note, that if there are no previous invocations you will get undefined. You should check it in your code properly.
|
|
22
|
-
*/
|
|
23
|
-
export interface DebouncedState<T extends (...args: any[]) => any> extends ControlFunctions<ReturnType<T>> {
|
|
24
|
-
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
29
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
30
|
-
* invoked, or until the next browser frame is drawn.
|
|
31
|
-
*/
|
|
32
|
-
export const useDebouncedCallback = <T extends (...args: any[]) => any>(
|
|
33
|
-
func: T,
|
|
34
|
-
wait?: number,
|
|
35
|
-
options?: Options,
|
|
36
|
-
forceUpdate?: Dispatch<SetStateAction<object>> | null,
|
|
37
|
-
): DebouncedState<T> => {
|
|
38
|
-
const lastCallTime = useRef<number | null>(null);
|
|
39
|
-
const lastInvokeTime = useRef<number>(0);
|
|
40
|
-
const firstInvokeTime = useRef<number>(0);
|
|
41
|
-
const timerId = useRef<number | null>(null);
|
|
42
|
-
const lastArgs = useRef<Parameters<T>>([] as unknown as Parameters<T>);
|
|
43
|
-
const lastThis = useRef<any>();
|
|
44
|
-
const result = useRef<ReturnType<T> | undefined>(undefined);
|
|
45
|
-
const funcRef = useRef<T>(func);
|
|
46
|
-
const mounted = useRef<boolean>(true);
|
|
47
|
-
|
|
48
|
-
funcRef.current = func;
|
|
49
|
-
|
|
50
|
-
const isClientSide = typeof window !== 'undefined';
|
|
51
|
-
const useRAF = !wait && wait !== 0 && isClientSide;
|
|
52
|
-
|
|
53
|
-
if (typeof func !== 'function') {
|
|
54
|
-
throw new TypeError('Expected a function');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
wait = +(wait || 0);
|
|
58
|
-
options = options || {};
|
|
59
|
-
|
|
60
|
-
const leading = !!options.leading;
|
|
61
|
-
const trailing = 'trailing' in options ? !!options.trailing : true;
|
|
62
|
-
const maxing = 'maxWait' in options;
|
|
63
|
-
const debounceOnServer = 'debounceOnServer' in options ? !!options.debounceOnServer : false;
|
|
64
|
-
const maxWait = maxing ? Math.max(+(options.maxWait || 0), wait) : null;
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
mounted.current = true;
|
|
68
|
-
return () => {
|
|
69
|
-
mounted.current = false;
|
|
70
|
-
};
|
|
71
|
-
}, []);
|
|
72
|
-
|
|
73
|
-
const debounced = useMemo(() => {
|
|
74
|
-
const invokeFunc = (time: number): ReturnType<T> | undefined => {
|
|
75
|
-
const args = lastArgs.current as Parameters<T>;
|
|
76
|
-
const thisArg = lastThis.current;
|
|
77
|
-
lastArgs.current = [] as unknown as Parameters<T>;
|
|
78
|
-
lastThis.current = null;
|
|
79
|
-
lastInvokeTime.current = time;
|
|
80
|
-
firstInvokeTime.current = firstInvokeTime.current || time;
|
|
81
|
-
|
|
82
|
-
return (result.current = funcRef.current.apply(thisArg, args));
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const startTimer = (pendingFunc: () => void, waitTime: number) => {
|
|
86
|
-
if (useRAF) cancelAnimationFrame(timerId.current!);
|
|
87
|
-
timerId.current = useRAF
|
|
88
|
-
? (requestAnimationFrame(pendingFunc) as unknown as number)
|
|
89
|
-
: (setTimeout(pendingFunc, waitTime) as unknown as number);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const shouldInvoke = (time: number) => {
|
|
93
|
-
if (!mounted.current) return false;
|
|
94
|
-
|
|
95
|
-
const timeSinceLastCall = time - (lastCallTime.current ?? 0);
|
|
96
|
-
const timeSinceLastInvoke = time - lastInvokeTime.current;
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
!lastCallTime.current ||
|
|
100
|
-
timeSinceLastCall >= wait ||
|
|
101
|
-
timeSinceLastCall < 0 ||
|
|
102
|
-
(maxing && timeSinceLastInvoke >= (maxWait ?? Infinity))
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const trailingEdge = (time: number): ReturnType<T> | undefined => {
|
|
107
|
-
timerId.current = null;
|
|
108
|
-
|
|
109
|
-
if (trailing && lastArgs.current.length) {
|
|
110
|
-
return invokeFunc(time);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
lastArgs.current = [] as unknown as Parameters<T>;
|
|
114
|
-
lastThis.current = null;
|
|
115
|
-
return result.current;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const timerExpired = () => {
|
|
119
|
-
const time = Date.now();
|
|
120
|
-
|
|
121
|
-
if (leading && firstInvokeTime.current === lastInvokeTime.current) {
|
|
122
|
-
notifyManuallyTimerExpired();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (shouldInvoke(time)) {
|
|
126
|
-
return trailingEdge(time);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (!mounted.current) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const timeSinceLastCall = time - (lastCallTime.current ?? 0);
|
|
134
|
-
const timeSinceLastInvoke = time - lastInvokeTime.current;
|
|
135
|
-
const timeWaiting = wait - timeSinceLastCall;
|
|
136
|
-
const remainingWait = maxing ? Math.min(timeWaiting, (maxWait ?? Infinity) - timeSinceLastInvoke) : timeWaiting;
|
|
137
|
-
|
|
138
|
-
startTimer(timerExpired, remainingWait);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const notifyManuallyTimerExpired = () => {
|
|
142
|
-
if (forceUpdate) {
|
|
143
|
-
forceUpdate({});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const func: DebouncedState<T> = (...args: Parameters<T>): ReturnType<T> | undefined => {
|
|
148
|
-
if (!isClientSide && !debounceOnServer) {
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const time = Date.now();
|
|
153
|
-
const isInvoking = shouldInvoke(time);
|
|
154
|
-
|
|
155
|
-
lastArgs.current = args;
|
|
156
|
-
lastThis.current = this;
|
|
157
|
-
lastCallTime.current = time;
|
|
158
|
-
|
|
159
|
-
if (isInvoking) {
|
|
160
|
-
if (!timerId.current && mounted.current) {
|
|
161
|
-
lastInvokeTime.current = lastCallTime.current;
|
|
162
|
-
startTimer(timerExpired, wait);
|
|
163
|
-
return leading ? invokeFunc(lastCallTime.current) : result.current;
|
|
164
|
-
}
|
|
165
|
-
if (maxing) {
|
|
166
|
-
startTimer(timerExpired, wait);
|
|
167
|
-
return invokeFunc(lastCallTime.current);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (!timerId.current) {
|
|
171
|
-
startTimer(timerExpired, wait);
|
|
172
|
-
}
|
|
173
|
-
return result.current;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
func.cancel = () => {
|
|
177
|
-
if (timerId.current) {
|
|
178
|
-
useRAF ? cancelAnimationFrame(timerId.current) : clearTimeout(timerId.current);
|
|
179
|
-
}
|
|
180
|
-
lastInvokeTime.current = 0;
|
|
181
|
-
lastArgs.current = [] as unknown as Parameters<T>;
|
|
182
|
-
lastCallTime.current = lastThis.current = timerId.current = null;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
func.isPending = () => {
|
|
186
|
-
return !!timerId.current;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
func.flush = () => {
|
|
190
|
-
return !timerId.current ? result.current : trailingEdge(Date.now());
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
return func;
|
|
194
|
-
}, [leading, maxing, wait, maxWait, trailing, useRAF, isClientSide, debounceOnServer, forceUpdate]);
|
|
195
|
-
|
|
196
|
-
return debounced;
|
|
197
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { DataSeries, LabelFormatter } from '@shopify/polaris-viz-core';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
data: DataSeries[];
|
|
6
|
-
labelFormatter: LabelFormatter;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function useFormattedLabels({ data, labelFormatter }: Props) {
|
|
10
|
-
return useMemo(() => {
|
|
11
|
-
const formattedLabels: string[] = [];
|
|
12
|
-
const unformattedLabels: string[] = [];
|
|
13
|
-
|
|
14
|
-
if (data == null || data.length === 0) {
|
|
15
|
-
return { formattedLabels, unformattedLabels };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
data.forEach((series) => {
|
|
19
|
-
if (series == null || series.data == null) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
series.data.forEach(({ key }, index) => {
|
|
24
|
-
formattedLabels[index] = (labelFormatter?.(`${key}`) as string) ?? `${key}`;
|
|
25
|
-
unformattedLabels[index] = `${key}`;
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
return { formattedLabels, unformattedLabels };
|
|
30
|
-
}, [data, labelFormatter]);
|
|
31
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { ScaleLinear } from 'd3-scale';
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
|
|
4
|
-
// Threshold to determine if we should scale the segments, i.e if the smallest segment is less than 10% of the tallest segment
|
|
5
|
-
export const SCALING_RATIO_THRESHOLD = 0.1;
|
|
6
|
-
|
|
7
|
-
// Minimum height ratio between smallest and tallest segments
|
|
8
|
-
export const MINIMUM_SEGMENT_HEIGHT_RATIO = 0.25;
|
|
9
|
-
|
|
10
|
-
interface UseFunnelBarScalingProps {
|
|
11
|
-
yScale: ScaleLinear<number, number>;
|
|
12
|
-
values: number[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function useFunnelBarScaling({ yScale, values }: UseFunnelBarScalingProps) {
|
|
16
|
-
const maxValue = Math.max(...values);
|
|
17
|
-
const smallestNonZeroValue = Math.min(...values.filter((value) => value > 0));
|
|
18
|
-
const tallestBarHeight = yScale(maxValue);
|
|
19
|
-
const smallestBarHeight = yScale(smallestNonZeroValue);
|
|
20
|
-
const smallestToTallestBarRatio = smallestBarHeight / tallestBarHeight;
|
|
21
|
-
const shouldApplyScaling = smallestToTallestBarRatio <= SCALING_RATIO_THRESHOLD;
|
|
22
|
-
|
|
23
|
-
const getBarHeight = useCallback(
|
|
24
|
-
(rawValue: number) => {
|
|
25
|
-
const sanitizedValue = Math.max(0, rawValue);
|
|
26
|
-
const barHeight = sanitizedValue === 0 ? 0 : yScale(sanitizedValue);
|
|
27
|
-
if (!shouldApplyScaling || barHeight === tallestBarHeight || sanitizedValue === 0) {
|
|
28
|
-
return barHeight;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Calculate the ratio of this segment's value compared to the maximum
|
|
32
|
-
const valueRatio = sanitizedValue / maxValue;
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
* Use logarithmic scaling to make small segments more visible in the funnel chart.
|
|
36
|
-
* This helps when values vary greatly (e.g., 1000 vs 10), ensuring smaller
|
|
37
|
-
* segments remain meaningful. The logarithmic scale uses exponential growth
|
|
38
|
-
* rather than linear increments on the y scale, which works well for visualizing
|
|
39
|
-
* large ranges.
|
|
40
|
-
*/
|
|
41
|
-
const logBase = MINIMUM_SEGMENT_HEIGHT_RATIO ** (1 / Math.log(smallestNonZeroValue / maxValue));
|
|
42
|
-
const scaledRatio = logBase ** Math.log(valueRatio);
|
|
43
|
-
|
|
44
|
-
return tallestBarHeight * Math.max(scaledRatio, MINIMUM_SEGMENT_HEIGHT_RATIO);
|
|
45
|
-
},
|
|
46
|
-
[yScale, shouldApplyScaling, tallestBarHeight, maxValue, smallestNonZeroValue],
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
shouldApplyScaling,
|
|
51
|
-
getBarHeight,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { Dimensions } from '@shopify/polaris-viz-core';
|
|
2
|
-
import { clamp } from '@shopify/polaris-viz-core';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
HORIZONTAL_GROUP_LABEL_HEIGHT,
|
|
7
|
-
HORIZONTAL_SPACE_BETWEEN_CHART_AND_AXIS,
|
|
8
|
-
HORIZONTAL_SPACE_BETWEEN_SETS,
|
|
9
|
-
HORIZONTAL_SPACE_BETWEEN_SINGLE,
|
|
10
|
-
WARN_FOR_DEVELOPMENT,
|
|
11
|
-
} from '../constants';
|
|
12
|
-
|
|
13
|
-
const MIN_BAR_HEIGHT = 6;
|
|
14
|
-
|
|
15
|
-
export interface Props {
|
|
16
|
-
chartDimensions: Dimensions;
|
|
17
|
-
isSimple: boolean;
|
|
18
|
-
isStacked: boolean;
|
|
19
|
-
seriesLength: number;
|
|
20
|
-
singleBarCount: number;
|
|
21
|
-
xAxisHeight: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Returns all the data needed to size and position the
|
|
25
|
-
// horizontal bar groups and individual bars
|
|
26
|
-
export function useHorizontalBarSizes({
|
|
27
|
-
chartDimensions,
|
|
28
|
-
isSimple,
|
|
29
|
-
isStacked,
|
|
30
|
-
seriesLength,
|
|
31
|
-
singleBarCount,
|
|
32
|
-
xAxisHeight,
|
|
33
|
-
}: Props) {
|
|
34
|
-
return useMemo(() => {
|
|
35
|
-
const spaceBetweenXAxis = isSimple ? 0 : HORIZONTAL_SPACE_BETWEEN_CHART_AND_AXIS;
|
|
36
|
-
// Push the container taller to line up last bar
|
|
37
|
-
const simpleHeight = chartDimensions.height + HORIZONTAL_SPACE_BETWEEN_SETS;
|
|
38
|
-
|
|
39
|
-
const containerHeight = isSimple ? simpleHeight : chartDimensions.height;
|
|
40
|
-
const xAxisAreaHeight = isSimple ? 0 : xAxisHeight + spaceBetweenXAxis;
|
|
41
|
-
const chartHeight = containerHeight - xAxisAreaHeight;
|
|
42
|
-
|
|
43
|
-
const groupHeight = chartHeight / seriesLength;
|
|
44
|
-
|
|
45
|
-
const groupBarsAreaHeight =
|
|
46
|
-
groupHeight -
|
|
47
|
-
HORIZONTAL_GROUP_LABEL_HEIGHT -
|
|
48
|
-
(singleBarCount - 1) * HORIZONTAL_SPACE_BETWEEN_SINGLE -
|
|
49
|
-
HORIZONTAL_SPACE_BETWEEN_SETS;
|
|
50
|
-
|
|
51
|
-
const barHeight = clamp({
|
|
52
|
-
amount: groupBarsAreaHeight / (isStacked ? 1 : singleBarCount),
|
|
53
|
-
min: MIN_BAR_HEIGHT,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (WARN_FOR_DEVELOPMENT && groupBarsAreaHeight < 0) {
|
|
57
|
-
// eslint-disable-next-line no-console
|
|
58
|
-
console.error(
|
|
59
|
-
'The height available for drawing the chart is too small and this will cause overlaps between labels and bars. Maybe you should increase the chart height or use fewer data series?',
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
barHeight,
|
|
65
|
-
chartHeight,
|
|
66
|
-
groupBarsAreaHeight,
|
|
67
|
-
groupHeight,
|
|
68
|
-
};
|
|
69
|
-
}, [chartDimensions, isSimple, isStacked, seriesLength, singleBarCount, xAxisHeight]);
|
|
70
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { DataSeries } from '@shopify/polaris-viz-core';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
import { getStackedValuesFromDataSeries } from '../utilities/getStackedValuesFromDataSeries';
|
|
5
|
-
import { getStackedMinMax } from '../utilities/getStackedMinMax';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
data: DataSeries[];
|
|
9
|
-
isStacked: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function useHorizontalStackedValues({ data, isStacked }: Props) {
|
|
13
|
-
const { stackedValues, stackedMin, stackedMax } = useMemo(() => {
|
|
14
|
-
if (!isStacked || data.length === 0) {
|
|
15
|
-
return { stackedMin: 0, stackedMax: 0, stackedValues: [] };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const { stackedValues, formattedStackedValues } = getStackedValuesFromDataSeries(data);
|
|
19
|
-
|
|
20
|
-
const { min, max } = getStackedMinMax({
|
|
21
|
-
stackedValues,
|
|
22
|
-
data,
|
|
23
|
-
integersOnly: false,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
stackedMin: min,
|
|
28
|
-
stackedMax: max,
|
|
29
|
-
stackedValues: formattedStackedValues,
|
|
30
|
-
};
|
|
31
|
-
}, [isStacked, data]);
|
|
32
|
-
|
|
33
|
-
return { stackedValues, stackedMin, stackedMax };
|
|
34
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { LabelFormatter } from '@shopify/polaris-viz-core';
|
|
2
|
-
import { scaleLinear } from 'd3-scale';
|
|
3
|
-
import { extent } from 'd3-array';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
allNumbers: number[];
|
|
8
|
-
isStacked: boolean;
|
|
9
|
-
labelFormatter: LabelFormatter;
|
|
10
|
-
maxWidth: number;
|
|
11
|
-
stackedMax: number;
|
|
12
|
-
stackedMin: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function useHorizontalTicksAndScale({
|
|
16
|
-
maxWidth,
|
|
17
|
-
allNumbers,
|
|
18
|
-
labelFormatter,
|
|
19
|
-
isStacked,
|
|
20
|
-
stackedMin,
|
|
21
|
-
stackedMax,
|
|
22
|
-
}: Props) {
|
|
23
|
-
const xScale = useMemo(() => {
|
|
24
|
-
const areAllZero = !allNumbers.some((num) => num != null && num !== 0);
|
|
25
|
-
|
|
26
|
-
const domainValues = [0, ...allNumbers];
|
|
27
|
-
|
|
28
|
-
if (areAllZero) {
|
|
29
|
-
domainValues.push(1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return scaleLinear()
|
|
33
|
-
.range([0, maxWidth])
|
|
34
|
-
.domain(extent(domainValues, (num) => num) as [number, number])
|
|
35
|
-
.nice();
|
|
36
|
-
}, [maxWidth, allNumbers]);
|
|
37
|
-
|
|
38
|
-
const ticks = useMemo(() => {
|
|
39
|
-
return xScale.ticks();
|
|
40
|
-
}, [xScale]);
|
|
41
|
-
|
|
42
|
-
const xScaleStacked = useMemo(() => {
|
|
43
|
-
if (!isStacked) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const xScale = scaleLinear().range([0, maxWidth]).domain([stackedMin, stackedMax]).nice();
|
|
48
|
-
|
|
49
|
-
return xScale;
|
|
50
|
-
}, [isStacked, maxWidth, stackedMin, stackedMax]);
|
|
51
|
-
|
|
52
|
-
const ticksStacked = useMemo(() => {
|
|
53
|
-
if (!isStacked || !xScaleStacked) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return xScaleStacked.ticks();
|
|
58
|
-
}, [isStacked, xScaleStacked]);
|
|
59
|
-
|
|
60
|
-
const finalTicks = isStacked ? ticksStacked! : ticks;
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
ticks: finalTicks,
|
|
64
|
-
xScale: isStacked ? xScaleStacked! : xScale,
|
|
65
|
-
ticksFormatted: finalTicks.map((tick) => `${labelFormatter(tick)}`),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { LabelFormatter } from '@shopify/polaris-viz-core';
|
|
2
|
-
|
|
3
|
-
import { useHorizontalTicksAndScale } from './useHorizontalTicksAndScale';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
allNumbers: number[];
|
|
7
|
-
isStacked: boolean;
|
|
8
|
-
maxWidth: number;
|
|
9
|
-
stackedMax: number;
|
|
10
|
-
stackedMin: number;
|
|
11
|
-
labelFormatter: LabelFormatter;
|
|
12
|
-
longestLabel: { positive: number; negative: number };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function useHorizontalXScale({
|
|
16
|
-
allNumbers,
|
|
17
|
-
isStacked,
|
|
18
|
-
labelFormatter,
|
|
19
|
-
maxWidth,
|
|
20
|
-
stackedMax = 0,
|
|
21
|
-
stackedMin = 0,
|
|
22
|
-
longestLabel,
|
|
23
|
-
}: Props) {
|
|
24
|
-
let drawableWidth = maxWidth;
|
|
25
|
-
let chartXPosition = 0;
|
|
26
|
-
|
|
27
|
-
const labelWidth = longestLabel.positive + longestLabel.negative;
|
|
28
|
-
|
|
29
|
-
drawableWidth -= labelWidth;
|
|
30
|
-
chartXPosition += labelWidth / 2;
|
|
31
|
-
|
|
32
|
-
const { xScale, ticks, ticksFormatted } = useHorizontalTicksAndScale({
|
|
33
|
-
maxWidth: drawableWidth,
|
|
34
|
-
allNumbers,
|
|
35
|
-
labelFormatter,
|
|
36
|
-
isStacked,
|
|
37
|
-
stackedMin,
|
|
38
|
-
stackedMax,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
xScale,
|
|
43
|
-
ticks,
|
|
44
|
-
ticksFormatted,
|
|
45
|
-
drawableWidth,
|
|
46
|
-
chartXPosition,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { DataSeries } from '@shopify/polaris-viz-core';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
export function useIndexForLabels(data: DataSeries[]) {
|
|
5
|
-
return useMemo(() => {
|
|
6
|
-
return data.reduce((longestIndex, currentSeries, index, array) => {
|
|
7
|
-
const previousSeries = array[index - 1];
|
|
8
|
-
|
|
9
|
-
if (previousSeries && previousSeries.data.length < currentSeries.data.length) {
|
|
10
|
-
return index;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return longestIndex;
|
|
14
|
-
}, 0);
|
|
15
|
-
}, [data]);
|
|
16
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { Dimensions } from '@shopify/polaris-viz-core';
|
|
2
|
-
import type { Dispatch } from 'react';
|
|
3
|
-
|
|
4
|
-
import { useBrowserCheck } from './useBrowserCheck';
|
|
5
|
-
import { useEnhancedEffect } from '@/hooks';
|
|
6
|
-
import { useState } from 'react';
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
ref: HTMLElement | null;
|
|
10
|
-
setContainerBounds: (value: React.SetStateAction<Dimensions | null>) => void;
|
|
11
|
-
onIsPrintingChange: Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function usePrintResizing({ ref, setContainerBounds, onIsPrintingChange }: Props) {
|
|
15
|
-
const [isPrinting, setIsPrinting] = useState(false);
|
|
16
|
-
const { isFirefox, isSafari } = useBrowserCheck();
|
|
17
|
-
|
|
18
|
-
useEnhancedEffect(() => {
|
|
19
|
-
const isServer = typeof window === 'undefined';
|
|
20
|
-
|
|
21
|
-
function handlePrint() {
|
|
22
|
-
if (ref != null) {
|
|
23
|
-
const { paddingRight, paddingLeft, paddingTop, paddingBottom } = getComputedStyle(ref);
|
|
24
|
-
const width = ref.clientWidth - parseInt(paddingLeft, 10) - parseInt(paddingRight, 10);
|
|
25
|
-
const height = ref.clientHeight - parseInt(paddingTop, 10) - parseInt(paddingBottom, 10);
|
|
26
|
-
setContainerBounds({ width, height });
|
|
27
|
-
|
|
28
|
-
setIsPrinting((isPrinting) => {
|
|
29
|
-
const newIsPrinting = !isPrinting;
|
|
30
|
-
onIsPrintingChange(newIsPrinting);
|
|
31
|
-
return newIsPrinting;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const printSafari = () => {
|
|
37
|
-
setTimeout(() => {
|
|
38
|
-
handlePrint();
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const addEventListener = typeof window.matchMedia('print').addEventListener === 'function';
|
|
43
|
-
// older versions of Safari break if we call addEventListener
|
|
44
|
-
const addListener = typeof window.matchMedia('print').addListener === 'function';
|
|
45
|
-
const notSafariOrServer = !isSafari && !isServer;
|
|
46
|
-
const safariNotServer = isSafari && !isServer;
|
|
47
|
-
|
|
48
|
-
if (isFirefox) {
|
|
49
|
-
window.addEventListener('beforeprint', handlePrint);
|
|
50
|
-
window.addEventListener('afterprint', handlePrint);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (notSafariOrServer) {
|
|
54
|
-
if (addEventListener) {
|
|
55
|
-
window.matchMedia('print').addEventListener('change', handlePrint);
|
|
56
|
-
} else if (addListener) {
|
|
57
|
-
window.matchMedia('print').addListener(printSafari);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (safariNotServer) {
|
|
62
|
-
if (addEventListener) {
|
|
63
|
-
window.matchMedia('print').addEventListener('change', printSafari);
|
|
64
|
-
} else if (addListener) {
|
|
65
|
-
window.matchMedia('print').addListener(printSafari);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return () => {
|
|
70
|
-
if (isFirefox) {
|
|
71
|
-
window.removeEventListener('beforeprint', handlePrint);
|
|
72
|
-
window.removeEventListener('afterprint', handlePrint);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (notSafariOrServer) {
|
|
76
|
-
if (addEventListener) {
|
|
77
|
-
window.matchMedia('print').removeEventListener('change', handlePrint);
|
|
78
|
-
} else if (addListener) {
|
|
79
|
-
window.matchMedia('print').removeListener(printSafari);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (safariNotServer) {
|
|
84
|
-
if (addEventListener) {
|
|
85
|
-
window.matchMedia('print').removeEventListener('change', printSafari);
|
|
86
|
-
} else if (addListener) {
|
|
87
|
-
window.matchMedia('print').removeListener(printSafari);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}, [onIsPrintingChange, setContainerBounds, ref, isFirefox, isSafari]);
|
|
92
|
-
|
|
93
|
-
return { isPrinting };
|
|
94
|
-
}
|