@sap-ux/flp-config-inquirer 0.1.5 → 0.2.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/index.d.ts CHANGED
@@ -1,22 +1,25 @@
1
+ import type { ManifestNamespace } from '@sap-ux/project-access';
1
2
  import type { InquirerAdapter, PromptDefaultValue } from '@sap-ux/inquirer-common';
2
3
  import { promptNames } from './types';
3
4
  import type { FLPConfigAnswers, FLPConfigQuestion, FLPConfigPromptOptions } from './types';
4
5
  /**
5
- * Get the inquirer prompts for the FLP configuration inquirer.
6
+ * Retrieves the inquirer prompts for the FLP configuration.
6
7
  *
7
- * @param inboundKeys - array of existing inbound keys to check for duplicates
8
- * @param promptOptions - options that can control some of the prompt behavior. See {@link FLPConfigPromptOptions} for details
9
- * @returns the prompts used to provide input for FLP configuration
8
+ * @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
9
+ * @param {string | undefined} appId - The application ID used to generate unique prompt keys.
10
+ * @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
11
+ * @returns {Promise<FLPConfigQuestion[]>} A promise that resolves to an array of FLP configuration questions.
10
12
  */
11
- declare function getPrompts(inboundKeys?: string[], promptOptions?: FLPConfigPromptOptions): Promise<FLPConfigQuestion[]>;
13
+ declare function getPrompts(inbounds?: ManifestNamespace.Inbound, appId?: string, promptOptions?: FLPConfigPromptOptions): Promise<FLPConfigQuestion[]>;
12
14
  /**
13
- * Prompt for FLP configuration inputs.
15
+ * Prompts the user for FLP configuration inputs.
14
16
  *
15
- * @param adapter - an instance of InquirerAdapter to handle prompting
16
- * @param inboundKeys - array of existing inbound keys to check for duplicates
17
- * @param promptOptions - options that can control some of the prompt behavior. See {@link FLPConfigPromptOptions} for details
18
- * @returns the prompt answers
17
+ * @param {InquirerAdapter} adapter - An instance of `InquirerAdapter` to handle prompting.
18
+ * @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
19
+ * @param {string | undefined} appId - The application ID used to generate unique prompt keys.
20
+ * @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
21
+ * @returns {Promise<FLPConfigAnswers>} A promise that resolves to the user's answers for the FLP configuration.
19
22
  */
20
- declare function prompt(adapter: InquirerAdapter, inboundKeys?: string[], promptOptions?: FLPConfigPromptOptions): Promise<FLPConfigAnswers>;
23
+ declare function prompt(adapter: InquirerAdapter, inbounds?: ManifestNamespace.Inbound, appId?: string, promptOptions?: FLPConfigPromptOptions): Promise<FLPConfigAnswers>;
21
24
  export { getPrompts, prompt, promptNames, type InquirerAdapter, type PromptDefaultValue, type FLPConfigAnswers, type FLPConfigPromptOptions };
22
25
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -12,44 +12,45 @@ const types_1 = require("./types");
12
12
  Object.defineProperty(exports, "promptNames", { enumerable: true, get: function () { return types_1.promptNames; } });
13
13
  const prompts_1 = require("./prompts");
14
14
  /**
15
- * Get the inquirer prompts for the FLP configuration inquirer.
15
+ * Retrieves the inquirer prompts for the FLP configuration.
16
16
  *
17
- * @param inboundKeys - array of existing inbound keys to check for duplicates
18
- * @param promptOptions - options that can control some of the prompt behavior. See {@link FLPConfigPromptOptions} for details
19
- * @returns the prompts used to provide input for FLP configuration
17
+ * @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
18
+ * @param {string | undefined} appId - The application ID used to generate unique prompt keys.
19
+ * @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
20
+ * @returns {Promise<FLPConfigQuestion[]>} A promise that resolves to an array of FLP configuration questions.
20
21
  */
