@ai-digital-factory/lmt-cli 0.1.6 → 1.0.0
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/README.md +175 -51
- package/dist/chunk-4N3XUBM4.js +1483 -0
- package/dist/chunk-7J2U4G5L.js +1394 -0
- package/dist/chunk-AQIOT6YD.js +2799 -0
- package/dist/chunk-DUF5HVSQ.js +58 -0
- package/dist/controller-app-UTLE4YVF.js +1382 -0
- package/dist/credential-app-QEFV6LZM.js +6 -0
- package/dist/index.js +8 -3544
- package/dist/menu-actions-HV2AY4KJ.js +67 -0
- package/dist/src-MZYWVU46.js +380 -0
- package/dist/web-5HW6PMSA.js +9 -0
- package/package.json +2 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/credential-app.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Box, Text, useApp, useInput } from "ink";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function CredentialProvisionApp({ store, onSaved }) {
|
|
6
|
+
const [credential, setCredential] = useState("");
|
|
7
|
+
const [state, setState] = useState("input");
|
|
8
|
+
const [error, setError] = useState("");
|
|
9
|
+
const { exit } = useApp();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (state !== "saved") return;
|
|
12
|
+
if (onSaved) onSaved();
|
|
13
|
+
else exit();
|
|
14
|
+
}, [state, exit]);
|
|
15
|
+
useInput((input, key) => {
|
|
16
|
+
if (state !== "input") return;
|
|
17
|
+
if (key.return) {
|
|
18
|
+
if (!credential.trim()) {
|
|
19
|
+
setError("Enter the SMS read credential.");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
setState("saving");
|
|
23
|
+
setError("");
|
|
24
|
+
void store.saveSmsCredential(credential).then(() => {
|
|
25
|
+
setCredential("");
|
|
26
|
+
setState("saved");
|
|
27
|
+
}).catch((error2) => {
|
|
28
|
+
setCredential("");
|
|
29
|
+
setError(error2 instanceof Error ? error2.message : "Could not save the protected SMS credential.");
|
|
30
|
+
setState("input");
|
|
31
|
+
});
|
|
32
|
+
} else if (key.backspace || key.delete) {
|
|
33
|
+
setCredential((value) => value.slice(0, -1));
|
|
34
|
+
setError("");
|
|
35
|
+
} else if (input && !key.ctrl && !key.meta && !/[\r\n]/.test(input)) {
|
|
36
|
+
setCredential((value) => value + input);
|
|
37
|
+
setError("");
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 1, children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Live Market Terminal" }),
|
|
42
|
+
state === "input" && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Text, { children: "SMS read credential" }),
|
|
44
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
45
|
+
"\u2022".repeat(credential.length),
|
|
46
|
+
/* @__PURE__ */ jsx(Text, { inverse: true, children: " " })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx(Text, { children: "Press Enter to save it in protected local profile storage." })
|
|
49
|
+
] }),
|
|
50
|
+
state === "saving" && /* @__PURE__ */ jsx(Text, { children: "Saving the protected SMS credential\u2026" }),
|
|
51
|
+
state === "saved" && /* @__PURE__ */ jsx(Text, { children: "SMS credential saved." }),
|
|
52
|
+
error ? /* @__PURE__ */ jsx(Text, { color: "red", children: error }) : null
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
CredentialProvisionApp
|
|
58
|
+
};
|