@posthog/wizard
Version:
The PostHog wizard helps you to configure your project
65 lines • 2.26 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLlmGatewayUrlFromHost = exports.getOauthClientIdFromRegion = exports.getCloudUrlFromRegion = exports.getHostFromRegion = exports.getUiHostFromHost = exports.getAssetHostFromHost = void 0;
const constants_1 = require("../lib/constants");
const getAssetHostFromHost = (host) => {
if (host.includes('us.i.posthog.com')) {
return 'https://us-assets.i.posthog.com';
}
if (host.includes('eu.i.posthog.com')) {
return 'https://eu-assets.i.posthog.com';
}
return host;
};
exports.getAssetHostFromHost = getAssetHostFromHost;
const getUiHostFromHost = (host) => {
if (host.includes('us.i.posthog.com')) {
return 'https://us.posthog.com';
}
if (host.includes('eu.i.posthog.com')) {
return 'https://eu.posthog.com';
}
return host;
};
exports.getUiHostFromHost = getUiHostFromHost;
const getHostFromRegion = (region) => {
if (constants_1.IS_DEV) {
return 'http://localhost:8010';
}
if (region === 'eu') {
return 'https://eu.i.posthog.com';
}
return 'https://us.i.posthog.com';
};
exports.getHostFromRegion = getHostFromRegion;
const getCloudUrlFromRegion = (region) => {
if (constants_1.IS_DEV) {
return 'http://localhost:8010';
}
if (region === 'eu') {
return 'https://eu.posthog.com';
}
return 'https://us.posthog.com';
};
exports.getCloudUrlFromRegion = getCloudUrlFromRegion;
const getOauthClientIdFromRegion = (region) => {
if (constants_1.IS_DEV) {
return constants_1.POSTHOG_DEV_CLIENT_ID;
}
if (region === 'us') {
return constants_1.POSTHOG_US_CLIENT_ID;
}
return constants_1.POSTHOG_EU_CLIENT_ID;
};
exports.getOauthClientIdFromRegion = getOauthClientIdFromRegion;
const getLlmGatewayUrlFromHost = (host) => {
if (host.includes('localhost')) {
return 'http://localhost:3308/wizard';
}
if (host.includes('eu.posthog.com') || host.includes('eu.i.posthog.com')) {
return 'https://gateway.eu.posthog.com/wizard';
}
return 'https://gateway.us.posthog.com/wizard';
};
exports.getLlmGatewayUrlFromHost = getLlmGatewayUrlFromHost;
//# sourceMappingURL=urls.js.map