@vercel/analytics
Advanced tools
Comparing version 0.1.9-beta.4 to 0.1.9-beta.5
@@ -23,9 +23,9 @@ interface PageViewEvent { | ||
declare const inject: (props?: AnalyticsProps) => void; | ||
declare const track: (name: string, properties?: Record<string, AllowedPropertyValues>) => void; | ||
declare function inject(props?: AnalyticsProps): void; | ||
declare function track(name: string, properties?: Record<string, AllowedPropertyValues>): void; | ||
declare const _default: { | ||
inject: (props?: AnalyticsProps) => void; | ||
track: (name: string, properties?: Record<string, AllowedPropertyValues> | undefined) => void; | ||
inject: typeof inject; | ||
track: typeof track; | ||
}; | ||
export { _default as default, inject, track }; |
@@ -0,1 +1,5 @@ | ||
// package.json | ||
var name = "@vercel/analytics"; | ||
var version = "0.1.9-beta.5"; | ||
// src/queue.ts | ||
@@ -37,3 +41,5 @@ var initQueue = () => { | ||
} | ||
var removeKey = (key, { [key]: _, ...rest }) => rest; | ||
function removeKey(key, { [key]: _, ...rest }) { | ||
return rest; | ||
} | ||
function parseProperties(properties, options) { | ||
@@ -62,5 +68,5 @@ let props = properties; | ||
// src/generic.ts | ||
var inject = (props = { | ||
function inject(props = { | ||
debug: true | ||
}) => { | ||
}) { | ||
var _a; | ||
@@ -80,2 +86,4 @@ if (!isBrowser()) | ||
script.defer = true; | ||
script.setAttribute("data-sdkn", name); | ||
script.setAttribute("data-sdkv", version); | ||
if (isDevelopment() && props.debug === false) { | ||
@@ -85,9 +93,13 @@ script.setAttribute("data-debug", "false"); | ||
document.head.appendChild(script); | ||
}; | ||
var track = (name, properties) => { | ||
} | ||
function track(name2, properties) { | ||
var _a, _b; | ||
if (!isBrowser()) | ||
if (!isBrowser()) { | ||
console.warn( | ||
"[Vercel Analytics] Server-side execution of `track()` is currently not supported." | ||
); | ||
return; | ||
} | ||
if (!properties) { | ||
(_a = window.va) == null ? void 0 : _a.call(window, "event", { name }); | ||
(_a = window.va) == null ? void 0 : _a.call(window, "event", { name: name2 }); | ||
return; | ||
@@ -100,3 +112,3 @@ } | ||
(_b = window.va) == null ? void 0 : _b.call(window, "event", { | ||
name, | ||
name: name2, | ||
data: props | ||
@@ -109,3 +121,3 @@ }); | ||
} | ||
}; | ||
} | ||
var generic_default = { | ||
@@ -112,0 +124,0 @@ inject, |
@@ -23,3 +23,3 @@ interface PageViewEvent { | ||
declare const track: (name: string, properties?: Record<string, AllowedPropertyValues>) => void; | ||
declare function track(name: string, properties?: Record<string, AllowedPropertyValues>): void; | ||
@@ -30,5 +30,5 @@ declare function Analytics({ beforeSend, debug, mode, }: AnalyticsProps): null; | ||
Analytics: typeof Analytics; | ||
track: (name: string, properties?: Record<string, AllowedPropertyValues> | undefined) => void; | ||
track: typeof track; | ||
}; | ||
export { Analytics, AnalyticsProps, _default as default, track }; |
@@ -0,4 +1,10 @@ | ||
"use client"; | ||
// src/react.tsx | ||
import { useEffect } from "react"; | ||
// package.json | ||
var name = "@vercel/analytics"; | ||
var version = "0.1.9-beta.5"; | ||
// src/queue.ts | ||
@@ -40,3 +46,5 @@ var initQueue = () => { | ||
} | ||
var removeKey = (key, { [key]: _, ...rest }) => rest; | ||
function removeKey(key, { [key]: _, ...rest }) { | ||
return rest; | ||
} | ||
function parseProperties(properties, options) { | ||
@@ -65,5 +73,5 @@ let props = properties; | ||
// src/generic.ts | ||
var inject = (props = { | ||
function inject(props = { | ||
debug: true | ||
}) => { | ||
}) { | ||
var _a; | ||
@@ -83,2 +91,4 @@ if (!isBrowser()) | ||
script.defer = true; | ||
script.setAttribute("data-sdkn", name); | ||
script.setAttribute("data-sdkv", version); | ||
if (isDevelopment() && props.debug === false) { | ||
@@ -88,9 +98,13 @@ script.setAttribute("data-debug", "false"); | ||
document.head.appendChild(script); | ||
}; | ||
var track = (name, properties) => { | ||
} | ||
function track(name2, properties) { | ||
var _a, _b; | ||
if (!isBrowser()) | ||
if (!isBrowser()) { | ||
console.warn( | ||
"[Vercel Analytics] Server-side execution of `track()` is currently not supported." | ||
); | ||
return; | ||
} | ||
if (!properties) { | ||
(_a = window.va) == null ? void 0 : _a.call(window, "event", { name }); | ||
(_a = window.va) == null ? void 0 : _a.call(window, "event", { name: name2 }); | ||
return; | ||
@@ -103,3 +117,3 @@ } | ||
(_b = window.va) == null ? void 0 : _b.call(window, "event", { | ||
name, | ||
name: name2, | ||
data: props | ||
@@ -112,3 +126,3 @@ }); | ||
} | ||
}; | ||
} | ||
@@ -115,0 +129,0 @@ // src/react.tsx |
{ | ||
"name": "@vercel/analytics", | ||
"version": "0.1.9-beta.4", | ||
"version": "0.1.9-beta.5", | ||
"keywords": [ | ||
@@ -13,8 +13,10 @@ "analytics", | ||
".": { | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.js" | ||
"browser": "./dist/index.js", | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"./react": { | ||
"require": "./dist/react/index.cjs", | ||
"import": "./dist/react/index.js" | ||
"browser": "./dist/react/index.js", | ||
"import": "./dist/react/index.js", | ||
"require": "./dist/react/index.cjs" | ||
} | ||
@@ -21,0 +23,0 @@ }, |
@@ -26,3 +26,9 @@ import { defineConfig } from 'tsup'; | ||
outDir: 'dist/react', | ||
esbuildOptions: (options) => { | ||
// Append "use client" to the top of the react entry point | ||
options.banner = { | ||
js: '"use client";', | ||
}; | ||
}, | ||
}, | ||
]); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63181
674