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>
87 lines
2.5 KiB
Text
87 lines
2.5 KiB
Text
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
const dsn = require('./utils/dsn.js');
|
|
|
|
const SENTRY_API_VERSION = '7';
|
|
|
|
/** Returns the prefix to construct Sentry ingestion API endpoints. */
|
|
function getBaseApiEndpoint(dsn) {
|
|
const protocol = dsn.protocol ? `${dsn.protocol}:` : '';
|
|
const port = dsn.port ? `:${dsn.port}` : '';
|
|
return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;
|
|
}
|
|
|
|
/** Returns the ingest API endpoint for target. */
|
|
function _getIngestEndpoint(dsn) {
|
|
return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;
|
|
}
|
|
|
|
/** Returns a URL-encoded string with auth config suitable for a query string. */
|
|
function _encodedAuth(dsn, sdkInfo) {
|
|
const params = {
|
|
sentry_version: SENTRY_API_VERSION,
|
|
};
|
|
|
|
if (dsn.publicKey) {
|
|
// We send only the minimum set of required information. See
|
|
// https://github.com/getsentry/sentry-javascript/issues/2572.
|
|
params.sentry_key = dsn.publicKey;
|
|
}
|
|
|
|
if (sdkInfo) {
|
|
params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`;
|
|
}
|
|
|
|
return new URLSearchParams(params).toString();
|
|
}
|
|
|
|
/**
|
|
* Returns the envelope endpoint URL with auth in the query string.
|
|
*
|
|
* Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.
|
|
*/
|
|
function getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) {
|
|
return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;
|
|
}
|
|
|
|
/** Returns the url to the report dialog endpoint. */
|
|
function getReportDialogEndpoint(dsnLike, dialogOptions) {
|
|
const dsn$1 = dsn.makeDsn(dsnLike);
|
|
if (!dsn$1) {
|
|
return '';
|
|
}
|
|
|
|
const endpoint = `${getBaseApiEndpoint(dsn$1)}embed/error-page/`;
|
|
|
|
let encodedOptions = `dsn=${dsn.dsnToString(dsn$1)}`;
|
|
for (const key in dialogOptions) {
|
|
if (key === 'dsn') {
|
|
continue;
|
|
}
|
|
|
|
if (key === 'onClose') {
|
|
continue;
|
|
}
|
|
|
|
if (key === 'user') {
|
|
const user = dialogOptions.user;
|
|
if (!user) {
|
|
continue;
|
|
}
|
|
if (user.name) {
|
|
encodedOptions += `&name=${encodeURIComponent(user.name)}`;
|
|
}
|
|
if (user.email) {
|
|
encodedOptions += `&email=${encodeURIComponent(user.email)}`;
|
|
}
|
|
} else {
|
|
encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;
|
|
}
|
|
}
|
|
|
|
return `${endpoint}?${encodedOptions}`;
|
|
}
|
|
|
|
exports.getEnvelopeEndpointWithUrlEncodedAuth = getEnvelopeEndpointWithUrlEncodedAuth;
|
|
exports.getReportDialogEndpoint = getReportDialogEndpoint;
|
|
//# sourceMappingURL=api.js.map
|