@contentful/experience-design-system-cli 2.37.1-dev-build-900f9bf0.0 → 2.37.1-dev-build-f56fd7cd.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 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}. If you skip, files are saved locally and nothing is pushed.`;
18171
18171
  }
18172
18172
  function normalize(values) {
18173
18173
  return {
@@ -18230,89 +18230,36 @@ 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 CredentialsScreen({
18234
- onDone,
18235
- onBack,
18236
- initial = {},
18237
- validate: validate3 = validateCredentials,
18238
- tokensOnly = false
18233
+ function CredentialsReview({
18234
+ values,
18235
+ subtitle,
18236
+ notice,
18237
+ validating,
18238
+ onChoose,
18239
+ children
18239
18240
  }) {
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);
18253
18241
  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
- };
18281
18242
  useInput11((_input, key) => {
18282
18243
  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);
18244
+ if (key.escape) onChoose("quit");
18245
+ else if (key.return) onChoose(MENU[focus].choice);
18297
18246
  else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
18298
18247
  else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
18299
18248
  });
18300
18249
  const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
18301
- const isLastField = active === FIELDS2.length - 1;
18302
- const changed = !isUnchanged(normalize(values), initialValues);
18303
18250
  return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
18304
18251
  /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
18305
18252
  /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
18306
18253
  /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
18307
18254
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
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." }),
18255
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
18309
18256
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
18310
- /* @__PURE__ */ jsx15(Text14, { bold: true, color: editing ? PALETTE.muted : PALETTE.accent, children: "ACTIONS" }),
18257
+ /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "ACTIONS" }),
18311
18258
  MENU.map((item, index) => {
18312
- const focused = !editing && index === focus;
18259
+ const focused = index === focus;
18313
18260
  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 }) }),
18261
+ /* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
18262
+ /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.text, children: item.label }) }),
18316
18263
  /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
18317
18264
  ] }, item.choice);
18318
18265
  }),
@@ -18327,27 +18274,10 @@ function CredentialsScreen({
18327
18274
  borderLeft: false,
18328
18275
  borderRight: false,
18329
18276
  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;
18277
+ /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.muted, children: "SPACE" }),
18278
+ FIELDS2.map((field) => {
18333
18279
  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);
18280
+ return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { color: value ? PALETTE.text : PALETTE.muted, children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
18351
18281
  })
18352
18282
  ]
18353
18283
  }
@@ -18363,32 +18293,104 @@ function CredentialsScreen({
18363
18293
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
18364
18294
  /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
18365
18295
  ] }),
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
- ] })
18296
+ children,
18297
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
18298
+ /* @__PURE__ */ jsx15(
18299
+ ControlHints,
18300
+ {
18301
+ hints: [
18302
+ { keys: "\u2191/\u2193", label: "move" },
18303
+ { keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
18304
+ { keys: "Esc", label: "back" }
18305
+ ]
18306
+ }
18307
+ )
18389
18308
  ] })
18390
18309
  ] });
18391
18310
  }
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
+ }
18392
18394
 
18393
18395
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts
18394
18396
  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}. If you skip, files are saved locally and nothing is pushed.`;
20614
20614
  }
