@scalar/api-client
Version:
the open source API testing client
30 lines (29 loc) • 938 B
JavaScript
import { analytics as s } from "../../analytics.js";
import { createWebHistoryRouter as c } from "../../router.js";
import n from "./ApiClientApp.vue.js";
/* empty css */
import { saveActiveWorkspace as f } from "../../routes.js";
import { createApiClient as y } from "../../libs/create-client.js";
const C = async (o, t = {}, a = !0, e = c()) => {
const r = y({
el: o,
appComponent: n,
configuration: t,
mountOnInitialize: a,
router: e,
layout: "desktop"
}), { importSpecFile: m, importSpecFromUrl: l } = r.store;
return e.afterEach((p, i) => {
t.telemetry && s?.capture("page-view", {
hostname: window.location.hostname,
to: p.path,
// capture path excluding query params
from: i.path
}), f(p);
}), t.url ? await l(t.url, "default", {
proxyUrl: t.proxyUrl
}) : t.content && await m(t.content, "default"), r;
};
export {
C as createApiClientApp
};