21
- async function getPrompts(inboundKeys = [], promptOptions) {
22
+ async function getPrompts(inbounds, appId, promptOptions) {
22
23
  await (0, i18n_1.initI18n)();
23
- return (0, prompts_1.getQuestions)(inboundKeys, promptOptions);
24
+ return (0, prompts_1.getQuestions)(inbounds, appId, promptOptions);
24
25
  }
25
26
  /**
26
- * Prompt for FLP configuration inputs.
27
+ * Prompts the user for FLP configuration inputs.
27
28
  *
28
- * @param adapter - an instance of InquirerAdapter to handle prompting
29
- * @param inboundKeys - array of existing inbound keys to check for duplicates
30
- * @param promptOptions - options that can control some of the prompt behavior. See {@link FLPConfigPromptOptions} for details
31
- * @returns the prompt answers
29
+ * @param {InquirerAdapter} adapter - An instance of `InquirerAdapter` to handle prompting.
30
+ * @param {ManifestNamespace.Inbound | undefined} inbounds - An object containing existing inbound keys to check for duplicates.
31
+ * @param {string | undefined} appId - The application ID used to generate unique prompt keys.
32
+ * @param {FLPConfigPromptOptions | undefined} promptOptions - Options that control prompt behavior. See {@link FLPConfigPromptOptions} for details.
33
+ * @returns {Promise<FLPConfigAnswers>} A promise that resolves to the user's answers for the FLP configuration.
32
34
  */
33
- async function prompt(adapter, inboundKeys = [], promptOptions) {
34
- const flpPrompts = await getPrompts(inboundKeys, promptOptions);
35
+ async function prompt(adapter, inbounds, appId, promptOptions) {
36
+ const flpPrompts = await getPrompts(inbounds, appId, promptOptions);
35
37
  const answers = await adapter.prompt(flpPrompts);
36
38
  // Apply default values to prompts in case they have not been executed
37
39
  if (promptOptions) {
38
- const defaultAnswers = applyPromptOptionDefaults(answers, flpPrompts, promptOptions);
40
+ const defaultAnswers = applyPromptOptionDefaults(answers, promptOptions);
39
41
  Object.assign(answers, defaultAnswers);
40
42
  }
41
43
  return answers;
42
44
  }
43
45
  /**
44
- * Apply prompt option default values to prompt answers in case they have not been executed by the user selections.
45
- * This can occur where some prompts are hidden by conditions.
46
+ * Applies default values to unanswered prompts based on the provided options.
47
+ * This function ensures that hidden or skipped prompts are assigned default values if specified in the options.
46
48
  *
47
- * @param answers the answers from previous prompting, only answers without a value will be considered for defaulting
48
- * @param flpPrompts the prompts that were used to prompt the user, will be used to apply default values if not answered or no default provided
49
- * @param promptOptions the prompt options which may provide default values or functions
50
- * @returns the default values for the unanswered prompts, based on the prompt options
49
+ * @param {Partial<FLPConfigAnswers>} answers - The answers from previous prompting. Only unanswered prompts are considered.
50
+ * @param {FLPConfigPromptOptions} promptOptions - Options for the prompts, which may include default values or functions.
51
+ * @returns {Partial<FLPConfigAnswers>} A partial object containing the default values for unanswered prompts.
51
52
  */
52
- function applyPromptOptionDefaults(answers, flpPrompts, promptOptions) {
53
+ function applyPromptOptionDefaults(answers, promptOptions) {
53
54
  const defaultAnswers = {};
54
55
  Object.entries(promptOptions).forEach(([key, promptOpt]) => {
55
56
  const promptKey = key;
@@ -65,12 +66,12 @@ function applyPromptOptionDefaults(answers, flpPrompts, promptOptions) {
65
66
  return defaultAnswers;
66
67
  }
67
68
  /**
68
- * Get the default value for a prompt based on the provided default value or function.
69
- * If a function is provided, it will be called with the current answers to determine the default value.
69
+ * Retrieves the default value for a prompt based on the provided default value or function.
70
+ * If the default value is a function, it is executed with the current answers to determine the value.
70
71
  *
71
- * @param answers the current answers provided to default functions
72
- * @param promptDefault the default value or function to determine the default value
73
- * @returns the default value for the prompt or undefined if no default value is provided
72
+ * @param {Partial<FLPConfigAnswers>} answers - The current answers provided to default functions.
73
+ * @param {PromptDefaultValue<string | boolean>['default'] | undefined} promptDefault - The default value or function to determine the default value.
74
+ * @returns The default value for the prompt, or `undefined` if no default is provided.
74
75
  */
75
76
  function getDefaultValue(answers, promptDefault) {
76
77
  if (typeof promptDefault === 'function') {
@@ -1,10 +1,16 @@
1
+ import type { ManifestNamespace } from '@sap-ux/project-access';
1
2
  import type { FLPConfigPromptOptions, FLPConfigQuestion } from '../types';
2
3
  /**
3
4
  * Generates a list of prompts for FLP (Fiori Launchpad) configuration.
4
5
  *
5
- * @param {string[]} [inboundKeys] - An array of existing inbound keys to check for duplicates.
6
- * @param {FLPConfigPromptOptions} [promptOptions] - Optional configuration to control prompt behavior and defaults.
6
+ * This function creates a set of prompts tailored for configuring FLP inbound navigation, including prompts
7
+ * for inbound IDs, semantic objects, actions, titles, subtitles, and overwrite options. The behavior of the
8
+ * prompts can be customized through the provided `promptOptions` parameter.
9
+ *
10
+ * @param {ManifestNamespace.Inbound | undefined} [inbounds] - Existing inbounds for the application, if any.
11
+ * @param {string | undefined} [appId] - Application ID for generating relevant prompts.
12
+ * @param {FLPConfigPromptOptions | undefined} [promptOptions] - Optional configuration to control prompt behavior and defaults.
7
13
  * @returns {FLPConfigQuestion[]} An array of FLPConfigQuestion objects to be used for prompting the user.
8
14
  */
9
- export declare function getQuestions(inboundKeys?: string[], promptOptions?: FLPConfigPromptOptions): FLPConfigQuestion[];
15
+ export declare function getQuestions(inbounds?: ManifestNamespace.Inbound, appId?: string, promptOptions?: FLPConfigPromptOptions): FLPConfigQuestion[];
10
16
  //# sourceMappingURL=prompts.d.ts.map
@@ -2,32 +2,46 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getQuestions = getQuestions;
4
4
  const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
5
- const basic_1 = require("./questions/basic");
5
+ const questions_1 = require("./questions");
6
6
  const types_1 = require("../types");
7
7
  /**
8
8
  * Generates a list of prompts for FLP (Fiori Launchpad) configuration.
9
9
  *
10
- * @param {string[]} [inboundKeys] - An array of existing inbound keys to check for duplicates.
11
- * @param {FLPConfigPromptOptions} [promptOptions] - Optional configuration to control prompt behavior and defaults.
10
+ * This function creates a set of prompts tailored for configuring FLP inbound navigation, including prompts
11
+ * for inbound IDs, semantic objects, actions, titles, subtitles, and overwrite options. The behavior of the
12
+ * prompts can be customized through the provided `promptOptions` parameter.
13
+ *
14
+ * @param {ManifestNamespace.Inbound | undefined} [inbounds] - Existing inbounds for the application, if any.
15
+ * @param {string | undefined} [appId] - Application ID for generating relevant prompts.
16
+ * @param {FLPConfigPromptOptions | undefined} [promptOptions] - Optional configuration to control prompt behavior and defaults.
12
17
  * @returns {FLPConfigQuestion[]} An array of FLPConfigQuestion objects to be used for prompting the user.
13
18
  */
14
- function getQuestions(inboundKeys = [], promptOptions) {
19
+ function getQuestions(inbounds, appId, promptOptions) {
20
+ const inboundKeys = Object.keys(inbounds ?? {});
15
21
  const isCLI = (0, fiori_generator_shared_1.getHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli;
16
22
  const existingKeyRef = { value: false };
17
23
  const silentOverwrite = promptOptions?.silentOverwrite ?? false;
18
24
  const keyedPrompts = {
19
- [types_1.promptNames.semanticObject]: (0, basic_1.getSemanticObjectPrompt)(isCLI, promptOptions?.[types_1.promptNames.semanticObject]),
20
- [types_1.promptNames.action]: (0, basic_1.getActionPrompt)(isCLI, promptOptions?.[types_1.promptNames.action]),
21
- [types_1.promptNames.overwrite]: (0, basic_1.getOverwritePrompt)(inboundKeys, isCLI, existingKeyRef, promptOptions?.[types_1.promptNames.overwrite]),
22
- [types_1.promptNames.title]: (0, basic_1.getTitlePrompt)(existingKeyRef, silentOverwrite, isCLI, promptOptions?.[types_1.promptNames.title]),
23
- [types_1.promptNames.subTitle]: (0, basic_1.getSubTitlePrompt)(existingKeyRef, silentOverwrite, promptOptions?.[types_1.promptNames.subTitle])
25
+ [types_1.promptNames.inboundId]: (0, questions_1.getInboundIdsPrompt)(inboundKeys, promptOptions?.[types_1.promptNames.inboundId]),
26
+ [types_1.promptNames.emptyInboundsInfo]: (0, questions_1.getEmptyInboundsLabelPrompt)(inboundKeys, appId),
27
+ [types_1.promptNames.semanticObject]: (0, questions_1.getSemanticObjectPrompt)(isCLI, promptOptions?.[types_1.promptNames.semanticObject]),
28
+ [types_1.promptNames.action]: (0, questions_1.getActionPrompt)(isCLI, promptOptions?.[types_1.promptNames.action]),
29
+ [types_1.promptNames.overwrite]: (0, questions_1.getOverwritePrompt)(inboundKeys, isCLI, existingKeyRef, promptOptions?.[types_1.promptNames.overwrite]),
30
+ [types_1.promptNames.title]: (0, questions_1.getTitlePrompt)(existingKeyRef, silentOverwrite, isCLI, promptOptions?.[types_1.promptNames.title]),
31
+ [types_1.promptNames.subTitle]: (0, questions_1.getSubTitlePrompt)(existingKeyRef, silentOverwrite, promptOptions?.[types_1.promptNames.subTitle]),
32
+ [types_1.promptNames.additionalParameters]: (0, questions_1.getParameterStringPrompt)(inboundKeys, promptOptions?.[types_1.promptNames.additionalParameters]),
33
+ [types_1.promptNames.createAnotherInbound]: (0, questions_1.getCreateAnotherInboundPrompt)(isCLI, promptOptions?.[types_1.promptNames.createAnotherInbound])
24
34
  };
25
35
  const questions = [
36
+ keyedPrompts[types_1.promptNames.inboundId],
37
+ keyedPrompts[types_1.promptNames.emptyInboundsInfo],
26
38
  keyedPrompts[types_1.promptNames.semanticObject],
27
39
  keyedPrompts[types_1.promptNames.action],
28
40
  keyedPrompts[types_1.promptNames.overwrite],
29
41
  keyedPrompts[types_1.promptNames.title],
30
- keyedPrompts[types_1.promptNames.subTitle]
42
+ keyedPrompts[types_1.promptNames.subTitle],
43
+ keyedPrompts[types_1.promptNames.additionalParameters],
44
+ keyedPrompts[types_1.promptNames.createAnotherInbound]
31
45
  ];
32
46
  return questions;
33
47
  }
@@ -0,0 +1,35 @@
1
+ import type { FLPConfigQuestion, InboundIdPromptOptions, CreateAnotherInboundPromptOptions, ParameterStringPromptOptions, EmptyInboundsLabelOptions } from '../../types';
2
+ /**
3
+ * Creates the 'inboundId' prompt for FLP configuration.
4
+ *
5
+ * @param {string[]} inboundIds - List of existing inbound IDs to populate the prompt choices.
6
+ * @param {InboundIdPromptOptions} [options] - Optional configuration for the inbound ID prompt, including defaults.
7
+ * @returns {FLPConfigQuestion} The prompt configuration for selecting an inbound ID.
8
+ */
9
+ export declare function getInboundIdsPrompt(inboundIds: string[], options?: InboundIdPromptOptions): FLPConfigQuestion;
10
+ /**
11
+ * Creates the 'emptyInboundsInfo' label prompt for cases where no inbounds exist.
12
+ *
13
+ * @param {string[]} inboundIds - List of existing inbound IDs to determine whether to display this label.
14
+ * @param {string} [appId] - Application ID to generate a link for the Fiori application library.
15
+ * @param {EmptyInboundsLabelOptions} [options] - Optional configuration for the label prompt.
16
+ * @returns {FLPConfigQuestion} The prompt configuration for displaying an information label when no inbounds exist.
17
+ */
18
+ export declare function getEmptyInboundsLabelPrompt(inboundIds: string[], appId?: string, options?: EmptyInboundsLabelOptions): FLPConfigQuestion;
19
+ /**
20
+ * Creates the 'additionalParameters' prompt for specifying parameters in JSON format.
21
+ *
22
+ * @param {string[]} inboundIds - List of existing inbound IDs to conditionally display this prompt.
23
+ * @param {ParameterStringPromptOptions} [options] - Optional configuration for the additional parameter string prompt, including defaults.
24
+ * @returns {FLPConfigQuestion} The prompt configuration for specifying a parameter string.
25
+ */
26
+ export declare function getParameterStringPrompt(inboundIds: string[], options?: ParameterStringPromptOptions): FLPConfigQuestion;
27
+ /**
28
+ * Creates the 'createAnotherInbound' confirmation prompt for adding additional inbounds.
29
+ *
30
+ * @param {boolean} isCLI - Indicates if the platform is CLI.
31
+ * @param {CreateAnotherInboundPromptOptions} [options] - Optional configuration for the confirmation prompt, including defaults.
32
+ * @returns {FLPConfigQuestion} The prompt configuration for confirming whether to create another inbound.
33
+ */
34
+ export declare function getCreateAnotherInboundPrompt(isCLI: boolean, options?: CreateAnotherInboundPromptOptions): FLPConfigQuestion;
35
+ //# sourceMappingURL=advanced.d.ts.map
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInboundIdsPrompt = getInboundIdsPrompt;
4
+ exports.getEmptyInboundsLabelPrompt = getEmptyInboundsLabelPrompt;
5
+ exports.getParameterStringPrompt = getParameterStringPrompt;
6
+ exports.getCreateAnotherInboundPrompt = getCreateAnotherInboundPrompt;
7
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
8
+ const project_input_validator_1 = require("@sap-ux/project-input-validator");
9
+ const i18n_1 = require("../../i18n");
10
+ const types_1 = require("../../types");
11
+ /**
12
+ * Creates the 'inboundId' prompt for FLP configuration.
13
+ *
14
+ * @param {string[]} inboundIds - List of existing inbound IDs to populate the prompt choices.
15
+ * @param {InboundIdPromptOptions} [options] - Optional configuration for the inbound ID prompt, including defaults.
16
+ * @returns {FLPConfigQuestion} The prompt configuration for selecting an inbound ID.
17
+ */
18
+ function getInboundIdsPrompt(inboundIds, options) {
19
+ return {
20
+ type: 'list',
21
+ name: types_1.promptNames.inboundId,
22
+ message: (0, i18n_1.t)('prompts.inboundIds'),
23
+ choices: inboundIds,
24
+ default: inboundIds[0],
25
+ validate: project_input_validator_1.validateEmptyString,
26
+ when: options?.hide ? false : inboundIds?.length > 0,
27
+ guiOptions: {
28
+ hint: (0, i18n_1.t)('tooltips.inboundId'),
29
+ breadcrumb: (0, i18n_1.t)('prompts.inboundIds'),
30
+ mandatory: true
31
+ }
32
+ };
33
+ }
34
+ /**
35
+ * Creates the 'emptyInboundsInfo' label prompt for cases where no inbounds exist.
36
+ *
37
+ * @param {string[]} inboundIds - List of existing inbound IDs to determine whether to display this label.
38
+ * @param {string} [appId] - Application ID to generate a link for the Fiori application library.
39
+ * @param {EmptyInboundsLabelOptions} [options] - Optional configuration for the label prompt.
40
+ * @returns {FLPConfigQuestion} The prompt configuration for displaying an information label when no inbounds exist.
41
+ */
42
+ function getEmptyInboundsLabelPrompt(inboundIds, appId, options) {
43
+ return {
44
+ type: 'input',
45
+ name: types_1.promptNames.emptyInboundsInfo,
46
+ message: (0, i18n_1.t)('prompts.emptyInboundsInfo'),
47
+ guiOptions: {
48
+ type: 'label',
49
+ mandatory: false,
50
+ link: {
51
+ text: 'application page.',
52
+ url: `https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/${appId ? `index.html?appId=${appId}&releaseGroupTextCombined=SC` : '#/home'}`
53
+ }
54
+ },
55
+ when: options?.hide ? false : inboundIds.length === 0
56
+ };
57
+ }
58
+ /**
59
+ * Creates the 'additionalParameters' prompt for specifying parameters in JSON format.
60
+ *
61
+ * @param {string[]} inboundIds - List of existing inbound IDs to conditionally display this prompt.
62
+ * @param {ParameterStringPromptOptions} [options] - Optional configuration for the additional parameter string prompt, including defaults.
63
+ * @returns {FLPConfigQuestion} The prompt configuration for specifying a parameter string.
64
+ */
65
+ function getParameterStringPrompt(inboundIds, options) {
66
+ return {
67
+ type: 'editor',
68
+ name: types_1.promptNames.additionalParameters,
69
+ message: (0, i18n_1.t)('prompts.additionalParameters'),
70
+ validate: (value) => {
71
+ if (!value) {
72
+ return true;
73
+ }
74
+ try {
75
+ (0, adp_tooling_1.parseParameters)(value);
76
+ }
77
+ catch (error) {
78
+ return error.message;
79
+ }
80
+ return true;
81
+ },
82
+ when: options?.hide ? false : inboundIds?.length === 0,
83
+ guiOptions: {
84
+ hint: (0, i18n_1.t)('tooltips.additionalParameters'),
85
+ mandatory: false
86
+ }
87
+ };
88
+ }
89
+ /**
90
+ * Creates the 'createAnotherInbound' confirmation prompt for adding additional inbounds.
91
+ *
92
+ * @param {boolean} isCLI - Indicates if the platform is CLI.
93
+ * @param {CreateAnotherInboundPromptOptions} [options] - Optional configuration for the confirmation prompt, including defaults.
94
+ * @returns {FLPConfigQuestion} The prompt configuration for confirming whether to create another inbound.
95
+ */
96
+ function getCreateAnotherInboundPrompt(isCLI, options) {
97
+ return {
98
+ type: 'confirm',
99
+ name: types_1.promptNames.createAnotherInbound,
100
+ message: (0, i18n_1.t)('prompts.createAnotherInbound'),
101
+ default: false,
102
+ when: options?.hide ? false : (answers) => !isCLI && !!answers?.inboundId,
103
+ guiOptions: {
104
+ hint: (0, i18n_1.t)('tooltips.inboundId'),
105
+ breadcrumb: (0, i18n_1.t)('prompts.inboundIds')
106
+ }
107
+ };
108
+ }
109
+ //# sourceMappingURL=advanced.js.map
@@ -1,2 +1,3 @@
1
1
  export * from './basic';
2
+ export * from './advanced';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./basic"), exports);
18
+ __exportStar(require("./advanced"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "prompts": {
3
+ "inboundIds": "Inbound ID",
4
+ "emptyInboundsInfo": "Original application target mapping and the default parameters can be found in Fiori reference library under Implementation Information -> Configuration -> Target Mapping(s) in",
3
5
  "semanticObject": "Semantic Object",
4
6
  "action": "Action",
5
7
  "title": "Title",
6
- "subTitle": "Subtitle"
8
+ "subTitle": "Subtitle",
9
+ "additionalParameters": "Parameters",
10
+ "createAnotherInbound": "Do you want to add or edit another inbound?"
11
+ },
12
+ "tooltips": {
13
+ "inboundId": "Choose the inbound ID that will be used to set the FLP tile configuration",
14
+ "additionalParameters": "Enter the value for the parameters in the Target Mappings section from the URL mentioned above"
7
15
  },
8
16
  "validators": {
9
17
  "inboundConfigKeyExists": "An inbound configuration with the key: '{{inboundKey}}' is already defined.",
10
- "flpConfigOverwrite": "Overwrite existing configuration?"
18
+ "flpConfigOverwrite": "Overwrite existing configuration?",
19
+ "noInboundKeysAreFound": "Original application target mapping and the default parameters can be found in Fiori reference library under Implementation Information -> Configuration -> Target Mapping(s) in application page."
11
20
  }
12
21
  }
package/dist/types.d.ts CHANGED
@@ -1,23 +1,32 @@
1
1
  import type { YUIQuestion, GuiOptions, PromptSeverityMessage } from '@sap-ux/inquirer-common';
2
+ import type { ListQuestionOptions } from 'inquirer';
2
3
  /**
3
4
  * Enumeration of prompt names used in the FLP configuration.
4
5
  */
5
6
  export declare enum promptNames {
7
+ inboundId = "inboundId",
8
+ emptyInboundsInfo = "emptyInboundsInfo",
6
9
  semanticObject = "semanticObject",
7
10
  action = "action",
8
11
  overwrite = "overwrite",
9
12
  title = "title",
10
- subTitle = "subTitle"
13
+ subTitle = "subTitle",
14
+ additionalParameters = "additionalParameters",
15
+ createAnotherInbound = "createAnotherInbound"
11
16
  }
12
17
  /**
13
18
  * Interface representing the answers collected from the FLP configuration prompts.
14
19
  */
15
20
  export interface FLPConfigAnswers {
21
+ [promptNames.inboundId]?: string;
22
+ [promptNames.emptyInboundsInfo]?: string;
16
23
  [promptNames.semanticObject]: string;
17
24
  [promptNames.action]: string;
18
25
  [promptNames.overwrite]?: boolean;
19
26
  [promptNames.title]?: string;
20
27
  [promptNames.subTitle]?: string;
28
+ [promptNames.additionalParameters]?: string;
29
+ [promptNames.createAnotherInbound]?: boolean;
21
30
  s4Continue?: boolean;
22
31
  }
23
32
  /**
@@ -29,11 +38,24 @@ export interface ExistingInboundRef {
29
38
  /**
30
39
  * The question type specific to FLP configuration prompts.
31
40
  */
32
- export interface FLPConfigQuestion extends YUIQuestion<FLPConfigAnswers> {
41
+ export interface FLPConfigQuestion extends YUIQuestion<FLPConfigAnswers>, Partial<Pick<ListQuestionOptions, 'choices'>> {
33
42
  name: promptNames;
34
43
  guiOptions?: GuiOptions;
35
44
  additionalMessages?: PromptSeverityMessage;
36
45
  }
46
+ /**
47
+ * Options for the 'inboundId' prompt.
48
+ */
49
+ export interface InboundIdPromptOptions {
50
+ default?: string;
51
+ hide?: boolean;
52
+ }
53
+ /**
54
+ * Options for the 'empty inbound label' prompt.
55
+ */
56
+ export interface EmptyInboundsLabelOptions {
57
+ hide?: boolean;
58
+ }
37
59
  /**
38
60
  * Options for the 'semanticObject' prompt.
39
61
  */
@@ -65,6 +87,20 @@ export interface TitlePromptOptions {
65
87
  export interface SubTitlePromptOptions {
66
88
  default?: string;
67
89
  }
90
+ /**
91
+ * Options for the 'additionalParameters' prompt.
92
+ */
93
+ export interface ParameterStringPromptOptions {
94
+ default?: string;
95
+ hide?: boolean;
96
+ }
97
+ /**
98
+ * Options for the 'createAnotherInbound' prompt.
99
+ */
100
+ export interface CreateAnotherInboundPromptOptions {
101
+ default?: string;
102
+ hide?: boolean;
103
+ }
68
104
  /**
69
105
  * The options which are common for the FLP config inquirer.
70
106
  */
@@ -74,7 +110,7 @@ type FLPConfigCommonInquirerOptions = {
74
110
  /**
75
111
  * The options for the FLP config inquirer & the prompts.
76
112
  */
77
- type flpConfigPromptOptions = Record<promptNames.semanticObject, SemanticObjectPromptOptions> & Record<promptNames.action, ActionPromptOptions> & Record<promptNames.overwrite, OverwritePromptOptions> & Record<promptNames.title, TitlePromptOptions> & Record<promptNames.subTitle, SubTitlePromptOptions>;
113
+ type flpConfigPromptOptions = Record<promptNames.inboundId, InboundIdPromptOptions> & Record<promptNames.emptyInboundsInfo, EmptyInboundsLabelOptions> & Record<promptNames.semanticObject, SemanticObjectPromptOptions> & Record<promptNames.action, ActionPromptOptions> & Record<promptNames.overwrite, OverwritePromptOptions> & Record<promptNames.title, TitlePromptOptions> & Record<promptNames.subTitle, SubTitlePromptOptions> & Record<promptNames.additionalParameters, ParameterStringPromptOptions> & Record<promptNames.createAnotherInbound, CreateAnotherInboundPromptOptions>;
78
114
  /**
79
115
  * The options for the FLP config inquirer & the prompts.
80
116
  */
package/dist/types.js CHANGED
@@ -6,10 +6,14 @@ exports.promptNames = void 0;
6
6
  */
7
7
  var promptNames;
8
8
  (function (promptNames) {
9
+ promptNames["inboundId"] = "inboundId";
10
+ promptNames["emptyInboundsInfo"] = "emptyInboundsInfo";
9
11
  promptNames["semanticObject"] = "semanticObject";
10
12
  promptNames["action"] = "action";
11
13
  promptNames["overwrite"] = "overwrite";
12
14
  promptNames["title"] = "title";
13
15
  promptNames["subTitle"] = "subTitle";
16
+ promptNames["additionalParameters"] = "additionalParameters";
17
+ promptNames["createAnotherInbound"] = "createAnotherInbound";
14
18
  })(promptNames || (exports.promptNames = promptNames = {}));
15
19
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/flp-config-inquirer",
3
3
  "description": "Prompts module that can prompt users for inputs required for FLP configuration",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -21,10 +21,12 @@
21
21
  "dependencies": {
22
22
  "i18next": "23.5.1",
23
23
  "lodash": "4.17.21",
24
- "@sap-ux/inquirer-common": "0.5.9",
24
+ "@sap-ux/inquirer-common": "0.5.11",
25
25
  "@sap-ux/btp-utils": "0.17.1",
26
26
  "@sap-ux/project-input-validator": "0.3.4",
27
- "@sap-ux/fiori-generator-shared": "0.7.13"
27
+ "@sap-ux/fiori-generator-shared": "0.7.14",
28
+ "@sap-ux/project-access": "1.28.9",
29
+ "@sap-ux/adp-tooling": "0.12.95"
28
30
  },
29
31
  "devDependencies": {
30
32
  "@sap-devx/yeoman-ui-types": "1.14.4",