@ecency/sdk 1.5.25 → 1.5.27
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/browser/index.d.ts
CHANGED
|
@@ -1999,9 +1999,9 @@ declare function getDiscoverCurationQueryOptions(duration: CurationDuration): _t
|
|
|
1999
1999
|
* @param url - URL to get stats for
|
|
2000
2000
|
* @param dimensions - Dimensions to query (default: [])
|
|
2001
2001
|
* @param metrics - Metrics to query (default: ["visitors", "pageviews", "visit_duration"])
|
|
2002
|
-
* @param dateRange - Date range for the query
|
|
2002
|
+
* @param dateRange - Date range for the query (e.g. "day", "7d", "30d", "all")
|
|
2003
2003
|
*/
|
|
2004
|
-
declare function getPageStatsQueryOptions(url: string, dimensions?: string[], metrics?: string[], dateRange?: string
|
|
2004
|
+
declare function getPageStatsQueryOptions(url: string, dimensions?: string[], metrics?: string[], dateRange?: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<PageStatsResponse, Error, PageStatsResponse, (string | string[] | undefined)[]>, "queryFn"> & {
|
|
2005
2005
|
queryFn?: _tanstack_react_query.QueryFunction<PageStatsResponse, (string | string[] | undefined)[], never> | undefined;
|
|
2006
2006
|
} & {
|
|
2007
2007
|
queryKey: (string | string[] | undefined)[] & {
|
package/dist/browser/index.js
CHANGED
|
@@ -4112,8 +4112,10 @@ function getDiscoverCurationQueryOptions(duration) {
|
|
|
4112
4112
|
});
|
|
4113
4113
|
}
|
|
4114
4114
|
function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "pageviews", "visit_duration"], dateRange) {
|
|
4115
|
+
const sortedDimensions = [...dimensions].sort();
|
|
4116
|
+
const sortedMetrics = [...metrics].sort();
|
|
4115
4117
|
return queryOptions({
|
|
4116
|
-
queryKey: ["analytics", "page-stats", url,
|
|
4118
|
+
queryKey: ["analytics", "page-stats", url, sortedDimensions, sortedMetrics, dateRange],
|
|
4117
4119
|
queryFn: async ({ signal }) => {
|
|
4118
4120
|
const response = await fetch(CONFIG.privateApiHost + "/api/stats", {
|
|
4119
4121
|
method: "POST",
|
|
@@ -4133,7 +4135,9 @@ function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "
|
|
|
4133
4135
|
}
|
|
4134
4136
|
return response.json();
|
|
4135
4137
|
},
|
|
4136
|
-
enabled: !!url
|
|
4138
|
+
enabled: !!url,
|
|
4139
|
+
// Analytics data should always be fresh - users expect current stats when changing range
|
|
4140
|
+
staleTime: 0
|
|
4137
4141
|
});
|
|
4138
4142
|
}
|
|
4139
4143
|
|