zudoku 0.66.2 → 0.66.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/validators/validate.d.ts +32 -3
- package/dist/config/validators/validate.js +1 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +1 -1
- package/dist/lib/auth/issuer.js +1 -1
- package/dist/lib/auth/issuer.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +3 -2
- package/dist/lib/authentication/hook.d.ts +2 -0
- package/dist/lib/authentication/hook.js +10 -0
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/firebase.js +67 -9
- package/dist/lib/authentication/providers/firebase.js.map +1 -1
- package/dist/lib/authentication/ui/EmailVerificationUi.d.ts +4 -0
- package/dist/lib/authentication/ui/EmailVerificationUi.js +34 -0
- package/dist/lib/authentication/ui/EmailVerificationUi.js.map +1 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +7 -2
- package/dist/lib/authentication/ui/ZudokuAuthUi.js +43 -11
- package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -1
- package/dist/lib/authentication/utils/relativeRedirectUrl.d.ts +1 -0
- package/dist/lib/authentication/utils/relativeRedirectUrl.js +8 -0
- package/dist/lib/authentication/utils/relativeRedirectUrl.js.map +1 -0
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/errors/ErrorMessage.d.ts +3 -0
- package/dist/lib/errors/ErrorMessage.js +16 -0
- package/dist/lib/errors/ErrorMessage.js.map +1 -0
- package/dist/lib/hooks/index.d.ts +2 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +9 -172
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +4 -1
- package/dist/lib/plugins/api-keys/index.js +19 -14
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.d.ts +12 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js +133 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js.map +1 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.d.ts +4 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +30 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.d.ts +6 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.js +39 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.js.map +1 -0
- package/dist/vite/config.js +7 -0
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-api-keys.js +4 -1
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/zuplo.d.ts +13 -0
- package/dist/vite/zuplo.js +15 -0
- package/dist/vite/zuplo.js.map +1 -0
- package/lib/{ClaudeLogo-CGRfGTk2.js → ClaudeLogo-BZslN9XF.js} +3 -3
- package/lib/{ClaudeLogo-CGRfGTk2.js.map → ClaudeLogo-BZslN9XF.js.map} +1 -1
- package/lib/{Drawer-Ci7XwhqT.js → Drawer-BRMcpfuF.js} +6 -6
- package/lib/{Drawer-Ci7XwhqT.js.map → Drawer-BRMcpfuF.js.map} +1 -1
- package/lib/Frame-DxlznfVd.js +205 -0
- package/lib/Frame-DxlznfVd.js.map +1 -0
- package/lib/{useMutation-C6RqWmTS.js → Input-D-kqEQ5M.js} +41 -23
- package/lib/Input-D-kqEQ5M.js.map +1 -0
- package/lib/{MdxPage-Bjf72BP3.js → MdxPage-B4zZq5aR.js} +8 -8
- package/lib/{MdxPage-Bjf72BP3.js.map → MdxPage-B4zZq5aR.js.map} +1 -1
- package/lib/{Mermaid-D_VSX7_Q.js → Mermaid-BjSczjLW.js} +3 -3
- package/lib/{Mermaid-D_VSX7_Q.js.map → Mermaid-BjSczjLW.js.map} +1 -1
- package/lib/{OAuthErrorPage-1Ekji0PK.js → OAuthErrorPage-DRY2hlga.js} +20 -21
- package/lib/{OAuthErrorPage-1Ekji0PK.js.map → OAuthErrorPage-DRY2hlga.js.map} +1 -1
- package/lib/{OasProvider-BZxmTyMM.js → OasProvider-lMwTD76Y.js} +4 -4
- package/lib/{OasProvider-BZxmTyMM.js.map → OasProvider-lMwTD76Y.js.map} +1 -1
- package/lib/{OperationList-B7nPIFB8.js → OperationList-Bm76b4vl.js} +23 -24
- package/lib/{OperationList-B7nPIFB8.js.map → OperationList-Bm76b4vl.js.map} +1 -1
- package/lib/{RouteGuard-9wjejsKm.js → RouteGuard-DGc32XJV.js} +4 -4
- package/lib/{RouteGuard-9wjejsKm.js.map → RouteGuard-DGc32XJV.js.map} +1 -1
- package/lib/{SchemaList-16_obkku.js → SchemaList-DX4FPogg.js} +7 -7
- package/lib/{SchemaList-16_obkku.js.map → SchemaList-DX4FPogg.js.map} +1 -1
- package/lib/SchemaView-CjXvSRxy.js +434 -0
- package/lib/SchemaView-CjXvSRxy.js.map +1 -0
- package/lib/{Select-CkxXP5I7.js → Secret-BxGpIhDP.js} +121 -121
- package/lib/Secret-BxGpIhDP.js.map +1 -0
- package/lib/{SignUp-D54_QWFy.js → SignUp-CntxjFGS.js} +4 -4
- package/lib/{SignUp-D54_QWFy.js.map → SignUp-CntxjFGS.js.map} +1 -1
- package/lib/{SyntaxHighlight-j_HRSPCU.js → SyntaxHighlight-Dgd0AaaX.js} +2 -2
- package/lib/{SyntaxHighlight-j_HRSPCU.js.map → SyntaxHighlight-Dgd0AaaX.js.map} +1 -1
- package/lib/{Toc-z05x698-.js → Toc-L1vGGHA1.js} +2 -2
- package/lib/{Toc-z05x698-.js.map → Toc-L1vGGHA1.js.map} +1 -1
- package/lib/{ZudokuContext-BXldanA8.js → ZudokuContext-DNHMZfcP.js} +33 -33
- package/lib/{ZudokuContext-BXldanA8.js.map → ZudokuContext-DNHMZfcP.js.map} +1 -1
- package/lib/{chunk-PVWAREVJ-dLIqswPy.js → chunk-PVWAREVJ-ClM0m2aJ.js} +19 -19
- package/lib/{chunk-PVWAREVJ-dLIqswPy.js.map → chunk-PVWAREVJ-ClM0m2aJ.js.map} +1 -1
- package/lib/{circular-D5sYCIWL.js → circular-BIN_WQ0c.js} +2 -2
- package/lib/{circular-D5sYCIWL.js.map → circular-BIN_WQ0c.js.map} +1 -1
- package/lib/{createServer-BlwU7lIr.js → createServer-BEl12QFw.js} +4 -4
- package/lib/{createServer-BlwU7lIr.js.map → createServer-BEl12QFw.js.map} +1 -1
- package/lib/createVariantComponent-CQVt-H3r.js +18 -0
- package/lib/createVariantComponent-CQVt-H3r.js.map +1 -0
- package/lib/{errors-BtC4Kn2j.js → errors-CtBbD47A.js} +2 -2
- package/lib/{errors-BtC4Kn2j.js.map → errors-CtBbD47A.js.map} +1 -1
- package/lib/{firebase-Ibm_tv3G.js → firebase-CT38ugg4.js} +1588 -1342
- package/lib/firebase-CT38ugg4.js.map +1 -0
- package/lib/hook-CHw_R_xu.js +52 -0
- package/lib/hook-CHw_R_xu.js.map +1 -0
- package/lib/{ErrorAlert-BUlG32M9.js → index-CG2v-T7-.js} +5373 -4335
- package/lib/index-CG2v-T7-.js.map +1 -0
- package/lib/{index-eKVhlB94.js → index-CISwSpdT.js} +2 -2
- package/lib/{index-eKVhlB94.js.map → index-CISwSpdT.js.map} +1 -1
- package/lib/{index-Css56y3F.js → index-DXXZDuSJ.js} +4 -4
- package/lib/{index-Css56y3F.js.map → index-DXXZDuSJ.js.map} +1 -1
- package/lib/{index-CeVTNcfF.js → index-jI2Fjpy-.js} +98 -99
- package/lib/{index-CeVTNcfF.js.map → index-jI2Fjpy-.js.map} +1 -1
- package/lib/{index.esm-BoKBnRoT.js → index.esm-Bu35TNgg.js} +16 -14
- package/lib/index.esm-Bu35TNgg.js.map +1 -0
- package/lib/{mutation-BoVlx8yA.js → mutation-DMHWqmFp.js} +2 -2
- package/lib/{mutation-BoVlx8yA.js.map → mutation-DMHWqmFp.js.map} +1 -1
- package/lib/ui/Drawer.js +2 -2
- package/lib/ui/SyntaxHighlight.js +2 -2
- package/lib/zudoku.__internal.js +507 -479
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-azureb2c.js +4 -4
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-firebase.js +6 -5
- package/lib/zudoku.auth-firebase.js.map +1 -1
- package/lib/zudoku.auth-openid.js +4 -4
- package/lib/zudoku.auth-supabase.js +5 -5
- package/lib/zudoku.components.js +20 -21
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +3 -3
- package/lib/zudoku.mermaid.js +3 -3
- package/lib/zudoku.plugin-api-catalog.js +8 -9
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +580 -543
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +3 -3
- package/lib/zudoku.router.js +2 -2
- package/package.json +4 -2
- package/src/lib/auth/issuer.ts +1 -1
- package/src/lib/authentication/authentication.ts +8 -2
- package/src/lib/authentication/hook.ts +16 -0
- package/src/lib/authentication/providers/firebase.tsx +98 -6
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +129 -0
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +170 -38
- package/src/lib/authentication/utils/relativeRedirectUrl.ts +12 -0
- package/src/lib/errors/ErrorMessage.tsx +38 -0
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +36 -476
- package/src/lib/plugins/api-keys/index.tsx +33 -18
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -0
- package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +64 -0
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +124 -0
- package/lib/ErrorAlert-BUlG32M9.js.map +0 -1
- package/lib/RouterError-DfTZblpv.js +0 -42
- package/lib/RouterError-DfTZblpv.js.map +0 -1
- package/lib/SchemaView-eyvR4bRt.js +0 -597
- package/lib/SchemaView-eyvR4bRt.js.map +0 -1
- package/lib/Select-CkxXP5I7.js.map +0 -1
- package/lib/createVariantComponent-B9_dVBvu.js +0 -35
- package/lib/createVariantComponent-B9_dVBvu.js.map +0 -1
- package/lib/firebase-Ibm_tv3G.js.map +0 -1
- package/lib/hook-BNxidGQq.js +0 -40
- package/lib/hook-BNxidGQq.js.map +0 -1
- package/lib/index-DSOi7zVM.js +0 -1059
- package/lib/index-DSOi7zVM.js.map +0 -1
- package/lib/index.esm-BoKBnRoT.js.map +0 -1
- package/lib/useMutation-C6RqWmTS.js.map +0 -1
|
@@ -1,81 +1,177 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { CircleSlashIcon as
|
|
3
|
-
import {
|
|
4
|
-
import { i as A } from "./invariant-CGOLuIIz.js";
|
|
5
|
-
import { O as ge, u as je } from "./chunk-PVWAREVJ-dLIqswPy.js";
|
|
6
|
-
import { u as Ce } from "./hook-BNxidGQq.js";
|
|
7
|
-
import { D as ve, a as Y } from "./ErrorAlert-BUlG32M9.js";
|
|
8
|
-
import { Button as v } from "./ui/Button.js";
|
|
9
|
-
import { a as ne, f as ie, e as we } from "./ZudokuContext-BXldanA8.js";
|
|
10
|
-
import { u as T } from "./useMutation-C6RqWmTS.js";
|
|
2
|
+
import { TrashIcon as pe, CircleSlashIcon as F, CheckIcon as me, XIcon as xe, PencilLineIcon as ye, RefreshCwIcon as ge, KeyRoundIcon as je } from "lucide-react";
|
|
3
|
+
import { Z as $, i as N } from "./invariant-CGOLuIIz.js";
|
|
11
4
|
import * as q from "react";
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { a as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
5
|
+
import { createContext as L, useRef as P, useLayoutEffect as ve, useEffect as ne, useId as Q, useContext as V, useInsertionEffect as Ce, useMemo as z, useCallback as we, Children as ke, isValidElement as Ee, useState as E } from "react";
|
|
6
|
+
import { D as Ie, c as be, d as Z, B as De, E as Ke } from "./index-CG2v-T7-.js";
|
|
7
|
+
import { b as ie } from "./index-DXXZDuSJ.js";
|
|
8
|
+
import { F as Pe, g as Ae, j as Ne, h as Se, d as Re, I as Oe, a as Te, b as qe, k as Me, c as Fe } from "./Frame-DxlznfVd.js";
|
|
9
|
+
import { A as D, a as K, b as re } from "./Mermaid-BjSczjLW.js";
|
|
10
|
+
import { e as H, f as A, D as _, g as B, a as G, b as J, c as Y, d as ae } from "./Dialog-BQciPiHN.js";
|
|
11
|
+
import { Button as oe } from "./ui/Button.js";
|
|
12
|
+
import { a as U, g as le, e as $e } from "./ZudokuContext-DNHMZfcP.js";
|
|
13
|
+
import { u as T, I as ze } from "./Input-D-kqEQ5M.js";
|
|
14
|
+
import { a as Le } from "./index.esm-BYObtETB.js";
|
|
15
|
+
import { u as Qe } from "./chunk-PVWAREVJ-ClM0m2aJ.js";
|
|
16
|
+
import { A as Ve } from "./ActionButton-DUgvSylL.js";
|
|
17
|
+
import { S as He, a as _e, b as Be, c as Ge, d as Je, e as ee, f as Ye } from "./Secret-BxGpIhDP.js";
|
|
18
|
+
import { Input as Ue } from "./ui/Input.js";
|
|
19
|
+
import { c as W } from "./cn-dYga0KKN.js";
|
|
20
|
+
import { B as k } from "./Button-CynVW1JV.js";
|
|
21
|
+
function We({ error: t }) {
|
|
22
|
+
const i = t instanceof Error ? t.message : "Something went wrong", s = process.env.NODE_ENV === "development", n = t instanceof $ ? t.developerHint : void 0, r = t instanceof $ ? t.title : "Something went wrong", a = t instanceof Error ? t.stack : void 0, o = t instanceof Error ? t.cause : void 0, d = o instanceof Error ? String(o.stack) : a;
|
|
23
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ e.jsxs(D, { variant: "destructive", children: [
|
|
25
|
+
/* @__PURE__ */ e.jsx(K, { children: r }),
|
|
26
|
+
/* @__PURE__ */ e.jsx(re, { children: i })
|
|
27
|
+
] }),
|
|
28
|
+
s && n && /* @__PURE__ */ e.jsx(Ie, { className: "mb-4", children: n }),
|
|
29
|
+
s && d && /* @__PURE__ */ e.jsx(
|
|
30
|
+
be,
|
|
31
|
+
{
|
|
32
|
+
className: "max-h-[400px] [&>pre]:p-4",
|
|
33
|
+
language: "js",
|
|
34
|
+
code: d
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
const Xe = ({
|
|
40
|
+
service: t,
|
|
41
|
+
onOpenChange: i
|
|
42
|
+
}) => {
|
|
43
|
+
const s = U(), n = le(), r = Qe(), a = Le({
|
|
44
|
+
defaultValues: {
|
|
45
|
+
expiresOn: "30"
|
|
46
|
+
}
|
|
47
|
+
}), o = ie(), d = T({
|
|
48
|
+
mutationFn: ({ description: c, expiresOn: u }) => {
|
|
49
|
+
if (!t.createKey)
|
|
50
|
+
throw new Error("createKey not implemented");
|
|
51
|
+
const h = u !== "never" ? Ze(Number(u)) : void 0;
|
|
52
|
+
return t.createKey({
|
|
53
|
+
apiKey: {
|
|
54
|
+
description: c || "Secret Key",
|
|
55
|
+
expiresOn: h
|
|
56
|
+
},
|
|
57
|
+
context: s,
|
|
58
|
+
auth: o
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
onSuccess: async () => {
|
|
62
|
+
await n.invalidateQueries({ queryKey: ["api-keys"] }), await r("/settings/api-keys/");
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return t.createKey ? /* @__PURE__ */ e.jsxs(
|
|
66
|
+
"form",
|
|
67
|
+
{
|
|
68
|
+
onSubmit: a.handleSubmit(
|
|
69
|
+
(c) => d.mutate(
|
|
70
|
+
{ ...c },
|
|
71
|
+
{
|
|
72
|
+
onSuccess: () => i(!1)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
),
|
|
76
|
+
children: [
|
|
77
|
+
d.error && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
78
|
+
/* @__PURE__ */ e.jsx(K, { children: "Error" }),
|
|
79
|
+
/* @__PURE__ */ e.jsx(re, { children: d.error.message })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
|
|
82
|
+
"Name",
|
|
83
|
+
/* @__PURE__ */ e.jsx(Ue, { ...a.register("description") }),
|
|
84
|
+
"Expiration",
|
|
85
|
+
/* @__PURE__ */ e.jsxs(
|
|
86
|
+
He,
|
|
87
|
+
{
|
|
88
|
+
onValueChange: (c) => a.setValue("expiresOn", c),
|
|
89
|
+
defaultValue: a.getValues("expiresOn"),
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ e.jsx(_e, { children: /* @__PURE__ */ e.jsx(Be, {}) }),
|
|
92
|
+
/* @__PURE__ */ e.jsx(Ge, { children: /* @__PURE__ */ e.jsxs(Je, { children: [
|
|
93
|
+
[7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(ee, { value: String(c), children: [
|
|
94
|
+
c,
|
|
95
|
+
" days"
|
|
96
|
+
] }, c)),
|
|
97
|
+
/* @__PURE__ */ e.jsx(ee, { value: "never", children: "Never" })
|
|
98
|
+
] }) })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ e.jsxs(H, { children: [
|
|
103
|
+
/* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(oe, { variant: "outline", children: "Cancel" }) }),
|
|
104
|
+
/* @__PURE__ */ e.jsx(Ve, { isPending: d.isPending, children: "Generate Key" })
|
|
105
|
+
] })
|
|
106
|
+
] })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
) : null;
|
|
110
|
+
}, Ze = (t) => {
|
|
111
|
+
const i = /* @__PURE__ */ new Date();
|
|
112
|
+
return i.setDate(i.getDate() + t), i.toISOString();
|
|
113
|
+
}, ce = ({
|
|
114
|
+
service: t,
|
|
115
|
+
isOpen: i,
|
|
116
|
+
onOpenChange: s,
|
|
117
|
+
trigger: n,
|
|
118
|
+
buttonVariant: r = "outline"
|
|
119
|
+
}) => {
|
|
120
|
+
const a = /* @__PURE__ */ e.jsx(oe, { variant: r, children: "Create API Key" });
|
|
121
|
+
return /* @__PURE__ */ e.jsxs(_, { open: i, onOpenChange: s, children: [
|
|
122
|
+
/* @__PURE__ */ e.jsx(B, { asChild: !0, children: n ?? a }),
|
|
123
|
+
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
124
|
+
/* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Y, { children: "Create API Key" }) }),
|
|
125
|
+
/* @__PURE__ */ e.jsx(Xe, { service: t, onOpenChange: s })
|
|
126
|
+
] })
|
|
127
|
+
] });
|
|
128
|
+
}, et = L({});
|
|
129
|
+
function de(t) {
|
|
130
|
+
const i = P(null);
|
|
131
|
+
return i.current === null && (i.current = t()), i.current;
|
|
36
132
|
}
|
|
37
|
-
const
|
|
38
|
-
function
|
|
133
|
+
const tt = typeof window < "u", st = tt ? ve : ne, ue = /* @__PURE__ */ L(null);
|
|
134
|
+
function nt(t) {
|
|
39
135
|
return typeof t == "object" && t !== null;
|
|
40
136
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
137
|
+
function it(t) {
|
|
138
|
+
return nt(t) && "offsetHeight" in t;
|
|
43
139
|
}
|
|
44
|
-
const
|
|
140
|
+
const rt = L({
|
|
45
141
|
transformPagePoint: (t) => t,
|
|
46
142
|
isStatic: !1,
|
|
47
143
|
reducedMotion: "never"
|
|
48
144
|
});
|
|
49
|
-
function
|
|
145
|
+
function te(t, i) {
|
|
50
146
|
if (typeof t == "function")
|
|
51
|
-
return t(
|
|
52
|
-
t != null && (t.current =
|
|
147
|
+
return t(i);
|
|
148
|
+
t != null && (t.current = i);
|
|
53
149
|
}
|
|
54
|
-
function
|
|
55
|
-
return (
|
|
150
|
+
function at(...t) {
|
|
151
|
+
return (i) => {
|
|
56
152
|
let s = !1;
|
|
57
|
-
const n = t.map((
|
|
58
|
-
const a =
|
|
153
|
+
const n = t.map((r) => {
|
|
154
|
+
const a = te(r, i);
|
|
59
155
|
return !s && typeof a == "function" && (s = !0), a;
|
|
60
156
|
});
|
|
61
157
|
if (s)
|
|
62
158
|
return () => {
|
|
63
|
-
for (let
|
|
64
|
-
const a = n[
|
|
65
|
-
typeof a == "function" ? a() :
|
|
159
|
+
for (let r = 0; r < n.length; r++) {
|
|
160
|
+
const a = n[r];
|
|
161
|
+
typeof a == "function" ? a() : te(t[r], null);
|
|
66
162
|
}
|
|
67
163
|
};
|
|
68
164
|
};
|
|
69
165
|
}
|
|
70
|
-
function
|
|
71
|
-
return q.useCallback(
|
|
166
|
+
function ot(...t) {
|
|
167
|
+
return q.useCallback(at(...t), t);
|
|
72
168
|
}
|
|
73
|
-
class
|
|
74
|
-
getSnapshotBeforeUpdate(
|
|
169
|
+
class lt extends q.Component {
|
|
170
|
+
getSnapshotBeforeUpdate(i) {
|
|
75
171
|
const s = this.props.childRef.current;
|
|
76
|
-
if (s &&
|
|
77
|
-
const n = s.offsetParent,
|
|
78
|
-
a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right =
|
|
172
|
+
if (s && i.isPresent && !this.props.isPresent) {
|
|
173
|
+
const n = s.offsetParent, r = it(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
|
|
174
|
+
a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right = r - a.width - a.left;
|
|
79
175
|
}
|
|
80
176
|
return null;
|
|
81
177
|
}
|
|
@@ -88,555 +184,489 @@ class We extends q.Component {
|
|
|
88
184
|
return this.props.children;
|
|
89
185
|
}
|
|
90
186
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
187
|
+
function ct({ children: t, isPresent: i, anchorX: s, root: n }) {
|
|
188
|
+
const r = Q(), a = P(null), o = P({
|
|
93
189
|
width: 0,
|
|
94
190
|
height: 0,
|
|
95
191
|
top: 0,
|
|
96
192
|
left: 0,
|
|
97
193
|
right: 0
|
|
98
|
-
}), { nonce:
|
|
99
|
-
return
|
|
100
|
-
const { width:
|
|
101
|
-
if (
|
|
194
|
+
}), { nonce: d } = V(rt), c = ot(a, t?.ref);
|
|
195
|
+
return Ce(() => {
|
|
196
|
+
const { width: u, height: h, top: f, left: m, right: g } = o.current;
|
|
197
|
+
if (i || !a.current || !u || !h)
|
|
102
198
|
return;
|
|
103
|
-
const
|
|
104
|
-
a.current.dataset.motionPopId =
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
[data-motion-pop-id="${
|
|
199
|
+
const j = s === "left" ? `left: ${m}` : `right: ${g}`;
|
|
200
|
+
a.current.dataset.motionPopId = r;
|
|
201
|
+
const l = document.createElement("style");
|
|
202
|
+
d && (l.nonce = d);
|
|
203
|
+
const x = n ?? document.head;
|
|
204
|
+
return x.appendChild(l), l.sheet && l.sheet.insertRule(`
|
|
205
|
+
[data-motion-pop-id="${r}"] {
|
|
110
206
|
position: absolute !important;
|
|
111
|
-
width: ${
|
|
112
|
-
height: ${
|
|
113
|
-
${
|
|
114
|
-
top: ${
|
|
207
|
+
width: ${u}px !important;
|
|
208
|
+
height: ${h}px !important;
|
|
209
|
+
${j}px !important;
|
|
210
|
+
top: ${f}px !important;
|
|
115
211
|
}
|
|
116
212
|
`), () => {
|
|
117
|
-
|
|
213
|
+
x.contains(l) && x.removeChild(l);
|
|
118
214
|
};
|
|
119
|
-
}, [
|
|
215
|
+
}, [i]), e.jsx(lt, { isPresent: i, childRef: a, sizeRef: o, children: q.cloneElement(t, { ref: c }) });
|
|
120
216
|
}
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
id:
|
|
125
|
-
initial:
|
|
217
|
+
const dt = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: a, mode: o, anchorX: d, root: c }) => {
|
|
218
|
+
const u = de(ut), h = Q();
|
|
219
|
+
let f = !0, m = z(() => (f = !1, {
|
|
220
|
+
id: h,
|
|
221
|
+
initial: i,
|
|
126
222
|
isPresent: s,
|
|
127
|
-
custom:
|
|
128
|
-
onExitComplete: (
|
|
129
|
-
|
|
130
|
-
for (const
|
|
131
|
-
if (!
|
|
223
|
+
custom: r,
|
|
224
|
+
onExitComplete: (g) => {
|
|
225
|
+
u.set(g, !0);
|
|
226
|
+
for (const j of u.values())
|
|
227
|
+
if (!j)
|
|
132
228
|
return;
|
|
133
229
|
n && n();
|
|
134
230
|
},
|
|
135
|
-
register: (
|
|
136
|
-
}), [s,
|
|
137
|
-
return a &&
|
|
138
|
-
|
|
231
|
+
register: (g) => (u.set(g, !1), () => u.delete(g))
|
|
232
|
+
}), [s, u, n]);
|
|
233
|
+
return a && f && (m = { ...m }), z(() => {
|
|
234
|
+
u.forEach((g, j) => u.set(j, !1));
|
|
139
235
|
}, [s]), q.useEffect(() => {
|
|
140
|
-
!s && !
|
|
141
|
-
}, [s]),
|
|
236
|
+
!s && !u.size && n && n();
|
|
237
|
+
}, [s]), o === "popLayout" && (t = e.jsx(ct, { isPresent: s, anchorX: d, root: c, children: t })), e.jsx(ue.Provider, { value: m, children: t });
|
|
142
238
|
};
|
|
143
|
-
function
|
|
239
|
+
function ut() {
|
|
144
240
|
return /* @__PURE__ */ new Map();
|
|
145
241
|
}
|
|
146
|
-
function
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
242
|
+
function ft(t = !0) {
|
|
243
|
+
const i = V(ue);
|
|
244
|
+
if (i === null)
|
|
149
245
|
return [!0, null];
|
|
150
|
-
const { isPresent: s, onExitComplete: n, register:
|
|
151
|
-
|
|
246
|
+
const { isPresent: s, onExitComplete: n, register: r } = i, a = Q();
|
|
247
|
+
ne(() => {
|
|
152
248
|
if (t)
|
|
153
|
-
return
|
|
249
|
+
return r(a);
|
|
154
250
|
}, [t]);
|
|
155
|
-
const
|
|
156
|
-
return !s && n ? [!1,
|
|
251
|
+
const o = we(() => t && n && n(a), [a, n, t]);
|
|
252
|
+
return !s && n ? [!1, o] : [!0];
|
|
157
253
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
}),
|
|
254
|
+
const S = (t) => t.key || "";
|
|
255
|
+
function se(t) {
|
|
256
|
+
const i = [];
|
|
257
|
+
return ke.forEach(t, (s) => {
|
|
258
|
+
Ee(s) && i.push(s);
|
|
259
|
+
}), i;
|
|
164
260
|
}
|
|
165
|
-
const
|
|
166
|
-
const [
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
for (let
|
|
170
|
-
const
|
|
171
|
-
|
|
261
|
+
const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: a = "sync", propagate: o = !1, anchorX: d = "left", root: c }) => {
|
|
262
|
+
const [u, h] = ft(o), f = z(() => se(t), [t]), m = o && !u ? [] : f.map(S), g = P(!0), j = P(f), l = de(() => /* @__PURE__ */ new Map()), [x, v] = E(f), [p, C] = E(f);
|
|
263
|
+
st(() => {
|
|
264
|
+
g.current = !1, j.current = f;
|
|
265
|
+
for (let w = 0; w < p.length; w++) {
|
|
266
|
+
const y = S(p[w]);
|
|
267
|
+
m.includes(y) ? l.delete(y) : l.get(y) !== !0 && l.set(y, !1);
|
|
172
268
|
}
|
|
173
|
-
}, [
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
let
|
|
177
|
-
for (let
|
|
178
|
-
const
|
|
179
|
-
|
|
269
|
+
}, [p, m.length, m.join("-")]);
|
|
270
|
+
const b = [];
|
|
271
|
+
if (f !== x) {
|
|
272
|
+
let w = [...f];
|
|
273
|
+
for (let y = 0; y < p.length; y++) {
|
|
274
|
+
const I = p[y], M = S(I);
|
|
275
|
+
m.includes(M) || (w.splice(y, 0, I), b.push(I));
|
|
180
276
|
}
|
|
181
|
-
return a === "wait" &&
|
|
277
|
+
return a === "wait" && b.length && (w = b), C(se(w)), v(f), null;
|
|
182
278
|
}
|
|
183
|
-
process.env.NODE_ENV !== "production" && a === "wait" &&
|
|
184
|
-
const { forceRender:
|
|
185
|
-
return e.jsx(e.Fragment, { children:
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
|
|
279
|
+
process.env.NODE_ENV !== "production" && a === "wait" && p.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
280
|
+
const { forceRender: fe } = V(et);
|
|
281
|
+
return e.jsx(e.Fragment, { children: p.map((w) => {
|
|
282
|
+
const y = S(w), I = o && !u ? !1 : f === p || m.includes(y), M = () => {
|
|
283
|
+
if (l.has(y))
|
|
284
|
+
l.set(y, !0);
|
|
189
285
|
else
|
|
190
286
|
return;
|
|
191
287
|
let X = !0;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}), X && (
|
|
288
|
+
l.forEach((he) => {
|
|
289
|
+
he || (X = !1);
|
|
290
|
+
}), X && (fe?.(), C(j.current), o && h?.(), n && n());
|
|
195
291
|
};
|
|
196
|
-
return e.jsx(
|
|
292
|
+
return e.jsx(dt, { isPresent: I, initial: !g.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: r, mode: a, root: c, onExitComplete: I ? void 0 : M, anchorX: d, children: w }, y);
|
|
197
293
|
}) });
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
|
|
294
|
+
}, pt = ({
|
|
295
|
+
apiKey: t,
|
|
296
|
+
onDeleteKey: i,
|
|
297
|
+
className: s
|
|
201
298
|
}) => {
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
context: s,
|
|
217
|
-
auth: l
|
|
218
|
-
});
|
|
219
|
-
},
|
|
220
|
-
onSuccess: async () => {
|
|
221
|
-
await n.invalidateQueries({ queryKey: ["api-keys"] }), await i("/settings/api-keys/");
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
return t.createKey ? /* @__PURE__ */ e.jsxs(
|
|
225
|
-
"form",
|
|
226
|
-
{
|
|
227
|
-
onSubmit: a.handleSubmit(
|
|
228
|
-
(f) => u.mutate(
|
|
229
|
-
{ ...f },
|
|
230
|
-
{
|
|
231
|
-
onSuccess: () => r(!1)
|
|
232
|
-
}
|
|
233
|
-
)
|
|
299
|
+
const [n, r] = E(!1), { key: a, createdOn: o, expiresOn: d } = t, c = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
|
|
300
|
+
(new Date(d).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
|
|
301
|
+
) : 1 / 0, h = u <= 7 && !c;
|
|
302
|
+
return /* @__PURE__ */ e.jsxs("div", { className: W("grid col-span-full grid-cols-subgrid p-6", s), children: [
|
|
303
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
304
|
+
/* @__PURE__ */ e.jsx(
|
|
305
|
+
Ye,
|
|
306
|
+
{
|
|
307
|
+
className: "max-w-fit w-full",
|
|
308
|
+
secret: a,
|
|
309
|
+
status: c ? "expired" : h ? "expiring" : "active",
|
|
310
|
+
revealed: n,
|
|
311
|
+
onReveal: r
|
|
312
|
+
}
|
|
234
313
|
),
|
|
235
|
-
children: [
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
314
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
|
|
315
|
+
o && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
316
|
+
"Created ",
|
|
317
|
+
mt(o),
|
|
318
|
+
"."
|
|
239
319
|
] }),
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
320
|
+
" ",
|
|
321
|
+
d && h && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
322
|
+
"Expires in ",
|
|
323
|
+
u,
|
|
324
|
+
" ",
|
|
325
|
+
u === 1 ? "day" : "days",
|
|
326
|
+
"."
|
|
327
|
+
] }),
|
|
328
|
+
d && c && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
329
|
+
"Expired",
|
|
330
|
+
" ",
|
|
331
|
+
u === 0 ? "today." : `${u * -1} days ago.`
|
|
332
|
+
] })
|
|
333
|
+
] })
|
|
334
|
+
] }),
|
|
335
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && i && /* @__PURE__ */ e.jsxs(_, { children: [
|
|
336
|
+
/* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(pe, { size: 16 }) }) }),
|
|
337
|
+
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
338
|
+
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
339
|
+
/* @__PURE__ */ e.jsx(Y, { children: "Delete API Key" }),
|
|
340
|
+
/* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to delete this API key?" })
|
|
341
|
+
] }),
|
|
342
|
+
/* @__PURE__ */ e.jsxs(H, { children: [
|
|
343
|
+
/* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
|
|
344
|
+
/* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
345
|
+
k,
|
|
246
346
|
{
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
/* @__PURE__ */ e.jsx(Oe, { children: /* @__PURE__ */ e.jsxs(Me, { children: [
|
|
252
|
-
[7, 30, 60, 90].map((f) => /* @__PURE__ */ e.jsxs(Z, { value: String(f), children: [
|
|
253
|
-
f,
|
|
254
|
-
" days"
|
|
255
|
-
] }, f)),
|
|
256
|
-
/* @__PURE__ */ e.jsx(Z, { value: "never", children: "Never" })
|
|
257
|
-
] }) })
|
|
258
|
-
]
|
|
347
|
+
onClick: () => {
|
|
348
|
+
i();
|
|
349
|
+
},
|
|
350
|
+
children: "Delete"
|
|
259
351
|
}
|
|
260
|
-
)
|
|
261
|
-
/* @__PURE__ */ e.jsxs(V, { children: [
|
|
262
|
-
/* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(v, { variant: "outline", children: "Cancel" }) }),
|
|
263
|
-
/* @__PURE__ */ e.jsx($e, { isPending: u.isPending, children: "Generate Key" })
|
|
264
|
-
] })
|
|
352
|
+
) })
|
|
265
353
|
] })
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
) : null;
|
|
269
|
-
}, nt = (t) => {
|
|
270
|
-
const r = /* @__PURE__ */ new Date();
|
|
271
|
-
return r.setDate(r.getDate() + t), r.toISOString();
|
|
272
|
-
}, se = ({
|
|
273
|
-
service: t,
|
|
274
|
-
isOpen: r,
|
|
275
|
-
onOpenChange: s,
|
|
276
|
-
trigger: n,
|
|
277
|
-
buttonVariant: i = "outline"
|
|
278
|
-
}) => {
|
|
279
|
-
const a = /* @__PURE__ */ e.jsx(v, { variant: i, children: "Create API Key" });
|
|
280
|
-
return /* @__PURE__ */ e.jsxs(B, { open: r, onOpenChange: s, children: [
|
|
281
|
-
/* @__PURE__ */ e.jsx(G, { asChild: !0, children: n ?? a }),
|
|
282
|
-
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
283
|
-
/* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(W, { children: "Create API Key" }) }),
|
|
284
|
-
/* @__PURE__ */ e.jsx(st, { service: t, onOpenChange: s })
|
|
285
|
-
] })
|
|
354
|
+
] })
|
|
355
|
+
] }) })
|
|
286
356
|
] });
|
|
287
|
-
},
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
357
|
+
}, mt = (t) => {
|
|
358
|
+
const i = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((i.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
359
|
+
return n < 60 ? r.format(-n, "second") : n < 3600 ? r.format(-Math.floor(n / 60), "minute") : n < 86400 ? r.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? r.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? r.format(-Math.floor(n / 2592e3), "month") : r.format(-Math.floor(n / 31536e3), "year");
|
|
360
|
+
}, xt = ({
|
|
361
|
+
consumer: t,
|
|
362
|
+
onUpdate: i,
|
|
363
|
+
onRollKey: s,
|
|
364
|
+
onDeleteKey: n
|
|
365
|
+
}) => {
|
|
366
|
+
const [r, a] = E(!1), [o, d] = E(t.label), c = le(), u = U(), h = T({
|
|
367
|
+
mutationFn: async (l) => {
|
|
368
|
+
if (!s)
|
|
369
|
+
throw new Error("rollKey not implemented");
|
|
370
|
+
return await s?.(l, u);
|
|
371
|
+
},
|
|
372
|
+
onSuccess: () => void c.invalidateQueries({ queryKey: ["api-keys"] })
|
|
373
|
+
}), f = T({
|
|
295
374
|
mutationFn: ({
|
|
296
|
-
consumerId:
|
|
297
|
-
keyId:
|
|
375
|
+
consumerId: l,
|
|
376
|
+
keyId: x
|
|
298
377
|
}) => {
|
|
299
|
-
if (!
|
|
378
|
+
if (!n)
|
|
300
379
|
throw new Error("deleteKey not implemented");
|
|
301
|
-
return
|
|
380
|
+
return n(l, x, u);
|
|
302
381
|
},
|
|
303
|
-
onMutate: async ({ consumerId:
|
|
304
|
-
await
|
|
305
|
-
const
|
|
382
|
+
onMutate: async ({ consumerId: l, keyId: x }) => {
|
|
383
|
+
await c.cancelQueries({ queryKey: ["api-keys"] });
|
|
384
|
+
const v = c.getQueryData([
|
|
306
385
|
"api-keys"
|
|
307
386
|
]);
|
|
308
|
-
return
|
|
309
|
-
...
|
|
310
|
-
apiKeys:
|
|
311
|
-
} :
|
|
387
|
+
return c.setQueryData(["api-keys"], (p) => p && p.map((C) => C.id === l ? {
|
|
388
|
+
...C,
|
|
389
|
+
apiKeys: C.apiKeys.filter((b) => b.id !== x)
|
|
390
|
+
} : C)), { previousData: v };
|
|
312
391
|
},
|
|
313
|
-
onError: (
|
|
314
|
-
|
|
392
|
+
onError: (l, x, v) => {
|
|
393
|
+
v?.previousData && c.setQueryData(["api-keys"], v.previousData);
|
|
315
394
|
},
|
|
316
395
|
onSuccess: () => {
|
|
317
|
-
|
|
396
|
+
c.invalidateQueries({ queryKey: ["api-keys"] });
|
|
318
397
|
}
|
|
319
|
-
}),
|
|
398
|
+
}), m = T({
|
|
320
399
|
mutationFn: ({
|
|
321
|
-
consumerId:
|
|
322
|
-
label:
|
|
400
|
+
consumerId: l,
|
|
401
|
+
label: x
|
|
323
402
|
}) => {
|
|
324
|
-
if (!
|
|
403
|
+
if (!i)
|
|
325
404
|
throw new Error("updateConsumer not implemented");
|
|
326
|
-
return
|
|
405
|
+
return i({ id: l, label: x }, u);
|
|
327
406
|
},
|
|
328
|
-
onMutate: async ({ consumerId:
|
|
329
|
-
await
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
...
|
|
333
|
-
label:
|
|
334
|
-
} :
|
|
407
|
+
onMutate: async ({ consumerId: l, label: x }) => {
|
|
408
|
+
await c.cancelQueries({ queryKey: ["api-keys"] });
|
|
409
|
+
const v = c.getQueryData(["api-keys"]);
|
|
410
|
+
return c.setQueryData(["api-keys"], (p) => p && p.map((C) => C.id === l ? {
|
|
411
|
+
...C,
|
|
412
|
+
label: x
|
|
413
|
+
} : C)), { previousData: v };
|
|
335
414
|
},
|
|
336
|
-
onError: (
|
|
337
|
-
|
|
415
|
+
onError: (l, x, v) => {
|
|
416
|
+
v?.previousData && c.setQueryData(["api-keys"], v.previousData);
|
|
338
417
|
},
|
|
339
418
|
onSuccess: () => {
|
|
340
|
-
|
|
419
|
+
c.invalidateQueries({ queryKey: ["api-keys"] });
|
|
341
420
|
}
|
|
342
|
-
}),
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}), k = (o, c) => {
|
|
350
|
-
i(o), l(c);
|
|
351
|
-
}, m = (o) => {
|
|
352
|
-
a.trim() && x.mutate({
|
|
353
|
-
consumerId: o,
|
|
354
|
-
label: a.trim()
|
|
355
|
-
}), i(null), l("");
|
|
356
|
-
}, K = () => {
|
|
357
|
-
i(null), l("");
|
|
421
|
+
}), g = () => {
|
|
422
|
+
a(!0), d(t.label);
|
|
423
|
+
}, j = () => {
|
|
424
|
+
o.trim() && m.mutate({
|
|
425
|
+
label: o.trim(),
|
|
426
|
+
consumerId: t.id
|
|
427
|
+
}), a(!1);
|
|
358
428
|
};
|
|
359
|
-
return /* @__PURE__ */ e.jsxs(
|
|
360
|
-
/* @__PURE__ */ e.
|
|
361
|
-
|
|
362
|
-
/* @__PURE__ */ e.jsx(
|
|
363
|
-
t.createKey && /* @__PURE__ */ e.jsx(
|
|
364
|
-
se,
|
|
365
|
-
{
|
|
366
|
-
service: t,
|
|
367
|
-
isOpen: d,
|
|
368
|
-
onOpenChange: y
|
|
369
|
-
}
|
|
370
|
-
)
|
|
429
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
430
|
+
h.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
431
|
+
/* @__PURE__ */ e.jsx(F, { size: 16 }),
|
|
432
|
+
/* @__PURE__ */ e.jsx(K, { children: h.error.message })
|
|
371
433
|
] }),
|
|
372
|
-
/* @__PURE__ */ e.
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
p.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
376
|
-
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
377
|
-
/* @__PURE__ */ e.jsx(M, { children: p.error.message })
|
|
378
|
-
] }),
|
|
379
|
-
x.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
|
|
380
|
-
/* @__PURE__ */ e.jsx($, { size: 16 }),
|
|
381
|
-
/* @__PURE__ */ e.jsx(M, { children: x.error.message })
|
|
434
|
+
m.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
435
|
+
/* @__PURE__ */ e.jsx(F, { size: 16 }),
|
|
436
|
+
/* @__PURE__ */ e.jsx(K, { children: m.error.message })
|
|
382
437
|
] }),
|
|
383
|
-
|
|
384
|
-
/* @__PURE__ */ e.jsx(
|
|
385
|
-
/* @__PURE__ */ e.jsx(
|
|
438
|
+
f.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
|
|
439
|
+
/* @__PURE__ */ e.jsx(F, { size: 16 }),
|
|
440
|
+
/* @__PURE__ */ e.jsx(K, { children: f.error.message })
|
|
386
441
|
] }),
|
|
387
|
-
/* @__PURE__ */ e.
|
|
388
|
-
|
|
389
|
-
"You have no API keys yet.",
|
|
390
|
-
/* @__PURE__ */ e.jsx("br", {}),
|
|
391
|
-
t.createKey && "Get started and create your first key."
|
|
392
|
-
] }),
|
|
393
|
-
t.createKey && /* @__PURE__ */ e.jsx(
|
|
394
|
-
se,
|
|
395
|
-
{
|
|
396
|
-
service: t,
|
|
397
|
-
isOpen: d,
|
|
398
|
-
onOpenChange: y
|
|
399
|
-
}
|
|
400
|
-
)
|
|
401
|
-
] }) : /* @__PURE__ */ e.jsx(
|
|
402
|
-
"ul",
|
|
442
|
+
/* @__PURE__ */ e.jsxs(
|
|
443
|
+
Pe,
|
|
403
444
|
{
|
|
404
|
-
className:
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
445
|
+
className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ e.jsxs(Ae, { className: "col-span-full flex-row items-start justify-between gap-4", children: [
|
|
448
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
449
|
+
r ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
450
|
+
/* @__PURE__ */ e.jsx(
|
|
451
|
+
ze,
|
|
452
|
+
{
|
|
453
|
+
maxLength: 32,
|
|
454
|
+
value: o,
|
|
455
|
+
onChange: (l) => d(l.target.value),
|
|
456
|
+
onKeyDown: (l) => {
|
|
457
|
+
l.key === "Enter" ? j() : l.key === "Escape" && a(!1);
|
|
458
|
+
},
|
|
459
|
+
autoFocus: !0
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
463
|
+
/* @__PURE__ */ e.jsx(
|
|
464
|
+
k,
|
|
465
|
+
{
|
|
466
|
+
size: "icon",
|
|
467
|
+
variant: "ghost",
|
|
468
|
+
onClick: j,
|
|
469
|
+
disabled: !o.trim(),
|
|
470
|
+
children: /* @__PURE__ */ e.jsx(me, { size: 16 })
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
/* @__PURE__ */ e.jsx(
|
|
474
|
+
k,
|
|
475
|
+
{
|
|
476
|
+
size: "icon",
|
|
477
|
+
variant: "ghost",
|
|
478
|
+
onClick: () => a(!1),
|
|
479
|
+
children: /* @__PURE__ */ e.jsx(xe, { size: 16 })
|
|
480
|
+
}
|
|
481
|
+
)
|
|
482
|
+
] })
|
|
483
|
+
] }) : /* @__PURE__ */ e.jsx(Ne, { children: t.label }),
|
|
484
|
+
/* @__PURE__ */ e.jsxs(Se, { children: [
|
|
485
|
+
t.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
486
|
+
"Created on ",
|
|
487
|
+
new Date(t.createdOn).toLocaleDateString()
|
|
488
|
+
] }),
|
|
489
|
+
t.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
490
|
+
"Expires on ",
|
|
491
|
+
new Date(t.expiresOn).toLocaleDateString()
|
|
492
|
+
] })
|
|
493
|
+
] })
|
|
494
|
+
] }),
|
|
495
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
496
|
+
i && /* @__PURE__ */ e.jsxs(
|
|
497
|
+
k,
|
|
498
|
+
{
|
|
499
|
+
variant: "ghost",
|
|
500
|
+
onClick: g,
|
|
501
|
+
className: W(
|
|
502
|
+
"flex gap-2",
|
|
503
|
+
r && "opacity-0! pointer-events-none"
|
|
504
|
+
),
|
|
505
|
+
disabled: r,
|
|
506
|
+
children: [
|
|
507
|
+
/* @__PURE__ */ e.jsx(ye, { size: 16 }),
|
|
508
|
+
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
s && /* @__PURE__ */ e.jsxs(_, { children: [
|
|
513
|
+
/* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
514
|
+
k,
|
|
515
|
+
{
|
|
516
|
+
title: "Roll this key",
|
|
517
|
+
variant: "ghost",
|
|
518
|
+
disabled: h.isPending,
|
|
519
|
+
className: "flex items-center gap-2",
|
|
520
|
+
children: [
|
|
416
521
|
/* @__PURE__ */ e.jsx(
|
|
417
|
-
|
|
522
|
+
ge,
|
|
418
523
|
{
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
onChange: (c) => l(c.target.value),
|
|
422
|
-
onKeyDown: (c) => {
|
|
423
|
-
c.key === "Enter" ? m(o.id) : c.key === "Escape" && K();
|
|
424
|
-
},
|
|
425
|
-
className: "text-lg font-medium",
|
|
426
|
-
autoFocus: !0
|
|
524
|
+
size: 16,
|
|
525
|
+
className: h.isPending ? "animate-spin" : void 0
|
|
427
526
|
}
|
|
428
527
|
),
|
|
429
|
-
/* @__PURE__ */ e.
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
children: /* @__PURE__ */ e.jsx(ue, { size: 16 })
|
|
438
|
-
}
|
|
439
|
-
),
|
|
440
|
-
/* @__PURE__ */ e.jsx(
|
|
441
|
-
v,
|
|
442
|
-
{
|
|
443
|
-
size: "icon",
|
|
444
|
-
variant: "ghost",
|
|
445
|
-
onClick: K,
|
|
446
|
-
children: /* @__PURE__ */ e.jsx(fe, { size: 16 })
|
|
447
|
-
}
|
|
448
|
-
)
|
|
449
|
-
] })
|
|
450
|
-
] }) : o.label,
|
|
451
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: o.createdOn })
|
|
528
|
+
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
|
|
529
|
+
]
|
|
530
|
+
}
|
|
531
|
+
) }),
|
|
532
|
+
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
533
|
+
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
534
|
+
/* @__PURE__ */ e.jsx(Y, { children: "Roll API Key" }),
|
|
535
|
+
/* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to roll this API key?" })
|
|
452
536
|
] }),
|
|
453
|
-
/* @__PURE__ */ e.jsxs(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
new Date(o.createdOn).toLocaleDateString()
|
|
458
|
-
] }),
|
|
459
|
-
o.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
|
|
460
|
-
"Expires on",
|
|
461
|
-
" ",
|
|
462
|
-
new Date(o.expiresOn).toLocaleDateString()
|
|
463
|
-
] })
|
|
464
|
-
] })
|
|
465
|
-
] }),
|
|
466
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
|
|
467
|
-
t.updateConsumer && /* @__PURE__ */ e.jsxs(
|
|
468
|
-
v,
|
|
469
|
-
{
|
|
470
|
-
variant: "ghost",
|
|
471
|
-
onClick: () => k(o.id, o.label),
|
|
472
|
-
className: L(
|
|
473
|
-
"flex gap-2",
|
|
474
|
-
n === o.id && "opacity-0! pointer-events-none"
|
|
475
|
-
),
|
|
476
|
-
disabled: n === o.id,
|
|
477
|
-
children: [
|
|
478
|
-
/* @__PURE__ */ e.jsx(he, { size: 16 }),
|
|
479
|
-
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
|
|
480
|
-
]
|
|
481
|
-
}
|
|
482
|
-
),
|
|
483
|
-
t.rollKey && /* @__PURE__ */ e.jsxs(B, { children: [
|
|
484
|
-
/* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
485
|
-
v,
|
|
537
|
+
/* @__PURE__ */ e.jsxs(H, { children: [
|
|
538
|
+
/* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
|
|
539
|
+
/* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
540
|
+
k,
|
|
486
541
|
{
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
children: [
|
|
492
|
-
/* @__PURE__ */ e.jsx(
|
|
493
|
-
pe,
|
|
494
|
-
{
|
|
495
|
-
size: 16,
|
|
496
|
-
className: p.isPending ? "animate-spin" : void 0
|
|
497
|
-
}
|
|
498
|
-
),
|
|
499
|
-
/* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
|
|
500
|
-
]
|
|
542
|
+
onClick: () => {
|
|
543
|
+
h.mutate(t.id);
|
|
544
|
+
},
|
|
545
|
+
children: "Roll Key"
|
|
501
546
|
}
|
|
502
|
-
) })
|
|
503
|
-
/* @__PURE__ */ e.jsxs(J, { children: [
|
|
504
|
-
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
505
|
-
/* @__PURE__ */ e.jsx(W, { children: "Roll API Key" }),
|
|
506
|
-
/* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to roll this API key?" })
|
|
507
|
-
] }),
|
|
508
|
-
/* @__PURE__ */ e.jsxs(V, { children: [
|
|
509
|
-
/* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(v, { variant: "outline", children: "Cancel" }) }),
|
|
510
|
-
/* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
511
|
-
v,
|
|
512
|
-
{
|
|
513
|
-
onClick: () => {
|
|
514
|
-
p.mutate(o.id);
|
|
515
|
-
},
|
|
516
|
-
children: "Roll Key"
|
|
517
|
-
}
|
|
518
|
-
) })
|
|
519
|
-
] })
|
|
520
|
-
] })
|
|
547
|
+
) })
|
|
521
548
|
] })
|
|
522
549
|
] })
|
|
523
|
-
] })
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
) })
|
|
550
|
+
] })
|
|
551
|
+
] })
|
|
552
|
+
] }),
|
|
553
|
+
/* @__PURE__ */ e.jsx(Re, { className: "p-0 grid grid-cols-subgrid col-span-full divide-y divide-border", children: /* @__PURE__ */ e.jsx(ht, { children: t.apiKeys.map((l) => /* @__PURE__ */ e.jsx(
|
|
554
|
+
pt,
|
|
555
|
+
{
|
|
556
|
+
apiKey: l,
|
|
557
|
+
onDeleteKey: () => {
|
|
558
|
+
f.mutate({
|
|
559
|
+
consumerId: t.id,
|
|
560
|
+
keyId: l.id
|
|
561
|
+
});
|
|
562
|
+
},
|
|
563
|
+
className: f.variables?.keyId === l.id && f.isPending ? "opacity-10!" : void 0
|
|
564
|
+
},
|
|
565
|
+
l.id
|
|
566
|
+
)) }) })
|
|
567
|
+
]
|
|
568
|
+
},
|
|
569
|
+
t.id
|
|
570
|
+
)
|
|
546
571
|
] });
|
|
547
|
-
},
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
572
|
+
}, yt = ({ service: t }) => {
|
|
573
|
+
const i = U(), { data: s } = $e({
|
|
574
|
+
queryFn: async () => {
|
|
575
|
+
try {
|
|
576
|
+
return await t.getConsumers(i);
|
|
577
|
+
} catch (a) {
|
|
578
|
+
throw new $("Cannot get API keys", {
|
|
579
|
+
cause: a,
|
|
580
|
+
title: "Error getting API keys",
|
|
581
|
+
developerHint: "Check the response of the API request for more information."
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
queryKey: ["api-keys"],
|
|
586
|
+
retry: !1
|
|
587
|
+
}), [n, r] = E(!1);
|
|
588
|
+
return /* @__PURE__ */ e.jsx("div", { className: "mt-8", children: s.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
|
|
589
|
+
/* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
|
|
590
|
+
"You have no API keys yet.",
|
|
591
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
592
|
+
t.createKey && "Get started and create your first key."
|
|
593
|
+
] }),
|
|
594
|
+
t.createKey && /* @__PURE__ */ e.jsx(
|
|
595
|
+
ce,
|
|
596
|
+
{
|
|
597
|
+
service: t,
|
|
598
|
+
isOpen: n,
|
|
599
|
+
onOpenChange: r
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
] }) : /* @__PURE__ */ e.jsx("ul", { className: W("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((a) => /* @__PURE__ */ e.jsx(
|
|
603
|
+
xt,
|
|
604
|
+
{
|
|
605
|
+
consumer: a,
|
|
606
|
+
onUpdate: t.updateConsumer,
|
|
607
|
+
onRollKey: t.rollKey,
|
|
608
|
+
onDeleteKey: t.deleteKey
|
|
609
|
+
},
|
|
610
|
+
a.id
|
|
611
|
+
)) }) });
|
|
612
|
+
}, gt = ({ service: t }) => {
|
|
613
|
+
const [i, s] = E(!1), n = ie();
|
|
614
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "max-w-3xl h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
|
|
615
|
+
/* @__PURE__ */ e.jsx(Z.Target, { name: "api-keys-list-page" }),
|
|
616
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
|
|
617
|
+
/* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
|
|
618
|
+
t.createKey && /* @__PURE__ */ e.jsx(
|
|
619
|
+
ce,
|
|
562
620
|
{
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
revealed: n,
|
|
567
|
-
onReveal: i
|
|
621
|
+
service: t,
|
|
622
|
+
isOpen: i,
|
|
623
|
+
onOpenChange: s
|
|
568
624
|
}
|
|
569
|
-
)
|
|
570
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
|
|
571
|
-
l && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
572
|
-
"Created ",
|
|
573
|
-
rt(l),
|
|
574
|
-
"."
|
|
575
|
-
] }),
|
|
576
|
-
" ",
|
|
577
|
-
u && y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
578
|
-
"Expires in ",
|
|
579
|
-
d,
|
|
580
|
-
" ",
|
|
581
|
-
d === 1 ? "day" : "days",
|
|
582
|
-
"."
|
|
583
|
-
] }),
|
|
584
|
-
u && f && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
|
|
585
|
-
"Expired",
|
|
586
|
-
" ",
|
|
587
|
-
d === 0 ? "today." : `${d * -1} days ago.`
|
|
588
|
-
] })
|
|
589
|
-
] })
|
|
625
|
+
)
|
|
590
626
|
] }),
|
|
591
|
-
/* @__PURE__ */ e.jsx("
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
children: "Delete"
|
|
607
|
-
}
|
|
608
|
-
) })
|
|
609
|
-
] })
|
|
610
|
-
] })
|
|
611
|
-
] }) })
|
|
627
|
+
/* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
|
|
628
|
+
/* @__PURE__ */ e.jsx(Z.Target, { name: "api-keys-list-page-before-keys" }),
|
|
629
|
+
n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(Oe, { variant: "outline", children: [
|
|
630
|
+
/* @__PURE__ */ e.jsxs(Te, { children: [
|
|
631
|
+
/* @__PURE__ */ e.jsx(qe, { children: "Verified email required" }),
|
|
632
|
+
/* @__PURE__ */ e.jsx(Me, { children: "You need to verify your email to access API keys." })
|
|
633
|
+
] }),
|
|
634
|
+
/* @__PURE__ */ e.jsx(Fe, { children: /* @__PURE__ */ e.jsx(De, { onClick: () => n.requestEmailVerification(), children: "Verify email" }) })
|
|
635
|
+
] }) : /* @__PURE__ */ e.jsx(
|
|
636
|
+
Ke,
|
|
637
|
+
{
|
|
638
|
+
fallbackRender: ({ error: r }) => /* @__PURE__ */ e.jsx(We, { error: r }),
|
|
639
|
+
children: /* @__PURE__ */ e.jsx(yt, { service: t })
|
|
640
|
+
}
|
|
641
|
+
)
|
|
612
642
|
] });
|
|
613
|
-
}, R = "https://api.zuploedge.com/v2/client",
|
|
643
|
+
}, R = "https://api.zuploedge.com/v2/client", jt = async (t) => {
|
|
614
644
|
try {
|
|
615
645
|
return await t.json();
|
|
616
646
|
} catch {
|
|
617
647
|
return;
|
|
618
648
|
}
|
|
619
|
-
},
|
|
620
|
-
const
|
|
621
|
-
if (!t.ok &&
|
|
622
|
-
const s = await
|
|
649
|
+
}, O = async (t) => {
|
|
650
|
+
const i = t.headers.get("content-type");
|
|
651
|
+
if (!t.ok && i?.includes("application/problem+json")) {
|
|
652
|
+
const s = await jt(t);
|
|
623
653
|
if (s.type && s.title)
|
|
624
654
|
throw new Error(s.detail ?? s.title);
|
|
625
655
|
}
|
|
626
|
-
},
|
|
627
|
-
deleteKey: async (s, n,
|
|
656
|
+
}, vt = (t, i) => ({
|
|
657
|
+
deleteKey: async (s, n, r) => {
|
|
628
658
|
const a = new Request(
|
|
629
659
|
R + `/${t}/consumers/${s}/keys/${n}`,
|
|
630
660
|
{
|
|
631
661
|
method: "DELETE"
|
|
632
662
|
}
|
|
633
663
|
);
|
|
634
|
-
await
|
|
635
|
-
const
|
|
636
|
-
await
|
|
664
|
+
await r.signRequest(a);
|
|
665
|
+
const o = await fetch(a);
|
|
666
|
+
await O(o), N(o.ok, "Failed to delete API key");
|
|
637
667
|
},
|
|
638
668
|
updateConsumer: async (s, n) => {
|
|
639
|
-
const
|
|
669
|
+
const r = await fetch(
|
|
640
670
|
await n.signRequest(
|
|
641
671
|
new Request(
|
|
642
672
|
R + `/${t}/consumers/${s.id}`,
|
|
@@ -652,10 +682,10 @@ const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
|
|
|
652
682
|
)
|
|
653
683
|
)
|
|
654
684
|
);
|
|
655
|
-
await
|
|
685
|
+
await O(r), N(r.ok, "Failed to update API key description");
|
|
656
686
|
},
|
|
657
687
|
rollKey: async (s, n) => {
|
|
658
|
-
const
|
|
688
|
+
const r = await fetch(
|
|
659
689
|
await n.signRequest(
|
|
660
690
|
new Request(
|
|
661
691
|
R + `/${t}/consumers/${s}/roll-key`,
|
|
@@ -669,42 +699,54 @@ const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
|
|
|
669
699
|
)
|
|
670
700
|
)
|
|
671
701
|
);
|
|
672
|
-
await
|
|
702
|
+
await O(r), N(r.ok, "Failed to delete API key");
|
|
673
703
|
},
|
|
674
704
|
getConsumers: async (s) => {
|
|
675
705
|
const n = new Request(
|
|
676
706
|
`${R}/${t}/consumers`
|
|
677
707
|
);
|
|
678
708
|
await s.signRequest(n);
|
|
679
|
-
const
|
|
680
|
-
return await
|
|
681
|
-
id:
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
709
|
+
const r = await fetch(n);
|
|
710
|
+
return await O(r), N(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((o) => ({
|
|
711
|
+
id: o.id,
|
|
712
|
+
createdOn: o.createdOn,
|
|
713
|
+
updatedOn: o.updatedOn,
|
|
714
|
+
expiresOn: o.expiresOn,
|
|
715
|
+
label: o.label || o.subject || "API Key",
|
|
716
|
+
apiKeys: o.apiKeys.data,
|
|
717
|
+
key: o.apiKeys.data.at(0)
|
|
685
718
|
}));
|
|
686
719
|
},
|
|
687
|
-
...
|
|
688
|
-
}),
|
|
689
|
-
|
|
720
|
+
...i
|
|
721
|
+
}), zt = (t) => t, Lt = ({
|
|
722
|
+
deploymentName: t,
|
|
723
|
+
...i
|
|
724
|
+
}) => {
|
|
725
|
+
const s = t ? vt(t, { deploymentName: t, ...i }) : i;
|
|
726
|
+
if (!s.getConsumers)
|
|
727
|
+
throw new Error("getConsumers is required when using the apiKeyPlugin");
|
|
728
|
+
const n = {
|
|
729
|
+
...s,
|
|
730
|
+
getConsumers: s.getConsumers
|
|
731
|
+
};
|
|
690
732
|
return {
|
|
691
733
|
getProfileMenuItems: () => [
|
|
692
734
|
{
|
|
693
735
|
label: "API Keys",
|
|
694
736
|
path: "/settings/api-keys",
|
|
695
737
|
category: "middle",
|
|
696
|
-
icon:
|
|
738
|
+
icon: je
|
|
697
739
|
}
|
|
698
740
|
],
|
|
699
|
-
getIdentities: async (
|
|
741
|
+
getIdentities: async (r) => {
|
|
700
742
|
try {
|
|
701
|
-
return (await
|
|
702
|
-
authorizeRequest: (
|
|
743
|
+
return (await n.getConsumers(r)).map((o) => ({
|
|
744
|
+
authorizeRequest: (d) => (d.headers.set(
|
|
703
745
|
"Authorization",
|
|
704
|
-
`Bearer ${
|
|
705
|
-
),
|
|
706
|
-
id:
|
|
707
|
-
label:
|
|
746
|
+
`Bearer ${o.apiKeys.at(0)?.key}`
|
|
747
|
+
), d),
|
|
748
|
+
id: o.id,
|
|
749
|
+
label: o.label
|
|
708
750
|
}));
|
|
709
751
|
} catch {
|
|
710
752
|
return [];
|
|
@@ -712,20 +754,15 @@ const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
|
|
|
712
754
|
},
|
|
713
755
|
getRoutes: () => [
|
|
714
756
|
{
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
children: [
|
|
718
|
-
{
|
|
719
|
-
path: "/settings/api-keys",
|
|
720
|
-
element: /* @__PURE__ */ e.jsx(it, { service: r })
|
|
721
|
-
}
|
|
722
|
-
]
|
|
757
|
+
path: "/settings/api-keys",
|
|
758
|
+
element: /* @__PURE__ */ e.jsx(gt, { service: n })
|
|
723
759
|
}
|
|
724
|
-
]
|
|
760
|
+
],
|
|
761
|
+
getProtectedRoutes: () => ["/settings/api-keys"]
|
|
725
762
|
};
|
|
726
763
|
};
|
|
727
764
|
export {
|
|
728
|
-
|
|
729
|
-
|
|
765
|
+
Lt as apiKeyPlugin,
|
|
766
|
+
zt as createApiKeyService
|
|
730
767
|
};
|
|
731
768
|
//# sourceMappingURL=zudoku.plugin-api-keys.js.map
|