@levi-gemcommerce/analytics 1.0.0-dev.31 → 1.0.0-dev.33
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSearchParams: () => [URLSearchParams];
|
package/dist/esm/index.js
CHANGED
|
@@ -12,7 +12,6 @@ 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 { useSearchParams } from '@remix-run/react';
|
|
16
15
|
import { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
17
16
|
import { t as t$1 } from 'i18next';
|
|
18
17
|
|
|
@@ -3240,6 +3239,14 @@ const useFunnelChartStore = create()((set, get) => ({
|
|
|
3240
3239
|
const MAX_FUNNEL_ADDITIONAL_LEVEL = 3;
|
|
3241
3240
|
const FINAL_FUNNEL_FIXED_LEVEL = 3;
|
|
3242
3241
|
|
|
3242
|
+
// Framework-agnostic replacement for @remix-run/react useSearchParams.
|
|
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
|
+
|
|
3243
3250
|
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, }) => {
|
|
3244
3251
|
const [searchParams] = useSearchParams();
|
|
3245
3252
|
const setFirstLevelLocationPath = usePathAnalysisStore((state) => state.setFirstLevelLocationPath);
|
|
@@ -21846,9 +21853,10 @@ function getVerticalLabels({ labels, characterWidths, longestLabelWidth, targetW
|
|
|
21846
21853
|
}
|
|
21847
21854
|
|
|
21848
21855
|
function getFontSize() {
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21856
|
+
if (typeof window === 'undefined')
|
|
21857
|
+
return FONT_SIZE;
|
|
21858
|
+
const isMobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
21859
|
+
return isMobile ? TOUCH_FONT_SIZE : FONT_SIZE;
|
|
21852
21860
|
}
|
|
21853
21861
|
|
|
21854
21862
|
function useLabels({ allowLineWrap, align = 'center', labels, onHeightChange = () => { }, targetWidth }) {
|
|
@@ -23124,15 +23132,17 @@ function TooltipTitle({ children, theme, color }) {
|
|
|
23124
23132
|
}
|
|
23125
23133
|
|
|
23126
23134
|
const useRootContainer = (id) => {
|
|
23127
|
-
const ref = useRef(
|
|
23135
|
+
const ref = useRef(null);
|
|
23128
23136
|
function getRootElem() {
|
|
23129
|
-
if (typeof document === 'undefined')
|
|
23137
|
+
if (typeof document === 'undefined')
|
|
23130
23138
|
return null;
|
|
23131
|
-
}
|
|
23132
23139
|
if (!ref.current) {
|
|
23133
|
-
ref.current = document.
|
|
23134
|
-
ref.current
|
|
23135
|
-
|
|
23140
|
+
ref.current = document.getElementById(id);
|
|
23141
|
+
if (!ref.current) {
|
|
23142
|
+
ref.current = document.createElement('div');
|
|
23143
|
+
ref.current.id = id;
|
|
23144
|
+
document.body.appendChild(ref.current);
|
|
23145
|
+
}
|
|
23136
23146
|
}
|
|
23137
23147
|
return ref.current;
|
|
23138
23148
|
}
|
|
@@ -23141,9 +23151,8 @@ const useRootContainer = (id) => {
|
|
|
23141
23151
|
|
|
23142
23152
|
function TooltipWithPortal({ children }) {
|
|
23143
23153
|
const container = useRootContainer(TOOLTIP_ID);
|
|
23144
|
-
if (!container)
|
|
23154
|
+
if (!container)
|
|
23145
23155
|
return null;
|
|
23146
|
-
}
|
|
23147
23156
|
return createPortal(children, container);
|
|
23148
23157
|
}
|
|
23149
23158
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -12,7 +12,6 @@ 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 { useSearchParams } from '@remix-run/react';
|
|
16
15
|
import { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
17
16
|
import { t as t$1 } from 'i18next';
|
|
18
17
|
|
|
@@ -3240,6 +3239,14 @@ const useFunnelChartStore = create()((set, get) => ({
|
|
|
3240
3239
|
const MAX_FUNNEL_ADDITIONAL_LEVEL = 3;
|
|
3241
3240
|
const FINAL_FUNNEL_FIXED_LEVEL = 3;
|
|
3242
3241
|
|
|
3242
|
+
// Framework-agnostic replacement for @remix-run/react useSearchParams.
|
|
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
|
+
|
|
3243
3250
|
const usePathAnalysisFunnel = ({ pathAnalytics, pathAnalysisCacheKey, dataFirstLevels, }) => {
|
|
3244
3251
|
const [searchParams] = useSearchParams();
|
|
3245
3252
|
const setFirstLevelLocationPath = usePathAnalysisStore((state) => state.setFirstLevelLocationPath);
|
|
@@ -21846,9 +21853,10 @@ function getVerticalLabels({ labels, characterWidths, longestLabelWidth, targetW
|
|
|
21846
21853
|
}
|
|
21847
21854
|
|
|
21848
21855
|
function getFontSize() {
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21856
|
+
if (typeof window === 'undefined')
|
|
21857
|
+
return FONT_SIZE;
|
|
21858
|
+
const isMobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
21859
|
+
return isMobile ? TOUCH_FONT_SIZE : FONT_SIZE;
|
|
21852
21860
|
}
|
|
21853
21861
|
|
|
21854
21862
|
function useLabels({ allowLineWrap, align = 'center', labels, onHeightChange = () => { }, targetWidth }) {
|
|
@@ -23124,15 +23132,17 @@ function TooltipTitle({ children, theme, color }) {
|
|
|
23124
23132
|
}
|
|
23125
23133
|
|
|
23126
23134
|
const useRootContainer = (id) => {
|
|
23127
|
-
const ref = useRef(
|
|
23135
|
+
const ref = useRef(null);
|
|
23128
23136
|
function getRootElem() {
|
|
23129
|
-
if (typeof document === 'undefined')
|
|
23137
|
+
if (typeof document === 'undefined')
|
|
23130
23138
|
return null;
|
|
23131
|
-
}
|
|
23132
23139
|
if (!ref.current) {
|
|
23133
|
-
ref.current = document.
|
|
23134
|
-
ref.current
|
|
23135
|
-
|
|
23140
|
+
ref.current = document.getElementById(id);
|
|
23141
|
+
if (!ref.current) {
|
|
23142
|
+
ref.current = document.createElement('div');
|
|
23143
|
+
ref.current.id = id;
|
|
23144
|
+
document.body.appendChild(ref.current);
|
|
23145
|
+
}
|
|
23136
23146
|
}
|
|
23137
23147
|
return ref.current;
|
|
23138
23148
|
}
|
|
@@ -23141,9 +23151,8 @@ const useRootContainer = (id) => {
|
|
|
23141
23151
|
|
|
23142
23152
|
function TooltipWithPortal({ children }) {
|
|
23143
23153
|
const container = useRootContainer(TOOLTIP_ID);
|
|
23144
|
-
if (!container)
|
|
23154
|
+
if (!container)
|
|
23145
23155
|
return null;
|
|
23146
|
-
}
|
|
23147
23156
|
return createPortal(children, container);
|
|
23148
23157
|
}
|
|
23149
23158
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSearchParams: () => [URLSearchParams];
|