@scalar/api-client
Version:
the open source API testing client
64 lines (63 loc) • 2.48 kB
JavaScript
import { defineComponent as u, computed as l, createElementBlock as m, openBlock as d, createElementVNode as n, createVNode as i, unref as a, normalizeClass as c } from "vue";
import { ScalarToggle as p } from "@scalar/components";
import v from "../../../blocks/scalar-auth-selector-block/components/AuthSelector.vue.js";
const y = { class: "flex flex-col gap-4" }, f = { class: "flex flex-col gap-2" }, h = { class: "flex h-8 items-center justify-between" }, x = /* @__PURE__ */ u({
__name: "Authentication",
props: {
documentSlug: {},
document: {},
eventBus: {},
layout: {},
path: {},
method: {},
exampleName: {},
environment: {},
workspaceStore: {},
activeWorkspace: {},
collectionType: {}
},
setup(o) {
const s = l(
() => o.document?.["x-scalar-set-operation-security"] ?? !1
), r = l(
() => o.document?.servers?.find(
({ url: e }) => e === o.document?.["x-scalar-selected-server"]
)
);
return (e, t) => (d(), m("div", y, [
n("div", f, [
n("div", h, [
t[1] || (t[1] = n("h3", { class: "font-bold" }, "Authentication", -1)),
i(a(p), {
class: "w-4",
modelValue: s.value,
"onUpdate:modelValue": t[0] || (t[0] = () => e.eventBus.emit("document:toggle:security"))
}, null, 8, ["modelValue"])
]),
t[2] || (t[2] = n("p", { class: "pr-6 text-sm" }, " If enabled, all selected authentication will apply to all operations in this document. You can override this by disabling the toggle and authentication will then be applied at the operation level. ", -1))
]),
n("div", {
class: c(!s.value && "cursor-not-allowed")
}, [
i(a(v), {
class: c([
"scalar-collection-auth !border-none",
!s.value && "pointer-events-none opacity-50 mix-blend-luminosity"
]),
environment: e.environment,
eventBus: e.eventBus,
isStatic: "",
meta: { type: "document" },
security: e.document?.security ?? [],
securitySchemes: e.document?.components?.securitySchemes ?? {},
selectedSecurity: e.document?.["x-scalar-selected-security"],
server: r.value,
title: "Authentication"
}, null, 8, ["class", "environment", "eventBus", "security", "securitySchemes", "selectedSecurity", "server"])
], 2)
]));
}
});
export {
x as default
};