Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
239 lines
No EOL
6.8 KiB
Text
239 lines
No EOL
6.8 KiB
Text
"use strict";
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name2 in all)
|
|
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// src/remix/index.tsx
|
|
var remix_exports = {};
|
|
__export(remix_exports, {
|
|
Analytics: () => Analytics2
|
|
});
|
|
module.exports = __toCommonJS(remix_exports);
|
|
var import_react3 = __toESM(require("react"));
|
|
|
|
// src/react/index.tsx
|
|
var import_react = require("react");
|
|
|
|
// package.json
|
|
var name = "@vercel/analytics";
|
|
var version = "1.5.0";
|
|
|
|
// src/queue.ts
|
|
var initQueue = () => {
|
|
if (window.va) return;
|
|
window.va = function a(...params) {
|
|
(window.vaq = window.vaq || []).push(params);
|
|
};
|
|
};
|
|
|
|
// src/utils.ts
|
|
function isBrowser() {
|
|
return typeof window !== "undefined";
|
|
}
|
|
function detectEnvironment() {
|
|
try {
|
|
const env = process.env.NODE_ENV;
|
|
if (env === "development" || env === "test") {
|
|
return "development";
|
|
}
|
|
} catch (e) {
|
|
}
|
|
return "production";
|
|
}
|
|
function setMode(mode = "auto") {
|
|
if (mode === "auto") {
|
|
window.vam = detectEnvironment();
|
|
return;
|
|
}
|
|
window.vam = mode;
|
|
}
|
|
function getMode() {
|
|
const mode = isBrowser() ? window.vam : detectEnvironment();
|
|
return mode || "production";
|
|
}
|
|
function isDevelopment() {
|
|
return getMode() === "development";
|
|
}
|
|
function computeRoute(pathname, pathParams) {
|
|
if (!pathname || !pathParams) {
|
|
return pathname;
|
|
}
|
|
let result = pathname;
|
|
try {
|
|
const entries = Object.entries(pathParams);
|
|
for (const [key, value] of entries) {
|
|
if (!Array.isArray(value)) {
|
|
const matcher = turnValueToRegExp(value);
|
|
if (matcher.test(result)) {
|
|
result = result.replace(matcher, `/[${key}]`);
|
|
}
|
|
}
|
|
}
|
|
for (const [key, value] of entries) {
|
|
if (Array.isArray(value)) {
|
|
const matcher = turnValueToRegExp(value.join("/"));
|
|
if (matcher.test(result)) {
|
|
result = result.replace(matcher, `/[...${key}]`);
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
} catch (e) {
|
|
return pathname;
|
|
}
|
|
}
|
|
function turnValueToRegExp(value) {
|
|
return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);
|
|
}
|
|
function escapeRegExp(string) {
|
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
}
|
|
function getScriptSrc(props) {
|
|
if (props.scriptSrc) {
|
|
return props.scriptSrc;
|
|
}
|
|
if (isDevelopment()) {
|
|
return "https://va.vercel-scripts.com/v1/script.debug.js";
|
|
}
|
|
if (props.basePath) {
|
|
return `${props.basePath}/insights/script.js`;
|
|
}
|
|
return "/_vercel/insights/script.js";
|
|
}
|
|
|
|
// src/generic.ts
|
|
function inject(props = {
|
|
debug: true
|
|
}) {
|
|
var _a;
|
|
if (!isBrowser()) return;
|
|
setMode(props.mode);
|
|
initQueue();
|
|
if (props.beforeSend) {
|
|
(_a = window.va) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend);
|
|
}
|
|
const src = getScriptSrc(props);
|
|
if (document.head.querySelector(`script[src*="${src}"]`)) return;
|
|
const script = document.createElement("script");
|
|
script.src = src;
|
|
script.defer = true;
|
|
script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : "");
|
|
script.dataset.sdkv = version;
|
|
if (props.disableAutoTrack) {
|
|
script.dataset.disableAutoTrack = "1";
|
|
}
|
|
if (props.endpoint) {
|
|
script.dataset.endpoint = props.endpoint;
|
|
} else if (props.basePath) {
|
|
script.dataset.endpoint = `${props.basePath}/insights`;
|
|
}
|
|
if (props.dsn) {
|
|
script.dataset.dsn = props.dsn;
|
|
}
|
|
script.onerror = () => {
|
|
const errorMessage = isDevelopment() ? "Please check if any ad blockers are enabled and try again." : "Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";
|
|
console.log(
|
|
`[Vercel Web Analytics] Failed to load script from ${src}. ${errorMessage}`
|
|
);
|
|
};
|
|
if (isDevelopment() && props.debug === false) {
|
|
script.dataset.debug = "false";
|
|
}
|
|
document.head.appendChild(script);
|
|
}
|
|
function pageview({
|
|
route,
|
|
path
|
|
}) {
|
|
var _a;
|
|
(_a = window.va) == null ? void 0 : _a.call(window, "pageview", { route, path });
|
|
}
|
|
|
|
// src/react/utils.ts
|
|
function getBasePath() {
|
|
if (typeof process === "undefined" || typeof process.env === "undefined") {
|
|
return void 0;
|
|
}
|
|
return process.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;
|
|
}
|
|
|
|
// src/react/index.tsx
|
|
function Analytics(props) {
|
|
(0, import_react.useEffect)(() => {
|
|
var _a;
|
|
if (props.beforeSend) {
|
|
(_a = window.va) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend);
|
|
}
|
|
}, [props.beforeSend]);
|
|
(0, import_react.useEffect)(() => {
|
|
inject({
|
|
framework: props.framework || "react",
|
|
basePath: props.basePath ?? getBasePath(),
|
|
...props.route !== void 0 && { disableAutoTrack: true },
|
|
...props
|
|
});
|
|
}, []);
|
|
(0, import_react.useEffect)(() => {
|
|
if (props.route && props.path) {
|
|
pageview({ route: props.route, path: props.path });
|
|
}
|
|
}, [props.route, props.path]);
|
|
return null;
|
|
}
|
|
|
|
// src/remix/utils.ts
|
|
var import_react2 = require("@remix-run/react");
|
|
var import_meta = {};
|
|
var useRoute = () => {
|
|
const params = (0, import_react2.useParams)();
|
|
const { pathname: path } = (0, import_react2.useLocation)();
|
|
return { route: computeRoute(path, params), path };
|
|
};
|
|
function getBasePath2() {
|
|
try {
|
|
return import_meta.env.VITE_VERCEL_OBSERVABILITY_BASEPATH;
|
|
} catch {
|
|
}
|
|
}
|
|
|
|
// src/remix/index.tsx
|
|
function Analytics2(props) {
|
|
return /* @__PURE__ */ import_react3.default.createElement(
|
|
Analytics,
|
|
{
|
|
...useRoute(),
|
|
...props,
|
|
basePath: getBasePath2(),
|
|
framework: "remix"
|
|
}
|
|
);
|
|
}
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
Analytics
|
|
});
|
|
//# sourceMappingURL=index.js.map |