@contentful/experience-design-system-cli 2.37.1-dev-build-f86ffbb8.0 → 2.37.1-dev-build-c5906aa0.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/dist/app.js +136 -370
- package/dist/index.js +140 -401
- package/dist/package.json +1 -2
- package/dist/src/tui/import/spawn-v1-import.d.ts +0 -1
- package/dist/src/tui/import/steps/index.d.ts +0 -1
- package/legacy/dist/src/import/tui/steps/CredentialsStep.d.ts +43 -0
- package/legacy/dist/src/index.js +1379 -977
- package/legacy/package.json +1 -2
- package/package.json +2 -3
- package/dist/src/tui/import/steps/04-credentials/controls.d.ts +0 -21
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +0 -23
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +0 -17
- package/dist/src/tui/import/steps/04-credentials/validate.d.ts +0 -8
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/experience-design-system-cli/app.tsx
|
|
2
|
-
import { useEffect as useEffect9, useState as
|
|
2
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
3
3
|
|
|
4
4
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
5
5
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -705,219 +705,6 @@ function PathValidationScreen({
|
|
|
705
705
|
] });
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
709
|
-
import { useRef, useState as useState6 } from "react";
|
|
710
|
-
import { Box as Box6, Text as Text7 } from "ink";
|
|
711
|
-
import TextInput3 from "ink-text-input";
|
|
712
|
-
|
|
713
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
714
|
-
import { useInput as useInput6 } from "ink";
|
|
715
|
-
|
|
716
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
717
|
-
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
718
|
-
var DEFAULT_HOST = "api.contentful.com";
|
|
719
|
-
function keyAction2(input, key) {
|
|
720
|
-
if (key.escape) return "back";
|
|
721
|
-
if (key.tab) return "next-field";
|
|
722
|
-
if (key.ctrl && input === "s") return "skip";
|
|
723
|
-
return null;
|
|
724
|
-
}
|
|
725
|
-
function nextField(field) {
|
|
726
|
-
return FIELDS[(FIELDS.indexOf(field) + 1) % FIELDS.length];
|
|
727
|
-
}
|
|
728
|
-
function toConfiguredHost(host) {
|
|
729
|
-
const value = (host ?? "").trim().replace(/\/+$/, "");
|
|
730
|
-
return value === "" ? DEFAULT_HOST : value.replace(/^https:\/\//i, "");
|
|
731
|
-
}
|
|
732
|
-
function toApiHost(host) {
|
|
733
|
-
const value = host.trim().replace(/\/+$/, "");
|
|
734
|
-
if (value === "") return `https://${DEFAULT_HOST}`;
|
|
735
|
-
return /^[a-z][a-z\d+\-.]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
736
|
-
}
|
|
737
|
-
function normalize(values) {
|
|
738
|
-
return {
|
|
739
|
-
spaceId: values.spaceId.trim(),
|
|
740
|
-
environmentId: values.environmentId.trim(),
|
|
741
|
-
cmaToken: values.cmaToken.trim(),
|
|
742
|
-
host: toConfiguredHost(values.host)
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
function missingField(values) {
|
|
746
|
-
return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
|
|
747
|
-
}
|
|
748
|
-
function isUnchanged(current, initial) {
|
|
749
|
-
return FIELDS.every((field) => current[field] === initial[field]);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
753
|
-
var CREDENTIALS_CONTROLS = [
|
|
754
|
-
{ keys: "Enter", label: "Next field / Continue" },
|
|
755
|
-
{ keys: "Tab", label: "Switch field" },
|
|
756
|
-
{ keys: "Ctrl+S", label: "Skip (no push)" },
|
|
757
|
-
{ keys: "Esc", label: "Back" }
|
|
758
|
-
];
|
|
759
|
-
function useCredentialsControls(handlers) {
|
|
760
|
-
useInput6((input, key) => {
|
|
761
|
-
if (handlers.disabled) return;
|
|
762
|
-
const action = keyAction2(input, key);
|
|
763
|
-
if (action === "back") handlers.onBack();
|
|
764
|
-
else if (action === "next-field") handlers.onNextField();
|
|
765
|
-
else if (action === "skip") handlers.onSkip();
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts
|
|
770
|
-
var USER_AGENT = "app contentful.experience-design-system-cli";
|
|
771
|
-
function headers(token) {
|
|
772
|
-
return { Authorization: `Bearer ${token}`, "X-Contentful-User-Agent": USER_AGENT };
|
|
773
|
-
}
|
|
774
|
-
function isApsDenial(body) {
|
|
775
|
-
try {
|
|
776
|
-
const id = JSON.parse(body).sys?.id;
|
|
777
|
-
return id === "NotFound" || id === "AccessDenied";
|
|
778
|
-
} catch {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
function messageFrom(body) {
|
|
783
|
-
try {
|
|
784
|
-
const message = JSON.parse(body).message;
|
|
785
|
-
return typeof message === "string" && message !== "" ? message : void 0;
|
|
786
|
-
} catch {
|
|
787
|
-
return void 0;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
async function validateCredentials(values) {
|
|
791
|
-
const base = toApiHost(values.host);
|
|
792
|
-
let me;
|
|
793
|
-
try {
|
|
794
|
-
me = await fetch(`${base}/users/me`, { headers: headers(values.cmaToken) });
|
|
795
|
-
} catch (error) {
|
|
796
|
-
return { ok: false, error: `Could not reach ${base}: ${error instanceof Error ? error.message : String(error)}` };
|
|
797
|
-
}
|
|
798
|
-
if (me.status === 401) return { ok: false, error: "CMA token is invalid or revoked." };
|
|
799
|
-
if (!me.ok) return { ok: false, error: `Unexpected error validating the token (${me.status}).` };
|
|
800
|
-
let preflight;
|
|
801
|
-
try {
|
|
802
|
-
preflight = await fetch(
|
|
803
|
-
`${base}/spaces/${values.spaceId}/environments/${values.environmentId}/design_systems/preflight`,
|
|
804
|
-
{ headers: headers(values.cmaToken) }
|
|
805
|
-
);
|
|
806
|
-
} catch {
|
|
807
|
-
return { ok: true };
|
|
808
|
-
}
|
|
809
|
-
if (preflight.ok || preflight.status >= 500) return { ok: true };
|
|
810
|
-
const body = await preflight.text();
|
|
811
|
-
if (preflight.status === 404 && !isApsDenial(body)) return { ok: true };
|
|
812
|
-
const detail = messageFrom(body);
|
|
813
|
-
if (preflight.status === 403) {
|
|
814
|
-
return { ok: false, error: `Access denied. ${detail ?? "Your token cannot write design system components here."}` };
|
|
815
|
-
}
|
|
816
|
-
if (preflight.status === 404) {
|
|
817
|
-
return {
|
|
818
|
-
ok: false,
|
|
819
|
-
error: `Not found. Check the space ID, environment and API host.${detail ? ` (${detail})` : ""}`
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
return { ok: false, error: `Credential check failed (${preflight.status}).${detail ? ` ${detail}` : ""}` };
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
826
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
827
|
-
var LABELS = {
|
|
828
|
-
spaceId: "Space ID",
|
|
829
|
-
environmentId: "Environment",
|
|
830
|
-
cmaToken: "CMA Token",
|
|
831
|
-
host: "API Host"
|
|
832
|
-
};
|
|
833
|
-
function CredentialsScreen({
|
|
834
|
-
onDone,
|
|
835
|
-
onBack,
|
|
836
|
-
initial = {},
|
|
837
|
-
validate = validateCredentials
|
|
838
|
-
}) {
|
|
839
|
-
const initialValues = useRef(
|
|
840
|
-
normalize({
|
|
841
|
-
spaceId: initial.spaceId ?? "",
|
|
842
|
-
environmentId: initial.environmentId || "master",
|
|
843
|
-
cmaToken: initial.cmaToken ?? "",
|
|
844
|
-
host: initial.host ?? ""
|
|
845
|
-
})
|
|
846
|
-
).current;
|
|
847
|
-
const [values, setValues] = useState6(initialValues);
|
|
848
|
-
const [active, setActive] = useState6("spaceId");
|
|
849
|
-
const [error, setError] = useState6(null);
|
|
850
|
-
const [validating, setValidating] = useState6(false);
|
|
851
|
-
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
852
|
-
useCredentialsControls({
|
|
853
|
-
disabled: validating,
|
|
854
|
-
onBack,
|
|
855
|
-
onNextField: () => setActive(nextField),
|
|
856
|
-
onSkip: () => onDone({ skipped: true })
|
|
857
|
-
});
|
|
858
|
-
const change = (field) => (value) => {
|
|
859
|
-
setValues((current) => ({ ...current, [field]: value }));
|
|
860
|
-
setError(null);
|
|
861
|
-
};
|
|
862
|
-
const submit = async (field) => {
|
|
863
|
-
if (field !== "host") {
|
|
864
|
-
setActive(nextField(field));
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
const credentials = normalize(values);
|
|
868
|
-
if (missingField(credentials)) {
|
|
869
|
-
setError("Space ID, environment and CMA token are all required.");
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
setValidating(true);
|
|
873
|
-
const result = await validate(credentials);
|
|
874
|
-
setValidating(false);
|
|
875
|
-
if (result.ok) onDone({ skipped: false, credentials });
|
|
876
|
-
else setError(result.error);
|
|
877
|
-
};
|
|
878
|
-
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
879
|
-
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
880
|
-
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Contentful credentials" }),
|
|
881
|
-
/* @__PURE__ */ jsx7(Text7, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
882
|
-
!prefilled && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
883
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Used to align suggestions with what already exists in the space and to push your import at the end. Skipping runs without space context and disables push." }),
|
|
884
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
885
|
-
] })
|
|
886
|
-
] }),
|
|
887
|
-
/* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: FIELDS.map((field) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
888
|
-
/* @__PURE__ */ jsx7(Text7, { color: active === field ? PALETTE.accent : void 0, children: "?" }),
|
|
889
|
-
/* @__PURE__ */ jsxs6(Text7, { bold: active === field, children: [
|
|
890
|
-
LABELS[field],
|
|
891
|
-
":"
|
|
892
|
-
] }),
|
|
893
|
-
/* @__PURE__ */ jsx7(
|
|
894
|
-
TextInput3,
|
|
895
|
-
{
|
|
896
|
-
value: values[field],
|
|
897
|
-
focus: active === field && !validating,
|
|
898
|
-
mask: field === "cmaToken" ? "\u2022" : void 0,
|
|
899
|
-
placeholder: field === "host" ? DEFAULT_HOST : void 0,
|
|
900
|
-
onChange: change(field),
|
|
901
|
-
onSubmit: () => void submit(field)
|
|
902
|
-
}
|
|
903
|
-
)
|
|
904
|
-
] }, field)) }),
|
|
905
|
-
active === "host" && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Default: api.contentful.com \xB7 EU spaces: api.eu.contentful.com" }),
|
|
906
|
-
error && /* @__PURE__ */ jsxs6(Text7, { color: PALETTE.error, children: [
|
|
907
|
-
"\u2717 ",
|
|
908
|
-
error
|
|
909
|
-
] }),
|
|
910
|
-
validating && /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Validating credentials..." }),
|
|
911
|
-
!validating && !error && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Changed values are saved after they validate." }),
|
|
912
|
-
/* @__PURE__ */ jsx7(Box6, { marginTop: 1, gap: 3, children: CREDENTIALS_CONTROLS.map((control) => /* @__PURE__ */ jsxs6(Text7, { dimColor: true, children: [
|
|
913
|
-
"[",
|
|
914
|
-
control.keys,
|
|
915
|
-
"] ",
|
|
916
|
-
control.label
|
|
917
|
-
] }, control.keys)) })
|
|
918
|
-
] });
|
|
919
|
-
}
|
|
920
|
-
|
|
921
708
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
922
709
|
import { spawn } from "node:child_process";
|
|
923
710
|
|
|
@@ -955,8 +742,7 @@ async function spawnV1Import(options = {}) {
|
|
|
955
742
|
const args = buildArgs(options);
|
|
956
743
|
return new Promise((resolvePromise) => {
|
|
957
744
|
const child = spawn("node", [cliPath, ...args], {
|
|
958
|
-
stdio: "inherit"
|
|
959
|
-
env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
|
|
745
|
+
stdio: "inherit"
|
|
960
746
|
});
|
|
961
747
|
child.on("close", (code) => {
|
|
962
748
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -986,8 +772,8 @@ function startReadingTerminal() {
|
|
|
986
772
|
}
|
|
987
773
|
|
|
988
774
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
989
|
-
import { useEffect as useEffect4, useState as
|
|
990
|
-
import { Box as
|
|
775
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
776
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
991
777
|
|
|
992
778
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
993
779
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -1197,18 +983,18 @@ async function readHelpInfo() {
|
|
|
1197
983
|
}
|
|
1198
984
|
|
|
1199
985
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
1200
|
-
import { Fragment
|
|
986
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1201
987
|
function Section({ title, rows }) {
|
|
1202
|
-
return /* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
rows.map((row) => /* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
989
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
|
|
990
|
+
rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
991
|
+
/* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: row.label }) }),
|
|
992
|
+
/* @__PURE__ */ jsx7(Text7, { children: row.value })
|
|
1207
993
|
] }, row.label))
|
|
1208
994
|
] });
|
|
1209
995
|
}
|
|
1210
996
|
function HelpScreen({ onDone }) {
|
|
1211
|
-
const [info, setInfo] =
|
|
997
|
+
const [info, setInfo] = useState6();
|
|
1212
998
|
useEffect4(() => {
|
|
1213
999
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1214
1000
|
void readHelpInfo().then(setInfo);
|
|
@@ -1217,7 +1003,7 @@ function HelpScreen({ onDone }) {
|
|
|
1217
1003
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1218
1004
|
onDone();
|
|
1219
1005
|
};
|
|
1220
|
-
|
|
1006
|
+
useInput6((input, key) => {
|
|
1221
1007
|
if (key.return) {
|
|
1222
1008
|
leave("saved");
|
|
1223
1009
|
return;
|
|
@@ -1227,14 +1013,14 @@ function HelpScreen({ onDone }) {
|
|
|
1227
1013
|
return;
|
|
1228
1014
|
}
|
|
1229
1015
|
});
|
|
1230
|
-
return /* @__PURE__ */
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
info ? /* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
] }) : /* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1016
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1017
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
|
|
1018
|
+
info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1019
|
+
/* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1020
|
+
/* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1021
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
|
|
1022
|
+
] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
|
|
1023
|
+
/* @__PURE__ */ jsx7(
|
|
1238
1024
|
ControlHints,
|
|
1239
1025
|
{
|
|
1240
1026
|
hints: [
|
|
@@ -1247,20 +1033,20 @@ function HelpScreen({ onDone }) {
|
|
|
1247
1033
|
}
|
|
1248
1034
|
|
|
1249
1035
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1250
|
-
import { useState as
|
|
1251
|
-
import { Box as
|
|
1252
|
-
import { jsx as
|
|
1036
|
+
import { useState as useState7 } from "react";
|
|
1037
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1038
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1253
1039
|
function SettingsScreen({
|
|
1254
1040
|
onNavigate,
|
|
1255
1041
|
onBack
|
|
1256
1042
|
}) {
|
|
1257
|
-
const [focusIdx, setFocusIdx] =
|
|
1043
|
+
const [focusIdx, setFocusIdx] = useState7(0);
|
|
1258
1044
|
const items = [
|
|
1259
1045
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1260
1046
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1261
1047
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1262
1048
|
];
|
|
1263
|
-
|
|
1049
|
+
useInput7((input, key) => {
|
|
1264
1050
|
if (key.upArrow) {
|
|
1265
1051
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1266
1052
|
return;
|
|
@@ -1280,15 +1066,15 @@ function SettingsScreen({
|
|
|
1280
1066
|
onBack();
|
|
1281
1067
|
}
|
|
1282
1068
|
});
|
|
1283
|
-
return /* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1069
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1070
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
|
|
1071
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1072
|
+
items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1287
1073
|
i === focusIdx ? "> " : " ",
|
|
1288
1074
|
item.label
|
|
1289
1075
|
] }, item.label)),
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1077
|
+
/* @__PURE__ */ jsx8(
|
|
1292
1078
|
ControlHints,
|
|
1293
1079
|
{
|
|
1294
1080
|
hints: [
|
|
@@ -1302,9 +1088,9 @@ function SettingsScreen({
|
|
|
1302
1088
|
}
|
|
1303
1089
|
|
|
1304
1090
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1305
|
-
import { useEffect as useEffect5, useState as
|
|
1306
|
-
import { Box as
|
|
1307
|
-
import
|
|
1091
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1092
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1093
|
+
import TextInput3 from "ink-text-input";
|
|
1308
1094
|
|
|
1309
1095
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
1310
1096
|
var readV1Store = readSettings;
|
|
@@ -1335,7 +1121,7 @@ async function writeCredentials(config) {
|
|
|
1335
1121
|
}
|
|
1336
1122
|
|
|
1337
1123
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1338
|
-
import { Fragment as
|
|
1124
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1339
1125
|
var FIELD_ORDER = [
|
|
1340
1126
|
"spaceId",
|
|
1341
1127
|
"environmentId",
|
|
@@ -1363,13 +1149,13 @@ var FIELD_LABELS = {
|
|
|
1363
1149
|
defaultTokenFile: "Default token file (optional)"
|
|
1364
1150
|
};
|
|
1365
1151
|
function ConfigurationScreen({ onDone }) {
|
|
1366
|
-
const [stage, setStage] =
|
|
1367
|
-
const [config, setConfig] =
|
|
1368
|
-
const [activeField, setActiveField] =
|
|
1369
|
-
const [notice, setNotice] =
|
|
1370
|
-
const [lastSaved, setLastSaved] =
|
|
1371
|
-
const [editing, setEditing] =
|
|
1372
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1152
|
+
const [stage, setStage] = useState8("loading");
|
|
1153
|
+
const [config, setConfig] = useState8(null);
|
|
1154
|
+
const [activeField, setActiveField] = useState8("spaceId");
|
|
1155
|
+
const [notice, setNotice] = useState8(null);
|
|
1156
|
+
const [lastSaved, setLastSaved] = useState8(null);
|
|
1157
|
+
const [editing, setEditing] = useState8(false);
|
|
1158
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
1373
1159
|
useEffect5(() => {
|
|
1374
1160
|
readCredentials().then((cfg) => {
|
|
1375
1161
|
setConfig(cfg);
|
|
@@ -1410,7 +1196,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1410
1196
|
);
|
|
1411
1197
|
onDone();
|
|
1412
1198
|
}
|
|
1413
|
-
|
|
1199
|
+
useInput8((input, key) => {
|
|
1414
1200
|
if (stage === "loading" || stage === "saving") return;
|
|
1415
1201
|
if (editing) {
|
|
1416
1202
|
if (key.escape) {
|
|
@@ -1447,46 +1233,46 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1447
1233
|
}
|
|
1448
1234
|
});
|
|
1449
1235
|
if (stage === "loading") {
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1237
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1238
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1239
|
+
/* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
|
|
1454
1240
|
] });
|
|
1455
1241
|
}
|
|
1456
|
-
return /* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
/* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1243
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1244
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1245
|
+
/* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1460
1246
|
const isActive = activeField === field;
|
|
1461
1247
|
const value = fieldValue(field);
|
|
1462
1248
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1463
|
-
return /* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
1250
|
+
/* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1251
|
+
/* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
|
|
1466
1252
|
FIELD_LABELS[field],
|
|
1467
1253
|
":"
|
|
1468
1254
|
] }),
|
|
1469
|
-
isActive && editing ? /* @__PURE__ */
|
|
1470
|
-
|
|
1255
|
+
isActive && editing ? /* @__PURE__ */ jsx9(
|
|
1256
|
+
TextInput3,
|
|
1471
1257
|
{
|
|
1472
1258
|
value,
|
|
1473
1259
|
onChange: (next) => setFieldValue(field, next),
|
|
1474
1260
|
onSubmit: () => setEditing(false),
|
|
1475
1261
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1476
1262
|
}
|
|
1477
|
-
) : /* @__PURE__ */
|
|
1263
|
+
) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "(empty)" }) })
|
|
1478
1264
|
] }, field);
|
|
1479
1265
|
}) }),
|
|
1480
|
-
notice && /* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1266
|
+
notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1267
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1268
|
+
/* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1483
1269
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1484
1270
|
" ",
|
|
1485
1271
|
notice.text
|
|
1486
1272
|
] })
|
|
1487
1273
|
] }),
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1274
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1275
|
+
/* @__PURE__ */ jsx9(
|
|
1490
1276
|
ControlHints,
|
|
1491
1277
|
{
|
|
1492
1278
|
hints: editing ? [
|
|
@@ -1507,8 +1293,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1507
1293
|
}
|
|
1508
1294
|
|
|
1509
1295
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1510
|
-
import { useEffect as useEffect6, useState as
|
|
1511
|
-
import { Box as
|
|
1296
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1297
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1512
1298
|
|
|
1513
1299
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
1514
1300
|
async function readAnalyticsSetting() {
|
|
@@ -1526,10 +1312,10 @@ async function writeAnalyticsSetting(setting) {
|
|
|
1526
1312
|
}
|
|
1527
1313
|
|
|
1528
1314
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1529
|
-
import { Fragment as
|
|
1315
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1530
1316
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1531
|
-
const [loading, setLoading] =
|
|
1532
|
-
const [enabled, setEnabled] =
|
|
1317
|
+
const [loading, setLoading] = useState9(true);
|
|
1318
|
+
const [enabled, setEnabled] = useState9(true);
|
|
1533
1319
|
useEffect6(() => {
|
|
1534
1320
|
readAnalyticsSetting().then((setting) => {
|
|
1535
1321
|
setEnabled(setting.enabled);
|
|
@@ -1542,7 +1328,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1542
1328
|
});
|
|
1543
1329
|
});
|
|
1544
1330
|
}, []);
|
|
1545
|
-
|
|
1331
|
+
useInput9((input, key) => {
|
|
1546
1332
|
if (loading) return;
|
|
1547
1333
|
if (key.return || input === " ") {
|
|
1548
1334
|
setEnabled((current) => {
|
|
@@ -1557,21 +1343,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1557
1343
|
onDone();
|
|
1558
1344
|
}
|
|
1559
1345
|
});
|
|
1560
|
-
return /* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
loading ? /* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1346
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1347
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1348
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1349
|
+
loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1350
|
+
/* @__PURE__ */ jsxs9(Text10, { children: [
|
|
1565
1351
|
"Share anonymous usage data:",
|
|
1566
1352
|
" ",
|
|
1567
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1568
1354
|
] }),
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1356
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1357
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1572
1358
|
] }),
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1360
|
+
/* @__PURE__ */ jsx10(
|
|
1575
1361
|
ControlHints,
|
|
1576
1362
|
{
|
|
1577
1363
|
hints: [
|
|
@@ -1584,12 +1370,12 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1584
1370
|
}
|
|
1585
1371
|
|
|
1586
1372
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1587
|
-
import { useEffect as useEffect7, useState as
|
|
1588
|
-
import { Box as
|
|
1589
|
-
import { jsx as
|
|
1373
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1374
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1375
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1590
1376
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
1591
1377
|
function UpgradeScreen({ onDone }) {
|
|
1592
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1378
|
+
const [upgradeCheck, setUpgradeCheck] = useState10();
|
|
1593
1379
|
useEffect7(() => {
|
|
1594
1380
|
startDebugRun({
|
|
1595
1381
|
flow: "upgrade",
|
|
@@ -1599,7 +1385,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1599
1385
|
});
|
|
1600
1386
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1601
1387
|
}, []);
|
|
1602
|
-
|
|
1388
|
+
useInput10((_input, key) => {
|
|
1603
1389
|
if (key.return) {
|
|
1604
1390
|
void finishDebugRun({
|
|
1605
1391
|
outputs: upgradeCheck ?? {},
|
|
@@ -1610,12 +1396,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1610
1396
|
return;
|
|
1611
1397
|
}
|
|
1612
1398
|
});
|
|
1613
|
-
return /* @__PURE__ */
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1400
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
|
|
1401
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1616
1402
|
renderBody(upgradeCheck),
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1403
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1404
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
|
|
1619
1405
|
FOCUS_MARKER,
|
|
1620
1406
|
" Go Back"
|
|
1621
1407
|
] })
|
|
@@ -1623,44 +1409,44 @@ function UpgradeScreen({ onDone }) {
|
|
|
1623
1409
|
}
|
|
1624
1410
|
function renderBody(upgradeCheck) {
|
|
1625
1411
|
if (!upgradeCheck) {
|
|
1626
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1627
1413
|
}
|
|
1628
1414
|
if (upgradeCheck.status === "error") {
|
|
1629
|
-
return /* @__PURE__ */
|
|
1415
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1630
1416
|
}
|
|
1631
1417
|
if (upgradeCheck.status === "up-to-date") {
|
|
1632
|
-
return /* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
|
|
1633
1419
|
"You're already on the latest version (v",
|
|
1634
1420
|
upgradeCheck.current,
|
|
1635
1421
|
")."
|
|
1636
1422
|
] });
|
|
1637
1423
|
}
|
|
1638
|
-
return /* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
1425
|
+
/* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
1426
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
|
|
1641
1427
|
"v",
|
|
1642
1428
|
upgradeCheck.latest
|
|
1643
1429
|
] }),
|
|
1644
1430
|
" ",
|
|
1645
1431
|
"is available (you're on ",
|
|
1646
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
|
|
1647
1433
|
"v",
|
|
1648
1434
|
upgradeCheck.current
|
|
1649
1435
|
] }),
|
|
1650
1436
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1651
1437
|
] }),
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1439
|
+
/* @__PURE__ */ jsx11(Box10, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx11(Text11, { bold: true, children: cmd }, cmd)) })
|
|
1654
1440
|
] });
|
|
1655
1441
|
}
|
|
1656
1442
|
|
|
1657
1443
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1658
|
-
import { useEffect as useEffect8, useState as
|
|
1659
|
-
import { Box as
|
|
1660
|
-
import { jsx as
|
|
1444
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
1445
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1446
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1661
1447
|
function DebugModeScreen({ onDone }) {
|
|
1662
|
-
const [loading, setLoading] =
|
|
1663
|
-
const [enabled, setEnabled] =
|
|
1448
|
+
const [loading, setLoading] = useState11(true);
|
|
1449
|
+
const [enabled, setEnabled] = useState11(true);
|
|
1664
1450
|
useEffect8(() => {
|
|
1665
1451
|
readDebugModeSetting().then((setting) => {
|
|
1666
1452
|
setEnabled(setting.enabled);
|
|
@@ -1673,7 +1459,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1673
1459
|
});
|
|
1674
1460
|
});
|
|
1675
1461
|
}, []);
|
|
1676
|
-
|
|
1462
|
+
useInput11((input, key) => {
|
|
1677
1463
|
if (loading) return;
|
|
1678
1464
|
if (key.return || input === " ") {
|
|
1679
1465
|
setEnabled((current) => {
|
|
@@ -1688,16 +1474,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1688
1474
|
onDone();
|
|
1689
1475
|
}
|
|
1690
1476
|
});
|
|
1691
|
-
return /* @__PURE__ */
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
loading ? /* @__PURE__ */
|
|
1477
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1478
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1479
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1480
|
+
loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
1695
1481
|
"Debug logging:",
|
|
1696
1482
|
" ",
|
|
1697
|
-
/* @__PURE__ */
|
|
1483
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1698
1484
|
] }),
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1485
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1486
|
+
/* @__PURE__ */ jsx12(
|
|
1701
1487
|
ControlHints,
|
|
1702
1488
|
{
|
|
1703
1489
|
hints: [
|
|
@@ -1710,38 +1496,28 @@ function DebugModeScreen({ onDone }) {
|
|
|
1710
1496
|
}
|
|
1711
1497
|
|
|
1712
1498
|
// packages/experience-design-system-cli/app.tsx
|
|
1713
|
-
import { Fragment as
|
|
1499
|
+
import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
|
|
1714
1500
|
function App({ onLaunchImport, importExitCode }) {
|
|
1715
1501
|
const returnedFromImport = importExitCode !== void 0;
|
|
1716
|
-
const [screen, setScreen] =
|
|
1717
|
-
const [showImportResult, setShowImportResult] =
|
|
1718
|
-
const [projectPath, setProjectPath] =
|
|
1719
|
-
const [tokensPath, setTokensPath] =
|
|
1720
|
-
const [
|
|
1721
|
-
const [importDefaults, setImportDefaults] = useState13();
|
|
1502
|
+
const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
|
|
1503
|
+
const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
|
|
1504
|
+
const [projectPath, setProjectPath] = useState12();
|
|
1505
|
+
const [tokensPath, setTokensPath] = useState12();
|
|
1506
|
+
const [importDefaults, setImportDefaults] = useState12();
|
|
1722
1507
|
useEffect9(() => {
|
|
1723
1508
|
if (screen !== "import") {
|
|
1724
1509
|
setImportDefaults(void 0);
|
|
1725
1510
|
return;
|
|
1726
1511
|
}
|
|
1727
1512
|
void readCredentials().then(
|
|
1728
|
-
(saved) => setImportDefaults({
|
|
1729
|
-
componentDir: saved.defaultComponentDir ?? "",
|
|
1730
|
-
tokenFile: saved.defaultTokenFile ?? "",
|
|
1731
|
-
credentials: saved
|
|
1732
|
-
})
|
|
1513
|
+
(saved) => setImportDefaults({ componentDir: saved.defaultComponentDir ?? "", tokenFile: saved.defaultTokenFile ?? "" })
|
|
1733
1514
|
);
|
|
1734
1515
|
}, [screen]);
|
|
1735
|
-
const finishCredentials = async (result, project, tokens) => {
|
|
1736
|
-
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
1737
|
-
onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
|
|
1738
|
-
};
|
|
1739
1516
|
const goToStart = () => setScreen("start");
|
|
1740
1517
|
const goToSettings = () => setScreen("settings");
|
|
1741
1518
|
const resetImport = () => {
|
|
1742
1519
|
setProjectPath(void 0);
|
|
1743
1520
|
setTokensPath(void 0);
|
|
1744
|
-
setPathConfirmed(false);
|
|
1745
1521
|
};
|
|
1746
1522
|
const finishImportResult = () => {
|
|
1747
1523
|
setShowImportResult(false);
|
|
@@ -1754,13 +1530,13 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1754
1530
|
};
|
|
1755
1531
|
switch (screen) {
|
|
1756
1532
|
case "import":
|
|
1757
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1758
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1533
|
+
if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1534
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
|
|
1759
1535
|
if (projectPath === void 0) {
|
|
1760
|
-
return /* @__PURE__ */
|
|
1536
|
+
return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1761
1537
|
}
|
|
1762
1538
|
if (tokensPath === void 0) {
|
|
1763
|
-
return /* @__PURE__ */
|
|
1539
|
+
return /* @__PURE__ */ jsx13(
|
|
1764
1540
|
TokenInputScreen,
|
|
1765
1541
|
{
|
|
1766
1542
|
initialPath: importDefaults.tokenFile,
|
|
@@ -1769,46 +1545,36 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1769
1545
|
}
|
|
1770
1546
|
);
|
|
1771
1547
|
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
PathValidationScreen,
|
|
1775
|
-
{
|
|
1776
|
-
projectPath,
|
|
1777
|
-
onConfirm: () => setPathConfirmed(true),
|
|
1778
|
-
onChangePath: resetImport,
|
|
1779
|
-
onBack: () => setTokensPath(void 0)
|
|
1780
|
-
}
|
|
1781
|
-
);
|
|
1782
|
-
}
|
|
1783
|
-
return /* @__PURE__ */ jsx14(
|
|
1784
|
-
CredentialsScreen,
|
|
1548
|
+
return /* @__PURE__ */ jsx13(
|
|
1549
|
+
PathValidationScreen,
|
|
1785
1550
|
{
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1551
|
+
projectPath,
|
|
1552
|
+
onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
|
|
1553
|
+
onChangePath: resetImport,
|
|
1554
|
+
onBack: () => setTokensPath(void 0)
|
|
1789
1555
|
}
|
|
1790
1556
|
);
|
|
1791
1557
|
case "help":
|
|
1792
|
-
return /* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
|
|
1793
1559
|
case "upgrade":
|
|
1794
|
-
return /* @__PURE__ */
|
|
1560
|
+
return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
|
|
1795
1561
|
case "settings":
|
|
1796
|
-
return /* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1797
1563
|
case "settings-configuration":
|
|
1798
|
-
return /* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
|
|
1799
1565
|
case "settings-opt-in-analytics":
|
|
1800
|
-
return /* @__PURE__ */
|
|
1566
|
+
return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1801
1567
|
case "settings-debug-mode":
|
|
1802
|
-
return /* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
|
|
1803
1569
|
case "start":
|
|
1804
|
-
return /* @__PURE__ */
|
|
1570
|
+
return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
|
|
1805
1571
|
}
|
|
1806
1572
|
}
|
|
1807
1573
|
var CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1808
1574
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1809
1575
|
let requestedImport;
|
|
1810
1576
|
const instance = renderApp(
|
|
1811
|
-
/* @__PURE__ */
|
|
1577
|
+
/* @__PURE__ */ jsx13(
|
|
1812
1578
|
App,
|
|
1813
1579
|
{
|
|
1814
1580
|
importExitCode,
|