@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/index.js
CHANGED
|
@@ -847,245 +847,6 @@ var init_screen3 = __esm({
|
|
|
847
847
|
}
|
|
848
848
|
});
|
|
849
849
|
|
|
850
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
851
|
-
function keyAction2(input, key) {
|
|
852
|
-
if (key.escape) return "back";
|
|
853
|
-
if (key.tab) return "next-field";
|
|
854
|
-
if (key.ctrl && input === "s") return "skip";
|
|
855
|
-
return null;
|
|
856
|
-
}
|
|
857
|
-
function nextField(field) {
|
|
858
|
-
return FIELDS[(FIELDS.indexOf(field) + 1) % FIELDS.length];
|
|
859
|
-
}
|
|
860
|
-
function toConfiguredHost(host) {
|
|
861
|
-
const value = (host ?? "").trim().replace(/\/+$/, "");
|
|
862
|
-
return value === "" ? DEFAULT_HOST : value.replace(/^https:\/\//i, "");
|
|
863
|
-
}
|
|
864
|
-
function toApiHost(host) {
|
|
865
|
-
const value = host.trim().replace(/\/+$/, "");
|
|
866
|
-
if (value === "") return `https://${DEFAULT_HOST}`;
|
|
867
|
-
return /^[a-z][a-z\d+\-.]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
868
|
-
}
|
|
869
|
-
function normalize(values) {
|
|
870
|
-
return {
|
|
871
|
-
spaceId: values.spaceId.trim(),
|
|
872
|
-
environmentId: values.environmentId.trim(),
|
|
873
|
-
cmaToken: values.cmaToken.trim(),
|
|
874
|
-
host: toConfiguredHost(values.host)
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
function missingField(values) {
|
|
878
|
-
return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
|
|
879
|
-
}
|
|
880
|
-
function isUnchanged(current, initial) {
|
|
881
|
-
return FIELDS.every((field) => current[field] === initial[field]);
|
|
882
|
-
}
|
|
883
|
-
var FIELDS, DEFAULT_HOST;
|
|
884
|
-
var init_logic4 = __esm({
|
|
885
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
|
|
886
|
-
"use strict";
|
|
887
|
-
FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
888
|
-
DEFAULT_HOST = "api.contentful.com";
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
|
|
892
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
893
|
-
import { useInput as useInput6 } from "ink";
|
|
894
|
-
function useCredentialsControls(handlers) {
|
|
895
|
-
useInput6((input, key) => {
|
|
896
|
-
if (handlers.disabled) return;
|
|
897
|
-
const action = keyAction2(input, key);
|
|
898
|
-
if (action === "back") handlers.onBack();
|
|
899
|
-
else if (action === "next-field") handlers.onNextField();
|
|
900
|
-
else if (action === "skip") handlers.onSkip();
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
var CREDENTIALS_CONTROLS;
|
|
904
|
-
var init_controls4 = __esm({
|
|
905
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts"() {
|
|
906
|
-
"use strict";
|
|
907
|
-
init_logic4();
|
|
908
|
-
CREDENTIALS_CONTROLS = [
|
|
909
|
-
{ keys: "Enter", label: "Next field / Continue" },
|
|
910
|
-
{ keys: "Tab", label: "Switch field" },
|
|
911
|
-
{ keys: "Ctrl+S", label: "Skip (no push)" },
|
|
912
|
-
{ keys: "Esc", label: "Back" }
|
|
913
|
-
];
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
|
|
917
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts
|
|
918
|
-
function headers(token) {
|
|
919
|
-
return { Authorization: `Bearer ${token}`, "X-Contentful-User-Agent": USER_AGENT };
|
|
920
|
-
}
|
|
921
|
-
function isApsDenial(body) {
|
|
922
|
-
try {
|
|
923
|
-
const id = JSON.parse(body).sys?.id;
|
|
924
|
-
return id === "NotFound" || id === "AccessDenied";
|
|
925
|
-
} catch {
|
|
926
|
-
return false;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
function messageFrom(body) {
|
|
930
|
-
try {
|
|
931
|
-
const message = JSON.parse(body).message;
|
|
932
|
-
return typeof message === "string" && message !== "" ? message : void 0;
|
|
933
|
-
} catch {
|
|
934
|
-
return void 0;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
async function validateCredentials(values) {
|
|
938
|
-
const base = toApiHost(values.host);
|
|
939
|
-
let me;
|
|
940
|
-
try {
|
|
941
|
-
me = await fetch(`${base}/users/me`, { headers: headers(values.cmaToken) });
|
|
942
|
-
} catch (error) {
|
|
943
|
-
return { ok: false, error: `Could not reach ${base}: ${error instanceof Error ? error.message : String(error)}` };
|
|
944
|
-
}
|
|
945
|
-
if (me.status === 401) return { ok: false, error: "CMA token is invalid or revoked." };
|
|
946
|
-
if (!me.ok) return { ok: false, error: `Unexpected error validating the token (${me.status}).` };
|
|
947
|
-
let preflight;
|
|
948
|
-
try {
|
|
949
|
-
preflight = await fetch(
|
|
950
|
-
`${base}/spaces/${values.spaceId}/environments/${values.environmentId}/design_systems/preflight`,
|
|
951
|
-
{ headers: headers(values.cmaToken) }
|
|
952
|
-
);
|
|
953
|
-
} catch {
|
|
954
|
-
return { ok: true };
|
|
955
|
-
}
|
|
956
|
-
if (preflight.ok || preflight.status >= 500) return { ok: true };
|
|
957
|
-
const body = await preflight.text();
|
|
958
|
-
if (preflight.status === 404 && !isApsDenial(body)) return { ok: true };
|
|
959
|
-
const detail = messageFrom(body);
|
|
960
|
-
if (preflight.status === 403) {
|
|
961
|
-
return { ok: false, error: `Access denied. ${detail ?? "Your token cannot write design system components here."}` };
|
|
962
|
-
}
|
|
963
|
-
if (preflight.status === 404) {
|
|
964
|
-
return {
|
|
965
|
-
ok: false,
|
|
966
|
-
error: `Not found. Check the space ID, environment and API host.${detail ? ` (${detail})` : ""}`
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
return { ok: false, error: `Credential check failed (${preflight.status}).${detail ? ` ${detail}` : ""}` };
|
|
970
|
-
}
|
|
971
|
-
var USER_AGENT;
|
|
972
|
-
var init_validate = __esm({
|
|
973
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts"() {
|
|
974
|
-
"use strict";
|
|
975
|
-
init_logic4();
|
|
976
|
-
USER_AGENT = "app contentful.experience-design-system-cli";
|
|
977
|
-
}
|
|
978
|
-
});
|
|
979
|
-
|
|
980
|
-
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
981
|
-
import { useRef, useState as useState6 } from "react";
|
|
982
|
-
import { Box as Box6, Text as Text7 } from "ink";
|
|
983
|
-
import TextInput3 from "ink-text-input";
|
|
984
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
985
|
-
function CredentialsScreen({
|
|
986
|
-
onDone,
|
|
987
|
-
onBack,
|
|
988
|
-
initial = {},
|
|
989
|
-
validate = validateCredentials
|
|
990
|
-
}) {
|
|
991
|
-
const initialValues = useRef(
|
|
992
|
-
normalize({
|
|
993
|
-
spaceId: initial.spaceId ?? "",
|
|
994
|
-
environmentId: initial.environmentId || "master",
|
|
995
|
-
cmaToken: initial.cmaToken ?? "",
|
|
996
|
-
host: initial.host ?? ""
|
|
997
|
-
})
|
|
998
|
-
).current;
|
|
999
|
-
const [values, setValues] = useState6(initialValues);
|
|
1000
|
-
const [active, setActive] = useState6("spaceId");
|
|
1001
|
-
const [error, setError] = useState6(null);
|
|
1002
|
-
const [validating, setValidating] = useState6(false);
|
|
1003
|
-
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
1004
|
-
useCredentialsControls({
|
|
1005
|
-
disabled: validating,
|
|
1006
|
-
onBack,
|
|
1007
|
-
onNextField: () => setActive(nextField),
|
|
1008
|
-
onSkip: () => onDone({ skipped: true })
|
|
1009
|
-
});
|
|
1010
|
-
const change = (field) => (value) => {
|
|
1011
|
-
setValues((current) => ({ ...current, [field]: value }));
|
|
1012
|
-
setError(null);
|
|
1013
|
-
};
|
|
1014
|
-
const submit = async (field) => {
|
|
1015
|
-
if (field !== "host") {
|
|
1016
|
-
setActive(nextField(field));
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
const credentials = normalize(values);
|
|
1020
|
-
if (missingField(credentials)) {
|
|
1021
|
-
setError("Space ID, environment and CMA token are all required.");
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
setValidating(true);
|
|
1025
|
-
const result = await validate(credentials);
|
|
1026
|
-
setValidating(false);
|
|
1027
|
-
if (result.ok) onDone({ skipped: false, credentials });
|
|
1028
|
-
else setError(result.error);
|
|
1029
|
-
};
|
|
1030
|
-
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
1031
|
-
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1032
|
-
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Contentful credentials" }),
|
|
1033
|
-
/* @__PURE__ */ jsx7(Text7, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
1034
|
-
!prefilled && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1035
|
-
/* @__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." }),
|
|
1036
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
1037
|
-
] })
|
|
1038
|
-
] }),
|
|
1039
|
-
/* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: FIELDS.map((field) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
1040
|
-
/* @__PURE__ */ jsx7(Text7, { color: active === field ? PALETTE.accent : void 0, children: "?" }),
|
|
1041
|
-
/* @__PURE__ */ jsxs6(Text7, { bold: active === field, children: [
|
|
1042
|
-
LABELS[field],
|
|
1043
|
-
":"
|
|
1044
|
-
] }),
|
|
1045
|
-
/* @__PURE__ */ jsx7(
|
|
1046
|
-
TextInput3,
|
|
1047
|
-
{
|
|
1048
|
-
value: values[field],
|
|
1049
|
-
focus: active === field && !validating,
|
|
1050
|
-
mask: field === "cmaToken" ? "\u2022" : void 0,
|
|
1051
|
-
placeholder: field === "host" ? DEFAULT_HOST : void 0,
|
|
1052
|
-
onChange: change(field),
|
|
1053
|
-
onSubmit: () => void submit(field)
|
|
1054
|
-
}
|
|
1055
|
-
)
|
|
1056
|
-
] }, field)) }),
|
|
1057
|
-
active === "host" && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Default: api.contentful.com \xB7 EU spaces: api.eu.contentful.com" }),
|
|
1058
|
-
error && /* @__PURE__ */ jsxs6(Text7, { color: PALETTE.error, children: [
|
|
1059
|
-
"\u2717 ",
|
|
1060
|
-
error
|
|
1061
|
-
] }),
|
|
1062
|
-
validating && /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Validating credentials..." }),
|
|
1063
|
-
!validating && !error && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Changed values are saved after they validate." }),
|
|
1064
|
-
/* @__PURE__ */ jsx7(Box6, { marginTop: 1, gap: 3, children: CREDENTIALS_CONTROLS.map((control) => /* @__PURE__ */ jsxs6(Text7, { dimColor: true, children: [
|
|
1065
|
-
"[",
|
|
1066
|
-
control.keys,
|
|
1067
|
-
"] ",
|
|
1068
|
-
control.label
|
|
1069
|
-
] }, control.keys)) })
|
|
1070
|
-
] });
|
|
1071
|
-
}
|
|
1072
|
-
var LABELS;
|
|
1073
|
-
var init_screen4 = __esm({
|
|
1074
|
-
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
|
|
1075
|
-
"use strict";
|
|
1076
|
-
init_home_theme();
|
|
1077
|
-
init_controls4();
|
|
1078
|
-
init_logic4();
|
|
1079
|
-
init_validate();
|
|
1080
|
-
LABELS = {
|
|
1081
|
-
spaceId: "Space ID",
|
|
1082
|
-
environmentId: "Environment",
|
|
1083
|
-
cmaToken: "CMA Token",
|
|
1084
|
-
host: "API Host"
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
850
|
// packages/experience-design-system-cli/src/tui/import/steps/index.ts
|
|
1090
851
|
var init_steps = __esm({
|
|
1091
852
|
"packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
|
|
@@ -1093,7 +854,6 @@ var init_steps = __esm({
|
|
|
1093
854
|
init_screen();
|
|
1094
855
|
init_screen2();
|
|
1095
856
|
init_screen3();
|
|
1096
|
-
init_screen4();
|
|
1097
857
|
}
|
|
1098
858
|
});
|
|
1099
859
|
|
|
@@ -1114,8 +874,7 @@ async function spawnV1Import(options = {}) {
|
|
|
1114
874
|
const args = buildArgs(options);
|
|
1115
875
|
return new Promise((resolvePromise) => {
|
|
1116
876
|
const child = spawn3("node", [cliPath, ...args], {
|
|
1117
|
-
stdio: "inherit"
|
|
1118
|
-
env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
|
|
877
|
+
stdio: "inherit"
|
|
1119
878
|
});
|
|
1120
879
|
child.on("close", (code) => {
|
|
1121
880
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -1393,20 +1152,20 @@ var init_help_info = __esm({
|
|
|
1393
1152
|
});
|
|
1394
1153
|
|
|
1395
1154
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
1396
|
-
import { useEffect as useEffect4, useState as
|
|
1397
|
-
import { Box as
|
|
1398
|
-
import { Fragment
|
|
1155
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1156
|
+
import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
|
|
1157
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1399
1158
|
function Section({ title, rows }) {
|
|
1400
|
-
return /* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
rows.map((row) => /* @__PURE__ */
|
|
1403
|
-
/* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1160
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
|
|
1161
|
+
rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
|
|
1162
|
+
/* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: row.label }) }),
|
|
1163
|
+
/* @__PURE__ */ jsx7(Text7, { children: row.value })
|
|
1405
1164
|
] }, row.label))
|
|
1406
1165
|
] });
|
|
1407
1166
|
}
|
|
1408
1167
|
function HelpScreen({ onDone }) {
|
|
1409
|
-
const [info, setInfo] =
|
|
1168
|
+
const [info, setInfo] = useState6();
|
|
1410
1169
|
useEffect4(() => {
|
|
1411
1170
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1412
1171
|
void readHelpInfo().then(setInfo);
|
|
@@ -1415,7 +1174,7 @@ function HelpScreen({ onDone }) {
|
|
|
1415
1174
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1416
1175
|
onDone();
|
|
1417
1176
|
};
|
|
1418
|
-
|
|
1177
|
+
useInput6((input, key) => {
|
|
1419
1178
|
if (key.return) {
|
|
1420
1179
|
leave("saved");
|
|
1421
1180
|
return;
|
|
@@ -1425,14 +1184,14 @@ function HelpScreen({ onDone }) {
|
|
|
1425
1184
|
return;
|
|
1426
1185
|
}
|
|
1427
1186
|
});
|
|
1428
|
-
return /* @__PURE__ */
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
info ? /* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
] }) : /* @__PURE__ */
|
|
1435
|
-
/* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1188
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
|
|
1189
|
+
info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1190
|
+
/* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1191
|
+
/* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1192
|
+
/* @__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." })
|
|
1193
|
+
] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
|
|
1194
|
+
/* @__PURE__ */ jsx7(
|
|
1436
1195
|
ControlHints,
|
|
1437
1196
|
{
|
|
1438
1197
|
hints: [
|
|
@@ -1454,20 +1213,20 @@ var init_PageContainer2 = __esm({
|
|
|
1454
1213
|
});
|
|
1455
1214
|
|
|
1456
1215
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1457
|
-
import { useState as
|
|
1458
|
-
import { Box as
|
|
1459
|
-
import { jsx as
|
|
1216
|
+
import { useState as useState7 } from "react";
|
|
1217
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1218
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1460
1219
|
function SettingsScreen({
|
|
1461
1220
|
onNavigate,
|
|
1462
1221
|
onBack
|
|
1463
1222
|
}) {
|
|
1464
|
-
const [focusIdx, setFocusIdx] =
|
|
1223
|
+
const [focusIdx, setFocusIdx] = useState7(0);
|
|
1465
1224
|
const items = [
|
|
1466
1225
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1467
1226
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1468
1227
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1469
1228
|
];
|
|
1470
|
-
|
|
1229
|
+
useInput7((input, key) => {
|
|
1471
1230
|
if (key.upArrow) {
|
|
1472
1231
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1473
1232
|
return;
|
|
@@ -1487,15 +1246,15 @@ function SettingsScreen({
|
|
|
1487
1246
|
onBack();
|
|
1488
1247
|
}
|
|
1489
1248
|
});
|
|
1490
|
-
return /* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1250
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
|
|
1251
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1252
|
+
items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1494
1253
|
i === focusIdx ? "> " : " ",
|
|
1495
1254
|
item.label
|
|
1496
1255
|
] }, item.label)),
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsx8(Text8, { children: " " }),
|
|
1257
|
+
/* @__PURE__ */ jsx8(
|
|
1499
1258
|
ControlHints,
|
|
1500
1259
|
{
|
|
1501
1260
|
hints: [
|
|
@@ -1556,10 +1315,10 @@ var init_config_store = __esm({
|
|
|
1556
1315
|
});
|
|
1557
1316
|
|
|
1558
1317
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1559
|
-
import { useEffect as useEffect5, useState as
|
|
1560
|
-
import { Box as
|
|
1561
|
-
import
|
|
1562
|
-
import { Fragment as
|
|
1318
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1319
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1320
|
+
import TextInput3 from "ink-text-input";
|
|
1321
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1563
1322
|
function debugFields(config) {
|
|
1564
1323
|
return {
|
|
1565
1324
|
space_id: config?.spaceId ?? "",
|
|
@@ -1571,13 +1330,13 @@ function debugFields(config) {
|
|
|
1571
1330
|
};
|
|
1572
1331
|
}
|
|
1573
1332
|
function ConfigurationScreen({ onDone }) {
|
|
1574
|
-
const [stage, setStage] =
|
|
1575
|
-
const [config, setConfig] =
|
|
1576
|
-
const [activeField, setActiveField] =
|
|
1577
|
-
const [notice, setNotice] =
|
|
1578
|
-
const [lastSaved, setLastSaved] =
|
|
1579
|
-
const [editing, setEditing] =
|
|
1580
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1333
|
+
const [stage, setStage] = useState8("loading");
|
|
1334
|
+
const [config, setConfig] = useState8(null);
|
|
1335
|
+
const [activeField, setActiveField] = useState8("spaceId");
|
|
1336
|
+
const [notice, setNotice] = useState8(null);
|
|
1337
|
+
const [lastSaved, setLastSaved] = useState8(null);
|
|
1338
|
+
const [editing, setEditing] = useState8(false);
|
|
1339
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
1581
1340
|
useEffect5(() => {
|
|
1582
1341
|
readCredentials().then((cfg) => {
|
|
1583
1342
|
setConfig(cfg);
|
|
@@ -1618,7 +1377,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1618
1377
|
);
|
|
1619
1378
|
onDone();
|
|
1620
1379
|
}
|
|
1621
|
-
|
|
1380
|
+
useInput8((input, key) => {
|
|
1622
1381
|
if (stage === "loading" || stage === "saving") return;
|
|
1623
1382
|
if (editing) {
|
|
1624
1383
|
if (key.escape) {
|
|
@@ -1655,46 +1414,46 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1655
1414
|
}
|
|
1656
1415
|
});
|
|
1657
1416
|
if (stage === "loading") {
|
|
1658
|
-
return /* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
1661
|
-
/* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1418
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1419
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1420
|
+
/* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
|
|
1662
1421
|
] });
|
|
1663
1422
|
}
|
|
1664
|
-
return /* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1424
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
|
|
1425
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1426
|
+
/* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1668
1427
|
const isActive = activeField === field;
|
|
1669
1428
|
const value = fieldValue(field);
|
|
1670
1429
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1671
|
-
return /* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
1431
|
+
/* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1432
|
+
/* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
|
|
1674
1433
|
FIELD_LABELS[field],
|
|
1675
1434
|
":"
|
|
1676
1435
|
] }),
|
|
1677
|
-
isActive && editing ? /* @__PURE__ */
|
|
1678
|
-
|
|
1436
|
+
isActive && editing ? /* @__PURE__ */ jsx9(
|
|
1437
|
+
TextInput3,
|
|
1679
1438
|
{
|
|
1680
1439
|
value,
|
|
1681
1440
|
onChange: (next) => setFieldValue(field, next),
|
|
1682
1441
|
onSubmit: () => setEditing(false),
|
|
1683
1442
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1684
1443
|
}
|
|
1685
|
-
) : /* @__PURE__ */
|
|
1444
|
+
) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "(empty)" }) })
|
|
1686
1445
|
] }, field);
|
|
1687
1446
|
}) }),
|
|
1688
|
-
notice && /* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1447
|
+
notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1448
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1449
|
+
/* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1691
1450
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1692
1451
|
" ",
|
|
1693
1452
|
notice.text
|
|
1694
1453
|
] })
|
|
1695
1454
|
] }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1456
|
+
/* @__PURE__ */ jsx9(
|
|
1698
1457
|
ControlHints,
|
|
1699
1458
|
{
|
|
1700
1459
|
hints: editing ? [
|
|
@@ -1762,12 +1521,12 @@ var init_analytics_store = __esm({
|
|
|
1762
1521
|
});
|
|
1763
1522
|
|
|
1764
1523
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1765
|
-
import { useEffect as useEffect6, useState as
|
|
1766
|
-
import { Box as
|
|
1767
|
-
import { Fragment as
|
|
1524
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
1525
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1526
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1768
1527
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1769
|
-
const [loading, setLoading] =
|
|
1770
|
-
const [enabled, setEnabled] =
|
|
1528
|
+
const [loading, setLoading] = useState9(true);
|
|
1529
|
+
const [enabled, setEnabled] = useState9(true);
|
|
1771
1530
|
useEffect6(() => {
|
|
1772
1531
|
readAnalyticsSetting().then((setting) => {
|
|
1773
1532
|
setEnabled(setting.enabled);
|
|
@@ -1780,7 +1539,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1780
1539
|
});
|
|
1781
1540
|
});
|
|
1782
1541
|
}, []);
|
|
1783
|
-
|
|
1542
|
+
useInput9((input, key) => {
|
|
1784
1543
|
if (loading) return;
|
|
1785
1544
|
if (key.return || input === " ") {
|
|
1786
1545
|
setEnabled((current) => {
|
|
@@ -1795,21 +1554,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1795
1554
|
onDone();
|
|
1796
1555
|
}
|
|
1797
1556
|
});
|
|
1798
|
-
return /* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
loading ? /* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1558
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1559
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1560
|
+
loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1561
|
+
/* @__PURE__ */ jsxs9(Text10, { children: [
|
|
1803
1562
|
"Share anonymous usage data:",
|
|
1804
1563
|
" ",
|
|
1805
|
-
/* @__PURE__ */
|
|
1564
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1806
1565
|
] }),
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1567
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1568
|
+
/* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1810
1569
|
] }),
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1571
|
+
/* @__PURE__ */ jsx10(
|
|
1813
1572
|
ControlHints,
|
|
1814
1573
|
{
|
|
1815
1574
|
hints: [
|
|
@@ -1820,7 +1579,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1820
1579
|
)
|
|
1821
1580
|
] });
|
|
1822
1581
|
}
|
|
1823
|
-
var
|
|
1582
|
+
var init_screen4 = __esm({
|
|
1824
1583
|
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
|
|
1825
1584
|
"use strict";
|
|
1826
1585
|
init_home_theme();
|
|
@@ -1831,11 +1590,11 @@ var init_screen5 = __esm({
|
|
|
1831
1590
|
});
|
|
1832
1591
|
|
|
1833
1592
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1834
|
-
import { useEffect as useEffect7, useState as
|
|
1835
|
-
import { Box as
|
|
1836
|
-
import { jsx as
|
|
1593
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1594
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1595
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1837
1596
|
function UpgradeScreen({ onDone }) {
|
|
1838
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1597
|
+
const [upgradeCheck, setUpgradeCheck] = useState10();
|
|
1839
1598
|
useEffect7(() => {
|
|
1840
1599
|
startDebugRun({
|
|
1841
1600
|
flow: "upgrade",
|
|
@@ -1845,7 +1604,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1845
1604
|
});
|
|
1846
1605
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1847
1606
|
}, []);
|
|
1848
|
-
|
|
1607
|
+
useInput10((_input, key) => {
|
|
1849
1608
|
if (key.return) {
|
|
1850
1609
|
void finishDebugRun({
|
|
1851
1610
|
outputs: upgradeCheck ?? {},
|
|
@@ -1856,12 +1615,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1856
1615
|
return;
|
|
1857
1616
|
}
|
|
1858
1617
|
});
|
|
1859
|
-
return /* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
1618
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1619
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
|
|
1620
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1862
1621
|
renderBody(upgradeCheck),
|
|
1863
|
-
/* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1623
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
|
|
1865
1624
|
FOCUS_MARKER,
|
|
1866
1625
|
" Go Back"
|
|
1867
1626
|
] })
|
|
@@ -1869,34 +1628,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
1869
1628
|
}
|
|
1870
1629
|
function renderBody(upgradeCheck) {
|
|
1871
1630
|
if (!upgradeCheck) {
|
|
1872
|
-
return /* @__PURE__ */
|
|
1631
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1873
1632
|
}
|
|
1874
1633
|
if (upgradeCheck.status === "error") {
|
|
1875
|
-
return /* @__PURE__ */
|
|
1634
|
+
return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1876
1635
|
}
|
|
1877
1636
|
if (upgradeCheck.status === "up-to-date") {
|
|
1878
|
-
return /* @__PURE__ */
|
|
1637
|
+
return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
|
|
1879
1638
|
"You're already on the latest version (v",
|
|
1880
1639
|
upgradeCheck.current,
|
|
1881
1640
|
")."
|
|
1882
1641
|
] });
|
|
1883
1642
|
}
|
|
1884
|
-
return /* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
1644
|
+
/* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
|
|
1645
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
|
|
1887
1646
|
"v",
|
|
1888
1647
|
upgradeCheck.latest
|
|
1889
1648
|
] }),
|
|
1890
1649
|
" ",
|
|
1891
1650
|
"is available (you're on ",
|
|
1892
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
|
|
1893
1652
|
"v",
|
|
1894
1653
|
upgradeCheck.current
|
|
1895
1654
|
] }),
|
|
1896
1655
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1897
1656
|
] }),
|
|
1898
|
-
/* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1658
|
+
/* @__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)) })
|
|
1900
1659
|
] });
|
|
1901
1660
|
}
|
|
1902
1661
|
var UPGRADE_COMMANDS;
|
|
@@ -1911,12 +1670,12 @@ var init_PageContainer4 = __esm({
|
|
|
1911
1670
|
});
|
|
1912
1671
|
|
|
1913
1672
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1914
|
-
import { useEffect as useEffect8, useState as
|
|
1915
|
-
import { Box as
|
|
1916
|
-
import { jsx as
|
|
1673
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
1674
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1675
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1917
1676
|
function DebugModeScreen({ onDone }) {
|
|
1918
|
-
const [loading, setLoading] =
|
|
1919
|
-
const [enabled, setEnabled] =
|
|
1677
|
+
const [loading, setLoading] = useState11(true);
|
|
1678
|
+
const [enabled, setEnabled] = useState11(true);
|
|
1920
1679
|
useEffect8(() => {
|
|
1921
1680
|
readDebugModeSetting().then((setting) => {
|
|
1922
1681
|
setEnabled(setting.enabled);
|
|
@@ -1929,7 +1688,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1929
1688
|
});
|
|
1930
1689
|
});
|
|
1931
1690
|
}, []);
|
|
1932
|
-
|
|
1691
|
+
useInput11((input, key) => {
|
|
1933
1692
|
if (loading) return;
|
|
1934
1693
|
if (key.return || input === " ") {
|
|
1935
1694
|
setEnabled((current) => {
|
|
@@ -1944,16 +1703,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1944
1703
|
onDone();
|
|
1945
1704
|
}
|
|
1946
1705
|
});
|
|
1947
|
-
return /* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
loading ? /* @__PURE__ */
|
|
1706
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1707
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1708
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1709
|
+
loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
1951
1710
|
"Debug logging:",
|
|
1952
1711
|
" ",
|
|
1953
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1954
1713
|
] }),
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1715
|
+
/* @__PURE__ */ jsx12(
|
|
1957
1716
|
ControlHints,
|
|
1958
1717
|
{
|
|
1959
1718
|
hints: [
|
|
@@ -1964,7 +1723,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1964
1723
|
)
|
|
1965
1724
|
] });
|
|
1966
1725
|
}
|
|
1967
|
-
var
|
|
1726
|
+
var init_screen5 = __esm({
|
|
1968
1727
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
|
|
1969
1728
|
"use strict";
|
|
1970
1729
|
init_home_theme();
|
|
@@ -1979,39 +1738,29 @@ var app_exports = {};
|
|
|
1979
1738
|
__export(app_exports, {
|
|
1980
1739
|
runApp: () => runApp
|
|
1981
1740
|
});
|
|
1982
|
-
import { useEffect as useEffect9, useState as
|
|
1983
|
-
import { Fragment as
|
|
1741
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
1742
|
+
import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
|
|
1984
1743
|
function App({ onLaunchImport, importExitCode }) {
|
|
1985
1744
|
const returnedFromImport = importExitCode !== void 0;
|
|
1986
|
-
const [screen, setScreen] =
|
|
1987
|
-
const [showImportResult, setShowImportResult] =
|
|
1988
|
-
const [projectPath, setProjectPath] =
|
|
1989
|
-
const [tokensPath, setTokensPath] =
|
|
1990
|
-
const [
|
|
1991
|
-
const [importDefaults, setImportDefaults] = useState13();
|
|
1745
|
+
const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
|
|
1746
|
+
const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
|
|
1747
|
+
const [projectPath, setProjectPath] = useState12();
|
|
1748
|
+
const [tokensPath, setTokensPath] = useState12();
|
|
1749
|
+
const [importDefaults, setImportDefaults] = useState12();
|
|
1992
1750
|
useEffect9(() => {
|
|
1993
1751
|
if (screen !== "import") {
|
|
1994
1752
|
setImportDefaults(void 0);
|
|
1995
1753
|
return;
|
|
1996
1754
|
}
|
|
1997
1755
|
void readCredentials().then(
|
|
1998
|
-
(saved) => setImportDefaults({
|
|
1999
|
-
componentDir: saved.defaultComponentDir ?? "",
|
|
2000
|
-
tokenFile: saved.defaultTokenFile ?? "",
|
|
2001
|
-
credentials: saved
|
|
2002
|
-
})
|
|
1756
|
+
(saved) => setImportDefaults({ componentDir: saved.defaultComponentDir ?? "", tokenFile: saved.defaultTokenFile ?? "" })
|
|
2003
1757
|
);
|
|
2004
1758
|
}, [screen]);
|
|
2005
|
-
const finishCredentials = async (result, project, tokens) => {
|
|
2006
|
-
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
2007
|
-
onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
|
|
2008
|
-
};
|
|
2009
1759
|
const goToStart = () => setScreen("start");
|
|
2010
1760
|
const goToSettings = () => setScreen("settings");
|
|
2011
1761
|
const resetImport = () => {
|
|
2012
1762
|
setProjectPath(void 0);
|
|
2013
1763
|
setTokensPath(void 0);
|
|
2014
|
-
setPathConfirmed(false);
|
|
2015
1764
|
};
|
|
2016
1765
|
const finishImportResult = () => {
|
|
2017
1766
|
setShowImportResult(false);
|
|
@@ -2024,13 +1773,13 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
2024
1773
|
};
|
|
2025
1774
|
switch (screen) {
|
|
2026
1775
|
case "import":
|
|
2027
|
-
if (showImportResult) return /* @__PURE__ */
|
|
2028
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
1776
|
+
if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
1777
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
|
|
2029
1778
|
if (projectPath === void 0) {
|
|
2030
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
2031
1780
|
}
|
|
2032
1781
|
if (tokensPath === void 0) {
|
|
2033
|
-
return /* @__PURE__ */
|
|
1782
|
+
return /* @__PURE__ */ jsx13(
|
|
2034
1783
|
TokenInputScreen,
|
|
2035
1784
|
{
|
|
2036
1785
|
initialPath: importDefaults.tokenFile,
|
|
@@ -2039,45 +1788,35 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
2039
1788
|
}
|
|
2040
1789
|
);
|
|
2041
1790
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
PathValidationScreen,
|
|
2045
|
-
{
|
|
2046
|
-
projectPath,
|
|
2047
|
-
onConfirm: () => setPathConfirmed(true),
|
|
2048
|
-
onChangePath: resetImport,
|
|
2049
|
-
onBack: () => setTokensPath(void 0)
|
|
2050
|
-
}
|
|
2051
|
-
);
|
|
2052
|
-
}
|
|
2053
|
-
return /* @__PURE__ */ jsx14(
|
|
2054
|
-
CredentialsScreen,
|
|
1791
|
+
return /* @__PURE__ */ jsx13(
|
|
1792
|
+
PathValidationScreen,
|
|
2055
1793
|
{
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
1794
|
+
projectPath,
|
|
1795
|
+
onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
|
|
1796
|
+
onChangePath: resetImport,
|
|
1797
|
+
onBack: () => setTokensPath(void 0)
|
|
2059
1798
|
}
|
|
2060
1799
|
);
|
|
2061
1800
|
case "help":
|
|
2062
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
|
|
2063
1802
|
case "upgrade":
|
|
2064
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
|
|
2065
1804
|
case "settings":
|
|
2066
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
2067
1806
|
case "settings-configuration":
|
|
2068
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
|
|
2069
1808
|
case "settings-opt-in-analytics":
|
|
2070
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
2071
1810
|
case "settings-debug-mode":
|
|
2072
|
-
return /* @__PURE__ */
|
|
1811
|
+
return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
|
|
2073
1812
|
case "start":
|
|
2074
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
|
|
2075
1814
|
}
|
|
2076
1815
|
}
|
|
2077
1816
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
2078
1817
|
let requestedImport;
|
|
2079
1818
|
const instance = renderApp(
|
|
2080
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ jsx13(
|
|
2081
1820
|
App,
|
|
2082
1821
|
{
|
|
2083
1822
|
importExitCode,
|
|
@@ -2116,9 +1855,9 @@ var init_app = __esm({
|
|
|
2116
1855
|
init_PageContainer2();
|
|
2117
1856
|
init_PageContainer3();
|
|
2118
1857
|
init_ContentfulConfigScreen();
|
|
2119
|
-
|
|
1858
|
+
init_screen4();
|
|
2120
1859
|
init_PageContainer4();
|
|
2121
|
-
|
|
1860
|
+
init_screen5();
|
|
2122
1861
|
init_config_store();
|
|
2123
1862
|
CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
2124
1863
|
}
|