20615
20615
  function normalize(values) {
20616
20616
  return {
@@ -20686,89 +20686,36 @@ 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 CredentialsScreen({
20690
- onDone,
20691
- onBack,
20692
- initial = {},
20693
- validate: validate3 = validateCredentials,
20694
- tokensOnly = false
20689
+ function CredentialsReview({
20690
+ values,
20691
+ subtitle,
20692
+ notice,
20693
+ validating,
20694
+ onChoose,
20695
+ children
20695
20696
  }) {
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);
20709
20697
  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
- };
20737
20698
  useInput11((_input, key) => {
20738
20699
  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);
20700
+ if (key.escape) onChoose("quit");
20701
+ else if (key.return) onChoose(MENU[focus].choice);
20753
20702
  else if (key.upArrow) setFocus((current) => (current - 1 + MENU.length) % MENU.length);
20754
20703
  else if (key.downArrow || key.tab) setFocus((current) => (current + 1) % MENU.length);
20755
20704
  });
20756
20705
  const labelWidth = formLabelWidth([...FIELDS2, ...MENU]);
20757
- const isLastField = active === FIELDS2.length - 1;
20758
- const changed = !isUnchanged(normalize(values), initialValues);
20759
20706
  return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
20760
20707
  /* @__PURE__ */ jsx15(StepHeader, { step: "setup" }),
20761
20708
  /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingBottom: 1, children: [
20762
20709
  /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Contentful Credentials" }),
20763
20710
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
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." }),
20711
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: subtitle }),
20765
20712
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
20766
- /* @__PURE__ */ jsx15(Text14, { bold: true, color: editing ? PALETTE.muted : PALETTE.accent, children: "ACTIONS" }),
20713
+ /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.accent, children: "ACTIONS" }),
20767
20714
  MENU.map((item, index) => {
20768
- const focused = !editing && index === focus;
20715
+ const focused = index === focus;
20769
20716
  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 }) }),
20717
+ /* @__PURE__ */ jsx15(Text14, { color: focused ? PALETTE.accent : void 0, children: focused ? "\u276F" : " " }),
20718
+ /* @__PURE__ */ jsx15(Box14, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx15(Text14, { bold: focused, color: focused ? PALETTE.accent : PALETTE.text, children: item.label }) }),
20772
20719
  /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: item.description })
20773
20720
  ] }, item.choice);
20774
20721
  }),
@@ -20783,27 +20730,10 @@ function CredentialsScreen({
20783
20730
  borderLeft: false,
20784
20731
  borderRight: false,
20785
20732
  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;
20733
+ /* @__PURE__ */ jsx15(Text14, { bold: true, color: PALETTE.muted, children: "SPACE" }),
20734
+ FIELDS2.map((field) => {
20789
20735
  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);
20736
+ return /* @__PURE__ */ jsx15(FormReadOnlyRow, { label: field.label, labelWidth, children: /* @__PURE__ */ jsx15(Text14, { color: value ? PALETTE.text : PALETTE.muted, children: field.masked ? "\u2022".repeat(value.length) : value || "(empty)" }) }, field.key);
20807
20737
  })
20808
20738
  ]
20809
20739
  }
@@ -20819,39 +20749,110 @@ function CredentialsScreen({
20819
20749
  /* @__PURE__ */ jsx15(Text14, { children: " " }),
20820
20750
  /* @__PURE__ */ jsx15(Text14, { color: PALETTE.accent, children: "Validating credentials..." })
20821
20751
  ] }),
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
- ] })
20752
+ children,
20753
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
20754
+ /* @__PURE__ */ jsx15(
20755
+ ControlHints,
20756
+ {
20757
+ hints: [
20758
+ { keys: "\u2191/\u2193", label: "move" },
20759
+ { keys: "\u23CE", label: MENU[focus].label.toLowerCase() },
20760
+ { keys: "Esc", label: "back" }
20761
+ ]
20762
+ }
20763
+ )
20845
20764
  ] })
20846
20765
  ] });
20847
20766
  }
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
+ }
20848
20850
  var FIELDS2, MENU;
20849
20851
  var init_screen5 = __esm({
20850
20852
  "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
20851
20853
  "use strict";
20852
20854
  init_theme();
20853
20855
  init_FieldForm();
20854
- init_ClearableTextInput();
20855
20856
  init_ControlHints();
20856
20857
  init_StepHeader();
20857
20858
  init_logic8();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-900f9bf0.0",
3
+ "version": "2.37.1-dev-build-f56fd7cd.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
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-900f9bf0.0",
3
+ "version": "2.37.1-dev-build-f56fd7cd.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-900f9bf0.0",
49
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-900f9bf0.0"
48
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-f56fd7cd.0",
49
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-f56fd7cd.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",