@contentful/experience-design-system-cli 2.37.1-dev-build-76b10f7f.0 → 2.37.1-dev-build-900f9bf0.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 +118 -105
- package/dist/index.js +119 -105
- 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,69 +18230,6 @@ 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 CredentialsReview({
|
|
18234
|
-
values,
|
|
18235
|
-
subtitle,
|
|
18236
|
-
notice,
|
|
18237
|
-
validating,
|
|
18238
|
-
onChoose,
|
|
18239
|
-
children
|
|
18240
|
-
}) {
|
|
18241
|
-
const [focus, setFocus] = useState9(0);
|
|
18242
|
-
useInput11((_input, key) => {
|
|
18243
|
-
if (validating) return;
|
|
18244
|
-
if (key.escape) onChoose("quit");
|
|
18245
|
-
else if (key.return) onChoose(MENU[focus].choice);
|
|
18246
|
-
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
18247
|
-
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
18248
|
-
});
|
|
18249
|
-
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
18250
|
-
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
18251
|
-
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
18252
|
-
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
18253
|
-
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
18254
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18255
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
|
|
18256
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18257
|
-
MENU.map((item, index) => {
|
|
18258
|
-
const focused = index === focus;
|
|
18259
|
-
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18260
|
-
/* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
|
|
18261
|
-
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.muted, children: item.label }) }),
|
|
18262
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
18263
|
-
] }, item.choice);
|
|
18264
|
-
}),
|
|
18265
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18266
|
-
FIELDS2.map((field) => {
|
|
18267
|
-
const value = values[field.key];
|
|
18268
|
-
return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { bold: value !== "", children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
|
|
18269
|
-
}),
|
|
18270
|
-
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18271
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18272
|
-
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
18273
|
-
"\u2717 ",
|
|
18274
|
-
notice.text
|
|
18275
|
-
] })
|
|
18276
|
-
] }),
|
|
18277
|
-
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18278
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18279
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
18280
|
-
] }),
|
|
18281
|
-
children,
|
|
18282
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18283
|
-
/* @__PURE__ */ jsx15(
|
|
18284
|
-
ControlHints,
|
|
18285
|
-
{
|
|
18286
|
-
hints: [
|
|
18287
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
18288
|
-
{ keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
|
|
18289
|
-
{ keys: "Esc", label: "back" }
|
|
18290
|
-
]
|
|
18291
|
-
}
|
|
18292
|
-
)
|
|
18293
|
-
] })
|
|
18294
|
-
] });
|
|
18295
|
-
}
|
|
18296
18233
|
function CredentialsScreen({
|
|
18297
18234
|
onDone,
|
|
18298
18235
|
onBack,
|
|
@@ -18313,6 +18250,9 @@ function CredentialsScreen({
|
|
|
18313
18250
|
const [validating, setValidating] = useState9(false);
|
|
18314
18251
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18315
18252
|
const [editing, setEditing] = useState9(!prefilled);
|
|
18253
|
+
const [focus, setFocus] = useState9(0);
|
|
18254
|
+
const [active, setActive] = useState9(0);
|
|
18255
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
18316
18256
|
const submit = async () => {
|
|
18317
18257
|
const credentials = normalize(values);
|
|
18318
18258
|
if (missingField(credentials)) {
|
|
@@ -18325,56 +18265,129 @@ function CredentialsScreen({
|
|
|
18325
18265
|
if (result.ok) onDone({ skipped: false, credentials });
|
|
18326
18266
|
else setNotice({ kind: "error", text: result.error });
|
|
18327
18267
|
};
|
|
18328
|
-
const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
|
|
18329
18268
|
const choose = (choice) => {
|
|
18330
18269
|
if (choice === "continue") void submit();
|
|
18331
18270
|
else if (choice === "edit") {
|
|
18332
18271
|
setNotice(null);
|
|
18272
|
+
setBeforeEdit(values);
|
|
18273
|
+
setActive(0);
|
|
18333
18274
|
setEditing(true);
|
|
18334
18275
|
} else onBack();
|
|
18335
18276
|
};
|
|
18336
|
-
|
|
18337
|
-
|
|
18277
|
+
const stopEditing = () => {
|
|
18278
|
+
setEditing(false);
|
|
18279
|
+
setFocus(0);
|
|
18280
|
+
};
|
|
18281
|
+
useInput11((_input, key) => {
|
|
18282
|
+
if (validating) return;
|
|
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);
|
|
18297
|
+
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
18298
|
+
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
18299
|
+
});
|
|
18300
|
+
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
18301
|
+
const isLastField = active === FIELDS2.length - 1;
|
|
18302
|
+
const changed = !isUnchanged(normalize(values), initialValues);
|
|
18303
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
18304
|
+
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
18305
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
18306
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
18338
18307
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18339
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
|
|
18308
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
18309
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18310
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: editing ? PALETTE.muted : PALETTE.accent, children: "ACTIONS" }),
|
|
18311
|
+
MENU.map((item, index) => {
|
|
18312
|
+
const focused = !editing && index === focus;
|
|
18313
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18314
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
|
|
18315
|
+
/* @__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 }) }),
|
|
18316
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
18317
|
+
] }, item.choice);
|
|
18318
|
+
}),
|
|
18319
|
+
/* @__PURE__ */ jsxs14(
|
|
18320
|
+
Box14,
|
|
18321
|
+
{
|
|
18322
|
+
flexDirection: "column",
|
|
18323
|
+
marginTop: 1,
|
|
18324
|
+
borderStyle: "single",
|
|
18325
|
+
borderColor: PALETTE.border,
|
|
18326
|
+
borderBottom: false,
|
|
18327
|
+
borderLeft: false,
|
|
18328
|
+
borderRight: false,
|
|
18329
|
+
children: [
|
|
18330
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: editing ? PALETTE.accent : PALETTE.muted, children: "SPACE" }),
|
|
18331
|
+
FIELDS2.map((field, index) => {
|
|
18332
|
+
const open = editing && index === active;
|
|
18333
|
+
const value = values[field.key];
|
|
18334
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
18335
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
18336
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
|
|
18337
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
18338
|
+
open ? /* @__PURE__ */ jsx15(
|
|
18339
|
+
ClearableTextInput,
|
|
18340
|
+
{
|
|
18341
|
+
value,
|
|
18342
|
+
onChange: (next) => {
|
|
18343
|
+
setValues((current) => ({ ...current, [field.key]: next }));
|
|
18344
|
+
setNotice(null);
|
|
18345
|
+
},
|
|
18346
|
+
onSubmit: () => isLastField ? stopEditing() : setActive(index + 1),
|
|
18347
|
+
mask: field.masked ? "\u2022" : void 0
|
|
18348
|
+
}
|
|
18349
|
+
) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
|
|
18350
|
+
] }, field.key);
|
|
18351
|
+
})
|
|
18352
|
+
]
|
|
18353
|
+
}
|
|
18354
|
+
),
|
|
18355
|
+
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18356
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18357
|
+
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
18358
|
+
"\u2717 ",
|
|
18359
|
+
notice.text
|
|
18374
18360
|
] })
|
|
18375
|
-
]
|
|
18376
|
-
|
|
18377
|
-
|
|
18361
|
+
] }),
|
|
18362
|
+
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18363
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18364
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
18365
|
+
] }),
|
|
18366
|
+
!prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18367
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18368
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
18369
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
18370
|
+
] }),
|
|
18371
|
+
changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18372
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18373
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
18374
|
+
] }),
|
|
18375
|
+
editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
18376
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
18377
|
+
/* @__PURE__ */ jsx15(
|
|
18378
|
+
ControlHints,
|
|
18379
|
+
{
|
|
18380
|
+
hints: [
|
|
18381
|
+
{ keys: "\u2191/\u2193", label: "field" },
|
|
18382
|
+
{ keys: "\u23CE", label: isLastField ? "done" : "next field" },
|
|
18383
|
+
{ keys: "Ctrl+D", label: "clear" },
|
|
18384
|
+
{ keys: "Esc", label: prefilled ? "cancel" : "back" }
|
|
18385
|
+
]
|
|
18386
|
+
}
|
|
18387
|
+
)
|
|
18388
|
+
] })
|
|
18389
|
+
] })
|
|
18390
|
+
] });
|
|
18378
18391
|
}
|
|
18379
18392
|
|
|
18380
18393
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts
|
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,69 +20686,6 @@ 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 CredentialsReview({
|
|
20690
|
-
values,
|
|
20691
|
-
subtitle,
|
|
20692
|
-
notice,
|
|
20693
|
-
validating,
|
|
20694
|
-
onChoose,
|
|
20695
|
-
children
|
|
20696
|
-
}) {
|
|
20697
|
-
const [focus, setFocus] = useState9(0);
|
|
20698
|
-
useInput11((_input, key) => {
|
|
20699
|
-
if (validating) return;
|
|
20700
|
-
if (key.escape) onChoose("quit");
|
|
20701
|
-
else if (key.return) onChoose(MENU[focus].choice);
|
|
20702
|
-
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
20703
|
-
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
20704
|
-
});
|
|
20705
|
-
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
20706
|
-
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
20707
|
-
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
20708
|
-
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
20709
|
-
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
20710
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20711
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
|
|
20712
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20713
|
-
MENU.map((item, index) => {
|
|
20714
|
-
const focused = index === focus;
|
|
20715
|
-
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20716
|
-
/* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
|
|
20717
|
-
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.muted, children: item.label }) }),
|
|
20718
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
20719
|
-
] }, item.choice);
|
|
20720
|
-
}),
|
|
20721
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20722
|
-
FIELDS2.map((field) => {
|
|
20723
|
-
const value = values[field.key];
|
|
20724
|
-
return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { bold: value !== "", children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
|
|
20725
|
-
}),
|
|
20726
|
-
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20727
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20728
|
-
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
20729
|
-
"\u2717 ",
|
|
20730
|
-
notice.text
|
|
20731
|
-
] })
|
|
20732
|
-
] }),
|
|
20733
|
-
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20734
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20735
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
20736
|
-
] }),
|
|
20737
|
-
children,
|
|
20738
|
-
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20739
|
-
/* @__PURE__ */ jsx15(
|
|
20740
|
-
ControlHints,
|
|
20741
|
-
{
|
|
20742
|
-
hints: [
|
|
20743
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
20744
|
-
{ keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
|
|
20745
|
-
{ keys: "Esc", label: "back" }
|
|
20746
|
-
]
|
|
20747
|
-
}
|
|
20748
|
-
)
|
|
20749
|
-
] })
|
|
20750
|
-
] });
|
|
20751
|
-
}
|
|
20752
20689
|
function CredentialsScreen({
|
|
20753
20690
|
onDone,
|
|
20754
20691
|
onBack,
|
|
@@ -20769,6 +20706,9 @@ function CredentialsScreen({
|
|
|
20769
20706
|
const [validating, setValidating] = useState9(false);
|
|
20770
20707
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
20771
20708
|
const [editing, setEditing] = useState9(!prefilled);
|
|
20709
|
+
const [focus, setFocus] = useState9(0);
|
|
20710
|
+
const [active, setActive] = useState9(0);
|
|
20711
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
20772
20712
|
const submit = async () => {
|
|
20773
20713
|
const credentials = normalize(values);
|
|
20774
20714
|
if (missingField(credentials)) {
|
|
@@ -20781,56 +20721,129 @@ function CredentialsScreen({
|
|
|
20781
20721
|
if (result.ok) onDone({ skipped: false, credentials });
|
|
20782
20722
|
else setNotice({ kind: "error", text: result.error });
|
|
20783
20723
|
};
|
|
20784
|
-
const subtitle = prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into.";
|
|
20785
20724
|
const choose = (choice) => {
|
|
20786
20725
|
if (choice === "continue") void submit();
|
|
20787
20726
|
else if (choice === "edit") {
|
|
20788
20727
|
setNotice(null);
|
|
20728
|
+
setBeforeEdit(values);
|
|
20729
|
+
setActive(0);
|
|
20789
20730
|
setEditing(true);
|
|
20790
20731
|
} else onBack();
|
|
20791
20732
|
};
|
|
20792
|
-
|
|
20793
|
-
|
|
20733
|
+
const stopEditing = () => {
|
|
20734
|
+
setEditing(false);
|
|
20735
|
+
setFocus(0);
|
|
20736
|
+
};
|
|
20737
|
+
useInput11((_input, key) => {
|
|
20738
|
+
if (validating) return;
|
|
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);
|
|
20753
|
+
else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
|
|
20754
|
+
else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
|
|
20755
|
+
});
|
|
20756
|
+
const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
|
|
20757
|
+
const isLastField = active === FIELDS2.length - 1;
|
|
20758
|
+
const changed = !isUnchanged(normalize(values), initialValues);
|
|
20759
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
|
|
20760
|
+
/* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
|
|
20761
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
|
|
20762
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
|
|
20794
20763
|
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20795
|
-
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20764
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
|
|
20765
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20766
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: editing ? PALETTE.muted : PALETTE.accent, children: "ACTIONS" }),
|
|
20767
|
+
MENU.map((item, index) => {
|
|
20768
|
+
const focused = !editing && index === focus;
|
|
20769
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20770
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: focused ? "\u276F" : " " }),
|
|
20771
|
+
/* @__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 }) }),
|
|
20772
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
|
|
20773
|
+
] }, item.choice);
|
|
20774
|
+
}),
|
|
20775
|
+
/* @__PURE__ */ jsxs14(
|
|
20776
|
+
Box14,
|
|
20777
|
+
{
|
|
20778
|
+
flexDirection: "column",
|
|
20779
|
+
marginTop: 1,
|
|
20780
|
+
borderStyle: "single",
|
|
20781
|
+
borderColor: PALETTE.border,
|
|
20782
|
+
borderBottom: false,
|
|
20783
|
+
borderLeft: false,
|
|
20784
|
+
borderRight: false,
|
|
20785
|
+
children: [
|
|
20786
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: editing ? PALETTE.accent : PALETTE.muted, children: "SPACE" }),
|
|
20787
|
+
FIELDS2.map((field, index) => {
|
|
20788
|
+
const open = editing && index === active;
|
|
20789
|
+
const value = values[field.key];
|
|
20790
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
20791
|
+
return /* @__PURE__ */ jsxs14(Box14, { gap: 1, children: [
|
|
20792
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: open ? "\u276F" : " " }),
|
|
20793
|
+
/* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: open, color: open ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
20794
|
+
open ? /* @__PURE__ */ jsx15(
|
|
20795
|
+
ClearableTextInput,
|
|
20796
|
+
{
|
|
20797
|
+
value,
|
|
20798
|
+
onChange: (next) => {
|
|
20799
|
+
setValues((current) => ({ ...current, [field.key]: next }));
|
|
20800
|
+
setNotice(null);
|
|
20801
|
+
},
|
|
20802
|
+
onSubmit: () => isLastField ? stopEditing() : setActive(index + 1),
|
|
20803
|
+
mask: field.masked ? "\u2022" : void 0
|
|
20804
|
+
}
|
|
20805
|
+
) : /* @__PURE__ */ jsx15(Text14, { color: display ? PALETTE.text : PALETTE.muted, children: display || (field.hint ?? "(empty)") })
|
|
20806
|
+
] }, field.key);
|
|
20807
|
+
})
|
|
20808
|
+
]
|
|
20809
|
+
}
|
|
20810
|
+
),
|
|
20811
|
+
notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20812
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20813
|
+
/* @__PURE__ */ jsxs14(Text14, { color: PALETTE.error, children: [
|
|
20814
|
+
"\u2717 ",
|
|
20815
|
+
notice.text
|
|
20830
20816
|
] })
|
|
20831
|
-
]
|
|
20832
|
-
|
|
20833
|
-
|
|
20817
|
+
] }),
|
|
20818
|
+
validating && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20819
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20820
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
|
|
20821
|
+
] }),
|
|
20822
|
+
!prefilled && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20823
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20824
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: credentialsPurpose(tokensOnly) }),
|
|
20825
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
|
|
20826
|
+
] }),
|
|
20827
|
+
changed && !validating && !notice && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20828
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20829
|
+
/* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Changed values are saved after they validate." })
|
|
20830
|
+
] }),
|
|
20831
|
+
editing && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
20832
|
+
/* @__PURE__ */ jsx15(Text14, { children: " " }),
|
|
20833
|
+
/* @__PURE__ */ jsx15(
|
|
20834
|
+
ControlHints,
|
|
20835
|
+
{
|
|
20836
|
+
hints: [
|
|
20837
|
+
{ keys: "\u2191/\u2193", label: "field" },
|
|
20838
|
+
{ keys: "\u23CE", label: isLastField ? "done" : "next field" },
|
|
20839
|
+
{ keys: "Ctrl+D", label: "clear" },
|
|
20840
|
+
{ keys: "Esc", label: prefilled ? "cancel" : "back" }
|
|
20841
|
+
]
|
|
20842
|
+
}
|
|
20843
|
+
)
|
|
20844
|
+
] })
|
|
20845
|
+
] })
|
|
20846
|
+
] });
|
|
20834
20847
|
}
|
|
20835
20848
|
var FIELDS2, MENU;
|
|
20836
20849
|
var init_screen5 = __esm({
|
|
@@ -20838,6 +20851,7 @@ var init_screen5 = __esm({
|
|
|
20838
20851
|
"use strict";
|
|
20839
20852
|
init_theme();
|
|
20840
20853
|
init_FieldForm();
|
|
20854
|
+
init_ClearableTextInput();
|
|
20841
20855
|
init_ControlHints();
|
|
20842
20856
|
init_StepHeader();
|
|
20843
20857
|
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-900f9bf0.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-
|
|
49
|
-
"@contentful/experience-design-system-
|
|
48
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-900f9bf0.0",
|
|
49
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-900f9bf0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|