@sap-ux/flp-config-inquirer 0.3.37 → 0.3.39

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/i18n.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { TOptions } from 'i18next';
1
+ import type { i18n as i18nNext, TOptions } from 'i18next';
2
2
  export declare const FLP_CONFIG_NAMESPACE = "flp-config-inquirer";
3
+ export declare const i18n: i18nNext;
3
4
  /**
4
5
  * Adds the `flp-config-inquirer` resource bundle to i18next.
5
6
  * May be required to load i18n translations after initialising in the consumer module.
package/dist/i18n.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FLP_CONFIG_NAMESPACE = void 0;
6
+ exports.i18n = exports.FLP_CONFIG_NAMESPACE = void 0;
7
7
  exports.addi18nResourceBundle = addi18nResourceBundle;
8
8
  exports.initI18n = initI18n;
9
9
  exports.t = t;
@@ -11,18 +11,22 @@ const i18next_1 = __importDefault(require("i18next"));
11
11
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
12
12
  const flp_config_inquirer_i18n_json_1 = __importDefault(require("./translations/flp-config-inquirer.i18n.json"));
13
13
  exports.FLP_CONFIG_NAMESPACE = 'flp-config-inquirer';
14
+ exports.i18n = i18next_1.default.createInstance();
14
15
  /**
15
16
  * Adds the `flp-config-inquirer` resource bundle to i18next.
16
17
  * May be required to load i18n translations after initialising in the consumer module.
17
18
  */
18
19
  function addi18nResourceBundle() {
19
- i18next_1.default.addResourceBundle('en', exports.FLP_CONFIG_NAMESPACE, flp_config_inquirer_i18n_json_1.default);
20
+ exports.i18n.addResourceBundle('en', exports.FLP_CONFIG_NAMESPACE, flp_config_inquirer_i18n_json_1.default);
20
21
  }
21
22
  /**
22
23
  * Initialize i18next with the translations for this module.
23
24
  */
