"use strict"; (() => { var exports = {}; exports.id = 6057; exports.ids = [6057]; exports.modules = { /***/ 3406: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "ApiKeysContext": () => (/* binding */ ApiKeysContext), "default": () => (/* binding */ Dashboard), "getServerSideProps": () => (/* binding */ getServerSideProps) }); // EXTERNAL MODULE: external "react/jsx-runtime" var jsx_runtime_ = __webpack_require__(997); // EXTERNAL MODULE: external "react" var external_react_ = __webpack_require__(6689); var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_); // EXTERNAL MODULE: ./layouts/AdminLayout.jsx + 2 modules var AdminLayout = __webpack_require__(4858); // EXTERNAL MODULE: ./functions/backend/userAuth.js var userAuth = __webpack_require__(370); var userAuth_default = /*#__PURE__*/__webpack_require__.n(userAuth); // EXTERNAL MODULE: ./components/general/Breadcrumbs.jsx var Breadcrumbs = __webpack_require__(424); // EXTERNAL MODULE: ./components/general/GeneralPopup.jsx var GeneralPopup = __webpack_require__(5472); // EXTERNAL MODULE: ./components/general/VerificationBanner.jsx var VerificationBanner = __webpack_require__(7946); // EXTERNAL MODULE: ./functions/frontend/fetchApi.js var fetchApi = __webpack_require__(6729); // EXTERNAL MODULE: ./components/general/LoadingBlock.jsx var LoadingBlock = __webpack_require__(5264); // EXTERNAL MODULE: ./components/general/ui/ButtonGroup.jsx var ButtonGroup = __webpack_require__(5449); ;// CONCATENATED MODULE: ./components/admin/api-keys/ApiKeyListCard.jsx // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props * @param {import("@/package-shared/types").ApiKeyDef} props.apiKeyObject * @param {React.Dispatch>} props.setTargetApiKey */ function ApiKeyListCard({ apiKeyObject , setTargetApiKey }) { /** * Get Contexts * * @abstract { React.useContext } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ const [loading, setLoading] = external_react_default().useState(false); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "card no-hover justify-between items-center" + (apiKeyObject.scope.match(/fullAccess/) ? " green" : ""), onClick: (e)=>{ // @ts-ignore if (e.target?.closest("button")) return; setTargetApiKey(apiKeyObject); (0,GeneralPopup/* openPopup */.Mw)("target-media-popup"); }, children: [ loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, { width: "20px" }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "text-sm flex-wrap", children: [ /*#__PURE__*/ jsx_runtime_.jsx("div", { children: apiKeyObject.scope.match(/readOnly/) ? /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "notification" }) : apiKeyObject.scope.match(/fullAccess/) ? /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "notification success" }) : "No Scope" }), /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "title text-xl", style: { fontSize: "16px" }, children: apiKeyObject.name }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", { className: "text-slate-400 ", children: [ "Created: ", apiKeyObject.date_created.substring(0, 24) ] }) ] }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)(ButtonGroup/* default */.Z, { children: [ /*#__PURE__*/ jsx_runtime_.jsx("button", { className: "outlined light-gray small-text", onClick: (e)=>{ alert(apiKeyObject.apiKeyPayload); }, children: "Reveal Api Key" }), /*#__PURE__*/ jsx_runtime_.jsx("button", { className: "outlined light-gray small-text", onClick: (e)=>{ // document.execCommand("copy", false, apiKeyObject.apiKeyPayload); navigator.clipboard.writeText(apiKeyObject.apiKeyPayload).then(()=>{ alert("Api Key Copied To Clipboard"); }); }, children: "Copy Api Key" }), /*#__PURE__*/ jsx_runtime_.jsx("button", { className: "outlined light-gray small-text" + (loading ? " pointer-events-none opacity-40" : ""), onClick: (e)=>{ setLoading(true); if (window.confirm(`Delete this Api Key?`)) { (0,fetchApi/* default */.Z)("/api/deleteApiKey", { method: "post", body: apiKeyObject }, true).then((res)=>{}).finally(()=>{ window.location.reload(); }); } else { setLoading(false); } }, children: "Delete Api Key" }) ] }) ] }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ ;// CONCATENATED MODULE: external "@mui/icons-material/HttpsTwoTone" const HttpsTwoTone_namespaceObject = require("@mui/icons-material/HttpsTwoTone"); var HttpsTwoTone_default = /*#__PURE__*/__webpack_require__.n(HttpsTwoTone_namespaceObject); ;// CONCATENATED MODULE: ./components/admin/api-keys/ApiKeysList.jsx // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props * @param {import("@/package-shared/types").UserType} [props.user] * @param {import("@/package-shared/types").ApiKeyDef[]} props.apiKeys * @param {React.Dispatch>} props.setTargetApiKey */ function ApiKeysList({ user , apiKeys , setTargetApiKey }) { /** * Get Contexts * * @abstract { React.useContext } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ return /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, { children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", { className: "p-0 items-start gap-4 overflow-visible bg-transparent border-transparent", children: [ /*#__PURE__*/ jsx_runtime_.jsx("div", { className: "w-full flex-col items-stretch gap-4", children: apiKeys && apiKeys[0] && apiKeys.map((apiKeyObject, index)=>{ return /*#__PURE__*/ jsx_runtime_.jsx(ApiKeyListCard, { apiKeyObject: apiKeyObject, setTargetApiKey: setTargetApiKey }, index); }) }), !apiKeys || !apiKeys[0] && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "button outlined gray dashed w-full p-10 flex-col", onClick: (e)=>{ (0,GeneralPopup/* openPopup */.Mw)("add-new-api-key-popup"); }, children: [ /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "text-slate-400", children: "No Api Keys Added." }), /*#__PURE__*/ jsx_runtime_.jsx((HttpsTwoTone_default()), { color: "action", sx: { fontSize: 80 }, className: "opacity-40" }), /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "", children: "Add Api Key" }) ] }) ] }) }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ ;// CONCATENATED MODULE: ./components/admin/api-keys/ApiKeysContent.jsx // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props */ function ApiKeysContent(props) { /** * Get Contexts * * @abstract { React.useContext } */ const { user , apiKeys , setApiKeys , setTargetApiKey } = external_react_default().useContext(ApiKeysContext); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, { children: [ /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex-col items-start gap-0 w-full", children: [ /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "w-full justify-between flex-wrap", children: [ /*#__PURE__*/ jsx_runtime_.jsx("h1", { className: "text-3xl m-0", children: "Api Keys" }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("button", { className: "flex items-center gap-2", onClick: (e)=>{ (0,GeneralPopup/* openPopup */.Mw)("add-new-api-key-popup"); }, children: [ /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "symbol", children: "+" }), /*#__PURE__*/ jsx_runtime_.jsx("span", { children: "Add New Api Key" }) ] }) ] }), /*#__PURE__*/ jsx_runtime_.jsx(Breadcrumbs/* default */.Z, { user: user }) ] }), user?.verification_status?.toString().match(/1/) ? /*#__PURE__*/ jsx_runtime_.jsx(ApiKeysList, { apiKeys: apiKeys, setTargetApiKey: setTargetApiKey, user: user }) : /*#__PURE__*/ jsx_runtime_.jsx(VerificationBanner/* default */.Z, {}) ] }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ ;// CONCATENATED MODULE: ./components/admin/api-keys/TargetApiKeyPreviewPopup.jsx // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props * @param {import("@/package-shared/types").ApiKeyDef} props.targetApiKey */ function TargetApiKeyPreviewPopup({ targetApiKey }) { /** * Get Contexts * * @abstract { React.useContext } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ const [loading, setLoading] = external_react_default().useState(false); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(GeneralPopup/* default */.ZP, { title: "target-api-key-preview-popup", noContainer: true, fullPage: true, children: [ loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}), targetApiKey && /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, { children: /*#__PURE__*/ jsx_runtime_.jsx("span", { children: "Target Api Key" }) }) ] }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ // EXTERNAL MODULE: ./functions/frontend/checkUniqueField.js var checkUniqueField = __webpack_require__(4105); ;// CONCATENATED MODULE: ./components/admin/api-keys/AddNewApiKeyPopup.jsx // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** @type {any} */ var timeout; /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props * @param {*} [props.targetApiKey] */ function AddNewApiKeyPopup({ targetApiKey }) { /** * Get Contexts * * @abstract { React.useContext } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ async function checkDuplicateSlug(/** @type {string} */ value) { const duplicate = await (0,checkUniqueField/* default */.Z)({ tableName: "api_keys", columnName: "slug", value: value }); return duplicate; } //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ const [loading, setLoading] = external_react_default().useState(false); const [alert, setAlert] = external_react_default().useState(/** @type {string | null} */ null); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(GeneralPopup/* default */.ZP, { title: "add-new-api-key-popup", children: [ loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}), /*#__PURE__*/ jsx_runtime_.jsx("h4", { className: "m-0", children: "Add New Api Key" }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("form", { className: "w-full flex flex-col items-stretch gap-2", onSubmit: (e)=>{ e.preventDefault(); setLoading(true); /** @type {HTMLFormElement | *} */ const formElement = e.target; const api_key_name = formElement["api_key_name"].value; const api_key_slug = formElement["api_key_slug"].value; const api_key_scope = formElement["api_key_scope"].value; /** @type {import("@/package-shared/types").AddApiKeyRequestBody} */ const formBody = { api_key_name, api_key_slug, api_key_scope, target_database: formElement["target_database"]?.value || undefined, target_table: formElement["target_table"]?.value || undefined }; (0,fetchApi/* default */.Z)("/api/addApiKey", { method: "post", body: formBody }, true).then((res)=>{ if (res.success) { window.location.reload(); } else { setTimeout(()=>{ setLoading(false); }, 2000); } }); }, children: [ alert && /*#__PURE__*/ jsx_runtime_.jsx("div", { children: /*#__PURE__*/ jsx_runtime_.jsx("span", { children: alert }) }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex flex-col items-start gap-0.5 w-full", children: [ /*#__PURE__*/ jsx_runtime_.jsx("label", { htmlFor: "api_key_name", children: "Api Key Name" }), /*#__PURE__*/ jsx_runtime_.jsx("input", { type: "text", name: "api_key_name", id: "api_key_name", placeholder: "Api Key Name", onInput: (e)=>{ /** @type {HTMLInputElement | *} */ const inputarget = e.target; if (inputarget) { inputarget.closest("form")["api_key_slug"].value = inputarget.value.toLowerCase().replace(/ /g, "_").replace(/[^a-zA-Z0-9-_]/g, ""); } }, required: true }) ] }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex flex-col items-start gap-0.5 w-full", children: [ /*#__PURE__*/ jsx_runtime_.jsx("label", { htmlFor: "api_key_slug", children: "Api Key Slug" }), /*#__PURE__*/ jsx_runtime_.jsx("input", { type: "text", name: "api_key_slug", id: "api_key_slug", placeholder: "Api Key Slug", onInput: (e)=>{ /** @type {HTMLInputElement & *} */ const inputarget = e.target; if (inputarget?.value.match(/./)) { inputarget?.classList.remove("warning"); setAlert(null); } else { inputarget?.classList.add("warning"); } window.clearTimeout(timeout); timeout = setTimeout(()=>{ checkDuplicateSlug(inputarget.value).then((res)=>{ if (res.result) { inputarget?.classList.add("warning"); // @ts-ignore setAlert("Duplicate Table Name"); } else { inputarget?.classList.remove("warning"); setAlert(null); } }); }, 300); }, required: true }) ] }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex flex-col items-start gap-0.5 w-full", children: [ /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "", children: [ /*#__PURE__*/ jsx_runtime_.jsx("label", { htmlFor: "api_key_scope", children: "Api Scope" }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "dropdown-wrapper reversed", children: [ /*#__PURE__*/ jsx_runtime_.jsx("span", { className: "px-2 py-1 bg-slate-100 rounded-full text-xs font-semibold", children: "Info" }), /*#__PURE__*/ jsx_runtime_.jsx("div", { className: "dropdown always left-aligned -ml-10 -mb-2", style: { minWidth: "300px" }, children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex-col items-start gap-2 text-sm leading-snug", children: [ /*#__PURE__*/ jsx_runtime_.jsx("span", { children: "Scope is the range of access the API Key can have" }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("ul", { className: "ml-0 pl-4 flex flex-col gap-2", children: [ /*#__PURE__*/ jsx_runtime_.jsx("li", { children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", { children: [ /*#__PURE__*/ jsx_runtime_.jsx("b", { children: "Read Only:" }), " Can only read from databases" ] }) }), /*#__PURE__*/ jsx_runtime_.jsx("li", { children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", { children: [ /*#__PURE__*/ jsx_runtime_.jsx("b", { children: "Full Access:" }), " Can read and Write to databases" ] }) }) ] }) ] }) }) ] }) ] }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("select", { name: "api_key_scope", id: "api_key_scope", children: [ /*#__PURE__*/ jsx_runtime_.jsx("option", { value: "readOnly", children: "Read Only" }), /*#__PURE__*/ jsx_runtime_.jsx("option", { value: "fullAccess", children: "Full Access" }) ] }) ] }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex flex-col items-start gap-0.5 w-full", children: [ /*#__PURE__*/ jsx_runtime_.jsx("label", { htmlFor: "target_database", children: "Target Databases" }), /*#__PURE__*/ jsx_runtime_.jsx("input", { type: "text", name: "target_database", id: "target_database", placeholder: "Target Databases (optional). Comma Separated" }) ] }), /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", { className: "flex flex-col items-start gap-0.5 w-full", children: [ /*#__PURE__*/ jsx_runtime_.jsx("label", { htmlFor: "target_table", children: "Target Tables" }), /*#__PURE__*/ jsx_runtime_.jsx("input", { type: "text", name: "target_table", id: "target_table", placeholder: "Target Tables (optional). Comma Separated" }) ] }), /*#__PURE__*/ jsx_runtime_.jsx("button", { type: "submit", className: loading ? " pointer-events-none opacity-40" : "", children: "Create New Api Key" }) ] }) ] }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ // EXTERNAL MODULE: ./package-shared/utils/backend/global-db/DB_HANDLER.js var DB_HANDLER = __webpack_require__(9395); var DB_HANDLER_default = /*#__PURE__*/__webpack_require__.n(DB_HANDLER); // EXTERNAL MODULE: ./package-shared/functions/backend/decrypt.js var decrypt = __webpack_require__(5304); var decrypt_default = /*#__PURE__*/__webpack_require__.n(decrypt); ;// CONCATENATED MODULE: ./pages/admin/[user_id]/api-keys/index.jsx // @ts-check /** * ============================================================================== * Imports * ============================================================================== */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** ****************************************************************************** */ /** @type {import("@/package-shared/types").ApiKeysContextType} */ // @ts-ignore const init = {}; const ApiKeysContext = /*#__PURE__*/ external_react_default().createContext(init); /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Main Component { Functional } * ============================================================================== * @param {Object} props - Server props * @param {import("@/package-shared/types").UserType} props.user * @param {any[]} props.fetchedApiKeys */ function Dashboard({ user , fetchedApiKeys }) { /** * Get Contexts * * @abstract { React.useContext } */ //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Javascript Variables * * @abstract Non hook variables and functions */ const pageTitle = "Api Keys | Datasquirel"; const pageDescription = "Welcome to your data app"; let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, { children: [ /*#__PURE__*/ jsx_runtime_.jsx("title", { children: pageTitle }), /*#__PURE__*/ jsx_runtime_.jsx("meta", { name: "description", content: pageDescription }) ] }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * React Hooks * * @abstract { useState, useEffect, useRef, etc ... } */ const [apiKeys, setApiKeys] = external_react_default().useState(fetchedApiKeys); const [newApiKey, setNewApiKey] = external_react_default().useState(null); const [targetApiKey, setTargetApiKey] = external_react_default().useState(null); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Function Return * * @abstract Main Function Return */ return /*#__PURE__*/ jsx_runtime_.jsx(AdminLayout/* default */.Z, { head: head, user: user, children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)(ApiKeysContext.Provider, { value: { user, apiKeys, setApiKeys, targetApiKey, setTargetApiKey, newApiKey, setNewApiKey }, children: [ /*#__PURE__*/ jsx_runtime_.jsx(ApiKeysContent, {}), targetApiKey && /*#__PURE__*/ jsx_runtime_.jsx(TargetApiKeyPreviewPopup, { targetApiKey: targetApiKey }), /*#__PURE__*/ jsx_runtime_.jsx(AddNewApiKeyPopup, {}) ] }) }); //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** * ============================================================================== * Server Side Props or Static Props * ============================================================================== * @type {import("next").GetServerSideProps} */ async function getServerSideProps({ req , res , query }) { /** * User Auth * * @description User Auth */ const user = await userAuth_default()(req, res); if (!user?.logged_in_status) { return { redirect: { destination: "/logout", permanent: false } }; } /** * Page/Site Data Data Fetching * * @description Fetch data on the server before returning */ const apiKeys = await DB_HANDLER_default()(`SELECT * FROM api_keys WHERE user_id='${user.id}'`); let apiKeysWithPayloads = []; if (apiKeys && apiKeys[0]) { for(let i = 0; i < apiKeys.length; i++){ const apiKey = apiKeys[i]; const apiKeyPayload = decrypt_default()(apiKey.key); apiKeysWithPayloads.push({ ...apiKey, apiKeyPayload }); } } //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /** * Server props return * * @description Return data fetched on the server side */ return { props: { user: user, fetchedApiKeys: apiKeysWithPayloads } }; //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// } /***/ }), /***/ 4003: /***/ ((module) => { module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone"); /***/ }), /***/ 69: /***/ ((module) => { module.exports = require("@mui/icons-material/CloudOffTwoTone"); /***/ }), /***/ 4008: /***/ ((module) => { module.exports = require("@mui/icons-material/CloudQueueRounded"); /***/ }), /***/ 7306: /***/ ((module) => { module.exports = require("@mui/icons-material/CollectionsTwoTone"); /***/ }), /***/ 386: /***/ ((module) => { module.exports = require("@mui/icons-material/CottageTwoTone"); /***/ }), /***/ 8979: /***/ ((module) => { module.exports = require("@mui/icons-material/DynamicFormTwoTone"); /***/ }), /***/ 300: /***/ ((module) => { module.exports = require("@mui/icons-material/LanguageOutlined"); /***/ }), /***/ 2814: /***/ ((module) => { module.exports = require("@mui/icons-material/LockTwoTone"); /***/ }), /***/ 5557: /***/ ((module) => { module.exports = require("@mui/icons-material/MenuBookTwoTone"); /***/ }), /***/ 9806: /***/ ((module) => { module.exports = require("@mui/icons-material/PeopleOutlineTwoTone"); /***/ }), /***/ 36: /***/ ((module) => { module.exports = require("@mui/icons-material/RefreshRounded"); /***/ }), /***/ 1799: /***/ ((module) => { module.exports = require("@mui/icons-material/SchemaTwoTone"); /***/ }), /***/ 2423: /***/ ((module) => { module.exports = require("lucide-react"); /***/ }), /***/ 968: /***/ ((module) => { module.exports = require("next/head"); /***/ }), /***/ 6689: /***/ ((module) => { module.exports = require("react"); /***/ }), /***/ 6405: /***/ ((module) => { module.exports = require("react-dom"); /***/ }), /***/ 997: /***/ ((module) => { module.exports = require("react/jsx-runtime"); /***/ }), /***/ 2261: /***/ ((module) => { module.exports = require("serverless-mysql"); /***/ }), /***/ 4300: /***/ ((module) => { module.exports = require("buffer"); /***/ }), /***/ 6113: /***/ ((module) => { module.exports = require("crypto"); /***/ }), /***/ 7147: /***/ ((module) => { module.exports = require("fs"); /***/ }), /***/ 3685: /***/ ((module) => { module.exports = require("http"); /***/ }) }; ; // load runtime var __webpack_require__ = require("../../../webpack-runtime.js"); __webpack_require__.C(exports); var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,913,4480,370,424,4858,5472,7946,4105], () => (__webpack_exec__(3406))); module.exports = __webpack_exports__; })();