@levi-gemcommerce/analytics 1.0.0-dev.34 → 1.0.0-dev.36
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/CardPathAnalysis/contexts/PathAnalysisProvider.d.ts +1 -0
- package/dist/esm/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.d.ts +2 -1
- package/dist/esm/index.js +42 -41
- package/dist/esm/index.mjs +42 -41
- package/dist/umd/esm/components/CardPathAnalysis/contexts/PathAnalysisProvider.d.ts +1 -0
- package/dist/umd/esm/components/CardPathAnalysis/hooks/usePathAnalysisFunnel.d.ts +2 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export interface IAnalyticsData {
|
|
|
20
20
|
pathAnalytics?: IBasePathAnalyticPageWithParent[];
|
|
21
21
|
previousPathAnalyticsMap?: Record<string, IBasePathAnalyticPageWithParent>;
|
|
22
22
|
isLoading?: boolean;
|
|
23
|
+
locationPath?: string;
|
|
23
24
|
}
|
|
24
25
|
export interface PathAnalysisType {
|
|
25
26
|
mode: EAnalyticMode;
|
|
@@ -5,8 +5,9 @@ interface IUsePathAnalysisFunnelProps {
|
|
|
5
5
|
pathAnalytics: IBasePathAnalyticPageWithParent[];
|
|
6
6
|
pathAnalysisCacheKey: string;
|
|
7
7
|
dataFirstLevels?: IPathAnalysisFirstLevel[];
|
|
8
|
+
locationPath?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const usePathAnalysisFunnel: ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, }: IUsePathAnalysisFunnelProps) => {
|
|
10
|
+
export declare const usePathAnalysisFunnel: ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, locationPath, }: IUsePathAnalysisFunnelProps) => {
|
|
10
11
|
pageWithMetric: IBasePathAnalyticPageWithChild | undefined;
|
|
11
12
|
dynamicLevels: IBasePathAnalyticPageWithChild[];
|
|
12
13
|
nextLevelPages: IBasePathAnalyticPageWithChild[];
|
package/dist/esm/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
12
|
import { create } from 'zustand';
|
|
13
13
|
import { useQuery } from '@tanstack/react-query';
|
|
14
14
|
import { PolarisVizProvider, LineChart, DonutChart } from '@shopify/polaris-viz';
|
|
15
|
+
import chartStyle from '@shopify/polaris-viz/build/esm/styles.css?url';
|
|
15
16
|
import { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
16
17
|
import { t as t$1 } from 'i18next';
|
|
17
18
|
|
|
@@ -1250,19 +1251,19 @@ const LINE_SERIES_COLORS = {
|
|
|
1250
1251
|
all: [...SERIES_COLORS.all],
|
|
1251
1252
|
};
|
|
1252
1253
|
const MetricChartProvider = ({ children, minHeight = CHART_MIN_HEIGHT, seriesColors = LINE_SERIES_COLORS, }) => {
|
|
1253
|
-
return (
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1254
|
+
return (jsxs(Fragment, { children: [jsx("link", { rel: "stylesheet", href: chartStyle }), jsx(PolarisVizProvider, { themes: {
|
|
1255
|
+
Light: {
|
|
1256
|
+
chartContainer: {
|
|
1257
|
+
minHeight,
|
|
1258
|
+
},
|
|
1259
|
+
grid: {
|
|
1260
|
+
horizontalOverflow: true,
|
|
1261
|
+
verticalOverflow: true,
|
|
1262
|
+
horizontalMargin: 0,
|
|
1263
|
+
},
|
|
1264
|
+
seriesColors,
|
|
1262
1265
|
},
|
|
1263
|
-
|
|
1264
|
-
},
|
|
1265
|
-
}, children: children }) }));
|
|
1266
|
+
}, children: children })] }));
|
|
1266
1267
|
};
|
|
1267
1268
|
|
|
1268
1269
|
const DEFAULT_PRICING_CONTEXT = {
|
|
@@ -3035,7 +3036,6 @@ const buildTree = (items) => {
|
|
|
3035
3036
|
return tree;
|
|
3036
3037
|
};
|
|
3037
3038
|
|
|
3038
|
-
const LOCATION_PATH_KEY = 'location_path';
|
|
3039
3039
|
const SHOPIFY_PAGE_TYPE_KEY = 'shopify_page_type';
|
|
3040
3040
|
const METRICS_COLUMNS = {};
|
|
3041
3041
|
const PAGE_ANALYTIC_MAPPING = {};
|
|
@@ -3239,18 +3239,9 @@ const useFunnelChartStore = create()((set, get) => ({
|
|
|
3239
3239
|
const MAX_FUNNEL_ADDITIONAL_LEVEL = 3;
|
|
3240
3240
|
const FINAL_FUNNEL_FIXED_LEVEL = 3;
|
|
3241
3241
|
|
|
3242
|
-
|
|
3243
|
-
// Returns a read-only URLSearchParams from window.location.search so the SDK
|
|
3244
|
-
// works outside of a Remix/React Router context (e.g. Next.js, plain React).
|
|
3245
|
-
const useSearchParams = () => {
|
|
3246
|
-
const params = typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3247
|
-
return [params];
|
|
3248
|
-
};
|
|
3249
|
-
|
|
3250
|
-
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, }) => {
|
|
3251
|
-
const [searchParams] = useSearchParams();
|
|
3242
|
+
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, locationPath, }) => {
|
|
3252
3243
|
const setFirstLevelLocationPath = usePathAnalysisStore((state) => state.setFirstLevelLocationPath);
|
|
3253
|
-
const firstLevelLocationPath = usePathAnalysisStore((state) => state.firstLevelLocationPath) ||
|
|
3244
|
+
const firstLevelLocationPath = usePathAnalysisStore((state) => state.firstLevelLocationPath) || locationPath;
|
|
3254
3245
|
const setCachedFunnelChartData = useFunnelChartStore((state) => state.setCachedFunnelChartData);
|
|
3255
3246
|
const resetCachedFunnelChartData = useFunnelChartStore((state) => state.resetData);
|
|
3256
3247
|
const cachedFunnelChartData = useFunnelChartStore((state) => state.cachedFunnelChartData);
|
|
@@ -3414,12 +3405,14 @@ const PathAnalysisProvider = (props) => {
|
|
|
3414
3405
|
const pathAnalytics = analyticsData?.pathAnalytics ?? [];
|
|
3415
3406
|
const previousPathAnalyticsMap = analyticsData?.previousPathAnalyticsMap ?? {};
|
|
3416
3407
|
const isLoadingMetric = analyticsData?.isLoading ?? false;
|
|
3408
|
+
const locationPath = analyticsData?.locationPath;
|
|
3417
3409
|
const pathAnalysisCacheKey = JSON.stringify({ mode, campaignVariantID, campaignVersionID });
|
|
3418
3410
|
const { processedPathAnalytics } = usePathAnalyticsMerger({ pathAnalytics, dataFirstLevels });
|
|
3419
3411
|
const pathAnalysisFunnelData = usePathAnalysisFunnel({
|
|
3420
3412
|
pathAnalytics: processedPathAnalytics,
|
|
3421
3413
|
pathAnalysisCacheKey,
|
|
3422
3414
|
dataFirstLevels,
|
|
3415
|
+
locationPath,
|
|
3423
3416
|
});
|
|
3424
3417
|
const isLoading = isLoadingMetric || isFetchingFirstLevelPaths;
|
|
3425
3418
|
return (jsx(PathAnalysisContext.Provider, { value: {
|
|
@@ -3509,6 +3502,14 @@ const useFeatureFlagChecker = () => ({
|
|
|
3509
3502
|
isEnabledHeatmapV2: false,
|
|
3510
3503
|
});
|
|
3511
3504
|
|
|
3505
|
+
// Framework-agnostic replacement for @remix-run/react useSearchParams.
|
|
3506
|
+
// Returns a read-only URLSearchParams from window.location.search so the SDK
|
|
3507
|
+
// works outside of a Remix/React Router context (e.g. Next.js, plain React).
|
|
3508
|
+
const useSearchParams = () => {
|
|
3509
|
+
const params = typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3510
|
+
return [params];
|
|
3511
|
+
};
|
|
3512
|
+
|
|
3512
3513
|
const FUNNEL_NAME = 'Conversion';
|
|
3513
3514
|
// Checkout pages don't support heatmap viewing
|
|
3514
3515
|
const NON_HEATMAP_PAGE_TYPES = new Set([TemplateType.CHECKOUT]);
|
|
@@ -23600,24 +23601,24 @@ const ChartContainerWrapper = ({ props, children, height, }) => {
|
|
|
23600
23601
|
};
|
|
23601
23602
|
|
|
23602
23603
|
const GChartProvider = ({ children, minHeight = 228, seriesColors, }) => {
|
|
23603
|
-
return (
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23604
|
+
return (jsxs(Fragment, { children: [jsx("link", { rel: "stylesheet", href: chartStyle }), jsx(PolarisVizProvider, { themes: {
|
|
23605
|
+
Light: {
|
|
23606
|
+
chartContainer: {
|
|
23607
|
+
minHeight,
|
|
23608
|
+
},
|
|
23609
|
+
grid: {
|
|
23610
|
+
horizontalOverflow: true,
|
|
23611
|
+
verticalOverflow: true,
|
|
23612
|
+
horizontalMargin: 0,
|
|
23613
|
+
},
|
|
23614
|
+
seriesColors: {
|
|
23615
|
+
comparison: 'rgba(64, 176, 230, 1)',
|
|
23616
|
+
single: 'rgba(64, 176, 230, 1)',
|
|
23617
|
+
all: ['#2C7DFF', '#F34A70'],
|
|
23618
|
+
...seriesColors,
|
|
23619
|
+
},
|
|
23618
23620
|
},
|
|
23619
|
-
},
|
|
23620
|
-
}, children: children }) }));
|
|
23621
|
+
}, children: children })] }));
|
|
23621
23622
|
};
|
|
23622
23623
|
|
|
23623
23624
|
const FunnelSelectionItem = ({ item, isSelected, isChangeFunnel, onSelectRow }) => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
12
|
import { create } from 'zustand';
|
|
13
13
|
import { useQuery } from '@tanstack/react-query';
|
|
14
14
|
import { PolarisVizProvider, LineChart, DonutChart } from '@shopify/polaris-viz';
|
|
15
|
+
import chartStyle from '@shopify/polaris-viz/build/esm/styles.css?url';
|
|
15
16
|
import { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
16
17
|
import { t as t$1 } from 'i18next';
|
|
17
18
|
|
|
@@ -1250,19 +1251,19 @@ const LINE_SERIES_COLORS = {
|
|
|
1250
1251
|
all: [...SERIES_COLORS.all],
|
|
1251
1252
|
};
|
|
1252
1253
|
const MetricChartProvider = ({ children, minHeight = CHART_MIN_HEIGHT, seriesColors = LINE_SERIES_COLORS, }) => {
|
|
1253
|
-
return (
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1254
|
+
return (jsxs(Fragment, { children: [jsx("link", { rel: "stylesheet", href: chartStyle }), jsx(PolarisVizProvider, { themes: {
|
|
1255
|
+
Light: {
|
|
1256
|
+
chartContainer: {
|
|
1257
|
+
minHeight,
|
|
1258
|
+
},
|
|
1259
|
+
grid: {
|
|
1260
|
+
horizontalOverflow: true,
|
|
1261
|
+
verticalOverflow: true,
|
|
1262
|
+
horizontalMargin: 0,
|
|
1263
|
+
},
|
|
1264
|
+
seriesColors,
|
|
1262
1265
|
},
|
|
1263
|
-
|
|
1264
|
-
},
|
|
1265
|
-
}, children: children }) }));
|
|
1266
|
+
}, children: children })] }));
|
|
1266
1267
|
};
|
|
1267
1268
|
|
|
1268
1269
|
const DEFAULT_PRICING_CONTEXT = {
|
|
@@ -3035,7 +3036,6 @@ const buildTree = (items) => {
|
|
|
3035
3036
|
return tree;
|
|
3036
3037
|
};
|
|
3037
3038
|
|
|
3038
|
-
const LOCATION_PATH_KEY = 'location_path';
|
|
3039
3039
|
const SHOPIFY_PAGE_TYPE_KEY = 'shopify_page_type';
|
|
3040
3040
|
const METRICS_COLUMNS = {};
|
|
3041
3041
|
const PAGE_ANALYTIC_MAPPING = {};
|
|
@@ -3239,18 +3239,9 @@ const useFunnelChartStore = create()((set, get) => ({
|
|
|
3239
3239
|
const MAX_FUNNEL_ADDITIONAL_LEVEL = 3;
|
|
3240
3240
|
const FINAL_FUNNEL_FIXED_LEVEL = 3;
|
|
3241
3241
|
|
|
3242
|
-
|
|
3243
|
-
// Returns a read-only URLSearchParams from window.location.search so the SDK
|
|
3244
|
-
// works outside of a Remix/React Router context (e.g. Next.js, plain React).
|
|
3245
|
-
const useSearchParams = () => {
|
|
3246
|
-
const params = typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3247
|
-
return [params];
|
|
3248
|
-
};
|
|
3249
|
-
|
|
3250
|
-
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, }) => {
|
|
3251
|
-
const [searchParams] = useSearchParams();
|
|
3242
|
+
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, locationPath, }) => {
|
|
3252
3243
|
const setFirstLevelLocationPath = usePathAnalysisStore((state) => state.setFirstLevelLocationPath);
|
|
3253
|
-
const firstLevelLocationPath = usePathAnalysisStore((state) => state.firstLevelLocationPath) ||
|
|
3244
|
+
const firstLevelLocationPath = usePathAnalysisStore((state) => state.firstLevelLocationPath) || locationPath;
|
|
3254
3245
|
const setCachedFunnelChartData = useFunnelChartStore((state) => state.setCachedFunnelChartData);
|
|
3255
3246
|
const resetCachedFunnelChartData = useFunnelChartStore((state) => state.resetData);
|
|
3256
3247
|
const cachedFunnelChartData = useFunnelChartStore((state) => state.cachedFunnelChartData);
|
|
@@ -3414,12 +3405,14 @@ const PathAnalysisProvider = (props) => {
|
|
|
3414
3405
|
const pathAnalytics = analyticsData?.pathAnalytics ?? [];
|
|
3415
3406
|
const previousPathAnalyticsMap = analyticsData?.previousPathAnalyticsMap ?? {};
|
|
3416
3407
|
const isLoadingMetric = analyticsData?.isLoading ?? false;
|
|
3408
|
+
const locationPath = analyticsData?.locationPath;
|
|
3417
3409
|
const pathAnalysisCacheKey = JSON.stringify({ mode, campaignVariantID, campaignVersionID });
|
|
3418
3410
|
const { processedPathAnalytics } = usePathAnalyticsMerger({ pathAnalytics, dataFirstLevels });
|
|
3419
3411
|
const pathAnalysisFunnelData = usePathAnalysisFunnel({
|
|
3420
3412
|
pathAnalytics: processedPathAnalytics,
|
|
3421
3413
|
pathAnalysisCacheKey,
|
|
3422
3414
|
dataFirstLevels,
|
|
3415
|
+
locationPath,
|
|
3423
3416
|
});
|
|
3424
3417
|
const isLoading = isLoadingMetric || isFetchingFirstLevelPaths;
|
|
3425
3418
|
return (jsx(PathAnalysisContext.Provider, { value: {
|
|
@@ -3509,6 +3502,14 @@ const useFeatureFlagChecker = () => ({
|
|
|
3509
3502
|
isEnabledHeatmapV2: false,
|
|
3510
3503
|
});
|
|
3511
3504
|
|
|
3505
|
+
// Framework-agnostic replacement for @remix-run/react useSearchParams.
|
|
3506
|
+
// Returns a read-only URLSearchParams from window.location.search so the SDK
|
|
3507
|
+
// works outside of a Remix/React Router context (e.g. Next.js, plain React).
|
|
3508
|
+
const useSearchParams = () => {
|
|
3509
|
+
const params = typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3510
|
+
return [params];
|
|
3511
|
+
};
|
|
3512
|
+
|
|
3512
3513
|
const FUNNEL_NAME = 'Conversion';
|
|
3513
3514
|
// Checkout pages don't support heatmap viewing
|
|
3514
3515
|
const NON_HEATMAP_PAGE_TYPES = new Set([TemplateType.CHECKOUT]);
|
|
@@ -23600,24 +23601,24 @@ const ChartContainerWrapper = ({ props, children, height, }) => {
|
|
|
23600
23601
|
};
|
|
23601
23602
|
|
|
23602
23603
|
const GChartProvider = ({ children, minHeight = 228, seriesColors, }) => {
|
|
23603
|
-
return (
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23604
|
+
return (jsxs(Fragment, { children: [jsx("link", { rel: "stylesheet", href: chartStyle }), jsx(PolarisVizProvider, { themes: {
|
|
23605
|
+
Light: {
|
|
23606
|
+
chartContainer: {
|
|
23607
|
+
minHeight,
|
|
23608
|
+
},
|
|
23609
|
+
grid: {
|
|
23610
|
+
horizontalOverflow: true,
|
|
23611
|
+
verticalOverflow: true,
|
|
23612
|
+
horizontalMargin: 0,
|
|
23613
|
+
},
|
|
23614
|
+
seriesColors: {
|
|
23615
|
+
comparison: 'rgba(64, 176, 230, 1)',
|
|
23616
|
+
single: 'rgba(64, 176, 230, 1)',
|
|
23617
|
+
all: ['#2C7DFF', '#F34A70'],
|
|
23618
|
+
...seriesColors,
|
|
23619
|
+
},
|
|
23618
23620
|
},
|
|
23619
|
-
},
|
|
23620
|
-
}, children: children }) }));
|
|
23621
|
+
}, children: children })] }));
|
|
23621
23622
|
};
|
|
23622
23623
|
|
|
23623
23624
|
const FunnelSelectionItem = ({ item, isSelected, isChangeFunnel, onSelectRow }) => {
|
|
@@ -20,6 +20,7 @@ export interface IAnalyticsData {
|
|
|
20
20
|
pathAnalytics?: IBasePathAnalyticPageWithParent[];
|
|
21
21
|
previousPathAnalyticsMap?: Record<string, IBasePathAnalyticPageWithParent>;
|
|
22
22
|
isLoading?: boolean;
|
|
23
|
+
locationPath?: string;
|
|
23
24
|
}
|
|
24
25
|
export interface PathAnalysisType {
|
|
25
26
|
mode: EAnalyticMode;
|
|
@@ -5,8 +5,9 @@ interface IUsePathAnalysisFunnelProps {
|
|
|
5
5
|
pathAnalytics: IBasePathAnalyticPageWithParent[];
|
|
6
6
|
pathAnalysisCacheKey: string;
|
|
7
7
|
dataFirstLevels?: IPathAnalysisFirstLevel[];
|
|
8
|
+
locationPath?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const usePathAnalysisFunnel: ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, }: IUsePathAnalysisFunnelProps) => {
|
|
10
|
+
export declare const usePathAnalysisFunnel: ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, locationPath, }: IUsePathAnalysisFunnelProps) => {
|
|
10
11
|
pageWithMetric: IBasePathAnalyticPageWithChild | undefined;
|
|
11
12
|
dynamicLevels: IBasePathAnalyticPageWithChild[];
|
|
12
13
|
nextLevelPages: IBasePathAnalyticPageWithChild[];
|