@contentful/experience-design-system-cli 2.37.1-dev-build-308a2a34.0 → 2.37.1-dev-build-979aba4b.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 +1 -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 +977 -1379
- package/legacy/package.json +1 -1
- package/package.json +2 -2
- package/legacy/dist/src/import/tui/steps/CredentialsStep.d.ts +0 -43
package/dist/index.js
CHANGED
|
@@ -847,6 +847,245 @@ 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: "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." }),
|
|
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
|
+
|
|
850
1089
|
// packages/experience-design-system-cli/src/tui/import/steps/index.ts
|
|
851
1090
|
var init_steps = __esm({
|
|
852
1091
|
"packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
|
|
@@ -854,6 +1093,7 @@ var init_steps = __esm({
|
|
|
854
1093
|
init_screen();
|
|
855
1094
|
init_screen2();
|
|
856
1095
|
init_screen3();
|
|
1096
|
+
init_screen4();
|
|
857
1097
|
}
|
|
858
1098
|
});
|
|
859
1099
|
|
|
@@ -874,7 +1114,8 @@ async function spawnV1Import(options = {}) {
|
|
|
874
1114
|
const args = buildArgs(options);
|
|
875
1115
|
return new Promise((resolvePromise) => {
|
|
876
1116
|
const child = spawn3("node", [cliPath, ...args], {
|
|
877
|
-
stdio: "inherit"
|
|
1117
|
+
stdio: "inherit",
|
|
1118
|
+
env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
|
|
878
1119
|
});
|
|
879
1120
|
child.on("close", (code) => {
|
|
880
1121
|
resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
|
|
@@ -1152,20 +1393,20 @@ var init_help_info = __esm({
|
|
|
1152
1393
|
});
|
|
1153
1394
|
|
|
1154
1395
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
1155
|
-
import { useEffect as useEffect4, useState as
|
|
1156
|
-
import { Box as
|
|
1157
|
-
import { Fragment, jsx as
|
|
1396
|
+
import { useEffect as useEffect4, useState as useState7 } from "react";
|
|
1397
|
+
import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
|
|
1398
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1158
1399
|
function Section({ title, rows }) {
|
|
1159
|
-
return /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1161
|
-
rows.map((row) => /* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1400
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
1401
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, color: PALETTE.accent, children: title }),
|
|
1402
|
+
rows.map((row) => /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
|
|
1403
|
+
/* @__PURE__ */ jsx8(Box7, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: row.label }) }),
|
|
1404
|
+
/* @__PURE__ */ jsx8(Text8, { children: row.value })
|
|
1164
1405
|
] }, row.label))
|
|
1165
1406
|
] });
|
|
1166
1407
|
}
|
|
1167
1408
|
function HelpScreen({ onDone }) {
|
|
1168
|
-
const [info, setInfo] =
|
|
1409
|
+
const [info, setInfo] = useState7();
|
|
1169
1410
|
useEffect4(() => {
|
|
1170
1411
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
1171
1412
|
void readHelpInfo().then(setInfo);
|
|
@@ -1174,7 +1415,7 @@ function HelpScreen({ onDone }) {
|
|
|
1174
1415
|
void finishDebugRun({ outputs: {}, status: "success", exitMethod });
|
|
1175
1416
|
onDone();
|
|
1176
1417
|
};
|
|
1177
|
-
|
|
1418
|
+
useInput7((input, key) => {
|
|
1178
1419
|
if (key.return) {
|
|
1179
1420
|
leave("saved");
|
|
1180
1421
|
return;
|
|
@@ -1184,14 +1425,14 @@ function HelpScreen({ onDone }) {
|
|
|
1184
1425
|
return;
|
|
1185
1426
|
}
|
|
1186
1427
|
});
|
|
1187
|
-
return /* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
info ? /* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
] }) : /* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
|
|
1429
|
+
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Help" }),
|
|
1430
|
+
info ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1431
|
+
/* @__PURE__ */ jsx8(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1432
|
+
/* @__PURE__ */ jsx8(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1433
|
+
/* @__PURE__ */ jsx8(Text8, { 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." })
|
|
1434
|
+
] }) : /* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." }),
|
|
1435
|
+
/* @__PURE__ */ jsx8(
|
|
1195
1436
|
ControlHints,
|
|
1196
1437
|
{
|
|
1197
1438
|
hints: [
|
|
@@ -1213,20 +1454,20 @@ var init_PageContainer2 = __esm({
|
|
|
1213
1454
|
});
|
|
1214
1455
|
|
|
1215
1456
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
1216
|
-
import { useState as
|
|
1217
|
-
import { Box as
|
|
1218
|
-
import { jsx as
|
|
1457
|
+
import { useState as useState8 } from "react";
|
|
1458
|
+
import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
|
|
1459
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1219
1460
|
function SettingsScreen({
|
|
1220
1461
|
onNavigate,
|
|
1221
1462
|
onBack
|
|
1222
1463
|
}) {
|
|
1223
|
-
const [focusIdx, setFocusIdx] =
|
|
1464
|
+
const [focusIdx, setFocusIdx] = useState8(0);
|
|
1224
1465
|
const items = [
|
|
1225
1466
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
1226
1467
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
1227
1468
|
{ label: "Debug Mode", screen: "settings-debug-mode" }
|
|
1228
1469
|
];
|
|
1229
|
-
|
|
1470
|
+
useInput8((input, key) => {
|
|
1230
1471
|
if (key.upArrow) {
|
|
1231
1472
|
setFocusIdx((i) => (i - 1 + items.length) % items.length);
|
|
1232
1473
|
return;
|
|
@@ -1246,15 +1487,15 @@ function SettingsScreen({
|
|
|
1246
1487
|
onBack();
|
|
1247
1488
|
}
|
|
1248
1489
|
});
|
|
1249
|
-
return /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1491
|
+
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings" }),
|
|
1492
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1493
|
+
items.map((item, i) => /* @__PURE__ */ jsxs8(Text9, { color: i === focusIdx ? "cyan" : void 0, children: [
|
|
1253
1494
|
i === focusIdx ? "> " : " ",
|
|
1254
1495
|
item.label
|
|
1255
1496
|
] }, item.label)),
|
|
1256
|
-
/* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
1497
|
+
/* @__PURE__ */ jsx9(Text9, { children: " " }),
|
|
1498
|
+
/* @__PURE__ */ jsx9(
|
|
1258
1499
|
ControlHints,
|
|
1259
1500
|
{
|
|
1260
1501
|
hints: [
|
|
@@ -1315,10 +1556,10 @@ var init_config_store = __esm({
|
|
|
1315
1556
|
});
|
|
1316
1557
|
|
|
1317
1558
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
1318
|
-
import { useEffect as useEffect5, useState as
|
|
1319
|
-
import { Box as
|
|
1320
|
-
import
|
|
1321
|
-
import { Fragment as
|
|
1559
|
+
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
1560
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
1561
|
+
import TextInput4 from "ink-text-input";
|
|
1562
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1322
1563
|
function debugFields(config) {
|
|
1323
1564
|
return {
|
|
1324
1565
|
space_id: config?.spaceId ?? "",
|
|
@@ -1330,13 +1571,13 @@ function debugFields(config) {
|
|
|
1330
1571
|
};
|
|
1331
1572
|
}
|
|
1332
1573
|
function ConfigurationScreen({ onDone }) {
|
|
1333
|
-
const [stage, setStage] =
|
|
1334
|
-
const [config, setConfig] =
|
|
1335
|
-
const [activeField, setActiveField] =
|
|
1336
|
-
const [notice, setNotice] =
|
|
1337
|
-
const [lastSaved, setLastSaved] =
|
|
1338
|
-
const [editing, setEditing] =
|
|
1339
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
1574
|
+
const [stage, setStage] = useState9("loading");
|
|
1575
|
+
const [config, setConfig] = useState9(null);
|
|
1576
|
+
const [activeField, setActiveField] = useState9("spaceId");
|
|
1577
|
+
const [notice, setNotice] = useState9(null);
|
|
1578
|
+
const [lastSaved, setLastSaved] = useState9(null);
|
|
1579
|
+
const [editing, setEditing] = useState9(false);
|
|
1580
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
1340
1581
|
useEffect5(() => {
|
|
1341
1582
|
readCredentials().then((cfg) => {
|
|
1342
1583
|
setConfig(cfg);
|
|
@@ -1377,7 +1618,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1377
1618
|
);
|
|
1378
1619
|
onDone();
|
|
1379
1620
|
}
|
|
1380
|
-
|
|
1621
|
+
useInput9((input, key) => {
|
|
1381
1622
|
if (stage === "loading" || stage === "saving") return;
|
|
1382
1623
|
if (editing) {
|
|
1383
1624
|
if (key.escape) {
|
|
@@ -1414,46 +1655,46 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1414
1655
|
}
|
|
1415
1656
|
});
|
|
1416
1657
|
if (stage === "loading") {
|
|
1417
|
-
return /* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */
|
|
1658
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1659
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
|
|
1660
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1661
|
+
/* @__PURE__ */ jsx10(Text10, { color: PALETTE.accent, children: "Loading..." })
|
|
1421
1662
|
] });
|
|
1422
1663
|
}
|
|
1423
|
-
return /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1664
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1665
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
|
|
1666
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1667
|
+
/* @__PURE__ */ jsx10(Box9, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
1427
1668
|
const isActive = activeField === field;
|
|
1428
1669
|
const value = fieldValue(field);
|
|
1429
1670
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
1430
|
-
return /* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsxs9(Box9, { gap: 1, children: [
|
|
1672
|
+
/* @__PURE__ */ jsx10(Text10, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
1673
|
+
/* @__PURE__ */ jsxs9(Text10, { bold: isActive, children: [
|
|
1433
1674
|
FIELD_LABELS[field],
|
|
1434
1675
|
":"
|
|
1435
1676
|
] }),
|
|
1436
|
-
isActive && editing ? /* @__PURE__ */
|
|
1437
|
-
|
|
1677
|
+
isActive && editing ? /* @__PURE__ */ jsx10(
|
|
1678
|
+
TextInput4,
|
|
1438
1679
|
{
|
|
1439
1680
|
value,
|
|
1440
1681
|
onChange: (next) => setFieldValue(field, next),
|
|
1441
1682
|
onSubmit: () => setEditing(false),
|
|
1442
1683
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1443
1684
|
}
|
|
1444
|
-
) : /* @__PURE__ */
|
|
1685
|
+
) : /* @__PURE__ */ jsx10(Text10, { children: display || /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "(empty)" }) })
|
|
1445
1686
|
] }, field);
|
|
1446
1687
|
}) }),
|
|
1447
|
-
notice && /* @__PURE__ */
|
|
1448
|
-
/* @__PURE__ */
|
|
1449
|
-
/* @__PURE__ */
|
|
1688
|
+
notice && /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1689
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1690
|
+
/* @__PURE__ */ jsxs9(Text10, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
1450
1691
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
1451
1692
|
" ",
|
|
1452
1693
|
notice.text
|
|
1453
1694
|
] })
|
|
1454
1695
|
] }),
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1696
|
+
/* @__PURE__ */ jsx10(Text10, { children: " " }),
|
|
1697
|
+
/* @__PURE__ */ jsx10(
|
|
1457
1698
|
ControlHints,
|
|
1458
1699
|
{
|
|
1459
1700
|
hints: editing ? [
|
|
@@ -1521,12 +1762,12 @@ var init_analytics_store = __esm({
|
|
|
1521
1762
|
});
|
|
1522
1763
|
|
|
1523
1764
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
1524
|
-
import { useEffect as useEffect6, useState as
|
|
1525
|
-
import { Box as
|
|
1526
|
-
import { Fragment as
|
|
1765
|
+
import { useEffect as useEffect6, useState as useState10 } from "react";
|
|
1766
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1767
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1527
1768
|
function OptInAnalyticsScreen({ onDone }) {
|
|
1528
|
-
const [loading, setLoading] =
|
|
1529
|
-
const [enabled, setEnabled] =
|
|
1769
|
+
const [loading, setLoading] = useState10(true);
|
|
1770
|
+
const [enabled, setEnabled] = useState10(true);
|
|
1530
1771
|
useEffect6(() => {
|
|
1531
1772
|
readAnalyticsSetting().then((setting) => {
|
|
1532
1773
|
setEnabled(setting.enabled);
|
|
@@ -1539,7 +1780,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1539
1780
|
});
|
|
1540
1781
|
});
|
|
1541
1782
|
}, []);
|
|
1542
|
-
|
|
1783
|
+
useInput10((input, key) => {
|
|
1543
1784
|
if (loading) return;
|
|
1544
1785
|
if (key.return || input === " ") {
|
|
1545
1786
|
setEnabled((current) => {
|
|
@@ -1554,21 +1795,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1554
1795
|
onDone();
|
|
1555
1796
|
}
|
|
1556
1797
|
});
|
|
1557
|
-
return /* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
loading ? /* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1798
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1799
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
1800
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1801
|
+
loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1802
|
+
/* @__PURE__ */ jsxs10(Text11, { children: [
|
|
1562
1803
|
"Share anonymous usage data:",
|
|
1563
1804
|
" ",
|
|
1564
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1565
1806
|
] }),
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1807
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1808
|
+
/* @__PURE__ */ jsx11(Text11, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
1809
|
+
/* @__PURE__ */ jsx11(Text11, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1569
1810
|
] }),
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1812
|
+
/* @__PURE__ */ jsx11(
|
|
1572
1813
|
ControlHints,
|
|
1573
1814
|
{
|
|
1574
1815
|
hints: [
|
|
@@ -1579,7 +1820,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1579
1820
|
)
|
|
1580
1821
|
] });
|
|
1581
1822
|
}
|
|
1582
|
-
var
|
|
1823
|
+
var init_screen5 = __esm({
|
|
1583
1824
|
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
|
|
1584
1825
|
"use strict";
|
|
1585
1826
|
init_home_theme();
|
|
@@ -1590,11 +1831,11 @@ var init_screen4 = __esm({
|
|
|
1590
1831
|
});
|
|
1591
1832
|
|
|
1592
1833
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
1593
|
-
import { useEffect as useEffect7, useState as
|
|
1594
|
-
import { Box as
|
|
1595
|
-
import { jsx as
|
|
1834
|
+
import { useEffect as useEffect7, useState as useState11 } from "react";
|
|
1835
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1836
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1596
1837
|
function UpgradeScreen({ onDone }) {
|
|
1597
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
1838
|
+
const [upgradeCheck, setUpgradeCheck] = useState11();
|
|
1598
1839
|
useEffect7(() => {
|
|
1599
1840
|
startDebugRun({
|
|
1600
1841
|
flow: "upgrade",
|
|
@@ -1604,7 +1845,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
1604
1845
|
});
|
|
1605
1846
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1606
1847
|
}, []);
|
|
1607
|
-
|
|
1848
|
+
useInput11((_input, key) => {
|
|
1608
1849
|
if (key.return) {
|
|
1609
1850
|
void finishDebugRun({
|
|
1610
1851
|
outputs: upgradeCheck ?? {},
|
|
@@ -1615,12 +1856,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
1615
1856
|
return;
|
|
1616
1857
|
}
|
|
1617
1858
|
});
|
|
1618
|
-
return /* @__PURE__ */
|
|
1619
|
-
/* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1859
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1860
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, children: "Upgrade" }),
|
|
1861
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1621
1862
|
renderBody(upgradeCheck),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1863
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1864
|
+
/* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.accent, children: [
|
|
1624
1865
|
FOCUS_MARKER,
|
|
1625
1866
|
" Go Back"
|
|
1626
1867
|
] })
|
|
@@ -1628,34 +1869,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
1628
1869
|
}
|
|
1629
1870
|
function renderBody(upgradeCheck) {
|
|
1630
1871
|
if (!upgradeCheck) {
|
|
1631
|
-
return /* @__PURE__ */
|
|
1872
|
+
return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
1632
1873
|
}
|
|
1633
1874
|
if (upgradeCheck.status === "error") {
|
|
1634
|
-
return /* @__PURE__ */
|
|
1875
|
+
return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
1635
1876
|
}
|
|
1636
1877
|
if (upgradeCheck.status === "up-to-date") {
|
|
1637
|
-
return /* @__PURE__ */
|
|
1878
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: PALETTE.success, children: [
|
|
1638
1879
|
"You're already on the latest version (v",
|
|
1639
1880
|
upgradeCheck.current,
|
|
1640
1881
|
")."
|
|
1641
1882
|
] });
|
|
1642
1883
|
}
|
|
1643
|
-
return /* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
1885
|
+
/* @__PURE__ */ jsxs11(Text12, { color: PALETTE.muted, children: [
|
|
1886
|
+
/* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.success, children: [
|
|
1646
1887
|
"v",
|
|
1647
1888
|
upgradeCheck.latest
|
|
1648
1889
|
] }),
|
|
1649
1890
|
" ",
|
|
1650
1891
|
"is available (you're on ",
|
|
1651
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsxs11(Text12, { bold: true, children: [
|
|
1652
1893
|
"v",
|
|
1653
1894
|
upgradeCheck.current
|
|
1654
1895
|
] }),
|
|
1655
1896
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
1656
1897
|
] }),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1898
|
+
/* @__PURE__ */ jsx12(Text12, { children: " " }),
|
|
1899
|
+
/* @__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)) })
|
|
1659
1900
|
] });
|
|
1660
1901
|
}
|
|
1661
1902
|
var UPGRADE_COMMANDS;
|
|
@@ -1670,12 +1911,12 @@ var init_PageContainer4 = __esm({
|
|
|
1670
1911
|
});
|
|
1671
1912
|
|
|
1672
1913
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
1673
|
-
import { useEffect as useEffect8, useState as
|
|
1674
|
-
import { Box as
|
|
1675
|
-
import { jsx as
|
|
1914
|
+
import { useEffect as useEffect8, useState as useState12 } from "react";
|
|
1915
|
+
import { Box as Box12, Text as Text13, useInput as useInput12 } from "ink";
|
|
1916
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1676
1917
|
function DebugModeScreen({ onDone }) {
|
|
1677
|
-
const [loading, setLoading] =
|
|
1678
|
-
const [enabled, setEnabled] =
|
|
1918
|
+
const [loading, setLoading] = useState12(true);
|
|
1919
|
+
const [enabled, setEnabled] = useState12(true);
|
|
1679
1920
|
useEffect8(() => {
|
|
1680
1921
|
readDebugModeSetting().then((setting) => {
|
|
1681
1922
|
setEnabled(setting.enabled);
|
|
@@ -1688,7 +1929,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1688
1929
|
});
|
|
1689
1930
|
});
|
|
1690
1931
|
}, []);
|
|
1691
|
-
|
|
1932
|
+
useInput12((input, key) => {
|
|
1692
1933
|
if (loading) return;
|
|
1693
1934
|
if (key.return || input === " ") {
|
|
1694
1935
|
setEnabled((current) => {
|
|
@@ -1703,16 +1944,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
1703
1944
|
onDone();
|
|
1704
1945
|
}
|
|
1705
1946
|
});
|
|
1706
|
-
return /* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
loading ? /* @__PURE__ */
|
|
1947
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1948
|
+
/* @__PURE__ */ jsx13(Text13, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
1949
|
+
/* @__PURE__ */ jsx13(Text13, { children: " " }),
|
|
1950
|
+
loading ? /* @__PURE__ */ jsx13(Text13, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
1710
1951
|
"Debug logging:",
|
|
1711
1952
|
" ",
|
|
1712
|
-
/* @__PURE__ */
|
|
1953
|
+
/* @__PURE__ */ jsx13(Text13, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1713
1954
|
] }),
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ jsx13(Text13, { children: " " }),
|
|
1956
|
+
/* @__PURE__ */ jsx13(
|
|
1716
1957
|
ControlHints,
|
|
1717
1958
|
{
|
|
1718
1959
|
hints: [
|
|
@@ -1723,7 +1964,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
1723
1964
|
)
|
|
1724
1965
|
] });
|
|
1725
1966
|
}
|
|
1726
|
-
var
|
|
1967
|
+
var init_screen6 = __esm({
|
|
1727
1968
|
"packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
|
|
1728
1969
|
"use strict";
|
|
1729
1970
|
init_home_theme();
|
|
@@ -1738,29 +1979,39 @@ var app_exports = {};
|
|
|
1738
1979
|
__export(app_exports, {
|
|
1739
1980
|
runApp: () => runApp
|
|
1740
1981
|
});
|
|
1741
|
-
import { useEffect as useEffect9, useState as
|
|
1742
|
-
import { Fragment as
|
|
1982
|
+
import { useEffect as useEffect9, useState as useState13 } from "react";
|
|
1983
|
+
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1743
1984
|
function App({ onLaunchImport, importExitCode }) {
|
|
1744
1985
|
const returnedFromImport = importExitCode !== void 0;
|
|
1745
|
-
const [screen, setScreen] =
|
|
1746
|
-
const [showImportResult, setShowImportResult] =
|
|
1747
|
-
const [projectPath, setProjectPath] =
|
|
1748
|
-
const [tokensPath, setTokensPath] =
|
|
1749
|
-
const [
|
|
1986
|
+
const [screen, setScreen] = useState13(returnedFromImport ? "import" : "start");
|
|
1987
|
+
const [showImportResult, setShowImportResult] = useState13(returnedFromImport);
|
|
1988
|
+
const [projectPath, setProjectPath] = useState13();
|
|
1989
|
+
const [tokensPath, setTokensPath] = useState13();
|
|
1990
|
+
const [pathConfirmed, setPathConfirmed] = useState13(false);
|
|
1991
|
+
const [importDefaults, setImportDefaults] = useState13();
|
|
1750
1992
|
useEffect9(() => {
|
|
1751
1993
|
if (screen !== "import") {
|
|
1752
1994
|
setImportDefaults(void 0);
|
|
1753
1995
|
return;
|
|
1754
1996
|
}
|
|
1755
1997
|
void readCredentials().then(
|
|
1756
|
-
(saved) => setImportDefaults({
|
|
1998
|
+
(saved) => setImportDefaults({
|
|
1999
|
+
componentDir: saved.defaultComponentDir ?? "",
|
|
2000
|
+
tokenFile: saved.defaultTokenFile ?? "",
|
|
2001
|
+
credentials: saved
|
|
2002
|
+
})
|
|
1757
2003
|
);
|
|
1758
2004
|
}, [screen]);
|
|
2005
|
+
const finishCredentials = async (result, project, tokens) => {
|
|
2006
|
+
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
2007
|
+
onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
|
|
2008
|
+
};
|
|
1759
2009
|
const goToStart = () => setScreen("start");
|
|
1760
2010
|
const goToSettings = () => setScreen("settings");
|
|
1761
2011
|
const resetImport = () => {
|
|
1762
2012
|
setProjectPath(void 0);
|
|
1763
2013
|
setTokensPath(void 0);
|
|
2014
|
+
setPathConfirmed(false);
|
|
1764
2015
|
};
|
|
1765
2016
|
const finishImportResult = () => {
|
|
1766
2017
|
setShowImportResult(false);
|
|
@@ -1773,13 +2024,13 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1773
2024
|
};
|
|
1774
2025
|
switch (screen) {
|
|
1775
2026
|
case "import":
|
|
1776
|
-
if (showImportResult) return /* @__PURE__ */
|
|
1777
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
2027
|
+
if (showImportResult) return /* @__PURE__ */ jsx14(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
2028
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx14(Fragment5, {});
|
|
1778
2029
|
if (projectPath === void 0) {
|
|
1779
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx14(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
1780
2031
|
}
|
|
1781
2032
|
if (tokensPath === void 0) {
|
|
1782
|
-
return /* @__PURE__ */
|
|
2033
|
+
return /* @__PURE__ */ jsx14(
|
|
1783
2034
|
TokenInputScreen,
|
|
1784
2035
|
{
|
|
1785
2036
|
initialPath: importDefaults.tokenFile,
|
|
@@ -1788,35 +2039,45 @@ function App({ onLaunchImport, importExitCode }) {
|
|
|
1788
2039
|
}
|
|
1789
2040
|
);
|
|
1790
2041
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
2042
|
+
if (!pathConfirmed) {
|
|
2043
|
+
return /* @__PURE__ */ jsx14(
|
|
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,
|
|
1793
2055
|
{
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
onBack: () => setTokensPath(void 0)
|
|
2056
|
+
initial: importDefaults.credentials,
|
|
2057
|
+
onBack: () => setPathConfirmed(false),
|
|
2058
|
+
onDone: (result) => void finishCredentials(result, projectPath, tokensPath)
|
|
1798
2059
|
}
|
|
1799
2060
|
);
|
|
1800
2061
|
case "help":
|
|
1801
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ jsx14(HelpScreen, { onDone: goToStart });
|
|
1802
2063
|
case "upgrade":
|
|
1803
|
-
return /* @__PURE__ */
|
|
2064
|
+
return /* @__PURE__ */ jsx14(UpgradeScreen, { onDone: goToStart });
|
|
1804
2065
|
case "settings":
|
|
1805
|
-
return /* @__PURE__ */
|
|
2066
|
+
return /* @__PURE__ */ jsx14(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
1806
2067
|
case "settings-configuration":
|
|
1807
|
-
return /* @__PURE__ */
|
|
2068
|
+
return /* @__PURE__ */ jsx14(ConfigurationScreen, { onDone: goToSettings });
|
|
1808
2069
|
case "settings-opt-in-analytics":
|
|
1809
|
-
return /* @__PURE__ */
|
|
2070
|
+
return /* @__PURE__ */ jsx14(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
1810
2071
|
case "settings-debug-mode":
|
|
1811
|
-
return /* @__PURE__ */
|
|
2072
|
+
return /* @__PURE__ */ jsx14(DebugModeScreen, { onDone: goToSettings });
|
|
1812
2073
|
case "start":
|
|
1813
|
-
return /* @__PURE__ */
|
|
2074
|
+
return /* @__PURE__ */ jsx14(HomeScreen, { onNavigate: setScreen });
|
|
1814
2075
|
}
|
|
1815
2076
|
}
|
|
1816
2077
|
async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
|
|
1817
2078
|
let requestedImport;
|
|
1818
2079
|
const instance = renderApp(
|
|
1819
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ jsx14(
|
|
1820
2081
|
App,
|
|
1821
2082
|
{
|
|
1822
2083
|
importExitCode,
|
|
@@ -1855,9 +2116,9 @@ var init_app = __esm({
|
|
|
1855
2116
|
init_PageContainer2();
|
|
1856
2117
|
init_PageContainer3();
|
|
1857
2118
|
init_ContentfulConfigScreen();
|
|
1858
|
-
init_screen4();
|
|
1859
|
-
init_PageContainer4();
|
|
1860
2119
|
init_screen5();
|
|
2120
|
+
init_PageContainer4();
|
|
2121
|
+
init_screen6();
|
|
1861
2122
|
init_config_store();
|
|
1862
2123
|
CLEAR_SCREEN = "\x1B[2J\x1B[H";
|
|
1863
2124
|
}
|