@contentful/experience-design-system-cli 2.37.1-dev-build-f56fd7cd.0 → 2.37.1-dev-build-6e954110.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 +111 -114
- package/dist/index.js +112 -114
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -18167,7 +18167,7 @@ function FieldForm({
|
|
|
18167
18167
|
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
18168
18168
|
function credentialsPurpose(tokensOnly) {
|
|
18169
18169
|
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
18170
|
-
return `${use}
|
|
18170
|
+
return `${use}.`;
|
|
18171
18171
|
}
|
|
18172
18172
|
function normalize(values) {
|
|
18173
18173
|
return {
|
|
@@ -18230,36 +18230,88 @@ var MENU = [
|
|
|
18230
18230
|
{ choice: "continue", label: "Continue", description: "Check the credentials and go on" },
|
|
18231
18231
|
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
18232
18232
|
];
|
|
18233
|
-
function
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
children
|
|
18233
|
+
function CredentialsScreen({
|
|
18234
|
+
onDone,
|
|
18235
|
+
onBack,
|
|
18236
|
+
initial = {},
|
|
18237
|
+
validate: validate3 = validateCredentials,
|
|
18238
|
+
tokensOnly = false
|
|
18240
18239
|
}) {
|
|
18240
|
+
const initialValues = useRef2(
|
|
18241
|
+
normalize({
|
|
18242
|
+
spaceId: initial.spaceId ?? "",
|
|
18243
|
+
environmentId: initial.environmentId || "master",
|
|
18244
|
+
cmaToken: initial.cmaToken ?? "",
|
|
18245
|
+
host: initial.host ?? ""
|
|
18246
|
+
})
|
|
18247
|
+
).current;
|
|
18248
|
+
const [values, setValues] = useState9(initialValues);
|
|
18249
|
+
const [notice, setNotice] = useState9(null);
|
|
18250
|
+
const [validating, setValidating] = useState9(false);
|
|
18251
|
+
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18252
|
+
const [editing, setEditing] = useState9(!prefilled);
|
|
18241
18253
|
const [focus, setFocus] = useState9(0);
|
|
18254
|
+
const [active, setActive] = useState9(0);
|
|
18255
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
18256
|
+
const submit = async () => {
|
|
18257
|
+
const credentials = normalize(values);
|
|
18258
|
+
if (missingField(credentials)) {
|
|
18259
|
+
setNotice({ kind: "error", text: "Space ID, environment and CMA token are all required." });
|
|
18260
|
+
return;
|
|
18261
|
+
}
|
|
18262
|
+
setValidating(true);
|
|
18263
|
+
const result = await validate3(credentials);
|
|
18264
|
+
setValidating(false);
|
|
18265
|
+
if (result.ok) onDone({ skipped: false, credentials });
|
|
18266
|
+
else setNotice({ kind: "error", text: result.error });
|
|
18267
|
+
};
|
|
18268
|
+
const choose = (choice) => {
|
|
18269
|
+
if (choice === "continue") void submit();
|
|
18270
|
+
else if (choice === "edit") {
|
|
18271
|
+
setNotice(null);
|
|
18272
|
+
setBeforeEdit(values);
|
|
18273
|
+
setActive(0);
|
|
18274
|
+
setEditing(true);
|
|
18275
|
+
} else onBack();
|
|
18276
|
+
};
|
|
18277
|
+
const stopEditing = () => {
|
|
18278
|
+
setEditing(false);
|
|
18279
|
+
setFocus(0);
|
|
18280
|
+
};
|
|
18242
18281
|
useInput11((_input, key) => {
|
|
18243
18282
|
if (validating) return;
|
|
18244
|
-
if (
|
|
18245
|
-
|
|
18283
|
+
if (editing) {
|
|
18284
|
+
if (key.escape) {
|
|
18285
|
+
if (!prefilled) onBack();
|
|
18286
|
+
else {
|
|
18287
|
+
setValues(beforeEdit);
|
|
18288
|
+
setNotice(null);
|
|
18289
|
+
stopEditing();
|
|
18290
|
+
}
|
|
18291
|
+
} else if (key.upArrow) setActive((current) => (current - 1 + FIELDS2.length) % FIELDS2.length);
|
|
18292
|
+
else if (key.downArrow || key.tab) setActive((current) => (current + 1) % FIELDS2.length);
|
|
18293
|
+
return;
|
|
18294
|
+
}
|
|
18295
|
+
if (key.escape) choose("quit");
|
|
18296
|
+
else if (key.return) choose(MENU[focus].choice);
|
|
18246
18297
|
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
18247
18298
|
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
18248
18299
|
});
|
|
18249
18300
|
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
18301
|
+
const changed = !isUnchanged(normalize(values), initialValues);
|
|
18250
18302
|
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
18251
18303
|
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
18252
18304
|
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
18253
|
-
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
18305
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "Contentful Credentials" }),
|
|
18254
18306
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18255
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children:
|
|
18307
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
18256
18308
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18257
|
-
/* @__PURE__ */ jsx15(Text14, {
|
|
18309
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Actions" }),
|
|
18258
18310
|
MENU.map((item, index) => {
|
|
18259
|
-
const focused = index === focus;
|
|
18311
|
+
const focused = !editing && index === focus;
|
|
18260
18312
|
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18261
|
-
/* @__PURE__ */ jsx15(Text14, { color:
|
|
18262
|
-
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.text, children: item.label }) }),
|
|
18313
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
|
|
18314
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : editing ? PALETTE.muted : PALETTE.text, children: item.label }) }),
|
|
18263
18315
|
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
18264
18316
|
] }, item.choice);
|
|
18265
18317
|
}),
|
|
@@ -18274,10 +18326,27 @@ function CredentialsReview({
|
|
|
18274
18326
|
borderLeft: false,
|
|
18275
18327
|
borderRight: false,
|
|
18276
18328
|
children: [
|
|
18277
|
-
/* @__PURE__ */ jsx15(Text14, {
|
|
18278
|
-
FIELDS2.map((field) => {
|
|
18329
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Space" }),
|
|
18330
|
+
FIELDS2.map((field, index) => {
|
|
18331
|
+
const open = editing && index === active;
|
|
18279
18332
|
const value = values[field.key];
|
|
18280
|
-
|
|
18333
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
18334
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18335
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
|
|
18336
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
18337
|
+
open ? /* @__PURE__ */ jsx15(
|
|
18338
|
+
ClearableTextInput,
|
|
18339
|
+
{
|
|
18340
|
+
value,
|
|
18341
|
+
onChange: (next) => {
|
|
18342
|
+
setValues((current) => ({ ...current, [field.key]: next }));
|
|
18343
|
+
setNotice(null);
|
|
18344
|
+
},
|
|
18345
|
+
onSubmit: stopEditing,
|
|
18346
|
+
mask: field.masked ? "\u2022" : void 0
|
|
18347
|
+
}
|
|
18348
|
+
) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
|
|
18349
|
+
] }, field.key);
|
|
18281
18350
|
})
|
|
18282
18351
|
]
|
|
18283
18352
|
}
|
|
@@ -18293,104 +18362,32 @@ function CredentialsReview({
|
|
|
18293
18362
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18294
18363
|
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
18295
18364
|
] }),
|
|
18296
|
-
children
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
}
|
|
18307
|
-
|
|
18365
|
+
!prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18366
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18367
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
18368
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
18369
|
+
] }),
|
|
18370
|
+
changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18371
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18372
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
18373
|
+
] }),
|
|
18374
|
+
editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18375
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18376
|
+
/* @__PURE__ */ jsx15(
|
|
18377
|
+
ControlHints,
|
|
18378
|
+
{
|
|
18379
|
+
hints: [
|
|
18380
|
+
{ keys: "\u2191/\u2193", label: "field" },
|
|
18381
|
+
{ keys: "\u23CE", label: "save" },
|
|
18382
|
+
{ keys: "Ctrl+D", label: "clear" },
|
|
18383
|
+
{ keys: "Esc", label: prefilled ? "cancel" : "back" }
|
|
18384
|
+
]
|
|
18385
|
+
}
|
|
18386
|
+
)
|
|
18387
|
+
] })
|
|
18308
18388
|
] })
|
|
18309
18389
|
] });
|
|
18310
18390
|
}
|
|
18311
|
-
function CredentialsScreen({
|
|
18312
|
-
onDone,
|
|
18313
|
-
onBack,
|
|
18314
|
-
initial = {},
|
|
18315
|
-
validate: validate3 = validateCredentials,
|
|
18316
|
-
tokensOnly = false
|
|
18317
|
-
}) {
|
|
18318
|
-
const initialValues = useRef2(
|
|
18319
|
-
normalize({
|
|
18320
|
-
spaceId: initial.spaceId ?? "",
|
|
18321
|
-
environmentId: initial.environmentId || "master",
|
|
18322
|
-
cmaToken: initial.cmaToken ?? "",
|
|
18323
|
-
host: initial.host ?? ""
|
|
18324
|
-
})
|
|
18325
|
-
).current;
|
|
18326
|
-
const [values, setValues] = useState9(initialValues);
|
|
18327
|
-
const [notice, setNotice] = useState9(null);
|
|
18328
|
-
const [validating, setValidating] = useState9(false);
|
|
18329
|
-
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18330
|
-
const [editing, setEditing] = useState9(!prefilled);
|
|
18331
|
-
const submit = async () => {
|
|
18332
|
-
const credentials = normalize(values);
|
|
18333
|
-
if (missingField(credentials)) {
|
|
18334
|
-
setNotice({ kind: "error", text: "Space ID, environment and CMA token are all required." });
|
|
18335
|
-
return;
|
|
18336
|
-
}
|
|
18337
|
-
setValidating(true);
|
|
18338
|
-
const result = await validate3(credentials);
|
|
18339
|
-
setValidating(false);
|
|
18340
|
-
if (result.ok) onDone({ skipped: false, credentials });
|
|
18341
|
-
else setNotice({ kind: "error", text: result.error });
|
|
18342
|
-
};
|
|
18343
|
-
const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
|
|
18344
|
-
const choose = (choice) => {
|
|
18345
|
-
if (choice === "continue") void submit();
|
|
18346
|
-
else if (choice === "edit") {
|
|
18347
|
-
setNotice(null);
|
|
18348
|
-
setEditing(true);
|
|
18349
|
-
} else onBack();
|
|
18350
|
-
};
|
|
18351
|
-
if (!editing) {
|
|
18352
|
-
return /* @__PURE__ */ jsx15(CredentialsReview, { values, subtitle, notice, validating, onChoose: choose, children: !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18353
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18354
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
18355
|
-
] }) });
|
|
18356
|
-
}
|
|
18357
|
-
return /* @__PURE__ */ jsxs14(
|
|
18358
|
-
FieldForm,
|
|
18359
|
-
{
|
|
18360
|
-
header: /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
18361
|
-
title: "Contentful Credentials",
|
|
18362
|
-
subtitle,
|
|
18363
|
-
fields: FIELDS2,
|
|
18364
|
-
values,
|
|
18365
|
-
onChange: (key, value) => {
|
|
18366
|
-
setValues((current) => ({ ...current, [key]: value }));
|
|
18367
|
-
setNotice(null);
|
|
18368
|
-
},
|
|
18369
|
-
enterAdvances: true,
|
|
18370
|
-
onSave: () => void submit(),
|
|
18371
|
-
saveLabel: "continue",
|
|
18372
|
-
onQuit: prefilled ? () => setEditing(false) : onBack,
|
|
18373
|
-
quitLabel: prefilled ? "stop editing" : "back",
|
|
18374
|
-
notice,
|
|
18375
|
-
busy: validating,
|
|
18376
|
-
children: [
|
|
18377
|
-
!prefilled && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18378
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18379
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
18380
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
18381
|
-
] }),
|
|
18382
|
-
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18383
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18384
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
18385
|
-
] }),
|
|
18386
|
-
!validating && !notice && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18387
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18388
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
18389
|
-
] })
|
|
18390
|
-
]
|
|
18391
|
-
}
|
|
18392
|
-
);
|
|
18393
|
-
}
|
|
18394
18391
|
|
|
18395
18392
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts
|
|
18396
18393
|
function initialProgress(input) {
|
package/dist/index.js
CHANGED
|
@@ -20610,7 +20610,7 @@ var init_FieldForm = __esm({
|
|
|
20610
20610
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
20611
20611
|
function credentialsPurpose(tokensOnly) {
|
|
20612
20612
|
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
20613
|
-
return `${use}
|
|
20613
|
+
return `${use}.`;
|
|
20614
20614
|
}
|
|
20615
20615
|
function normalize(values) {
|
|
20616
20616
|
return {
|
|
@@ -20686,36 +20686,88 @@ var init_validate4 = __esm({
|
|
|
20686
20686
|
import { useRef as useRef2, useState as useState9 } from "react";
|
|
20687
20687
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
20688
20688
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20689
|
-
function
|
|
20690
|
-
|
|
20691
|
-
|
|
20692
|
-
|
|
20693
|
-
|
|
20694
|
-
|
|
20695
|
-
children
|
|
20689
|
+
function CredentialsScreen({
|
|
20690
|
+
onDone,
|
|
20691
|
+
onBack,
|
|
20692
|
+
initial = {},
|
|
20693
|
+
validate: validate3 = validateCredentials,
|
|
20694
|
+
tokensOnly = false
|
|
20696
20695
|
}) {
|
|
20696
|
+
const initialValues = useRef2(
|
|
20697
|
+
normalize({
|
|
20698
|
+
spaceId: initial.spaceId ?? "",
|
|
20699
|
+
environmentId: initial.environmentId || "master",
|
|
20700
|
+
cmaToken: initial.cmaToken ?? "",
|
|
20701
|
+
host: initial.host ?? ""
|
|
20702
|
+
})
|
|
20703
|
+
).current;
|
|
20704
|
+
const [values, setValues] = useState9(initialValues);
|
|
20705
|
+
const [notice, setNotice] = useState9(null);
|
|
20706
|
+
const [validating, setValidating] = useState9(false);
|
|
20707
|
+
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
20708
|
+
const [editing, setEditing] = useState9(!prefilled);
|
|
20697
20709
|
const [focus, setFocus] = useState9(0);
|
|
20710
|
+
const [active, setActive] = useState9(0);
|
|
20711
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
20712
|
+
const submit = async () => {
|
|
20713
|
+
const credentials = normalize(values);
|
|
20714
|
+
if (missingField(credentials)) {
|
|
20715
|
+
setNotice({ kind: "error", text: "Space ID, environment and CMA token are all required." });
|
|
20716
|
+
return;
|
|
20717
|
+
}
|
|
20718
|
+
setValidating(true);
|
|
20719
|
+
const result = await validate3(credentials);
|
|
20720
|
+
setValidating(false);
|
|
20721
|
+
if (result.ok) onDone({ skipped: false, credentials });
|
|
20722
|
+
else setNotice({ kind: "error", text: result.error });
|
|
20723
|
+
};
|
|
20724
|
+
const choose = (choice) => {
|
|
20725
|
+
if (choice === "continue") void submit();
|
|
20726
|
+
else if (choice === "edit") {
|
|
20727
|
+
setNotice(null);
|
|
20728
|
+
setBeforeEdit(values);
|
|
20729
|
+
setActive(0);
|
|
20730
|
+
setEditing(true);
|
|
20731
|
+
} else onBack();
|
|
20732
|
+
};
|
|
20733
|
+
const stopEditing = () => {
|
|
20734
|
+
setEditing(false);
|
|
20735
|
+
setFocus(0);
|
|
20736
|
+
};
|
|
20698
20737
|
useInput11((_input, key) => {
|
|
20699
20738
|
if (validating) return;
|
|
20700
|
-
if (
|
|
20701
|
-
|
|
20739
|
+
if (editing) {
|
|
20740
|
+
if (key.escape) {
|
|
20741
|
+
if (!prefilled) onBack();
|
|
20742
|
+
else {
|
|
20743
|
+
setValues(beforeEdit);
|
|
20744
|
+
setNotice(null);
|
|
20745
|
+
stopEditing();
|
|
20746
|
+
}
|
|
20747
|
+
} else if (key.upArrow) setActive((current) => (current - 1 + FIELDS2.length) % FIELDS2.length);
|
|
20748
|
+
else if (key.downArrow || key.tab) setActive((current) => (current + 1) % FIELDS2.length);
|
|
20749
|
+
return;
|
|
20750
|
+
}
|
|
20751
|
+
if (key.escape) choose("quit");
|
|
20752
|
+
else if (key.return) choose(MENU[focus].choice);
|
|
20702
20753
|
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
20703
20754
|
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
20704
20755
|
});
|
|
20705
20756
|
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
20757
|
+
const changed = !isUnchanged(normalize(values), initialValues);
|
|
20706
20758
|
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
20707
20759
|
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
20708
20760
|
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
20709
|
-
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
20761
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "Contentful Credentials" }),
|
|
20710
20762
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20711
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children:
|
|
20763
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
20712
20764
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20713
|
-
/* @__PURE__ */ jsx15(Text14, {
|
|
20765
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Actions" }),
|
|
20714
20766
|
MENU.map((item, index) => {
|
|
20715
|
-
const focused = index === focus;
|
|
20767
|
+
const focused = !editing && index === focus;
|
|
20716
20768
|
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20717
|
-
/* @__PURE__ */ jsx15(Text14, { color:
|
|
20718
|
-
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.text, children: item.label }) }),
|
|
20769
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
|
|
20770
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : editing ? PALETTE.muted : PALETTE.text, children: item.label }) }),
|
|
20719
20771
|
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
20720
20772
|
] }, item.choice);
|
|
20721
20773
|
}),
|
|
@@ -20730,10 +20782,27 @@ function CredentialsReview({
|
|
|
20730
20782
|
borderLeft: false,
|
|
20731
20783
|
borderRight: false,
|
|
20732
20784
|
children: [
|
|
20733
|
-
/* @__PURE__ */ jsx15(Text14, {
|
|
20734
|
-
FIELDS2.map((field) => {
|
|
20785
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Space" }),
|
|
20786
|
+
FIELDS2.map((field, index) => {
|
|
20787
|
+
const open = editing && index === active;
|
|
20735
20788
|
const value = values[field.key];
|
|
20736
|
-
|
|
20789
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
20790
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20791
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
|
|
20792
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
20793
|
+
open ? /* @__PURE__ */ jsx15(
|
|
20794
|
+
ClearableTextInput,
|
|
20795
|
+
{
|
|
20796
|
+
value,
|
|
20797
|
+
onChange: (next) => {
|
|
20798
|
+
setValues((current) => ({ ...current, [field.key]: next }));
|
|
20799
|
+
setNotice(null);
|
|
20800
|
+
},
|
|
20801
|
+
onSubmit: stopEditing,
|
|
20802
|
+
mask: field.masked ? "\u2022" : void 0
|
|
20803
|
+
}
|
|
20804
|
+
) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
|
|
20805
|
+
] }, field.key);
|
|
20737
20806
|
})
|
|
20738
20807
|
]
|
|
20739
20808
|
}
|
|
@@ -20749,110 +20818,39 @@ function CredentialsReview({
|
|
|
20749
20818
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20750
20819
|
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
20751
20820
|
] }),
|
|
20752
|
-
children
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
}
|
|
20763
|
-
|
|
20821
|
+
!prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20822
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20823
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
20824
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
20825
|
+
] }),
|
|
20826
|
+
changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20827
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20828
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
20829
|
+
] }),
|
|
20830
|
+
editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20831
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20832
|
+
/* @__PURE__ */ jsx15(
|
|
20833
|
+
ControlHints,
|
|
20834
|
+
{
|
|
20835
|
+
hints: [
|
|
20836
|
+
{ keys: "\u2191/\u2193", label: "field" },
|
|
20837
|
+
{ keys: "\u23CE", label: "save" },
|
|
20838
|
+
{ keys: "Ctrl+D", label: "clear" },
|
|
20839
|
+
{ keys: "Esc", label: prefilled ? "cancel" : "back" }
|
|
20840
|
+
]
|
|
20841
|
+
}
|
|
20842
|
+
)
|
|
20843
|
+
] })
|
|
20764
20844
|
] })
|
|
20765
20845
|
] });
|
|
20766
20846
|
}
|
|
20767
|
-
function CredentialsScreen({
|
|
20768
|
-
onDone,
|
|
20769
|
-
onBack,
|
|
20770
|
-
initial = {},
|
|
20771
|
-
validate: validate3 = validateCredentials,
|
|
20772
|
-
tokensOnly = false
|
|
20773
|
-
}) {
|
|
20774
|
-
const initialValues = useRef2(
|
|
20775
|
-
normalize({
|
|
20776
|
-
spaceId: initial.spaceId ?? "",
|
|
20777
|
-
environmentId: initial.environmentId || "master",
|
|
20778
|
-
cmaToken: initial.cmaToken ?? "",
|
|
20779
|
-
host: initial.host ?? ""
|
|
20780
|
-
})
|
|
20781
|
-
).current;
|
|
20782
|
-
const [values, setValues] = useState9(initialValues);
|
|
20783
|
-
const [notice, setNotice] = useState9(null);
|
|
20784
|
-
const [validating, setValidating] = useState9(false);
|
|
20785
|
-
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
20786
|
-
const [editing, setEditing] = useState9(!prefilled);
|
|
20787
|
-
const submit = async () => {
|
|
20788
|
-
const credentials = normalize(values);
|
|
20789
|
-
if (missingField(credentials)) {
|
|
20790
|
-
setNotice({ kind: "error", text: "Space ID, environment and CMA token are all required." });
|
|
20791
|
-
return;
|
|
20792
|
-
}
|
|
20793
|
-
setValidating(true);
|
|
20794
|
-
const result = await validate3(credentials);
|
|
20795
|
-
setValidating(false);
|
|
20796
|
-
if (result.ok) onDone({ skipped: false, credentials });
|
|
20797
|
-
else setNotice({ kind: "error", text: result.error });
|
|
20798
|
-
};
|
|
20799
|
-
const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
|
|
20800
|
-
const choose = (choice) => {
|
|
20801
|
-
if (choice === "continue") void submit();
|
|
20802
|
-
else if (choice === "edit") {
|
|
20803
|
-
setNotice(null);
|
|
20804
|
-
setEditing(true);
|
|
20805
|
-
} else onBack();
|
|
20806
|
-
};
|
|
20807
|
-
if (!editing) {
|
|
20808
|
-
return /* @__PURE__ */ jsx15(CredentialsReview, { values, subtitle, notice, validating, onChoose: choose, children: !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20809
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20810
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
20811
|
-
] }) });
|
|
20812
|
-
}
|
|
20813
|
-
return /* @__PURE__ */ jsxs14(
|
|
20814
|
-
FieldForm,
|
|
20815
|
-
{
|
|
20816
|
-
header: /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
20817
|
-
title: "Contentful Credentials",
|
|
20818
|
-
subtitle,
|
|
20819
|
-
fields: FIELDS2,
|
|
20820
|
-
values,
|
|
20821
|
-
onChange: (key, value) => {
|
|
20822
|
-
setValues((current) => ({ ...current, [key]: value }));
|
|
20823
|
-
setNotice(null);
|
|
20824
|
-
},
|
|
20825
|
-
enterAdvances: true,
|
|
20826
|
-
onSave: () => void submit(),
|
|
20827
|
-
saveLabel: "continue",
|
|
20828
|
-
onQuit: prefilled ? () => setEditing(false) : onBack,
|
|
20829
|
-
quitLabel: prefilled ? "stop editing" : "back",
|
|
20830
|
-
notice,
|
|
20831
|
-
busy: validating,
|
|
20832
|
-
children: [
|
|
20833
|
-
!prefilled && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20834
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20835
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
20836
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
20837
|
-
] }),
|
|
20838
|
-
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20839
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20840
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
20841
|
-
] }),
|
|
20842
|
-
!validating && !notice && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20843
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20844
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
20845
|
-
] })
|
|
20846
|
-
]
|
|
20847
|
-
}
|
|
20848
|
-
);
|
|
20849
|
-
}
|
|
20850
20847
|
var FIELDS2, MENU;
|
|
20851
20848
|
var init_screen5 = __esm({
|
|
20852
20849
|
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
|
|
20853
20850
|
"use strict";
|
|
20854
20851
|
init_theme();
|
|
20855
20852
|
init_FieldForm();
|
|
20853
|
+
init_ClearableTextInput();
|
|
20856
20854
|
init_ControlHints();
|
|
20857
20855
|
init_StepHeader();
|
|
20858
20856
|
init_logic8();
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-6e954110.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-types": "2.37.1-dev-build-
|
|
49
|
-
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-6e954110.0",
|
|
49
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-6e954110.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|