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