24
25
  async function initI18n() {
25
- await i18next_1.default.init({ lng: 'en', fallbackLng: 'en' });
26
+ await exports.i18n.init({
27
+ lng: 'en',
28
+ fallbackLng: 'en'
29
+ });
26
30
  addi18nResourceBundle();
27
31
  // add the project-input-validator i18n resource bundle to ensure all translations are available
28
32
  (0, project_input_validator_1.addi18nResourceBundle)();
@@ -38,7 +42,7 @@ function t(key, options) {
38
42
  if (!options?.ns) {
39
43
  options = Object.assign(options ?? {}, { ns: exports.FLP_CONFIG_NAMESPACE });
40
44
  }
41
- return i18next_1.default.t(key, options);
45
+ return exports.i18n.t(key, options);
42
46
  }
43
47
  initI18n().catch(() => {
44
48
  // Needed for lint
@@ -14,14 +14,14 @@
14
14
  },
15
15
  "tooltips": {
16
16
  "inboundId": "Choose the inbound ID to be used to set the SAP Fiori launchpad tile configuration.",
17
- "additionalParameters": "Enter the value for the parameters in the Target Mappings section from the URL mentioned above."
17
+ "additionalParameters": "Enter the value for the parameters in JSON format."
18
18
  },
19
19
  "validators": {
20
20
  "inboundConfigKeyExists": "An inbound configuration with the key: {{inboundKey}} is already defined. Choose another key.",
21
21
  "flpConfigOverwrite": "Overwrite existing configuration?",
22
22
  "noInboundKeysAreFound": "The original application target mapping and the default parameters are found in the SAP Fiori reference library under Implementation Information -> Configuration -> Target Mappings.",
23
23
  "inboundId": "Choose the inbound ID that will be used to set the FLP tile configuration",
24
- "additionalParameters": "Enter the value for the parameters in the Target Mappings section from the URL mentioned above",
24
+ "additionalParameters": "Enter the value for the parameters in JSON format.",
25
25
  "semObjectActionDuplication": "When generating a new tile, you must modify the Semantic Object value, the Action value, or both. You can use the default suggestions, which include a '_New' suffix for each value or use your own designations.",
26
26
  "invalidParameterString": "The parameter string is not valid JSON.",
27
27
  "duplicateInbound": "The base application has an existing inbound that matches the values for Semantic Object and Action. To create a new tile you must modify the Semantic Object value, the Action value, or both."
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type DescriptorVariant, type NewInboundNavigation, type InternalInboundNavigation } from '@sap-ux/adp-tooling';
2
- import type { ManifestNamespace } from '@sap-ux/project-access';
2
+ import type { ManifestNamespace, UI5FlexLayer } from '@sap-ux/project-access';
3
3
  import { type FLPConfigPromptOptions, type FLPConfigAnswers, type TileSettingsAnswers } from './types';
4
4
  /**
5
5
  * Returns FLP configuration prompt options based on the provided inbounds, variant, and tile settings answers.
@@ -14,8 +14,9 @@ export declare function getAdpFlpConfigPromptOptions(tileSettingsAnswers: TileSe
14
14
  * Returns the configuration for writing FLP inbounds based on the provided answers and inbound content.
15
15
  *
16
16
  * @param {FLPConfigAnswers} flpConfigAnswers - The answers for FLP configuration.
17
- * @param {TileSettingsAnswers} tileSettingsAnswers - The answers for tile settings.
17
+ * @param {FlexLayer} layer - The layer of the project.
18
+ * @param {TileSettingsAnswers} [tileSettingsAnswers] - The answers for tile settings.
18
19
  * @returns {InternalInboundNavigation | NewInboundNavigation} The configuration for FLP inbounds writer.
19
20
  */
20
- export declare function getAdpFlpInboundsWriterConfig(flpConfigAnswers: FLPConfigAnswers, tileSettingsAnswers?: TileSettingsAnswers): InternalInboundNavigation | NewInboundNavigation;
21
+ export declare function getAdpFlpInboundsWriterConfig(flpConfigAnswers: FLPConfigAnswers, layer: UI5FlexLayer, tileSettingsAnswers?: TileSettingsAnswers): InternalInboundNavigation | NewInboundNavigation;
21
22
  //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js CHANGED
@@ -43,30 +43,42 @@ function getAdpFlpConfigPromptOptions(tileSettingsAnswers, inbounds, variant) {
43
43
  };
44
44
  }
45
45
  /**
46
- * Returns the configuration for writing FLP inbounds based on the provided answers and inbound content.
46
+ * Builds the configuration for replacing an existing FLP inbound based on the provided answers and layer.
47
47
  *
48
48
  * @param {FLPConfigAnswers} flpConfigAnswers - The answers for FLP configuration.
49
- * @param {TileSettingsAnswers} tileSettingsAnswers - The answers for tile settings.
50
- * @returns {InternalInboundNavigation | NewInboundNavigation} The configuration for FLP inbounds writer.
49
+ * @param {UI5FlexLayer} layer - The layer of the project.
50
+ * @returns {InternalInboundNavigation} The configuration for the replaced FLP inbound.
51
51
  */
52
- function getAdpFlpInboundsWriterConfig(flpConfigAnswers, tileSettingsAnswers) {
53
- const { tileHandlingAction } = tileSettingsAnswers ?? {};
54
- if (tileHandlingAction === types_1.tileActions.REPLACE) {
55
- const { semanticObject, action, signature: { parameters } = {} } = flpConfigAnswers.inboundId ?? {};
56
- const inboundId = !semanticObject || !action ? '' : `${semanticObject}-${action}`;
57
- return {
58
- inboundId,
59
- semanticObject: semanticObject ?? '',
60
- action: action ?? '',
61
- title: flpConfigAnswers.title ?? '',
62
- subTitle: flpConfigAnswers.subTitle ?? '',
63
- icon: flpConfigAnswers.icon ?? '',
64
- additionalParameters: parameters ? JSON.stringify(parameters) : ''
65
- };
52
+ function buildReplaceInboundConfig(flpConfigAnswers, layer) {
53
+ const { semanticObject, action, signature: { parameters } = {} } = flpConfigAnswers.inboundId ?? {};
54
+ let inboundId = !semanticObject || !action ? '' : `${semanticObject}-${action}`;
55
+ if (inboundId) {
56
+ inboundId = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */ ? `${"customer." /* NamespacePrefix.CUSTOMER */}${inboundId}` : inboundId;
66
57
  }
67
- const inboundId = !flpConfigAnswers.semanticObject || !flpConfigAnswers.action
58
+ return {
59
+ inboundId,
60
+ semanticObject: semanticObject ?? '',
61
+ action: action ?? '',
62
+ title: flpConfigAnswers.title ?? '',
63
+ subTitle: flpConfigAnswers.subTitle ?? '',
64
+ icon: flpConfigAnswers.icon ?? '',
65
+ additionalParameters: parameters ? JSON.stringify(parameters) : ''
66
+ };
67
+ }
68
+ /**
69
+ * Builds the configuration for adding a new FLP inbound based on the provided answers and layer.
70
+ *
71
+ * @param {FLPConfigAnswers} flpConfigAnswers - The answers for FLP configuration.
72
+ * @param {FlexLayer} layer - The layer of the project.
73
+ * @returns {InternalInboundNavigation} The configuration for the new FLP inbound.
74
+ */
75
+ function buildAddInboundConfig(flpConfigAnswers, layer) {
76
+ let inboundId = !flpConfigAnswers.semanticObject || !flpConfigAnswers.action
68
77
  ? ''
69
78
  : `${flpConfigAnswers.semanticObject}-${flpConfigAnswers.action}`;
79
+ if (inboundId) {
80
+ inboundId = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */ ? `${"customer." /* NamespacePrefix.CUSTOMER */}${inboundId}` : inboundId;
81
+ }
70
82
  return {
71
83
  inboundId,
72
84
  semanticObject: flpConfigAnswers.semanticObject ?? '',
@@ -77,4 +89,19 @@ function getAdpFlpInboundsWriterConfig(flpConfigAnswers, tileSettingsAnswers) {
77
89
  additionalParameters: flpConfigAnswers.additionalParameters ?? ''
78
90
  };
79
91
  }
92
+ /**
93
+ * Returns the configuration for writing FLP inbounds based on the provided answers and inbound content.
94
+ *
95
+ * @param {FLPConfigAnswers} flpConfigAnswers - The answers for FLP configuration.
96
+ * @param {FlexLayer} layer - The layer of the project.
97
+ * @param {TileSettingsAnswers} [tileSettingsAnswers] - The answers for tile settings.
98
+ * @returns {InternalInboundNavigation | NewInboundNavigation} The configuration for FLP inbounds writer.
99
+ */
100
+ function getAdpFlpInboundsWriterConfig(flpConfigAnswers, layer, tileSettingsAnswers) {
101
+ const { tileHandlingAction } = tileSettingsAnswers ?? {};
102
+ if (tileHandlingAction === types_1.tileActions.REPLACE) {
103
+ return buildReplaceInboundConfig(flpConfigAnswers, layer);
104
+ }
105
+ return buildAddInboundConfig(flpConfigAnswers, layer);
106
+ }
80
107
  //# sourceMappingURL=utils.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.3.37",
4
+ "version": "0.3.39",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -19,15 +19,15 @@
19
19
  "!dist/**/*.map"
20
20
  ],
21
21
  "dependencies": {
22
- "i18next": "23.5.1",
22
+ "i18next": "25.3.0",
23
23
  "lodash": "4.17.21",
24
- "@sap-ux/inquirer-common": "0.7.20",
24
+ "@sap-ux/inquirer-common": "0.7.21",
25
25
  "@sap-ux/btp-utils": "1.1.0",
26
- "@sap-ux/project-input-validator": "0.6.9",
27
- "@sap-ux/fiori-generator-shared": "0.12.15",
26
+ "@sap-ux/project-input-validator": "0.6.10",
27
+ "@sap-ux/fiori-generator-shared": "0.12.16",
28
28
  "@sap-ux/project-access": "1.30.6",
29
29
  "@sap-ux/axios-extension": "1.22.3",
30
- "@sap-ux/adp-tooling": "0.14.37"
30
+ "@sap-ux/adp-tooling": "0.14.39"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@sap-devx/yeoman-ui-types": "1.14.4",