relic 0.4.3 → 0.4.4
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/cli.js +310 -266
- package/package.json +1 -1
- package/prebuilds/win32-x64/relic_runner.dll +0 -0
package/dist/cli.js
CHANGED
|
@@ -11450,7 +11450,38 @@ var init_crypto2 = __esm(() => {
|
|
|
11450
11450
|
});
|
|
11451
11451
|
|
|
11452
11452
|
// ../../packages/auth/src/password.ts
|
|
11453
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync3 } from "fs";
|
|
11453
11454
|
import { resolve as resolve3 } from "path";
|
|
11455
|
+
function readPasswordMetadata() {
|
|
11456
|
+
try {
|
|
11457
|
+
if (!existsSync3(PASSWORD_METADATA_FILE))
|
|
11458
|
+
return null;
|
|
11459
|
+
let raw = JSON.parse(readFileSync2(PASSWORD_METADATA_FILE, "utf-8"));
|
|
11460
|
+
if (typeof raw.userId !== "string" || raw.userId.length === 0)
|
|
11461
|
+
return null;
|
|
11462
|
+
return {
|
|
11463
|
+
userId: raw.userId,
|
|
11464
|
+
email: typeof raw.email === "string" ? raw.email : void 0,
|
|
11465
|
+
savedAt: typeof raw.savedAt === "number" ? raw.savedAt : Date.now()
|
|
11466
|
+
};
|
|
11467
|
+
} catch {
|
|
11468
|
+
return null;
|
|
11469
|
+
}
|
|
11470
|
+
}
|
|
11471
|
+
function writePasswordMetadata(account) {
|
|
11472
|
+
if (!account.userId)
|
|
11473
|
+
return;
|
|
11474
|
+
writeFileSync3(PASSWORD_METADATA_FILE, JSON.stringify({
|
|
11475
|
+
userId: account.userId,
|
|
11476
|
+
email: account.email,
|
|
11477
|
+
savedAt: Date.now()
|
|
11478
|
+
}, null, 2));
|
|
11479
|
+
}
|
|
11480
|
+
function clearPasswordMetadata() {
|
|
11481
|
+
try {
|
|
11482
|
+
rmSync(PASSWORD_METADATA_FILE, { force: !0 });
|
|
11483
|
+
} catch (_5) {}
|
|
11484
|
+
}
|
|
11454
11485
|
async function ensureConfigDir2() {
|
|
11455
11486
|
let { mkdir: mkdir2, chmod: chmod2 } = await import("fs/promises");
|
|
11456
11487
|
try {
|
|
@@ -11511,15 +11542,33 @@ async function hasPassword() {
|
|
|
11511
11542
|
let password = await getPasswordFromStorage();
|
|
11512
11543
|
return password !== null && password.length > 0;
|
|
11513
11544
|
}
|
|
11514
|
-
async function
|
|
11515
|
-
await
|
|
11545
|
+
async function hasPasswordForAccount(account) {
|
|
11546
|
+
let password = await getPasswordFromStorage();
|
|
11547
|
+
if (!password)
|
|
11548
|
+
return !1;
|
|
11549
|
+
let metadata = readPasswordMetadata(), canVerifyAgainstKeys = !!account.encryptedPrivateKey && !!account.salt;
|
|
11550
|
+
if (metadata?.userId && metadata.userId !== account.userId)
|
|
11551
|
+
return !1;
|
|
11552
|
+
if (!canVerifyAgainstKeys)
|
|
11553
|
+
return metadata?.userId === account.userId;
|
|
11554
|
+
let { encryptedPrivateKey, salt } = account;
|
|
11555
|
+
if (!encryptedPrivateKey || !salt)
|
|
11556
|
+
return !1;
|
|
11557
|
+
let isValid = await verifyPasswordWithExistingKeys(password, encryptedPrivateKey, salt);
|
|
11558
|
+
if (isValid && metadata?.userId !== account.userId)
|
|
11559
|
+
await ensureConfigDir2(), writePasswordMetadata(account);
|
|
11560
|
+
return isValid;
|
|
11561
|
+
}
|
|
11562
|
+
async function savePassword(password, account) {
|
|
11563
|
+
if (await savePasswordToStorage(password), account)
|
|
11564
|
+
await ensureConfigDir2(), writePasswordMetadata(account);
|
|
11516
11565
|
}
|
|
11517
11566
|
async function verifyPassword(password) {
|
|
11518
11567
|
let stored = await getPasswordFromStorage();
|
|
11519
11568
|
return stored !== null && stored === password;
|
|
11520
11569
|
}
|
|
11521
11570
|
async function clearPassword() {
|
|
11522
|
-
await deletePasswordFromStorage();
|
|
11571
|
+
await deletePasswordFromStorage(), clearPasswordMetadata();
|
|
11523
11572
|
}
|
|
11524
11573
|
function checkPasswordRequirements(password) {
|
|
11525
11574
|
return [
|
|
@@ -11578,10 +11627,10 @@ function getConfigDir2() {
|
|
|
11578
11627
|
function getPasswordFilePath() {
|
|
11579
11628
|
return PASSWORD_FILE;
|
|
11580
11629
|
}
|
|
11581
|
-
var HOME3, CONFIG_DIR3, PASSWORD_FILE, SECRETS_SERVICE = "com.relic.tui", SECRETS_NAME = "master-password", ENV_PASSWORD_KEY = "RELIC_PASSWORD", MIN_PASSWORD_LENGTH = 8;
|
|
11630
|
+
var HOME3, CONFIG_DIR3, PASSWORD_FILE, PASSWORD_METADATA_FILE, SECRETS_SERVICE = "com.relic.tui", SECRETS_NAME = "master-password", ENV_PASSWORD_KEY = "RELIC_PASSWORD", MIN_PASSWORD_LENGTH = 8;
|
|
11582
11631
|
var init_password = __esm(() => {
|
|
11583
11632
|
init_crypto2();
|
|
11584
|
-
HOME3 = process.env.HOME || process.env.USERPROFILE || "~", CONFIG_DIR3 = process.platform === "win32" ? resolve3(HOME3, "AppData", "Roaming", "relic") : resolve3(HOME3, ".config", "relic"), PASSWORD_FILE = resolve3(CONFIG_DIR3, "password");
|
|
11633
|
+
HOME3 = process.env.HOME || process.env.USERPROFILE || "~", CONFIG_DIR3 = process.platform === "win32" ? resolve3(HOME3, "AppData", "Roaming", "relic") : resolve3(HOME3, ".config", "relic"), PASSWORD_FILE = resolve3(CONFIG_DIR3, "password"), PASSWORD_METADATA_FILE = resolve3(CONFIG_DIR3, "password-meta.json");
|
|
11585
11634
|
});
|
|
11586
11635
|
|
|
11587
11636
|
// ../../packages/auth/src/userKeyCache.ts
|
|
@@ -11663,6 +11712,7 @@ __export(exports_auth, {
|
|
|
11663
11712
|
isAuthorizationDenied: () => isAuthorizationDenied,
|
|
11664
11713
|
initializeUserKeyCacheSchema: () => initializeSchema,
|
|
11665
11714
|
hasValidSession: () => hasValidSession,
|
|
11715
|
+
hasPasswordForAccount: () => hasPasswordForAccount,
|
|
11666
11716
|
hasPassword: () => hasPassword,
|
|
11667
11717
|
getUserKeyCacheDb: () => getUserKeyCacheDb,
|
|
11668
11718
|
getStrengthColor: () => getStrengthColor,
|
|
@@ -13393,7 +13443,7 @@ import { EventEmitter as EventEmitter3 } from "events";
|
|
|
13393
13443
|
import { resolve as resolve6, dirname as dirname4 } from "path";
|
|
13394
13444
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13395
13445
|
import { resolve as resolve22, isAbsolute, parse as parse2 } from "path";
|
|
13396
|
-
import { existsSync as
|
|
13446
|
+
import { existsSync as existsSync4 } from "fs";
|
|
13397
13447
|
import { basename, join as join2 } from "path";
|
|
13398
13448
|
import os3 from "os";
|
|
13399
13449
|
import path2 from "path";
|
|
@@ -23236,7 +23286,7 @@ var init_index_h33hh1n5 = __esm(async () => {
|
|
|
23236
23286
|
worker_path = OTUI_TREE_SITTER_WORKER_PATH;
|
|
23237
23287
|
else if (this.options.workerPath)
|
|
23238
23288
|
worker_path = this.options.workerPath;
|
|
23239
|
-
else if (worker_path = new URL("./parser.worker.js", import.meta.url).href, !
|
|
23289
|
+
else if (worker_path = new URL("./parser.worker.js", import.meta.url).href, !existsSync4(resolve22(import.meta.dirname, "parser.worker.js")))
|
|
23240
23290
|
worker_path = new URL("./parser.worker.ts", import.meta.url).href;
|
|
23241
23291
|
this.worker = new Worker(worker_path), this.worker.onmessage = this.handleWorkerMessage.bind(this), this.worker.onerror = (error) => {
|
|
23242
23292
|
if (console.error("TreeSitter worker error:", error.message), this.initializeResolvers)
|
|
@@ -54532,8 +54582,8 @@ var init_constants2 = __esm(() => {
|
|
|
54532
54582
|
}, KEY_SYMBOLS = {
|
|
54533
54583
|
enter: "enter"
|
|
54534
54584
|
}, PRICING = {
|
|
54535
|
-
seatPrice: "$
|
|
54536
|
-
projectPrice: "$
|
|
54585
|
+
seatPrice: "$1",
|
|
54586
|
+
projectPrice: "$2"
|
|
54537
54587
|
}, SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"], DASHBOARD_URL = `${SITE_URL}/dashboard`;
|
|
54538
54588
|
});
|
|
54539
54589
|
|
|
@@ -55391,78 +55441,10 @@ var init_api4 = __esm(() => {
|
|
|
55391
55441
|
logger4 = createLogger2("tui");
|
|
55392
55442
|
});
|
|
55393
55443
|
|
|
55394
|
-
// ../../packages/tui/utils/mappers.ts
|
|
55395
|
-
function mapApiEnvironment(apiEnv) {
|
|
55396
|
-
return {
|
|
55397
|
-
id: apiEnv.id,
|
|
55398
|
-
name: apiEnv.name
|
|
55399
|
-
};
|
|
55400
|
-
}
|
|
55401
|
-
function mapApiFolder(apiFolder) {
|
|
55402
|
-
return {
|
|
55403
|
-
id: apiFolder.id,
|
|
55404
|
-
name: apiFolder.name,
|
|
55405
|
-
environmentId: apiFolder.environmentId
|
|
55406
|
-
};
|
|
55407
|
-
}
|
|
55408
|
-
function mapApiSecret(apiSecret) {
|
|
55409
|
-
return {
|
|
55410
|
-
id: apiSecret.id,
|
|
55411
|
-
key: apiSecret.key,
|
|
55412
|
-
value: void 0,
|
|
55413
|
-
encryptedValue: apiSecret.encryptedValue,
|
|
55414
|
-
type: apiSecret.valueType === "string" ? "string" : apiSecret.valueType === "number" ? "number" : apiSecret.valueType === "boolean" ? "boolean" : "string",
|
|
55415
|
-
scope: apiSecret.scope,
|
|
55416
|
-
folderId: apiSecret.folderId,
|
|
55417
|
-
environmentId: apiSecret.environmentId
|
|
55418
|
-
};
|
|
55419
|
-
}
|
|
55420
|
-
function getUserDisplayName(user) {
|
|
55421
|
-
return user.name || user.email.split("@")[0] || "User";
|
|
55422
|
-
}
|
|
55423
|
-
|
|
55424
|
-
// ../../packages/tui/hooks/useCurrentUser.ts
|
|
55425
|
-
function useCurrentUser() {
|
|
55426
|
-
let [user, setUser] = import_react26.useState(null), [hasKeys, setHasKeys] = import_react26.useState(!1), [isLoading, setIsLoading] = import_react26.useState(!0), [error, setError] = import_react26.useState(null), fetchUser = import_react26.useCallback(async () => {
|
|
55427
|
-
setIsLoading(!0), setError(null);
|
|
55428
|
-
try {
|
|
55429
|
-
let api2 = getProtectedApi();
|
|
55430
|
-
await api2.ensureAuth();
|
|
55431
|
-
let [currentUser, userHasKeys] = await Promise.all([
|
|
55432
|
-
api2.getCurrentUser(),
|
|
55433
|
-
api2.hasUserKeys()
|
|
55434
|
-
]);
|
|
55435
|
-
setUser(currentUser), setHasKeys(userHasKeys);
|
|
55436
|
-
} catch (err) {
|
|
55437
|
-
setError(err instanceof Error ? err : Error("Failed to fetch user"));
|
|
55438
|
-
} finally {
|
|
55439
|
-
setIsLoading(!1);
|
|
55440
|
-
}
|
|
55441
|
-
}, []);
|
|
55442
|
-
import_react26.useEffect(() => {
|
|
55443
|
-
fetchUser();
|
|
55444
|
-
}, [fetchUser]);
|
|
55445
|
-
let displayName = user ? getUserDisplayName(user) : "User";
|
|
55446
|
-
return {
|
|
55447
|
-
user,
|
|
55448
|
-
displayName,
|
|
55449
|
-
isLoading,
|
|
55450
|
-
error,
|
|
55451
|
-
refetch: fetchUser,
|
|
55452
|
-
hasKeys,
|
|
55453
|
-
hasPro: user?.hasPro ?? !1
|
|
55454
|
-
};
|
|
55455
|
-
}
|
|
55456
|
-
var import_react26;
|
|
55457
|
-
var init_useCurrentUser = __esm(() => {
|
|
55458
|
-
init_api4();
|
|
55459
|
-
import_react26 = __toESM(require_react_development(), 1);
|
|
55460
|
-
});
|
|
55461
|
-
|
|
55462
55444
|
// ../../packages/tui/hooks/useCursorBlink.ts
|
|
55463
55445
|
function useCursorBlink(shouldBlink) {
|
|
55464
|
-
let [cursorVisible, setCursorVisible] =
|
|
55465
|
-
return
|
|
55446
|
+
let [cursorVisible, setCursorVisible] = import_react26.useState(!0);
|
|
55447
|
+
return import_react26.useEffect(() => {
|
|
55466
55448
|
if (!shouldBlink) {
|
|
55467
55449
|
setCursorVisible(!0);
|
|
55468
55450
|
return;
|
|
@@ -55473,9 +55455,9 @@ function useCursorBlink(shouldBlink) {
|
|
|
55473
55455
|
return () => clearInterval(interval);
|
|
55474
55456
|
}, [shouldBlink]), cursorVisible;
|
|
55475
55457
|
}
|
|
55476
|
-
var
|
|
55458
|
+
var import_react26;
|
|
55477
55459
|
var init_useCursorBlink = __esm(() => {
|
|
55478
|
-
|
|
55460
|
+
import_react26 = __toESM(require_react_development(), 1);
|
|
55479
55461
|
});
|
|
55480
55462
|
|
|
55481
55463
|
// ../../packages/tui/hooks/useInput.ts
|
|
@@ -55507,14 +55489,14 @@ function wordBoundaryAfter(str, pos) {
|
|
|
55507
55489
|
return p2;
|
|
55508
55490
|
}
|
|
55509
55491
|
function useSingleLineInput(options = {}) {
|
|
55510
|
-
let { initialValue = "", maxLength = 1000, onSubmit } = options, [value, setValue] =
|
|
55492
|
+
let { initialValue = "", maxLength = 1000, onSubmit } = options, [value, setValue] = import_react27.useState(initialValue), [cursor, setCursor] = import_react27.useState(0), stateRef = import_react27.useRef({ value, cursor });
|
|
55511
55493
|
stateRef.current = { value, cursor };
|
|
55512
|
-
let reset =
|
|
55494
|
+
let reset = import_react27.useCallback(() => {
|
|
55513
55495
|
setValue(initialValue), setCursor(0);
|
|
55514
|
-
}, [initialValue]), handlePaste =
|
|
55496
|
+
}, [initialValue]), handlePaste = import_react27.useCallback((text) => {
|
|
55515
55497
|
let current = stateRef.current, result = insertAt(current.value, current.cursor, text, maxLength);
|
|
55516
55498
|
setValue(result.value), setCursor(result.cursor), stateRef.current = result;
|
|
55517
|
-
}, [maxLength]), handleKey =
|
|
55499
|
+
}, [maxLength]), handleKey = import_react27.useCallback((key) => {
|
|
55518
55500
|
if (key.name === "return" && onSubmit)
|
|
55519
55501
|
return onSubmit(value), !0;
|
|
55520
55502
|
if (key.name === "escape")
|
|
@@ -55582,12 +55564,12 @@ function indexToPosition(value, index) {
|
|
|
55582
55564
|
return { line: lines.length - 1, column: lines[lines.length - 1]?.length ?? 0 };
|
|
55583
55565
|
}
|
|
55584
55566
|
function useMultiLineInput(options = {}) {
|
|
55585
|
-
let { initialValue = "", maxLines = 100 } = options, [value, setValue] =
|
|
55567
|
+
let { initialValue = "", maxLines = 100 } = options, [value, setValue] = import_react27.useState(initialValue), [cursor, setCursor] = import_react27.useState({ line: 0, column: 0 }), stateRef = import_react27.useRef({ value, cursor });
|
|
55586
55568
|
stateRef.current = { value, cursor };
|
|
55587
55569
|
let lines = value.split(`
|
|
55588
|
-
`), reset =
|
|
55570
|
+
`), reset = import_react27.useCallback(() => {
|
|
55589
55571
|
setValue(initialValue), setCursor({ line: 0, column: 0 });
|
|
55590
|
-
}, [initialValue]), handlePaste =
|
|
55572
|
+
}, [initialValue]), handlePaste = import_react27.useCallback((text) => {
|
|
55591
55573
|
let current = stateRef.current, currentLines = current.value.split(`
|
|
55592
55574
|
`), index = linesToPosition(currentLines, current.cursor), newValue = current.value.slice(0, index) + text + current.value.slice(index);
|
|
55593
55575
|
if (newValue.split(`
|
|
@@ -55596,7 +55578,7 @@ function useMultiLineInput(options = {}) {
|
|
|
55596
55578
|
setValue(newValue);
|
|
55597
55579
|
let newCursor = indexToPosition(newValue, index + text.length);
|
|
55598
55580
|
setCursor(newCursor), stateRef.current = { value: newValue, cursor: newCursor };
|
|
55599
|
-
}, [maxLines]), handleKey =
|
|
55581
|
+
}, [maxLines]), handleKey = import_react27.useCallback((key) => {
|
|
55600
55582
|
let currentLine = lines[cursor.line] || "";
|
|
55601
55583
|
if (key.name === "a" && key.ctrl)
|
|
55602
55584
|
return setCursor({ ...cursor, column: 0 }), !0;
|
|
@@ -55687,15 +55669,15 @@ ${value.slice(index)}`), setCursor({ line: cursor.line + 1, column: 0 }), !0;
|
|
|
55687
55669
|
}, [value, cursor, lines, maxLines]);
|
|
55688
55670
|
return { value, lines, cursor, setValue, setCursor, reset, handleKey, handlePaste };
|
|
55689
55671
|
}
|
|
55690
|
-
var
|
|
55672
|
+
var import_react27;
|
|
55691
55673
|
var init_useInput = __esm(() => {
|
|
55692
|
-
|
|
55674
|
+
import_react27 = __toESM(require_react_development(), 1);
|
|
55693
55675
|
});
|
|
55694
55676
|
|
|
55695
55677
|
// ../../packages/tui/hooks/usePaste.ts
|
|
55696
55678
|
function usePaste(callback) {
|
|
55697
|
-
let callbackRef =
|
|
55698
|
-
callbackRef.current = callback,
|
|
55679
|
+
let callbackRef = import_react28.useRef(callback);
|
|
55680
|
+
callbackRef.current = callback, import_react28.useEffect(() => {
|
|
55699
55681
|
let stdin2 = process.stdin, pasteBuffer = "", isPasting = !1, handleData = (data) => {
|
|
55700
55682
|
if (data.includes("\x1B[200~"))
|
|
55701
55683
|
isPasting = !0, data = data.replace(/\x1b\[200~/g, "");
|
|
@@ -55723,9 +55705,9 @@ function usePaste(callback) {
|
|
|
55723
55705
|
};
|
|
55724
55706
|
}, []);
|
|
55725
55707
|
}
|
|
55726
|
-
var
|
|
55708
|
+
var import_react28;
|
|
55727
55709
|
var init_usePaste = __esm(() => {
|
|
55728
|
-
|
|
55710
|
+
import_react28 = __toESM(require_react_development(), 1);
|
|
55729
55711
|
});
|
|
55730
55712
|
|
|
55731
55713
|
// ../../packages/tui/components/forms/InlineInput.tsx
|
|
@@ -55749,11 +55731,11 @@ function InlineInput({
|
|
|
55749
55731
|
onSubmit,
|
|
55750
55732
|
onCancel
|
|
55751
55733
|
}) {
|
|
55752
|
-
let input = useSingleLineInput({ maxLength, initialValue, onSubmit }), cursorVisible = useCursorBlink(active), submittedRef =
|
|
55753
|
-
|
|
55734
|
+
let input = useSingleLineInput({ maxLength, initialValue, onSubmit }), cursorVisible = useCursorBlink(active), submittedRef = import_react30.useRef(!1);
|
|
55735
|
+
import_react30.useEffect(() => {
|
|
55754
55736
|
if (active)
|
|
55755
55737
|
submittedRef.current = !1;
|
|
55756
|
-
}, [active]),
|
|
55738
|
+
}, [active]), import_react30.useEffect(() => {
|
|
55757
55739
|
onChange?.(input.value);
|
|
55758
55740
|
}, [input.value, onChange]), usePaste((text) => {
|
|
55759
55741
|
if (!active)
|
|
@@ -55865,7 +55847,7 @@ function InlineInput({
|
|
|
55865
55847
|
]
|
|
55866
55848
|
}, void 0, !0, void 0, this);
|
|
55867
55849
|
}
|
|
55868
|
-
var
|
|
55850
|
+
var import_react30;
|
|
55869
55851
|
var init_InlineInput = __esm(async () => {
|
|
55870
55852
|
init_useCursorBlink();
|
|
55871
55853
|
init_useInput();
|
|
@@ -55873,7 +55855,7 @@ var init_InlineInput = __esm(async () => {
|
|
|
55873
55855
|
init_constants2();
|
|
55874
55856
|
init_jsx_dev_runtime();
|
|
55875
55857
|
await init_react();
|
|
55876
|
-
|
|
55858
|
+
import_react30 = __toESM(require_react_development(), 1);
|
|
55877
55859
|
});
|
|
55878
55860
|
|
|
55879
55861
|
// ../../packages/tui/components/modals/CommandPaletteModal.tsx
|
|
@@ -55895,7 +55877,7 @@ function CommandPaletteModal(props) {
|
|
|
55895
55877
|
}, void 0, !1, void 0, this);
|
|
55896
55878
|
}
|
|
55897
55879
|
function SmartCommandPaletteModal({ commands, onClose, onExecute }) {
|
|
55898
|
-
let [selectedIndex, setSelectedIndex] =
|
|
55880
|
+
let [selectedIndex, setSelectedIndex] = import_react32.useState(0), findNextIndex = (current, direction) => {
|
|
55899
55881
|
let next = current, attempts = commands.length;
|
|
55900
55882
|
do
|
|
55901
55883
|
next = direction === 1 ? (next + 1) % commands.length : (next - 1 + commands.length) % commands.length, attempts--;
|
|
@@ -56068,12 +56050,12 @@ function CommandPaletteDisplay({
|
|
|
56068
56050
|
]
|
|
56069
56051
|
}, void 0, !0, void 0, this);
|
|
56070
56052
|
}
|
|
56071
|
-
var
|
|
56053
|
+
var import_react32;
|
|
56072
56054
|
var init_CommandPaletteModal = __esm(async () => {
|
|
56073
56055
|
init_constants2();
|
|
56074
56056
|
init_jsx_dev_runtime();
|
|
56075
56057
|
await init_react();
|
|
56076
|
-
|
|
56058
|
+
import_react32 = __toESM(require_react_development(), 1);
|
|
56077
56059
|
});
|
|
56078
56060
|
|
|
56079
56061
|
// ../../packages/tui/components/shared/Modal.tsx
|
|
@@ -56312,15 +56294,15 @@ function UrlOpenModal({
|
|
|
56312
56294
|
hint,
|
|
56313
56295
|
autoOpenDelay = 1500
|
|
56314
56296
|
}) {
|
|
56315
|
-
let { isRunning } = useTaskQueue(), [status, setStatus] =
|
|
56316
|
-
if (
|
|
56297
|
+
let { isRunning } = useTaskQueue(), [status, setStatus] = import_react36.useState("pending");
|
|
56298
|
+
if (import_react36.useEffect(() => {
|
|
56317
56299
|
if (visible && url && status === "pending") {
|
|
56318
56300
|
let timer = setTimeout(() => {
|
|
56319
56301
|
setStatus("opening"), open_default(url).then(() => setStatus("opened"));
|
|
56320
56302
|
}, autoOpenDelay);
|
|
56321
56303
|
return () => clearTimeout(timer);
|
|
56322
56304
|
}
|
|
56323
|
-
}, [visible, url, status, autoOpenDelay]),
|
|
56305
|
+
}, [visible, url, status, autoOpenDelay]), import_react36.useEffect(() => {
|
|
56324
56306
|
if (!visible)
|
|
56325
56307
|
setStatus("pending");
|
|
56326
56308
|
}, [visible]), useKeyboard((key) => {
|
|
@@ -56399,7 +56381,7 @@ function BillingPortalModal({
|
|
|
56399
56381
|
onClose
|
|
56400
56382
|
}, void 0, !1, void 0, this);
|
|
56401
56383
|
}
|
|
56402
|
-
var
|
|
56384
|
+
var import_react36, STATUS_MESSAGES, STATUS_COLORS2, CHECKOUT_TITLES;
|
|
56403
56385
|
var init_UrlOpenModal = __esm(async () => {
|
|
56404
56386
|
init_open();
|
|
56405
56387
|
init_useTaskQueue();
|
|
@@ -56409,7 +56391,7 @@ var init_UrlOpenModal = __esm(async () => {
|
|
|
56409
56391
|
init_react(),
|
|
56410
56392
|
init_Modal()
|
|
56411
56393
|
]);
|
|
56412
|
-
|
|
56394
|
+
import_react36 = __toESM(require_react_development(), 1), STATUS_MESSAGES = {
|
|
56413
56395
|
pending: {
|
|
56414
56396
|
checkout: "Preparing checkout...",
|
|
56415
56397
|
billing: "Preparing billing portal...",
|
|
@@ -56581,7 +56563,7 @@ function PasswordInput({
|
|
|
56581
56563
|
error = null,
|
|
56582
56564
|
additionalShortcuts = []
|
|
56583
56565
|
}) {
|
|
56584
|
-
let [focusedField, setFocusedField] =
|
|
56566
|
+
let [focusedField, setFocusedField] = import_react38.useState(mode === "change" ? "current" : "password"), [showPassword, setShowPassword] = import_react38.useState(!1), [currentValue, setCurrentValue] = import_react38.useState(""), [passwordValue, setPasswordValue] = import_react38.useState(""), [confirmValue, setConfirmValue] = import_react38.useState(""), requirements = checkPasswordRequirements(passwordValue), validation = validatePassword(passwordValue), passwordsMatch = confirmValue.length > 0 && confirmValue === passwordValue, showStrength = mode !== "verify" && focusedField === "password", cycleFocus = (direction) => {
|
|
56585
56567
|
let fields = mode === "change" ? ["current", "password", "confirm"] : mode === "verify" ? ["password"] : ["password", "confirm"], currentIndex = fields.indexOf(focusedField), nextIndex = direction === "next" ? (currentIndex + 1) % fields.length : (currentIndex - 1 + fields.length) % fields.length;
|
|
56586
56568
|
setFocusedField(fields[nextIndex] ?? "password");
|
|
56587
56569
|
}, handleSubmit = () => {
|
|
@@ -56749,7 +56731,7 @@ function PasswordInput({
|
|
|
56749
56731
|
]
|
|
56750
56732
|
}, void 0, !0, void 0, this);
|
|
56751
56733
|
}
|
|
56752
|
-
var
|
|
56734
|
+
var import_react38;
|
|
56753
56735
|
var init_PasswordInput = __esm(async () => {
|
|
56754
56736
|
init_auth();
|
|
56755
56737
|
init_constants2();
|
|
@@ -56759,7 +56741,7 @@ var init_PasswordInput = __esm(async () => {
|
|
|
56759
56741
|
init_react(),
|
|
56760
56742
|
init_InlineInput()
|
|
56761
56743
|
]);
|
|
56762
|
-
|
|
56744
|
+
import_react38 = __toESM(require_react_development(), 1);
|
|
56763
56745
|
});
|
|
56764
56746
|
|
|
56765
56747
|
// ../../packages/tui/components/shared/DeleteConfirmation.tsx
|
|
@@ -56819,13 +56801,13 @@ var init_DeleteConfirmation = __esm(() => {
|
|
|
56819
56801
|
|
|
56820
56802
|
// ../../packages/tui/convex/hooks/useUserKeys.ts
|
|
56821
56803
|
function useUserKeys(options) {
|
|
56822
|
-
let [publicKey, setPublicKey] =
|
|
56823
|
-
|
|
56804
|
+
let [publicKey, setPublicKey] = import_react39.useState(null), [encryptedPrivateKey, setEncryptedPrivateKey] = import_react39.useState(null), [salt, setSalt] = import_react39.useState(null), [isLoading, setIsLoading] = import_react39.useState(!0), [isStoring, setIsStoring] = import_react39.useState(!1), [isUpdating, setIsUpdating] = import_react39.useState(!1), [isRotating, setIsRotating] = import_react39.useState(!1), [error, setError] = import_react39.useState(null), onErrorRef = import_react39.useRef(options?.onError);
|
|
56805
|
+
import_react39.useEffect(() => {
|
|
56824
56806
|
onErrorRef.current = options?.onError;
|
|
56825
56807
|
}, [options?.onError]);
|
|
56826
|
-
let clearError =
|
|
56808
|
+
let clearError = import_react39.useCallback(() => {
|
|
56827
56809
|
setError(null);
|
|
56828
|
-
}, []), fetchUserKeys =
|
|
56810
|
+
}, []), fetchUserKeys = import_react39.useCallback(async () => {
|
|
56829
56811
|
setIsLoading(!0), setError(null);
|
|
56830
56812
|
try {
|
|
56831
56813
|
let api2 = getProtectedApi();
|
|
@@ -56846,7 +56828,7 @@ function useUserKeys(options) {
|
|
|
56846
56828
|
} finally {
|
|
56847
56829
|
setIsLoading(!1);
|
|
56848
56830
|
}
|
|
56849
|
-
}, []), checkHasKeys =
|
|
56831
|
+
}, []), checkHasKeys = import_react39.useCallback(async () => {
|
|
56850
56832
|
try {
|
|
56851
56833
|
let api2 = getProtectedApi();
|
|
56852
56834
|
return await api2.ensureAuth(), await api2.hasUserKeys();
|
|
@@ -56855,7 +56837,7 @@ function useUserKeys(options) {
|
|
|
56855
56837
|
let error2 = err instanceof Error ? err : Error("Failed to check if user has keys");
|
|
56856
56838
|
return setError(error2), onErrorRef.current?.(error2), !1;
|
|
56857
56839
|
}
|
|
56858
|
-
}, []), storeUserKeys =
|
|
56840
|
+
}, []), storeUserKeys = import_react39.useCallback(async (args) => {
|
|
56859
56841
|
setIsStoring(!0), setError(null);
|
|
56860
56842
|
try {
|
|
56861
56843
|
let api2 = getProtectedApi();
|
|
@@ -56873,7 +56855,7 @@ function useUserKeys(options) {
|
|
|
56873
56855
|
} finally {
|
|
56874
56856
|
setIsStoring(!1);
|
|
56875
56857
|
}
|
|
56876
|
-
}, []), updatePassword =
|
|
56858
|
+
}, []), updatePassword = import_react39.useCallback(async (args) => {
|
|
56877
56859
|
setIsUpdating(!0), setError(null);
|
|
56878
56860
|
try {
|
|
56879
56861
|
let api2 = getProtectedApi();
|
|
@@ -56891,7 +56873,7 @@ function useUserKeys(options) {
|
|
|
56891
56873
|
} finally {
|
|
56892
56874
|
setIsUpdating(!1);
|
|
56893
56875
|
}
|
|
56894
|
-
}, []), rotateUserKeys =
|
|
56876
|
+
}, []), rotateUserKeys = import_react39.useCallback(async (args) => {
|
|
56895
56877
|
setIsRotating(!0), setError(null);
|
|
56896
56878
|
try {
|
|
56897
56879
|
let api2 = getProtectedApi();
|
|
@@ -56916,7 +56898,7 @@ function useUserKeys(options) {
|
|
|
56916
56898
|
setIsRotating(!1);
|
|
56917
56899
|
}
|
|
56918
56900
|
}, []);
|
|
56919
|
-
return
|
|
56901
|
+
return import_react39.useEffect(() => {
|
|
56920
56902
|
fetchUserKeys();
|
|
56921
56903
|
}, [fetchUserKeys]), {
|
|
56922
56904
|
publicKey,
|
|
@@ -56936,12 +56918,12 @@ function useUserKeys(options) {
|
|
|
56936
56918
|
clearError
|
|
56937
56919
|
};
|
|
56938
56920
|
}
|
|
56939
|
-
var
|
|
56921
|
+
var import_react39, logger5;
|
|
56940
56922
|
var init_useUserKeys = __esm(() => {
|
|
56941
56923
|
init_auth();
|
|
56942
56924
|
init_logger2();
|
|
56943
56925
|
init_api4();
|
|
56944
|
-
|
|
56926
|
+
import_react39 = __toESM(require_react_development(), 1), logger5 = createLogger2("tui");
|
|
56945
56927
|
});
|
|
56946
56928
|
|
|
56947
56929
|
// ../../packages/tui/hooks/useListNavigation.ts
|
|
@@ -56950,14 +56932,14 @@ function useListNavigation({
|
|
|
56950
56932
|
pageSize = 10,
|
|
56951
56933
|
onSelect
|
|
56952
56934
|
}) {
|
|
56953
|
-
let [selectedIndex, setSelectedIndex] =
|
|
56954
|
-
|
|
56935
|
+
let [selectedIndex, setSelectedIndex] = import_react40.useState(0), [scrollOffset, setScrollOffset] = import_react40.useState(0), onSelectRef = import_react40.useRef(onSelect);
|
|
56936
|
+
import_react40.useEffect(() => {
|
|
56955
56937
|
onSelectRef.current = onSelect;
|
|
56956
|
-
}, [onSelect]),
|
|
56938
|
+
}, [onSelect]), import_react40.useEffect(() => {
|
|
56957
56939
|
if (items.length > 0 && selectedIndex >= items.length)
|
|
56958
56940
|
setSelectedIndex(0);
|
|
56959
56941
|
}, [items.length, selectedIndex]);
|
|
56960
|
-
let moveUp =
|
|
56942
|
+
let moveUp = import_react40.useCallback(() => {
|
|
56961
56943
|
if (items.length === 0)
|
|
56962
56944
|
return;
|
|
56963
56945
|
setSelectedIndex((prev) => {
|
|
@@ -56970,7 +56952,7 @@ function useListNavigation({
|
|
|
56970
56952
|
return currentOffset;
|
|
56971
56953
|
}), next;
|
|
56972
56954
|
});
|
|
56973
|
-
}, [items.length, pageSize]), moveDown =
|
|
56955
|
+
}, [items.length, pageSize]), moveDown = import_react40.useCallback(() => {
|
|
56974
56956
|
if (items.length === 0)
|
|
56975
56957
|
return;
|
|
56976
56958
|
setSelectedIndex((prev) => {
|
|
@@ -56983,10 +56965,10 @@ function useListNavigation({
|
|
|
56983
56965
|
return currentOffset;
|
|
56984
56966
|
}), next;
|
|
56985
56967
|
});
|
|
56986
|
-
}, [items.length, pageSize]), select =
|
|
56968
|
+
}, [items.length, pageSize]), select = import_react40.useCallback(() => {
|
|
56987
56969
|
if (items.length > 0 && onSelectRef.current)
|
|
56988
56970
|
onSelectRef.current(selectedIndex);
|
|
56989
|
-
}, [selectedIndex, items.length]), reset =
|
|
56971
|
+
}, [selectedIndex, items.length]), reset = import_react40.useCallback(() => {
|
|
56990
56972
|
setSelectedIndex(0), setScrollOffset(0);
|
|
56991
56973
|
}, []);
|
|
56992
56974
|
return {
|
|
@@ -57005,18 +56987,18 @@ function useListNavigation({
|
|
|
57005
56987
|
}
|
|
57006
56988
|
};
|
|
57007
56989
|
}
|
|
57008
|
-
var
|
|
56990
|
+
var import_react40;
|
|
57009
56991
|
var init_useListNavigation = __esm(() => {
|
|
57010
|
-
|
|
56992
|
+
import_react40 = __toESM(require_react_development(), 1);
|
|
57011
56993
|
});
|
|
57012
56994
|
|
|
57013
56995
|
// ../../packages/tui/hooks/useLoadingState.ts
|
|
57014
56996
|
function useLoadingState(flags = []) {
|
|
57015
|
-
let [loading, setLoading] =
|
|
56997
|
+
let [loading, setLoading] = import_react41.useState(() => Object.fromEntries(flags.map((flag) => [flag, !1]))), start = import_react41.useCallback((flag) => {
|
|
57016
56998
|
setLoading((prev) => ({ ...prev, [flag]: !0 }));
|
|
57017
|
-
}, []), stop =
|
|
56999
|
+
}, []), stop = import_react41.useCallback((flag) => {
|
|
57018
57000
|
setLoading((prev) => ({ ...prev, [flag]: !1 }));
|
|
57019
|
-
}, []), run2 =
|
|
57001
|
+
}, []), run2 = import_react41.useCallback(async (flag, fn) => {
|
|
57020
57002
|
if (loading[flag])
|
|
57021
57003
|
return;
|
|
57022
57004
|
start(flag);
|
|
@@ -57025,7 +57007,7 @@ function useLoadingState(flags = []) {
|
|
|
57025
57007
|
} finally {
|
|
57026
57008
|
stop(flag);
|
|
57027
57009
|
}
|
|
57028
|
-
}, [loading, start, stop]), isLoading =
|
|
57010
|
+
}, [loading, start, stop]), isLoading = import_react41.useCallback((flag) => loading[flag] || !1, [loading]), anyLoading = import_react41.useCallback(() => Object.values(loading).some(Boolean), [loading]);
|
|
57029
57011
|
return {
|
|
57030
57012
|
isLoading,
|
|
57031
57013
|
anyLoading,
|
|
@@ -57035,16 +57017,16 @@ function useLoadingState(flags = []) {
|
|
|
57035
57017
|
flags: loading
|
|
57036
57018
|
};
|
|
57037
57019
|
}
|
|
57038
|
-
var
|
|
57020
|
+
var import_react41;
|
|
57039
57021
|
var init_useLoadingState = __esm(() => {
|
|
57040
|
-
|
|
57022
|
+
import_react41 = __toESM(require_react_development(), 1);
|
|
57041
57023
|
});
|
|
57042
57024
|
|
|
57043
57025
|
// ../../packages/tui/hooks/usePaymentFlow.ts
|
|
57044
57026
|
function usePaymentFlow(options = {}) {
|
|
57045
|
-
let { cancelTask, showSuccess, showError } = useTaskQueue(), [confirmationModal, setConfirmationModal] =
|
|
57027
|
+
let { cancelTask, showSuccess, showError } = useTaskQueue(), [confirmationModal, setConfirmationModal] = import_react42.useState({ visible: !1, type: "project", balance: 0 }), [checkoutModal, setCheckoutModal] = import_react42.useState({ visible: !1, url: "", reason: "pro_required" }), [billingPortalModal, setBillingPortalModal] = import_react42.useState({ visible: !1, url: "" }), [removalModal, setRemovalModal] = import_react42.useState({ visible: !1, currentUsage: 0, includedUsage: 0, excessCount: 0 }), closeAll = import_react42.useCallback(() => {
|
|
57046
57028
|
setConfirmationModal({ visible: !1, type: "project", balance: 0 }), setCheckoutModal({ visible: !1, url: "", reason: "pro_required" }), setBillingPortalModal({ visible: !1, url: "" }), setRemovalModal({ visible: !1, currentUsage: 0, includedUsage: 0, excessCount: 0 });
|
|
57047
|
-
}, []), handleResult =
|
|
57029
|
+
}, []), handleResult = import_react42.useCallback((result, type, itemName) => {
|
|
57048
57030
|
let normalized = "status" in result ? result.status === "success" ? {
|
|
57049
57031
|
success: !0,
|
|
57050
57032
|
message: result.message
|
|
@@ -57127,15 +57109,15 @@ function usePaymentFlow(options = {}) {
|
|
|
57127
57109
|
closeAll
|
|
57128
57110
|
};
|
|
57129
57111
|
}
|
|
57130
|
-
var
|
|
57112
|
+
var import_react42;
|
|
57131
57113
|
var init_usePaymentFlow = __esm(() => {
|
|
57132
57114
|
init_useTaskQueue();
|
|
57133
|
-
|
|
57115
|
+
import_react42 = __toESM(require_react_development(), 1);
|
|
57134
57116
|
});
|
|
57135
57117
|
|
|
57136
57118
|
// ../../packages/tui/hooks/useProjects.ts
|
|
57137
57119
|
function useProjects() {
|
|
57138
|
-
let ownedProjectsData = useQuery(api.project.listUserProjects), sharedProjectsData = useQuery(api.projectShare.listActiveSharedProjectsForCurrentUser), [limits, setLimits] =
|
|
57120
|
+
let ownedProjectsData = useQuery(api.project.listUserProjects), sharedProjectsData = useQuery(api.projectShare.listActiveSharedProjectsForCurrentUser), [limits, setLimits] = import_react44.useState(null), [limitsLoading, setLimitsLoading] = import_react44.useState(!0), [limitsError, setLimitsError] = import_react44.useState(null), fetchLimits = import_react44.useCallback(async () => {
|
|
57139
57121
|
setLimitsLoading(!0), setLimitsError(null);
|
|
57140
57122
|
try {
|
|
57141
57123
|
let apiClient = getProtectedApi();
|
|
@@ -57148,10 +57130,10 @@ function useProjects() {
|
|
|
57148
57130
|
setLimitsLoading(!1);
|
|
57149
57131
|
}
|
|
57150
57132
|
}, []);
|
|
57151
|
-
|
|
57133
|
+
import_react44.useEffect(() => {
|
|
57152
57134
|
fetchLimits();
|
|
57153
57135
|
}, [fetchLimits]);
|
|
57154
|
-
let { archivedCount, projects: projects2 } =
|
|
57136
|
+
let { archivedCount, projects: projects2 } = import_react44.useMemo(() => {
|
|
57155
57137
|
let projectMap = /* @__PURE__ */ new Map;
|
|
57156
57138
|
if (ownedProjectsData?.projects)
|
|
57157
57139
|
for (let p2 of ownedProjectsData.projects)
|
|
@@ -57174,7 +57156,7 @@ function useProjects() {
|
|
|
57174
57156
|
return diff !== 0 ? diff : a2.name.localeCompare(b4.name);
|
|
57175
57157
|
});
|
|
57176
57158
|
return { archivedCount: archivedCount2, projects: sorted };
|
|
57177
|
-
}, [ownedProjectsData, sharedProjectsData]), isLoading = ownedProjectsData === void 0 || sharedProjectsData === void 0 || limitsLoading, createProject =
|
|
57159
|
+
}, [ownedProjectsData, sharedProjectsData]), isLoading = ownedProjectsData === void 0 || sharedProjectsData === void 0 || limitsLoading, createProject = import_react44.useCallback(async (name, encryptedProjectKey, confirmPayment) => {
|
|
57178
57160
|
try {
|
|
57179
57161
|
let apiClient = getProtectedApi();
|
|
57180
57162
|
await apiClient.ensureAuth();
|
|
@@ -57185,10 +57167,10 @@ function useProjects() {
|
|
|
57185
57167
|
} catch (err) {
|
|
57186
57168
|
throw err instanceof Error ? err : Error("Failed to create project");
|
|
57187
57169
|
}
|
|
57188
|
-
}, [fetchLimits]), renameProject =
|
|
57170
|
+
}, [fetchLimits]), renameProject = import_react44.useCallback(async (projectId, name) => {
|
|
57189
57171
|
let apiClient = getProtectedApi();
|
|
57190
57172
|
await apiClient.ensureAuth(), await apiClient.updateProject({ projectId, name });
|
|
57191
|
-
}, []), archiveProject =
|
|
57173
|
+
}, []), archiveProject = import_react44.useCallback(async (projectId) => {
|
|
57192
57174
|
let apiClient = getProtectedApi();
|
|
57193
57175
|
await apiClient.ensureAuth(), await apiClient.archiveProject(projectId), fetchLimits();
|
|
57194
57176
|
}, [fetchLimits]);
|
|
@@ -57204,18 +57186,18 @@ function useProjects() {
|
|
|
57204
57186
|
archiveProject
|
|
57205
57187
|
};
|
|
57206
57188
|
}
|
|
57207
|
-
var
|
|
57189
|
+
var import_react44, logger6;
|
|
57208
57190
|
var init_useProjects = __esm(() => {
|
|
57209
57191
|
init_backend();
|
|
57210
57192
|
init_logger2();
|
|
57211
57193
|
init_react2();
|
|
57212
57194
|
init_api4();
|
|
57213
|
-
|
|
57195
|
+
import_react44 = __toESM(require_react_development(), 1), logger6 = createLogger2("tui");
|
|
57214
57196
|
});
|
|
57215
57197
|
|
|
57216
57198
|
// ../../packages/tui/router.tsx
|
|
57217
57199
|
function useRouter() {
|
|
57218
|
-
let context =
|
|
57200
|
+
let context = import_react45.useContext(RouterContext);
|
|
57219
57201
|
if (!context)
|
|
57220
57202
|
throw Error("useRouter must be used within RouterProvider");
|
|
57221
57203
|
return context;
|
|
@@ -57224,7 +57206,7 @@ function RouterProvider({
|
|
|
57224
57206
|
children,
|
|
57225
57207
|
initialRoute = { name: "login" }
|
|
57226
57208
|
}) {
|
|
57227
|
-
let [route, setRoute] =
|
|
57209
|
+
let [route, setRoute] = import_react45.useState(initialRoute), [history, setHistory] = import_react45.useState([]), navigate = (newRoute) => {
|
|
57228
57210
|
setHistory((prev) => [...prev, route]), setRoute(newRoute);
|
|
57229
57211
|
}, goBack = () => {
|
|
57230
57212
|
let prev = history[history.length - 1];
|
|
@@ -57236,18 +57218,18 @@ function RouterProvider({
|
|
|
57236
57218
|
children
|
|
57237
57219
|
}, void 0, !1, void 0, this);
|
|
57238
57220
|
}
|
|
57239
|
-
var
|
|
57221
|
+
var import_react45, RouterContext;
|
|
57240
57222
|
var init_router = __esm(() => {
|
|
57241
57223
|
init_jsx_dev_runtime();
|
|
57242
|
-
|
|
57224
|
+
import_react45 = __toESM(require_react_development(), 1), RouterContext = import_react45.createContext(null);
|
|
57243
57225
|
});
|
|
57244
57226
|
|
|
57245
57227
|
// ../../packages/tui/pages/HomePage.tsx
|
|
57246
57228
|
function HomePage() {
|
|
57247
|
-
|
|
57229
|
+
import_react47.useEffect(() => {
|
|
57248
57230
|
trackEvent("tui_page_viewed", { page: "home" });
|
|
57249
57231
|
}, []);
|
|
57250
|
-
let { width, height } = useTerminalDimensions(), { navigate } = useRouter(), { logout: logout2 } = useAppSession(), { runTask, continueTask, cancelTask, showSuccess, showError, isProcessing } = useTaskQueue(), { hasPro, isLoading: isLoadingPlan } = useUser(), {
|
|
57232
|
+
let { width, height } = useTerminalDimensions(), { navigate } = useRouter(), { logout: logout2 } = useAppSession(), { runTask, continueTask, cancelTask, showSuccess, showError, isProcessing } = useTaskQueue(), { user, hasPro, isLoading: isLoadingPlan } = useUser(), {
|
|
57251
57233
|
archivedCount,
|
|
57252
57234
|
projects: projects2,
|
|
57253
57235
|
isLoading: isLoadingProjects,
|
|
@@ -57261,7 +57243,9 @@ function HomePage() {
|
|
|
57261
57243
|
encryptedPrivateKey,
|
|
57262
57244
|
salt,
|
|
57263
57245
|
updatePassword
|
|
57264
|
-
} = useUserKeys(),
|
|
57246
|
+
} = useUserKeys(), showSetupRequiredError = import_react47.useCallback(() => {
|
|
57247
|
+
showError(hasKeys ? "Unlock your master password to continue." : "Create a master password first to generate your encryption keys.");
|
|
57248
|
+
}, [hasKeys, showError]), navigation = useListNavigation({
|
|
57265
57249
|
items: projects2,
|
|
57266
57250
|
pageSize: PAGE_SIZE,
|
|
57267
57251
|
onSelect: (index) => {
|
|
@@ -57274,16 +57258,16 @@ function HomePage() {
|
|
|
57274
57258
|
projectStatus: project.status
|
|
57275
57259
|
});
|
|
57276
57260
|
}
|
|
57277
|
-
}), payment = usePaymentFlow(), loading = useLoadingState(["creating", "renaming", "archiving"]), [showProSuccess, setShowProSuccess] =
|
|
57278
|
-
|
|
57261
|
+
}), payment = usePaymentFlow(), loading = useLoadingState(["creating", "renaming", "archiving"]), [showProSuccess, setShowProSuccess] = import_react47.useState(!1), prevHasProRef = import_react47.useRef(null);
|
|
57262
|
+
import_react47.useEffect(() => {
|
|
57279
57263
|
if (isLoadingPlan)
|
|
57280
57264
|
return;
|
|
57281
57265
|
if (prevHasProRef.current !== null && hasPro && !prevHasProRef.current)
|
|
57282
57266
|
payment.closeAll(), refetchProjects(), setShowProSuccess(!0);
|
|
57283
57267
|
prevHasProRef.current = hasPro;
|
|
57284
57268
|
}, [hasPro, isLoadingPlan, payment, refetchProjects]);
|
|
57285
|
-
let [activeModal, setActiveModal] =
|
|
57286
|
-
|
|
57269
|
+
let [activeModal, setActiveModal] = import_react47.useState("none"), [creatingProject, setCreatingProject] = import_react47.useState(!1), [pendingProjectName, setPendingProjectName] = import_react47.useState(null), [spinnerFrame, setSpinnerFrame] = import_react47.useState(0), [editingProject, setEditingProject] = import_react47.useState(null), [confirmingDelete, setConfirmingDelete] = import_react47.useState(null), [removalSelectedIndex, setRemovalSelectedIndex] = import_react47.useState(0), [isChangingPassword, setIsChangingPassword] = import_react47.useState(!1), [passwordChangeError, setPasswordChangeError] = import_react47.useState(null);
|
|
57270
|
+
import_react47.useEffect(() => {
|
|
57287
57271
|
if (!pendingProjectName)
|
|
57288
57272
|
return;
|
|
57289
57273
|
let interval = setInterval(() => {
|
|
@@ -57293,7 +57277,7 @@ function HomePage() {
|
|
|
57293
57277
|
}, [pendingProjectName]);
|
|
57294
57278
|
let validatedEditingProject = editingProject && projects2.some((p2) => p2.id === editingProject.id) ? editingProject : null, validatedConfirmingDelete = confirmingDelete && projects2.some((p2) => p2.id === confirmingDelete.id) ? confirmingDelete : null, showPendingProject = pendingProjectName && !projects2.some((p2) => p2.name === pendingProjectName), archivableProjects = projects2.filter((p2) => p2.status === "owned" && !p2.status.includes("archived")), handleCreateProject = async (name, confirmPayment) => {
|
|
57295
57279
|
if (!hasKeys || !publicKey) {
|
|
57296
|
-
logger7.error("Cannot create project: User has no keys");
|
|
57280
|
+
logger7.error("Cannot create project: User has no keys"), showSetupRequiredError();
|
|
57297
57281
|
return;
|
|
57298
57282
|
}
|
|
57299
57283
|
await loading.run("creating", async () => {
|
|
@@ -57404,7 +57388,10 @@ function HomePage() {
|
|
|
57404
57388
|
return;
|
|
57405
57389
|
}
|
|
57406
57390
|
try {
|
|
57407
|
-
await savePassword(newPassword
|
|
57391
|
+
await savePassword(newPassword, user ? {
|
|
57392
|
+
userId: user.id,
|
|
57393
|
+
email: user.email
|
|
57394
|
+
} : void 0);
|
|
57408
57395
|
} catch (error) {
|
|
57409
57396
|
logger7.error("Failed to save password locally:", error);
|
|
57410
57397
|
}
|
|
@@ -57421,6 +57408,8 @@ function HomePage() {
|
|
|
57421
57408
|
case "n":
|
|
57422
57409
|
if (!isLoadingKeys && hasKeys && publicKey)
|
|
57423
57410
|
setCreatingProject(!0);
|
|
57411
|
+
else if (!isLoadingKeys)
|
|
57412
|
+
showSetupRequiredError();
|
|
57424
57413
|
break;
|
|
57425
57414
|
case "u":
|
|
57426
57415
|
if (isOwned && project.id)
|
|
@@ -57503,6 +57492,8 @@ function HomePage() {
|
|
|
57503
57492
|
} else if (key.name === "n") {
|
|
57504
57493
|
if (!isLoadingKeys && hasKeys && publicKey)
|
|
57505
57494
|
setCreatingProject(!0);
|
|
57495
|
+
else if (!isLoadingKeys)
|
|
57496
|
+
showSetupRequiredError();
|
|
57506
57497
|
} else if (key.name === "u") {
|
|
57507
57498
|
let project = projects2[navigation.selectedIndex];
|
|
57508
57499
|
if (project && project.status === "owned" && project.id)
|
|
@@ -58018,7 +58009,7 @@ function HomePage() {
|
|
|
58018
58009
|
]
|
|
58019
58010
|
}, void 0, !0, void 0, this);
|
|
58020
58011
|
}
|
|
58021
|
-
var
|
|
58012
|
+
var import_react47, logger7, STATUS_ICONS, PAGE_SIZE = 5;
|
|
58022
58013
|
var init_HomePage = __esm(async () => {
|
|
58023
58014
|
init_auth();
|
|
58024
58015
|
init_crypto2();
|
|
@@ -58047,7 +58038,7 @@ var init_HomePage = __esm(async () => {
|
|
|
58047
58038
|
init_PasswordInput(),
|
|
58048
58039
|
init_Modal()
|
|
58049
58040
|
]);
|
|
58050
|
-
|
|
58041
|
+
import_react47 = __toESM(require_react_development(), 1), logger7 = createLogger2("tui"), STATUS_ICONS = {
|
|
58051
58042
|
owned: "\u25CF",
|
|
58052
58043
|
shared: "\u25C9",
|
|
58053
58044
|
archived: "\u25CB",
|
|
@@ -58081,13 +58072,13 @@ var init_LoginButton = __esm(() => {
|
|
|
58081
58072
|
|
|
58082
58073
|
// ../../packages/tui/convex/hooks/useDeviceAuth.ts
|
|
58083
58074
|
function useDeviceAuth(options) {
|
|
58084
|
-
let [status, setStatus] =
|
|
58085
|
-
|
|
58075
|
+
let [status, setStatus] = import_react48.useState("idle"), [userCode, setUserCode] = import_react48.useState(null), [verificationUri, setVerificationUri] = import_react48.useState(null), [isLoading, setIsLoading] = import_react48.useState(!1), [error, setError] = import_react48.useState(null), isMounted = import_react48.useRef(!0);
|
|
58076
|
+
import_react48.useEffect(() => {
|
|
58086
58077
|
return isMounted.current = !0, () => {
|
|
58087
58078
|
isMounted.current = !1, deviceAuth.stopPolling();
|
|
58088
58079
|
};
|
|
58089
58080
|
}, []);
|
|
58090
|
-
let startAuth =
|
|
58081
|
+
let startAuth = import_react48.useCallback(async () => {
|
|
58091
58082
|
if (!isMounted.current)
|
|
58092
58083
|
return;
|
|
58093
58084
|
setIsLoading(!0), setError(null), setStatus("pending");
|
|
@@ -58116,7 +58107,7 @@ function useDeviceAuth(options) {
|
|
|
58116
58107
|
if (!result.success && result.error)
|
|
58117
58108
|
setError(result.error);
|
|
58118
58109
|
setIsLoading(!1);
|
|
58119
|
-
}, [options]), cancel =
|
|
58110
|
+
}, [options]), cancel = import_react48.useCallback(() => {
|
|
58120
58111
|
deviceAuth.stopPolling(), setStatus("idle"), setIsLoading(!1), setUserCode(null), setVerificationUri(null);
|
|
58121
58112
|
}, []);
|
|
58122
58113
|
return {
|
|
@@ -58129,10 +58120,10 @@ function useDeviceAuth(options) {
|
|
|
58129
58120
|
cancel
|
|
58130
58121
|
};
|
|
58131
58122
|
}
|
|
58132
|
-
var
|
|
58123
|
+
var import_react48;
|
|
58133
58124
|
var init_useDeviceAuth = __esm(() => {
|
|
58134
58125
|
init_auth();
|
|
58135
|
-
|
|
58126
|
+
import_react48 = __toESM(require_react_development(), 1);
|
|
58136
58127
|
});
|
|
58137
58128
|
|
|
58138
58129
|
// ../../packages/tui/utils/ui.ts
|
|
@@ -58269,7 +58260,7 @@ function getStatusColor(status, hasCode, isLoading) {
|
|
|
58269
58260
|
}
|
|
58270
58261
|
}
|
|
58271
58262
|
function LoginPage({ onLogin }) {
|
|
58272
|
-
let { width, height } = useTerminalDimensions(), [isModalOpen, setIsModalOpen] =
|
|
58263
|
+
let { width, height } = useTerminalDimensions(), [isModalOpen, setIsModalOpen] = import_react50.useState(!1), { status, userCode, verificationUri, isLoading, error, startAuth, cancel } = useDeviceAuth({
|
|
58273
58264
|
onSuccess: () => {
|
|
58274
58265
|
trackEvent("tui_login_completed", { success: !0 }), setTimeout(() => {
|
|
58275
58266
|
onLogin();
|
|
@@ -58278,8 +58269,8 @@ function LoginPage({ onLogin }) {
|
|
|
58278
58269
|
onError: (err) => {
|
|
58279
58270
|
logger8.error("Device auth error:", err), trackEvent("tui_login_completed", { success: !1 });
|
|
58280
58271
|
}
|
|
58281
|
-
}), hyperlinkWrittenRef =
|
|
58282
|
-
|
|
58272
|
+
}), hyperlinkWrittenRef = import_react50.useRef(null);
|
|
58273
|
+
import_react50.useEffect(() => {
|
|
58283
58274
|
if (verificationUri && isModalOpen && hyperlinkWrittenRef.current !== verificationUri) {
|
|
58284
58275
|
let timer = setTimeout(() => {
|
|
58285
58276
|
let hyperlink = createHyperlink(verificationUri, verificationUri);
|
|
@@ -58460,7 +58451,7 @@ function LoginPage({ onLogin }) {
|
|
|
58460
58451
|
]
|
|
58461
58452
|
}, void 0, !0, void 0, this);
|
|
58462
58453
|
}
|
|
58463
|
-
var
|
|
58454
|
+
var import_react50, logger8, getShortcutGroups = (isLoading) => ({
|
|
58464
58455
|
primary: [
|
|
58465
58456
|
{ shortcuts: [{ key: KEY_SYMBOLS.enter, description: "sign in", disabled: isLoading }] }
|
|
58466
58457
|
],
|
|
@@ -58479,15 +58470,19 @@ var init_LoginPage = __esm(async () => {
|
|
|
58479
58470
|
init_react(),
|
|
58480
58471
|
init_Modal()
|
|
58481
58472
|
]);
|
|
58482
|
-
|
|
58473
|
+
import_react50 = __toESM(require_react_development(), 1), logger8 = createLogger2("tui");
|
|
58483
58474
|
});
|
|
58484
58475
|
|
|
58485
58476
|
// ../../packages/tui/pages/PasswordSetupPage.tsx
|
|
58486
|
-
function PasswordSetupPage({
|
|
58487
|
-
|
|
58477
|
+
function PasswordSetupPage({
|
|
58478
|
+
hasExistingKeys,
|
|
58479
|
+
onComplete,
|
|
58480
|
+
onLogout
|
|
58481
|
+
}) {
|
|
58482
|
+
let { width, height } = useTerminalDimensions(), { encryptedPrivateKey, salt, checkHasKeys, updatePassword, storeUserKeys } = useUserKeys(), [showLogoutModal, setShowLogoutModal] = import_react52.useState(!1), [showPasswordWarning, setShowPasswordWarning] = import_react52.useState(!1), [pendingPassword, setPendingPassword] = import_react52.useState(null), [currentEncryptedPrivateKey, setCurrentEncryptedPrivateKey] = import_react52.useState(null), [currentSalt, setCurrentSalt] = import_react52.useState(null), [taskStatus, setTaskStatus] = import_react52.useState(null), [setupError, setSetupError] = import_react52.useState(null), [rewrapError, setRewrapError] = import_react52.useState(null), handleLogout = async () => {
|
|
58488
58483
|
await onLogout();
|
|
58489
58484
|
}, handlePasswordSubmit = async (password) => {
|
|
58490
|
-
trackEvent("password_setup_started"), setTaskStatus("checking_password");
|
|
58485
|
+
trackEvent("password_setup_started"), setSetupError(null), setTaskStatus("checking_password");
|
|
58491
58486
|
try {
|
|
58492
58487
|
if (!await checkHasKeys()) {
|
|
58493
58488
|
setTaskStatus("creating_keys");
|
|
@@ -58501,7 +58496,7 @@ function PasswordSetupPage({ onComplete, onLogout }) {
|
|
|
58501
58496
|
publicKey,
|
|
58502
58497
|
encryptedPrivateKey: newEncryptedPrivateKey,
|
|
58503
58498
|
salt: newSalt
|
|
58504
|
-
}), setTaskStatus(null), onComplete(password);
|
|
58499
|
+
}), setTaskStatus(null), await onComplete(password);
|
|
58505
58500
|
return;
|
|
58506
58501
|
} catch (error) {
|
|
58507
58502
|
throw logger9.error("Failed to create user keys:", error), setTaskStatus(null), error;
|
|
@@ -58518,15 +58513,15 @@ function PasswordSetupPage({ onComplete, onLogout }) {
|
|
|
58518
58513
|
storedEncryptedPrivateKey = encryptedPrivateKey, storedSalt = salt;
|
|
58519
58514
|
if (storedEncryptedPrivateKey && storedSalt) {
|
|
58520
58515
|
if (await verifyPasswordWithExistingKeys(password, storedEncryptedPrivateKey, storedSalt)) {
|
|
58521
|
-
setTaskStatus(null), onComplete(password);
|
|
58516
|
+
setTaskStatus(null), await onComplete(password);
|
|
58522
58517
|
return;
|
|
58523
58518
|
}
|
|
58524
58519
|
setPendingPassword(password), setCurrentEncryptedPrivateKey(storedEncryptedPrivateKey), setCurrentSalt(storedSalt), setTaskStatus(null), setShowPasswordWarning(!0), setRewrapError(null);
|
|
58525
58520
|
return;
|
|
58526
58521
|
}
|
|
58527
|
-
setTaskStatus(null),
|
|
58522
|
+
setTaskStatus(null), setSetupError("Could not load your encryption keys. Please try again.");
|
|
58528
58523
|
} catch (error) {
|
|
58529
|
-
logger9.error("Error checking password:", error), setTaskStatus(null),
|
|
58524
|
+
logger9.error("Error checking password:", error), setTaskStatus(null), setSetupError("Failed to prepare your account. Please try again.");
|
|
58530
58525
|
}
|
|
58531
58526
|
}, handleWarningConfirm = async (oldPassword) => {
|
|
58532
58527
|
if (!pendingPassword || !currentEncryptedPrivateKey || !currentSalt)
|
|
@@ -58549,7 +58544,7 @@ function PasswordSetupPage({ onComplete, onLogout }) {
|
|
|
58549
58544
|
setTaskStatus("updating_backend"), await updatePassword({
|
|
58550
58545
|
encryptedPrivateKey: newEncryptedPrivateKey,
|
|
58551
58546
|
salt: newSalt
|
|
58552
|
-
}), setTaskStatus(null), setShowPasswordWarning(!1), onComplete(pendingPassword);
|
|
58547
|
+
}), setTaskStatus(null), setShowPasswordWarning(!1), await onComplete(pendingPassword);
|
|
58553
58548
|
} catch (error) {
|
|
58554
58549
|
logger9.error("Failed to rewrap password:", error), setTaskStatus(null), setRewrapError("Failed to update password. Please try again.");
|
|
58555
58550
|
}
|
|
@@ -58614,24 +58609,16 @@ function PasswordSetupPage({ onComplete, onLogout }) {
|
|
|
58614
58609
|
marginTop: 1,
|
|
58615
58610
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
58616
58611
|
fg: THEME_COLORS.text,
|
|
58617
|
-
children: "
|
|
58612
|
+
children: hasExistingKeys ? "Unlock Master Password" : "Create Master Password"
|
|
58618
58613
|
}, void 0, !1, void 0, this)
|
|
58619
58614
|
}, void 0, !1, void 0, this),
|
|
58620
58615
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
58621
58616
|
height: 1,
|
|
58622
58617
|
marginTop: 1,
|
|
58623
58618
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
58624
|
-
|
|
58625
|
-
|
|
58626
|
-
|
|
58627
|
-
children: "[!]"
|
|
58628
|
-
}, void 0, !1, void 0, this),
|
|
58629
|
-
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("span", {
|
|
58630
|
-
fg: THEME_COLORS.accent,
|
|
58631
|
-
children: " Your master password is never stored"
|
|
58632
|
-
}, void 0, !1, void 0, this)
|
|
58633
|
-
]
|
|
58634
|
-
}, void 0, !0, void 0, this)
|
|
58619
|
+
fg: hasExistingKeys ? THEME_COLORS.textDim : THEME_COLORS.accent,
|
|
58620
|
+
children: hasExistingKeys ? "Enter your password to unlock this account." : "Create a password to generate your encryption keys."
|
|
58621
|
+
}, void 0, !1, void 0, this)
|
|
58635
58622
|
}, void 0, !1, void 0, this),
|
|
58636
58623
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
58637
58624
|
flexDirection: "column",
|
|
@@ -58641,7 +58628,8 @@ function PasswordSetupPage({ onComplete, onLogout }) {
|
|
|
58641
58628
|
mode: "setup",
|
|
58642
58629
|
onSubmit: handlePasswordSubmit,
|
|
58643
58630
|
width: 46,
|
|
58644
|
-
disabled: isAnyModalOpen
|
|
58631
|
+
disabled: isAnyModalOpen,
|
|
58632
|
+
error: setupError
|
|
58645
58633
|
}, void 0, !1, void 0, this)
|
|
58646
58634
|
}, void 0, !1, void 0, this)
|
|
58647
58635
|
]
|
|
@@ -58707,7 +58695,7 @@ function PasswordSetupPage({ onComplete, onLogout }) {
|
|
|
58707
58695
|
]
|
|
58708
58696
|
}, void 0, !0, void 0, this);
|
|
58709
58697
|
}
|
|
58710
|
-
var
|
|
58698
|
+
var import_react52, logger9;
|
|
58711
58699
|
var init_PasswordSetupPage = __esm(async () => {
|
|
58712
58700
|
init_auth();
|
|
58713
58701
|
init_crypto2();
|
|
@@ -58721,7 +58709,7 @@ var init_PasswordSetupPage = __esm(async () => {
|
|
|
58721
58709
|
init_PasswordInput(),
|
|
58722
58710
|
init_Modal()
|
|
58723
58711
|
]);
|
|
58724
|
-
|
|
58712
|
+
import_react52 = __toESM(require_react_development(), 1), logger9 = createLogger2("tui");
|
|
58725
58713
|
});
|
|
58726
58714
|
|
|
58727
58715
|
// ../../packages/tui/utils/bulkImport.ts
|
|
@@ -58919,7 +58907,7 @@ function BulkImportModal({
|
|
|
58919
58907
|
cursorVisible,
|
|
58920
58908
|
onClose: _onClose
|
|
58921
58909
|
}) {
|
|
58922
|
-
let { isRunning } = useTaskQueue(), validationResult =
|
|
58910
|
+
let { isRunning } = useTaskQueue(), validationResult = import_react53.useMemo(() => {
|
|
58923
58911
|
let trimmed = content.trim();
|
|
58924
58912
|
if (trimmed === "")
|
|
58925
58913
|
return { valid: !1, secrets: [], errors: [], duplicateKeys: [] };
|
|
@@ -58945,7 +58933,7 @@ function BulkImportModal({
|
|
|
58945
58933
|
{ key: "esc", description: "cancel", disabled: isRunning }
|
|
58946
58934
|
];
|
|
58947
58935
|
}, lines = content.split(`
|
|
58948
|
-
`), visibleLines = EDITOR_HEIGHT - 2, maxLineWidth = EDITOR_WIDTH - 8, { wrappedLine, wrappedColumn, allWrappedLines } =
|
|
58936
|
+
`), visibleLines = EDITOR_HEIGHT - 2, maxLineWidth = EDITOR_WIDTH - 8, { wrappedLine, wrappedColumn, allWrappedLines } = import_react53.useMemo(() => mapCursorToWrappedLines(lines, cursor, maxLineWidth), [lines, cursor, maxLineWidth]), scrollOffset = Math.max(0, wrappedLine - visibleLines + 1), renderEditorContent = () => {
|
|
58949
58937
|
if (content === "")
|
|
58950
58938
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
58951
58939
|
children: [
|
|
@@ -59141,7 +59129,7 @@ function BulkImportModal({
|
|
|
59141
59129
|
}, void 0, !0, void 0, this)
|
|
59142
59130
|
}, void 0, !1, void 0, this);
|
|
59143
59131
|
}
|
|
59144
|
-
var
|
|
59132
|
+
var import_react53, EDITOR_HEIGHT = 18, EDITOR_WIDTH = 76;
|
|
59145
59133
|
var init_BulkImportModal = __esm(async () => {
|
|
59146
59134
|
init_useTaskQueue();
|
|
59147
59135
|
init_bulkImport();
|
|
@@ -59149,7 +59137,7 @@ var init_BulkImportModal = __esm(async () => {
|
|
|
59149
59137
|
init_ui();
|
|
59150
59138
|
init_jsx_dev_runtime();
|
|
59151
59139
|
await init_Modal();
|
|
59152
|
-
|
|
59140
|
+
import_react53 = __toESM(require_react_development(), 1);
|
|
59153
59141
|
});
|
|
59154
59142
|
|
|
59155
59143
|
// ../../packages/tui/components/modals/ManageCollaboratorsModal.tsx
|
|
@@ -59167,8 +59155,8 @@ function ManageCollaboratorsModal({
|
|
|
59167
59155
|
pendingEmail,
|
|
59168
59156
|
shareLimits
|
|
59169
59157
|
}) {
|
|
59170
|
-
let { isRunning } = useTaskQueue(), [selectedIndex, setSelectedIndex] =
|
|
59171
|
-
if (
|
|
59158
|
+
let { isRunning } = useTaskQueue(), [selectedIndex, setSelectedIndex] = import_react55.useState(0), [creatingCollab, setCreatingCollab] = import_react55.useState(!1), [confirmingDelete, setConfirmingDelete] = import_react55.useState(null), [emailError, setEmailError] = import_react55.useState(null), [spinnerFrame, setSpinnerFrame] = import_react55.useState(0), [emailValue, setEmailValue] = import_react55.useState("");
|
|
59159
|
+
if (import_react55.useEffect(() => {
|
|
59172
59160
|
if (!pendingEmail)
|
|
59173
59161
|
return;
|
|
59174
59162
|
let interval = setInterval(() => {
|
|
@@ -59394,7 +59382,7 @@ function ManageCollaboratorsModal({
|
|
|
59394
59382
|
}, void 0, !0, void 0, this)
|
|
59395
59383
|
}, void 0, !1, void 0, this);
|
|
59396
59384
|
}
|
|
59397
|
-
var
|
|
59385
|
+
var import_react55;
|
|
59398
59386
|
var init_ManageCollaboratorsModal = __esm(async () => {
|
|
59399
59387
|
init_useTaskQueue();
|
|
59400
59388
|
init_constants2();
|
|
@@ -59404,12 +59392,42 @@ var init_ManageCollaboratorsModal = __esm(async () => {
|
|
|
59404
59392
|
init_InlineInput(),
|
|
59405
59393
|
init_Modal()
|
|
59406
59394
|
]);
|
|
59407
|
-
|
|
59395
|
+
import_react55 = __toESM(require_react_development(), 1);
|
|
59408
59396
|
});
|
|
59409
59397
|
|
|
59398
|
+
// ../../packages/tui/utils/mappers.ts
|
|
59399
|
+
function mapApiEnvironment(apiEnv) {
|
|
59400
|
+
return {
|
|
59401
|
+
id: apiEnv.id,
|
|
59402
|
+
name: apiEnv.name
|
|
59403
|
+
};
|
|
59404
|
+
}
|
|
59405
|
+
function mapApiFolder(apiFolder) {
|
|
59406
|
+
return {
|
|
59407
|
+
id: apiFolder.id,
|
|
59408
|
+
name: apiFolder.name,
|
|
59409
|
+
environmentId: apiFolder.environmentId
|
|
59410
|
+
};
|
|
59411
|
+
}
|
|
59412
|
+
function mapApiSecret(apiSecret) {
|
|
59413
|
+
return {
|
|
59414
|
+
id: apiSecret.id,
|
|
59415
|
+
key: apiSecret.key,
|
|
59416
|
+
value: void 0,
|
|
59417
|
+
encryptedValue: apiSecret.encryptedValue,
|
|
59418
|
+
type: apiSecret.valueType === "string" ? "string" : apiSecret.valueType === "number" ? "number" : apiSecret.valueType === "boolean" ? "boolean" : "string",
|
|
59419
|
+
scope: apiSecret.scope,
|
|
59420
|
+
folderId: apiSecret.folderId,
|
|
59421
|
+
environmentId: apiSecret.environmentId
|
|
59422
|
+
};
|
|
59423
|
+
}
|
|
59424
|
+
function getUserDisplayName(user) {
|
|
59425
|
+
return user.name || user.email.split("@")[0] || "User";
|
|
59426
|
+
}
|
|
59427
|
+
|
|
59410
59428
|
// ../../packages/tui/hooks/useEnvironments.ts
|
|
59411
59429
|
function useEnvironments(projectId) {
|
|
59412
|
-
let [environments, setEnvironments] =
|
|
59430
|
+
let [environments, setEnvironments] = import_react56.useState([]), [isLoading, setIsLoading] = import_react56.useState(!0), [error, setError] = import_react56.useState(null), fetch2 = import_react56.useCallback(async () => {
|
|
59413
59431
|
setIsLoading(!0), setError(null);
|
|
59414
59432
|
try {
|
|
59415
59433
|
let api2 = getProtectedApi();
|
|
@@ -59422,35 +59440,35 @@ function useEnvironments(projectId) {
|
|
|
59422
59440
|
setIsLoading(!1);
|
|
59423
59441
|
}
|
|
59424
59442
|
}, [projectId]);
|
|
59425
|
-
|
|
59443
|
+
import_react56.useEffect(() => {
|
|
59426
59444
|
fetch2();
|
|
59427
59445
|
}, [fetch2]);
|
|
59428
|
-
let create =
|
|
59446
|
+
let create = import_react56.useCallback(async (name, color) => {
|
|
59429
59447
|
let api2 = getProtectedApi();
|
|
59430
59448
|
await api2.ensureAuth();
|
|
59431
59449
|
let { id } = await api2.createEnvironment({ projectId, name, color });
|
|
59432
59450
|
return await fetch2(), id;
|
|
59433
|
-
}, [projectId, fetch2]), update =
|
|
59451
|
+
}, [projectId, fetch2]), update = import_react56.useCallback(async (environmentId, name, color) => {
|
|
59434
59452
|
let api2 = getProtectedApi();
|
|
59435
59453
|
await api2.ensureAuth(), await api2.updateEnvironment({ environmentId, name, color }), await fetch2();
|
|
59436
|
-
}, [fetch2]), remove =
|
|
59454
|
+
}, [fetch2]), remove = import_react56.useCallback(async (environmentId) => {
|
|
59437
59455
|
let api2 = getProtectedApi();
|
|
59438
59456
|
await api2.ensureAuth(), await api2.deleteEnvironment(environmentId), await fetch2();
|
|
59439
59457
|
}, [fetch2]);
|
|
59440
59458
|
return { environments, isLoading, error, refetch: fetch2, create, update, remove };
|
|
59441
59459
|
}
|
|
59442
|
-
var
|
|
59460
|
+
var import_react56, logger10;
|
|
59443
59461
|
var init_useEnvironments = __esm(() => {
|
|
59444
59462
|
init_logger2();
|
|
59445
59463
|
init_api4();
|
|
59446
|
-
|
|
59464
|
+
import_react56 = __toESM(require_react_development(), 1), logger10 = createLogger2("tui");
|
|
59447
59465
|
});
|
|
59448
59466
|
|
|
59449
59467
|
// ../../packages/tui/hooks/useProject.ts
|
|
59450
59468
|
function useProject(projectId) {
|
|
59451
59469
|
let { user } = useUser(), projectData = useQuery(api.project.getProject, {
|
|
59452
59470
|
projectId
|
|
59453
|
-
}), isOwner = projectData && user ? projectData.ownerId === user.id : !1, sharesData = useQuery(api.projectShare.listActiveProjectSharesByProject, isOwner ? { projectId } : "skip"), [shareLimits, setShareLimits] =
|
|
59471
|
+
}), isOwner = projectData && user ? projectData.ownerId === user.id : !1, sharesData = useQuery(api.projectShare.listActiveProjectSharesByProject, isOwner ? { projectId } : "skip"), [shareLimits, setShareLimits] = import_react58.useState(null), [limitsLoading, setLimitsLoading] = import_react58.useState(!1), fetchShareLimits = import_react58.useCallback(async () => {
|
|
59454
59472
|
setLimitsLoading(!0);
|
|
59455
59473
|
try {
|
|
59456
59474
|
let apiClient = getProtectedApi();
|
|
@@ -59463,13 +59481,13 @@ function useProject(projectId) {
|
|
|
59463
59481
|
setLimitsLoading(!1);
|
|
59464
59482
|
}
|
|
59465
59483
|
}, [projectId]);
|
|
59466
|
-
|
|
59484
|
+
import_react58.useEffect(() => {
|
|
59467
59485
|
if (isOwner)
|
|
59468
59486
|
fetchShareLimits();
|
|
59469
59487
|
else
|
|
59470
59488
|
setShareLimits(null), setLimitsLoading(!1);
|
|
59471
59489
|
}, [isOwner, fetchShareLimits]);
|
|
59472
|
-
let project =
|
|
59490
|
+
let project = import_react58.useMemo(() => {
|
|
59473
59491
|
if (!projectData)
|
|
59474
59492
|
return null;
|
|
59475
59493
|
return {
|
|
@@ -59485,7 +59503,7 @@ function useProject(projectId) {
|
|
|
59485
59503
|
updatedAt: projectData.updatedAt,
|
|
59486
59504
|
shareUsageCount: 0
|
|
59487
59505
|
};
|
|
59488
|
-
}, [projectData]), sharedUsers =
|
|
59506
|
+
}, [projectData]), sharedUsers = import_react58.useMemo(() => {
|
|
59489
59507
|
if (!sharesData?.shares)
|
|
59490
59508
|
return [];
|
|
59491
59509
|
return sharesData.shares.map((share) => ({
|
|
@@ -59505,14 +59523,14 @@ function useProject(projectId) {
|
|
|
59505
59523
|
refetch: fetchShareLimits
|
|
59506
59524
|
};
|
|
59507
59525
|
}
|
|
59508
|
-
var
|
|
59526
|
+
var import_react58, logger11;
|
|
59509
59527
|
var init_useProject = __esm(() => {
|
|
59510
59528
|
init_backend();
|
|
59511
59529
|
init_logger2();
|
|
59512
59530
|
init_react2();
|
|
59513
59531
|
init_api4();
|
|
59514
59532
|
init_context2();
|
|
59515
|
-
|
|
59533
|
+
import_react58 = __toESM(require_react_development(), 1), logger11 = createLogger2("tui");
|
|
59516
59534
|
});
|
|
59517
59535
|
|
|
59518
59536
|
// ../../packages/tui/utils/crypto.ts
|
|
@@ -59552,7 +59570,7 @@ var init_crypto3 = __esm(() => {
|
|
|
59552
59570
|
|
|
59553
59571
|
// ../../packages/tui/hooks/useSecrets.ts
|
|
59554
59572
|
function useSecrets(_projectId, encryptedProjectKeySource, encryptedPrivateKey, salt) {
|
|
59555
|
-
let [folders, setFolders] =
|
|
59573
|
+
let [folders, setFolders] = import_react59.useState([]), [secrets, setSecrets] = import_react59.useState([]), [isLoading, setIsLoading] = import_react59.useState(!1), [error, setError] = import_react59.useState(null), loadEnvironment = import_react59.useCallback(async (environmentId) => {
|
|
59556
59574
|
setIsLoading(!0), setError(null);
|
|
59557
59575
|
try {
|
|
59558
59576
|
let api2 = getProtectedApi();
|
|
@@ -59575,20 +59593,20 @@ function useSecrets(_projectId, encryptedProjectKeySource, encryptedPrivateKey,
|
|
|
59575
59593
|
} finally {
|
|
59576
59594
|
setIsLoading(!1);
|
|
59577
59595
|
}
|
|
59578
|
-
}, [encryptedProjectKeySource, encryptedPrivateKey, salt]), createFolder =
|
|
59596
|
+
}, [encryptedProjectKeySource, encryptedPrivateKey, salt]), createFolder = import_react59.useCallback(async (environmentId, name) => {
|
|
59579
59597
|
let api2 = getProtectedApi();
|
|
59580
59598
|
await api2.ensureAuth();
|
|
59581
59599
|
let { id } = await api2.createFolder({ environmentId, name });
|
|
59582
59600
|
return await loadEnvironment(environmentId), id;
|
|
59583
|
-
}, [loadEnvironment]), updateFolder =
|
|
59601
|
+
}, [loadEnvironment]), updateFolder = import_react59.useCallback(async (folderId, name) => {
|
|
59584
59602
|
let folder = folders.find((f3) => f3.id === folderId), api2 = getProtectedApi();
|
|
59585
59603
|
if (await api2.ensureAuth(), await api2.updateFolder({ folderId, name }), folder)
|
|
59586
59604
|
await loadEnvironment(folder.environmentId);
|
|
59587
|
-
}, [folders, loadEnvironment]), deleteFolder =
|
|
59605
|
+
}, [folders, loadEnvironment]), deleteFolder = import_react59.useCallback(async (folderId) => {
|
|
59588
59606
|
let folder = folders.find((f3) => f3.id === folderId), api2 = getProtectedApi();
|
|
59589
59607
|
if (await api2.ensureAuth(), await api2.deleteFolder(folderId), folder)
|
|
59590
59608
|
await loadEnvironment(folder.environmentId);
|
|
59591
|
-
}, [folders, loadEnvironment]), createSecret =
|
|
59609
|
+
}, [folders, loadEnvironment]), createSecret = import_react59.useCallback(async (args) => {
|
|
59592
59610
|
if (!encryptedProjectKeySource || !encryptedPrivateKey || !salt)
|
|
59593
59611
|
throw Error("Cannot encrypt: No project key available");
|
|
59594
59612
|
let projectKey = await getProjectKey2(encryptedProjectKeySource, encryptedPrivateKey, salt), encryptedValue = await encryptSecretValue(projectKey, args.value), api2 = getProtectedApi();
|
|
@@ -59602,7 +59620,7 @@ function useSecrets(_projectId, encryptedProjectKeySource, encryptedPrivateKey,
|
|
|
59602
59620
|
scope: args.scope
|
|
59603
59621
|
});
|
|
59604
59622
|
return await loadEnvironment(args.environmentId), id;
|
|
59605
|
-
}, [encryptedProjectKeySource, encryptedPrivateKey, salt, loadEnvironment]), updateSecretBulk =
|
|
59623
|
+
}, [encryptedProjectKeySource, encryptedPrivateKey, salt, loadEnvironment]), updateSecretBulk = import_react59.useCallback(async (args) => {
|
|
59606
59624
|
if (!encryptedProjectKeySource || !encryptedPrivateKey || !salt)
|
|
59607
59625
|
throw Error("Cannot encrypt: No project key available");
|
|
59608
59626
|
let projectKey = await getProjectKey2(encryptedProjectKeySource, encryptedPrivateKey, salt), encrypted = await Promise.all(args.secrets.map(async (s2) => {
|
|
@@ -59631,7 +59649,7 @@ function useSecrets(_projectId, encryptedProjectKeySource, encryptedPrivateKey,
|
|
|
59631
59649
|
mode: args.mode
|
|
59632
59650
|
}, result = await api2.updateSecretBulk(payload);
|
|
59633
59651
|
return await loadEnvironment(args.environmentId), result;
|
|
59634
|
-
}, [encryptedProjectKeySource, encryptedPrivateKey, salt, loadEnvironment, secrets]), updateSecret =
|
|
59652
|
+
}, [encryptedProjectKeySource, encryptedPrivateKey, salt, loadEnvironment, secrets]), updateSecret = import_react59.useCallback(async (args) => {
|
|
59635
59653
|
let encryptedValue;
|
|
59636
59654
|
if (args.value) {
|
|
59637
59655
|
if (!encryptedProjectKeySource || !encryptedPrivateKey || !salt)
|
|
@@ -59646,7 +59664,7 @@ function useSecrets(_projectId, encryptedProjectKeySource, encryptedPrivateKey,
|
|
|
59646
59664
|
encryptedValue,
|
|
59647
59665
|
valueType: args.valueType
|
|
59648
59666
|
}), await loadEnvironment(args.environmentId);
|
|
59649
|
-
}, [encryptedProjectKeySource, encryptedPrivateKey, salt, loadEnvironment]), deleteSecret =
|
|
59667
|
+
}, [encryptedProjectKeySource, encryptedPrivateKey, salt, loadEnvironment]), deleteSecret = import_react59.useCallback(async (secretId) => {
|
|
59650
59668
|
let secret = secrets.find((s2) => s2.id === secretId), api2 = getProtectedApi();
|
|
59651
59669
|
if (await api2.ensureAuth(), await api2.deleteSecret(secretId), secret)
|
|
59652
59670
|
await loadEnvironment(secret.environmentId);
|
|
@@ -59666,17 +59684,17 @@ function useSecrets(_projectId, encryptedProjectKeySource, encryptedPrivateKey,
|
|
|
59666
59684
|
deleteSecret
|
|
59667
59685
|
};
|
|
59668
59686
|
}
|
|
59669
|
-
var
|
|
59687
|
+
var import_react59, logger12;
|
|
59670
59688
|
var init_useSecrets = __esm(() => {
|
|
59671
59689
|
init_logger2();
|
|
59672
59690
|
init_api4();
|
|
59673
59691
|
init_crypto3();
|
|
59674
|
-
|
|
59692
|
+
import_react59 = __toESM(require_react_development(), 1), logger12 = createLogger2("tui");
|
|
59675
59693
|
});
|
|
59676
59694
|
|
|
59677
59695
|
// ../../packages/tui/hooks/useSharing.ts
|
|
59678
59696
|
function useSharing(projectId, encryptedProjectKeySource, encryptedPrivateKey, salt, shareLimits) {
|
|
59679
|
-
let shareProject =
|
|
59697
|
+
let shareProject = import_react60.useCallback(async (email, confirmPayment) => {
|
|
59680
59698
|
let api2 = getProtectedApi();
|
|
59681
59699
|
if (await api2.ensureAuth(), !shareLimits?.hasPro)
|
|
59682
59700
|
return await api2.shareProject({
|
|
@@ -59697,10 +59715,10 @@ function useSharing(projectId, encryptedProjectKeySource, encryptedPrivateKey, s
|
|
|
59697
59715
|
encryptedProjectKey,
|
|
59698
59716
|
confirmPayment
|
|
59699
59717
|
});
|
|
59700
|
-
}, [projectId, encryptedProjectKeySource, encryptedPrivateKey, salt, shareLimits]), revokeShare =
|
|
59718
|
+
}, [projectId, encryptedProjectKeySource, encryptedPrivateKey, salt, shareLimits]), revokeShare = import_react60.useCallback(async (shareId) => {
|
|
59701
59719
|
let api2 = getProtectedApi();
|
|
59702
59720
|
await api2.ensureAuth(), await api2.revokeShare(shareId);
|
|
59703
|
-
}, []), revokeShareWithRotation =
|
|
59721
|
+
}, []), revokeShareWithRotation = import_react60.useCallback(async (shareId, sharedUsers) => {
|
|
59704
59722
|
if (!encryptedProjectKeySource || !encryptedPrivateKey || !salt)
|
|
59705
59723
|
throw Error("Cannot rotate: Missing keys");
|
|
59706
59724
|
let api2 = getProtectedApi();
|
|
@@ -59733,17 +59751,17 @@ function useSharing(projectId, encryptedProjectKeySource, encryptedPrivateKey, s
|
|
|
59733
59751
|
}, [projectId, encryptedProjectKeySource, encryptedPrivateKey, salt]);
|
|
59734
59752
|
return { shareProject, revokeShare, revokeShareWithRotation };
|
|
59735
59753
|
}
|
|
59736
|
-
var
|
|
59754
|
+
var import_react60;
|
|
59737
59755
|
var init_useSharing = __esm(() => {
|
|
59738
59756
|
init_crypto2();
|
|
59739
59757
|
init_api4();
|
|
59740
59758
|
init_crypto3();
|
|
59741
|
-
|
|
59759
|
+
import_react60 = __toESM(require_react_development(), 1);
|
|
59742
59760
|
});
|
|
59743
59761
|
|
|
59744
59762
|
// ../../packages/tui/hooks/useProjectPage.ts
|
|
59745
59763
|
function useProjectPage(projectId) {
|
|
59746
|
-
let { user } = useUser(), { encryptedPrivateKey, salt } = useUserKeys(), [encryptedProjectKey, setEncryptedProjectKey] =
|
|
59764
|
+
let { user } = useUser(), { encryptedPrivateKey, salt } = useUserKeys(), [encryptedProjectKey, setEncryptedProjectKey] = import_react61.useState(null), {
|
|
59747
59765
|
project,
|
|
59748
59766
|
sharedUsers,
|
|
59749
59767
|
shareLimits,
|
|
@@ -59756,7 +59774,7 @@ function useProjectPage(projectId) {
|
|
|
59756
59774
|
update: updateEnv,
|
|
59757
59775
|
remove: removeEnv
|
|
59758
59776
|
} = useEnvironments(projectId), isOwner = project && user ? project.ownerId === user.id : !1;
|
|
59759
|
-
|
|
59777
|
+
import_react61.useEffect(() => {
|
|
59760
59778
|
let fetchProjectKey = async () => {
|
|
59761
59779
|
if (isOwner && project?.encryptedProjectKey)
|
|
59762
59780
|
setEncryptedProjectKey(project.encryptedProjectKey);
|
|
@@ -59814,7 +59832,7 @@ function useProjectPage(projectId) {
|
|
|
59814
59832
|
revokeShareWithRotation
|
|
59815
59833
|
};
|
|
59816
59834
|
}
|
|
59817
|
-
var
|
|
59835
|
+
var import_react61, logger13;
|
|
59818
59836
|
var init_useProjectPage = __esm(() => {
|
|
59819
59837
|
init_logger2();
|
|
59820
59838
|
init_api4();
|
|
@@ -59824,12 +59842,12 @@ var init_useProjectPage = __esm(() => {
|
|
|
59824
59842
|
init_useProject();
|
|
59825
59843
|
init_useSecrets();
|
|
59826
59844
|
init_useSharing();
|
|
59827
|
-
|
|
59845
|
+
import_react61 = __toESM(require_react_development(), 1), logger13 = createLogger2("tui");
|
|
59828
59846
|
});
|
|
59829
59847
|
|
|
59830
59848
|
// ../../packages/tui/pages/ProjectPage.tsx
|
|
59831
59849
|
function ProjectPage({ projectId, projectName, projectStatus }) {
|
|
59832
|
-
|
|
59850
|
+
import_react63.useEffect(() => {
|
|
59833
59851
|
trackEvent("tui_page_viewed", { page: "project" });
|
|
59834
59852
|
}, []);
|
|
59835
59853
|
let { width, height } = useTerminalDimensions(), { goBack: routerGoBack } = useRouter(), {
|
|
@@ -59860,19 +59878,19 @@ function ProjectPage({ projectId, projectName, projectStatus }) {
|
|
|
59860
59878
|
revokeShare,
|
|
59861
59879
|
revokeShareWithRotation,
|
|
59862
59880
|
refetchProject: refetchProjectData
|
|
59863
|
-
} = useProjectPage(projectId), [showProSuccess, setShowProSuccess] =
|
|
59864
|
-
|
|
59881
|
+
} = useProjectPage(projectId), [showProSuccess, setShowProSuccess] = import_react63.useState(!1), prevHasProRef = import_react63.useRef(null);
|
|
59882
|
+
import_react63.useEffect(() => {
|
|
59865
59883
|
if (isLoadingPlan)
|
|
59866
59884
|
return;
|
|
59867
59885
|
if (prevHasProRef.current !== null && hasPro && !prevHasProRef.current)
|
|
59868
59886
|
refetchProjectData(), setCheckoutModal({ visible: !1, url: "", reason: "pro_required" }), setBillingPortalModal({ visible: !1, url: "" }), setShowProSuccess(!0);
|
|
59869
59887
|
prevHasProRef.current = hasPro;
|
|
59870
59888
|
}, [hasPro, isLoadingPlan, refetchProjectData]);
|
|
59871
|
-
let [viewLevel, setViewLevel] =
|
|
59889
|
+
let [viewLevel, setViewLevel] = import_react63.useState("environments"), [selectedEnvId, setSelectedEnvId] = import_react63.useState(null), [selectedFolderId, setSelectedFolderId] = import_react63.useState(null), [selectedIndex, setSelectedIndex] = import_react63.useState(0), [scrollOffset, setScrollOffset] = import_react63.useState(0), [showSecrets, setShowSecrets] = import_react63.useState(!1), [activeModal, setActiveModal] = import_react63.useState("none"), [creatingItem, setCreatingItem] = import_react63.useState(null), [editingItem, setEditingItem] = import_react63.useState(null), [confirmingDelete, setConfirmingDelete] = import_react63.useState(null), bulkImportInput = useMultiLineInput({ maxLines: 50 }), [bulkImportFormat, setBulkImportFormat] = import_react63.useState("env"), [bulkImportScopes, setBulkImportScopes] = import_react63.useState(/* @__PURE__ */ new Map), [bulkImportCollisions, setBulkImportCollisions] = import_react63.useState([]), [pendingCollaboratorEmail, setPendingCollaboratorEmail] = import_react63.useState(null), [confirmationModal, setConfirmationModal] = import_react63.useState({
|
|
59872
59890
|
visible: !1,
|
|
59873
59891
|
type: "seat",
|
|
59874
59892
|
balance: 0
|
|
59875
|
-
}), [checkoutModal, setCheckoutModal] =
|
|
59893
|
+
}), [checkoutModal, setCheckoutModal] = import_react63.useState({ visible: !1, url: "", reason: "pro_required" }), [billingPortalModal, setBillingPortalModal] = import_react63.useState({ visible: !1, url: "" }), [isAddingCollaborator, setIsAddingCollaborator] = import_react63.useState(!1), [isRevokingCollaborator, setIsRevokingCollaborator] = import_react63.useState(!1), [isRevokingWithRotation, setIsRevokingWithRotation] = import_react63.useState(!1), [isCreatingItem, setIsCreatingItem] = import_react63.useState(!1), [isRenamingItem, setIsRenamingItem] = import_react63.useState(!1), [isDeletingItem, setIsDeletingItem] = import_react63.useState(!1), [showPasswordModal, setShowPasswordModal] = import_react63.useState(!1), [passwordError, setPasswordError] = import_react63.useState(null), [isVerifyingPassword, setIsVerifyingPassword] = import_react63.useState(!1), [isSessionUnlocked, setIsSessionUnlocked] = import_react63.useState(!1), [pendingAction, setPendingAction] = import_react63.useState(null), isRestricted = projectStatus === "restricted" || projectStatus === "archived", selectedEnv = environments.find((e3) => e3.id === selectedEnvId), selectedFolder = folders.find((f3) => f3.id === selectedFolderId), items = import_react63.useCallback(() => {
|
|
59876
59894
|
if (viewLevel === "environments")
|
|
59877
59895
|
return environments.map((e3) => ({ type: "env", id: e3.id, name: e3.name }));
|
|
59878
59896
|
if (viewLevel === "environment" && selectedEnvId) {
|
|
@@ -59900,7 +59918,7 @@ function ProjectPage({ projectId, projectName, projectStatus }) {
|
|
|
59900
59918
|
}));
|
|
59901
59919
|
return [];
|
|
59902
59920
|
}, [viewLevel, selectedEnvId, selectedFolderId, environments, folders, secrets])();
|
|
59903
|
-
|
|
59921
|
+
import_react63.useEffect(() => {
|
|
59904
59922
|
if (activeModal !== "bulkImport")
|
|
59905
59923
|
return;
|
|
59906
59924
|
let trimmed = bulkImportInput.value.trim();
|
|
@@ -60811,7 +60829,7 @@ API_KEY=your_key_here`), setBulkImportScopes(/* @__PURE__ */ new Map);
|
|
|
60811
60829
|
]
|
|
60812
60830
|
}, void 0, !0, void 0, this);
|
|
60813
60831
|
}
|
|
60814
|
-
var
|
|
60832
|
+
var import_react63, logger14, PAGE_SIZE2 = 10;
|
|
60815
60833
|
var init_ProjectPage = __esm(async () => {
|
|
60816
60834
|
init_auth();
|
|
60817
60835
|
init_logger2();
|
|
@@ -60838,33 +60856,60 @@ var init_ProjectPage = __esm(async () => {
|
|
|
60838
60856
|
init_PasswordInput(),
|
|
60839
60857
|
init_Modal()
|
|
60840
60858
|
]);
|
|
60841
|
-
|
|
60859
|
+
import_react63 = __toESM(require_react_development(), 1), logger14 = createLogger2("tui");
|
|
60842
60860
|
});
|
|
60843
60861
|
|
|
60844
60862
|
// ../../packages/tui/index.tsx
|
|
60845
60863
|
var exports_tui = {};
|
|
60846
60864
|
function AuthenticatedApp({ onLogout }) {
|
|
60847
|
-
let { route, navigate } = useRouter(), {
|
|
60848
|
-
|
|
60865
|
+
let { route, navigate } = useRouter(), { user, isLoading: isUserLoading } = useUser(), displayName = user ? getUserDisplayName(user) : "User", hasExistingKeys = !!user?.publicKey && !!user?.encryptedPrivateKey && !!user?.salt, [passwordStatus, setPasswordStatus] = import_react65.useState({
|
|
60866
|
+
isReady: !1,
|
|
60849
60867
|
loading: !0
|
|
60850
60868
|
});
|
|
60851
|
-
|
|
60852
|
-
|
|
60853
|
-
|
|
60854
|
-
|
|
60855
|
-
|
|
60856
|
-
|
|
60857
|
-
|
|
60869
|
+
import_react65.useEffect(() => {
|
|
60870
|
+
let cancelled = !1, checkPassword = async () => {
|
|
60871
|
+
if (isUserLoading)
|
|
60872
|
+
return;
|
|
60873
|
+
if (!user || !hasExistingKeys) {
|
|
60874
|
+
if (!cancelled)
|
|
60875
|
+
setPasswordStatus({ isReady: !1, loading: !1 });
|
|
60876
|
+
return;
|
|
60877
|
+
}
|
|
60878
|
+
let isReady = await hasPasswordForAccount({
|
|
60879
|
+
userId: user.id,
|
|
60880
|
+
email: user.email,
|
|
60881
|
+
encryptedPrivateKey: user.encryptedPrivateKey,
|
|
60882
|
+
salt: user.salt
|
|
60883
|
+
});
|
|
60884
|
+
if (!cancelled)
|
|
60885
|
+
setPasswordStatus({ isReady, loading: !1 });
|
|
60886
|
+
};
|
|
60887
|
+
return setPasswordStatus({ isReady: !1, loading: !0 }), checkPassword(), () => {
|
|
60888
|
+
cancelled = !0;
|
|
60889
|
+
};
|
|
60890
|
+
}, [
|
|
60891
|
+
hasExistingKeys,
|
|
60892
|
+
isUserLoading,
|
|
60893
|
+
user?.email,
|
|
60894
|
+
user?.encryptedPrivateKey,
|
|
60895
|
+
user?.id,
|
|
60896
|
+
user?.salt
|
|
60897
|
+
]);
|
|
60898
|
+
let handleLogout = import_react65.useCallback(async () => {
|
|
60858
60899
|
await onLogout(), navigate({ name: "login" });
|
|
60859
60900
|
}, [onLogout, navigate]), handlePasswordSetup = async (password) => {
|
|
60860
|
-
await savePassword(password
|
|
60901
|
+
await savePassword(password, user ? {
|
|
60902
|
+
userId: user.id,
|
|
60903
|
+
email: user.email
|
|
60904
|
+
} : void 0), trackEvent("password_setup_completed", { success: !0 }), setPasswordStatus({ isReady: !0, loading: !1 }), navigate({ name: "home" });
|
|
60861
60905
|
};
|
|
60862
|
-
if (passwordStatus.loading)
|
|
60906
|
+
if (isUserLoading || !user || passwordStatus.loading)
|
|
60863
60907
|
return null;
|
|
60864
|
-
if (!passwordStatus.
|
|
60908
|
+
if (!hasExistingKeys || !passwordStatus.isReady)
|
|
60865
60909
|
return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(import_jsx_dev_runtime2.Fragment, {
|
|
60866
60910
|
children: [
|
|
60867
60911
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(PasswordSetupPage, {
|
|
60912
|
+
hasExistingKeys,
|
|
60868
60913
|
onComplete: handlePasswordSetup,
|
|
60869
60914
|
onLogout: handleLogout
|
|
60870
60915
|
}, void 0, !1, void 0, this),
|
|
@@ -60905,8 +60950,8 @@ function AuthenticatedTaskBar() {
|
|
|
60905
60950
|
}, void 0, !1, void 0, this);
|
|
60906
60951
|
}
|
|
60907
60952
|
function AppRouter() {
|
|
60908
|
-
let { navigate } = useRouter(), [authState, setAuthState] =
|
|
60909
|
-
|
|
60953
|
+
let { navigate } = useRouter(), [authState, setAuthState] = import_react65.useState({ isAuthenticated: !1, isLoading: !0 });
|
|
60954
|
+
import_react65.useEffect(() => {
|
|
60910
60955
|
let cleanup;
|
|
60911
60956
|
return (async () => {
|
|
60912
60957
|
try {
|
|
@@ -60925,10 +60970,10 @@ function AppRouter() {
|
|
|
60925
60970
|
});
|
|
60926
60971
|
})(), () => cleanup?.();
|
|
60927
60972
|
}, []);
|
|
60928
|
-
let handleLogin =
|
|
60973
|
+
let handleLogin = import_react65.useCallback(async () => {
|
|
60929
60974
|
let validation = await validateSession();
|
|
60930
60975
|
setAuthState({ isAuthenticated: validation.isValid, isLoading: !1 }), navigate({ name: "home" });
|
|
60931
|
-
}, [navigate]), handleLogout =
|
|
60976
|
+
}, [navigate]), handleLogout = import_react65.useCallback(async () => {
|
|
60932
60977
|
let userKeyDb = await getUserKeyCacheDb();
|
|
60933
60978
|
clearCachedUserKeys(userKeyDb), await clearSession(), await clearPassword(), setAuthState({ isAuthenticated: !1, isLoading: !1 });
|
|
60934
60979
|
}, []);
|
|
@@ -60958,14 +61003,13 @@ function App() {
|
|
|
60958
61003
|
}, void 0, !1, void 0, this)
|
|
60959
61004
|
}, void 0, !1, void 0, this);
|
|
60960
61005
|
}
|
|
60961
|
-
var
|
|
61006
|
+
var import_react65, isDev3, renderer;
|
|
60962
61007
|
var init_tui = __esm(async () => {
|
|
60963
61008
|
init_logger2();
|
|
60964
61009
|
init_auth();
|
|
60965
61010
|
init_context2();
|
|
60966
61011
|
init_provider();
|
|
60967
61012
|
init_useAppSession();
|
|
60968
|
-
init_useCurrentUser();
|
|
60969
61013
|
init_useTaskQueue();
|
|
60970
61014
|
init_router();
|
|
60971
61015
|
init_jsx_dev_runtime();
|
|
@@ -60978,7 +61022,7 @@ var init_tui = __esm(async () => {
|
|
|
60978
61022
|
init_PasswordSetupPage(),
|
|
60979
61023
|
init_ProjectPage()
|
|
60980
61024
|
]);
|
|
60981
|
-
|
|
61025
|
+
import_react65 = __toESM(require_react_development(), 1);
|
|
60982
61026
|
await initLogger();
|
|
60983
61027
|
if (isFirstRun())
|
|
60984
61028
|
console.log("Relic collects anonymous usage data to improve the product. Run `relic telemetry disable` to opt out."), saveTelemetryPreference(!0);
|
|
@@ -64465,7 +64509,7 @@ async function whoami() {
|
|
|
64465
64509
|
// package.json
|
|
64466
64510
|
var package_default = {
|
|
64467
64511
|
name: "relic",
|
|
64468
|
-
version: "0.4.
|
|
64512
|
+
version: "0.4.4",
|
|
64469
64513
|
description: "The Relic CLI for managing and sharing secrets. Encrypted on your device, never exposed to anyone else. Not even us.",
|
|
64470
64514
|
keywords: [
|
|
64471
64515
|
"cli",
|