@commercetools-frontend/application-config 27.9.0 → 27.9.1

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.
@@ -12,8 +12,8 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
15
- var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
16
15
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
16
+ var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
17
17
  var fs$1 = require('node:fs');
18
18
  var path = require('node:path');
19
19
  var omitEmpty = require('omit-empty-es');
@@ -36,8 +36,7 @@ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/insta
36
36
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
37
37
  var path$1 = require('path');
38
38
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
39
- var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
40
- var formatters = require('./formatters-5a68b5ac.cjs.dev.js');
39
+ var formatters = require('./formatters-3e1c755e.cjs.dev.js');
41
40
  var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
42
41
  var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
43
42
  var Ajv = require('ajv');
@@ -59,8 +58,8 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
59
58
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
60
59
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
61
60
  var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
62
- var _URL__default = /*#__PURE__*/_interopDefault(_URL);
63
61
  var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
62
+ var _URL__default = /*#__PURE__*/_interopDefault(_URL);
64
63
  var fs__default$1 = /*#__PURE__*/_interopDefault(fs$1);
65
64
  var path__default = /*#__PURE__*/_interopDefault(path);
66
65
  var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
@@ -73,7 +72,6 @@ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceP
73
72
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
74
73
  var path__default$1 = /*#__PURE__*/_interopDefault(path$1);
75
74
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
76
- var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
77
75
  var _Set__default = /*#__PURE__*/_interopDefault(_Set);
78
76
  var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
79
77
  var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
@@ -150,10 +148,11 @@ const isDynamicAwaitSupported = () => {
150
148
  const isEsmModule = async cwd => {
151
149
  const packagePath = path__default["default"].join(cwd, 'package.json');
152
150
  try {
151
+ var _JSON$parse;
153
152
  const packageJSON = await fs__default["default"].readFile(packagePath, {
154
153
  encoding: 'utf-8'
155
154
  });
156
- return JSON.parse(packageJSON)?.type === 'module';
155
+ return ((_JSON$parse = JSON.parse(packageJSON)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.type) === 'module';
157
156
  } catch (error) {
158
157
  return false;
159
158
  }
@@ -173,7 +172,7 @@ const createExplorerFor = async configFileName => {
173
172
  const loaders = isDynamicAwaitSupported() || (await isEsmModule(process.cwd())) ? cosmiconfig.defaultLoaders : cosmiconfig.defaultLoadersSync;
174
173
  return cosmiconfig.cosmiconfig(configFileName, {
175
174
  searchStrategy: 'project',
176
- searchPlaces: [`${configFileName}.js`, `${configFileName}.cjs`, `${configFileName}.mjs`, `${configFileName}.ts`],
175
+ searchPlaces: ["".concat(configFileName, ".js"), "".concat(configFileName, ".cjs"), "".concat(configFileName, ".mjs"), "".concat(configFileName, ".ts")],
177
176
  loaders: {
178
177
  '.js': loaders['.js'],
179
178
  '.cjs': loaders['.cjs'],
@@ -188,9 +187,9 @@ const getConfigPath = async () => {
188
187
  const customApplicationConfigFile = await customApplicationExplorer.search();
189
188
  const customViewConfigFile = await customViewExplorer.search();
190
189
  if (!customApplicationConfigFile && !customViewConfigFile) {
191
- throw new Error(`Missing or invalid configuration file.`);
190
+ throw new Error("Missing or invalid configuration file.");
192
191
  }
193
- return customApplicationConfigFile?.filepath || customViewConfigFile?.filepath;
192
+ return (customApplicationConfigFile === null || customApplicationConfigFile === void 0 ? void 0 : customApplicationConfigFile.filepath) || (customViewConfigFile === null || customViewConfigFile === void 0 ? void 0 : customViewConfigFile.filepath);
194
193
  };
195
194
  const loadConfig = async applicationPath => {
196
195
  const customApplicationExplorer = await createExplorerFor('custom-application-config');
@@ -198,10 +197,10 @@ const loadConfig = async applicationPath => {
198
197
  const customApplicationConfigFile = await customApplicationExplorer.search(applicationPath);
199
198
  const customViewConfigFile = await customViewExplorer.search(applicationPath);
200
199
  if ((!customApplicationConfigFile || !customApplicationConfigFile.config) && (!customViewConfigFile || !customViewConfigFile.config)) {
201
- throw new MissingOrInvalidConfigError(`Missing or invalid configuration file.`);
200
+ throw new MissingOrInvalidConfigError("Missing or invalid configuration file.");
202
201
  }
203
202
  if (customApplicationConfigFile && customViewConfigFile) {
204
- throw new MissingOrInvalidConfigError(`Found configuration files for both Custom Application and Custom View. Please remove one of them.`);
203
+ throw new MissingOrInvalidConfigError("Found configuration files for both Custom Application and Custom View. Please remove one of them.");
205
204
  }
206
205
  return customViewConfigFile || customApplicationConfigFile;
207
206
  };
@@ -235,14 +234,15 @@ Boolean(valueOfEnvConfig.match(variableSyntax));
235
234
  const isEnvVariablePlaceholder = valueOfPlaceholder => Boolean(valueOfPlaceholder.match(envRefSyntax));
236
235
  const isIntlVariablePlaceholder = valueOfPlaceholder => Boolean(valueOfPlaceholder.match(intlRefSyntax));
237
236
  const isFilePathVariablePlaceholder = valueOfPlaceholder => Boolean(valueOfPlaceholder.match(filePathRefSyntax));
238
- const isStructuredJson = message => message?.string !== undefined;
237
+ const isStructuredJson = message => (message === null || message === void 0 ? void 0 : message.string) !== undefined;
239
238
  const substituteEnvVariablePlaceholder = (valueOfPlaceholder, matchedString, valueOfEnvConfig, loadingOptions) => {
240
239
  const _valueOfPlaceholder$s = valueOfPlaceholder.split(':'),
241
240
  _valueOfPlaceholder$s2 = _slicedToArray(_valueOfPlaceholder$s, 2),
242
241
  requestedEnvVar = _valueOfPlaceholder$s2[1];
243
242
  const hasEnvField = loadingOptions.processEnv.hasOwnProperty(requestedEnvVar);
244
243
  if (!hasEnvField) {
245
- throw new Error(`Missing environment variable '${requestedEnvVar}' specified in config as 'env:${requestedEnvVar}'.`);
244
+ var _context;
245
+ throw new Error(_concatInstanceProperty__default["default"](_context = "Missing environment variable '".concat(requestedEnvVar, "' specified in config as 'env:")).call(_context, requestedEnvVar, "'."));
246
246
  }
247
247
  return valueOfEnvConfig.replace(new RegExp(escapeRegExp(matchedString), 'g'), loadingOptions.processEnv[requestedEnvVar]);
248
248
  };
@@ -251,13 +251,14 @@ const substituteIntlVariablePlaceholder = (valueOfPlaceholder, matchedString, va
251
251
  _valueOfPlaceholder$s4 = _slicedToArray(_valueOfPlaceholder$s3, 3),
252
252
  locale = _valueOfPlaceholder$s4[1],
253
253
  requestedIntlMessageId = _valueOfPlaceholder$s4[2];
254
- const translationsFilePath = require.resolve(`./i18n/data/${locale}.json`, {
255
- paths: [`${loadingOptions.applicationPath}/src`, loadingOptions.applicationPath]
254
+ const translationsFilePath = require.resolve("./i18n/data/".concat(locale, ".json"), {
255
+ paths: ["".concat(loadingOptions.applicationPath, "/src"), loadingOptions.applicationPath]
256
256
  });
257
257
  const translations = require(translationsFilePath);
258
258
  const hasIntlMessage = translations.hasOwnProperty(requestedIntlMessageId);
259
259
  if (!hasIntlMessage) {
260
- throw new Error(`Missing message key '${requestedIntlMessageId}' specified in config as 'intl:${locale}:${requestedIntlMessageId}'.`);
260
+ var _context2, _context3;
261
+ throw new Error(_concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "Missing message key '".concat(requestedIntlMessageId, "' specified in config as 'intl:")).call(_context3, locale, ":")).call(_context2, requestedIntlMessageId, "'."));
261
262
  }
262
263
  const translation = translations[requestedIntlMessageId];
263
264
  const translationValue = isStructuredJson(translation) ? translation.string : translation;
@@ -283,7 +284,7 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
283
284
  // to /etc/passwd).
284
285
  const normalizedSpecifier = path__default$1["default"].posix.normalize(filePathOrModule);
285
286
  if (_startsWithInstanceProperty__default["default"](normalizedSpecifier).call(normalizedSpecifier, '..')) {
286
- throw new Error(`Path traversal in module specifiers is not allowed: ${filePathOrModule}`);
287
+ throw new Error("Path traversal in module specifiers is not allowed: ".concat(filePathOrModule));
287
288
  }
288
289
  }
289
290
  const resolvedPath = require.resolve(filePathOrModule, {
@@ -318,7 +319,7 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
318
319
  // Use path.relative() to avoid string prefix vulnerabilities (e.g., "/app" vs "/app-evil")
319
320
  const isSafePath = !_startsWithInstanceProperty__default["default"](relativePath).call(relativePath, '..') && !path__default$1["default"].isAbsolute(relativePath);
320
321
  if (!isSafePath) {
321
- throw new Error(`Access to files outside workspace directory is not allowed: ${filePathOrModule}`);
322
+ throw new Error("Access to files outside workspace directory is not allowed: ".concat(filePathOrModule));
322
323
  }
323
324
  }
324
325
  const content = fs__default$1["default"].readFileSync(normalizedPath, {
@@ -1020,12 +1021,13 @@ const printErrors = errors => {
1020
1021
  return 'No errors';
1021
1022
  }
1022
1023
  return _mapInstanceProperty__default["default"](errors).call(errors, error => {
1023
- const baseMessage = `${error.instancePath} ${error.message}`;
1024
+ var _context, _context2, _context3;
1025
+ const baseMessage = _concatInstanceProperty__default["default"](_context = "".concat(error.instancePath, " ")).call(_context, error.message);
1024
1026
  switch (error.keyword) {
1025
1027
  case 'additionalProperties':
1026
- return `${baseMessage}: ${error.params.additionalProperty}`;
1028
+ return _concatInstanceProperty__default["default"](_context2 = "".concat(baseMessage, ": ")).call(_context2, error.params.additionalProperty);
1027
1029
  case 'enum':
1028
- return `${baseMessage}: ${error.params.allowedValues.toString()}`;
1030
+ return _concatInstanceProperty__default["default"](_context3 = "".concat(baseMessage, ": ")).call(_context3, error.params.allowedValues.toString());
1029
1031
  default:
1030
1032
  return baseMessage;
1031
1033
  }
@@ -1038,7 +1040,8 @@ const validateConfig = (configType, config) => {
1038
1040
  } else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
1039
1041
  validation = validateCustomViewConfig;
1040
1042
  } else {
1041
- throw new Error(`Invalid config type "${configType}", expected ${_Object$keys__default["default"](LOADED_CONFIG_TYPES).toString()}`);
1043
+ var _context4;
1044
+ throw new Error(_concatInstanceProperty__default["default"](_context4 = "Invalid config type \"".concat(configType, "\", expected ")).call(_context4, _Object$keys__default["default"](LOADED_CONFIG_TYPES).toString()));
1042
1045
  }
1043
1046
  const isValid = validation(config);
1044
1047
  if (!isValid) {
@@ -1051,9 +1054,9 @@ const validateEntryPointUriPath = config => {
1051
1054
  }
1052
1055
  };
1053
1056
  const validateSubmenuLinks = config => {
1054
- var _context;
1057
+ var _context5;
1055
1058
  const uriPathSet = new _Set__default["default"]();
1056
- _forEachInstanceProperty__default["default"](_context = config.submenuLinks).call(_context, _ref => {
1059
+ _forEachInstanceProperty__default["default"](_context5 = config.submenuLinks).call(_context5, _ref => {
1057
1060
  let uriPath = _ref.uriPath;
1058
1061
  if (uriPathSet.has(uriPath)) {
1059
1062
  throw new Error('Duplicate URI path. Every submenu link must have a unique URI path value');
@@ -1062,63 +1065,64 @@ const validateSubmenuLinks = config => {
1062
1065
  });
1063
1066
  };
1064
1067
  const validateAdditionalOAuthScopes = config => {
1065
- var _context2, _context3;
1068
+ var _config$additionalOAu;
1066
1069
  const additionalPermissionNames = new _Set__default["default"]();
1067
- ((_context2 = config.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _forEachInstanceProperty__default["default"](_context2), _context2))?.(_ref2 => {
1070
+ (_config$additionalOAu = config.additionalOAuthScopes) === null || _config$additionalOAu === void 0 || _forEachInstanceProperty__default["default"](_config$additionalOAu).call(_config$additionalOAu, _ref2 => {
1068
1071
  let name = _ref2.name,
1069
1072
  view = _ref2.view,
1070
1073
  manage = _ref2.manage;
1071
1074
  if ((_Array$isArray__default["default"](view) && view.length === 0 || !view) && (_Array$isArray__default["default"](manage) && manage.length === 0 || !manage)) {
1072
- throw new Error(`At least one OAuth Scope for permission group name "${name}" is required`);
1075
+ throw new Error("At least one OAuth Scope for permission group name \"".concat(name, "\" is required"));
1073
1076
  } else if (additionalPermissionNames.has(name)) {
1074
- throw new Error(`Duplicate additional permission group name "${name}". Every additional permission must have a unique name`);
1077
+ throw new Error("Duplicate additional permission group name \"".concat(name, "\". Every additional permission must have a unique name"));
1075
1078
  }
1076
1079
  if (!name.match(constants.PERMISSION_GROUP_NAME_REGEX)) {
1077
- throw new Error(`Additional permission group name "${name}" is invalid. The value may be between 2 and 64 characters and only contain alphabetic lowercase characters and non-consecutive hyphens. Leading and trailing hyphens are also not allowed`);
1080
+ throw new Error("Additional permission group name \"".concat(name, "\" is invalid. The value may be between 2 and 64 characters and only contain alphabetic lowercase characters and non-consecutive hyphens. Leading and trailing hyphens are also not allowed"));
1078
1081
  }
1079
1082
  additionalPermissionNames.add(name);
1080
1083
  });
1081
1084
  };
1082
1085
 
1083
1086
  function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1084
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$1(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$1(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1087
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$1(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$1(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1085
1088
 
1086
1089
  // The `uriPath` of each submenu link is supposed to be defined relative
1087
1090
  // to the `entryPointUriPath`. Computing the full path is done internally to keep
1088
1091
  // the configuration simple.
1089
1092
  const computeUriPath = (uriPath, entryPointUriPath) => {
1093
+ var _context;
1090
1094
  // In case the `uriPath` is only `/`, it means that the link is supposed to be
1091
1095
  // treated the same as the main application path. In this case, the return value
1092
1096
  // should not contain any unnecessary trailing slash and therefore we use the `entryPointUriPath`.
1093
1097
  if (uriPath === '/') return entryPointUriPath;
1094
1098
  // In case the `uriPath` is already configured including the `entryPointUriPath`,
1095
1099
  // we return the `uriPath` as-is.
1096
- if (_startsWithInstanceProperty__default["default"](uriPath).call(uriPath, `${entryPointUriPath}/`)) return uriPath;
1100
+ if (_startsWithInstanceProperty__default["default"](uriPath).call(uriPath, "".concat(entryPointUriPath, "/"))) return uriPath;
1097
1101
  // Return the full path including the `entryPointUriPath` as a prefix.
1098
- return `${entryPointUriPath}/${uriPath}`;
1102
+ return _concatInstanceProperty__default["default"](_context = "".concat(entryPointUriPath, "/")).call(_context, uriPath);
1099
1103
  };
1100
1104
  const getPermissions = appConfig => {
1101
- var _context, _context2, _context3, _context4;
1102
- const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty__default["default"](_context = appConfig.additionalOAuthScopes || []).call(_context, (previousOauthScope, _ref) => {
1105
+ var _context2, _appConfig$additional, _context3;
1106
+ const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty__default["default"](_context2 = appConfig.additionalOAuthScopes || []).call(_context2, (previousOauthScope, _ref) => {
1103
1107
  let name = _ref.name,
1104
1108
  view = _ref.view,
1105
1109
  manage = _ref.manage;
1106
1110
  const formattedResourceKey = formatters.formatEntryPointUriPathToResourceAccessKey(name);
1107
1111
  return _objectSpread$1(_objectSpread$1({}, previousOauthScope), {}, {
1108
- [`view${formattedResourceKey}`]: view,
1109
- [`manage${formattedResourceKey}`]: manage
1112
+ ["view".concat(formattedResourceKey)]: view,
1113
+ ["manage".concat(formattedResourceKey)]: manage
1110
1114
  });
1111
1115
  }, {});
1112
- const additionalPermissionNames = ((_context2 = appConfig.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _mapInstanceProperty__default["default"](_context2), _context2))?.(_ref2 => {
1116
+ const additionalPermissionNames = ((_appConfig$additional = appConfig.additionalOAuthScopes) === null || _appConfig$additional === void 0 ? void 0 : _mapInstanceProperty__default["default"](_appConfig$additional).call(_appConfig$additional, _ref2 => {
1113
1117
  let name = _ref2.name;
1114
1118
  return name;
1115
- }) || [];
1119
+ })) || [];
1116
1120
  const permissionKeys = formatters.entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath ||
1117
1121
  // In case the `entryPointUriPath` is not defined it is because the
1118
1122
  // configuration is for a custom view. In this case we use the
1119
1123
  // default entry point uri path.
1120
1124
  constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, additionalPermissionNames);
1121
- const additionalPermissions = _mapInstanceProperty__default["default"](_context4 = _Object$keys__default["default"](additionalResourceAccessKeyToOauthScopeMap)).call(_context4, additionalResourceAccessKey => ({
1125
+ const additionalPermissions = _mapInstanceProperty__default["default"](_context3 = _Object$keys__default["default"](additionalResourceAccessKeyToOauthScopeMap)).call(_context3, additionalResourceAccessKey => ({
1122
1126
  name: permissionKeys[additionalResourceAccessKey],
1123
1127
  oAuthScopes: additionalResourceAccessKeyToOauthScopeMap[additionalResourceAccessKey]
1124
1128
  }));
@@ -1131,7 +1135,7 @@ const getPermissions = appConfig => {
1131
1135
  }, ...additionalPermissions];
1132
1136
  };
1133
1137
  function transformCustomApplicationConfigToData(appConfig) {
1134
- var _context5;
1138
+ var _context4;
1135
1139
  validateEntryPointUriPath(appConfig);
1136
1140
  validateSubmenuLinks(appConfig);
1137
1141
  validateAdditionalOAuthScopes(appConfig);
@@ -1144,7 +1148,7 @@ function transformCustomApplicationConfigToData(appConfig) {
1144
1148
  permissions: getPermissions(appConfig),
1145
1149
  icon: appConfig.icon,
1146
1150
  mainMenuLink: appConfig.mainMenuLink,
1147
- submenuLinks: _mapInstanceProperty__default["default"](_context5 = appConfig.submenuLinks).call(_context5, submenuLink => _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
1151
+ submenuLinks: _mapInstanceProperty__default["default"](_context4 = appConfig.submenuLinks).call(_context4, submenuLink => _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
1148
1152
  uriPath: computeUriPath(submenuLink.uriPath, appConfig.entryPointUriPath)
1149
1153
  }))
1150
1154
  };
@@ -1169,11 +1173,12 @@ function transformConfigurationToData(configType, configuration) {
1169
1173
  } else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
1170
1174
  return transformCustomViewConfigToData(configuration);
1171
1175
  } else {
1172
- throw new Error(`Invalid config type: ${configType}`);
1176
+ throw new Error("Invalid config type: ".concat(configType));
1173
1177
  }
1174
1178
  }
1175
1179
 
1176
1180
  const mapCloudIdentifierToApiUrl = key => {
1181
+ var _context;
1177
1182
  switch (key) {
1178
1183
  case CLOUD_IDENTIFIERS.GCP_AU:
1179
1184
  return MC_API_URLS[CLOUD_IDENTIFIERS.GCP_AU];
@@ -1190,7 +1195,7 @@ const mapCloudIdentifierToApiUrl = key => {
1190
1195
  default:
1191
1196
  // We would probably never get to this point, as the JSON schema validation
1192
1197
  // kicks in before.
1193
- throw new Error(`Unknown cloud identifier "${key}". Supported values: ${_Object$values__default["default"](CLOUD_IDENTIFIERS).toString()}`);
1198
+ throw new Error(_concatInstanceProperty__default["default"](_context = "Unknown cloud identifier \"".concat(key, "\". Supported values: ")).call(_context, _Object$values__default["default"](CLOUD_IDENTIFIERS).toString()));
1194
1199
  }
1195
1200
  };
1196
1201
  const getUniqueValues = function () {
@@ -1214,10 +1219,10 @@ const getOrThrow = (fn, errorMessage) => {
1214
1219
  };
1215
1220
 
1216
1221
  function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1217
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1222
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1218
1223
  // TODO: make it configurable.
1219
1224
  const developmentPort = 3001;
1220
- const developmentAppUrl = `http://localhost:${developmentPort}`;
1225
+ const developmentAppUrl = "http://localhost:".concat(developmentPort);
1221
1226
  const getLoadedConfigurationType = configFileName => {
1222
1227
  if (_includesInstanceProperty__default["default"](configFileName).call(configFileName, 'custom-view-config')) {
1223
1228
  return LOADED_CONFIG_TYPES.CUSTOM_VIEW;
@@ -1233,6 +1238,7 @@ const omitDevConfigIfEmpty = devConfig => {
1233
1238
  };
1234
1239
  const isCustomViewData = data => data.entryPointUriPath === undefined;
1235
1240
  const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1241
+ var _appConfig$env$develo;
1236
1242
  let isProd = _ref.isProd,
1237
1243
  configurationData = _ref.configurationData,
1238
1244
  mcApiUrl = _ref.mcApiUrl,
@@ -1249,7 +1255,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1249
1255
  initialProjectKey:
1250
1256
  // For the `account` application, we should unset the projectKey.
1251
1257
  entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey
1252
- }, appConfig.env.development?.teamId && _objectSpread({
1258
+ }, ((_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.teamId) && _objectSpread({
1253
1259
  teamId: appConfig.env.development.teamId
1254
1260
  }, isCustomViewData(configurationData) ? {
1255
1261
  customViewId: configurationData.id
@@ -1257,11 +1263,12 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1257
1263
  applicationId: configurationData.id
1258
1264
  })), {}, {
1259
1265
  oAuthScopes: appConfig.oAuthScopes,
1260
- additionalOAuthScopes: appConfig?.additionalOAuthScopes
1266
+ additionalOAuthScopes: appConfig === null || appConfig === void 0 ? void 0 : appConfig.additionalOAuthScopes
1261
1267
  }));
1262
1268
  if (isCustomViewData(configurationData)) {
1269
+ var _context;
1263
1270
  const hostUriPath = appConfig.env.development.hostUriPath;
1264
- const defaultHostUriPath = oidcConfig.initialProjectKey ? `/${oidcConfig.initialProjectKey}/${entryPointUriPath}` : `/${entryPointUriPath}`;
1271
+ const defaultHostUriPath = oidcConfig.initialProjectKey ? _concatInstanceProperty__default["default"](_context = "/".concat(oidcConfig.initialProjectKey, "/")).call(_context, entryPointUriPath) : "/".concat(entryPointUriPath);
1265
1272
  const hostUrl = new _URL__default["default"](hostUriPath || defaultHostUriPath, developmentAppUrl);
1266
1273
  return omitDevConfigIfEmpty({
1267
1274
  oidc: oidcConfig,
@@ -1283,6 +1290,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1283
1290
  });
1284
1291
  };
1285
1292
  const getRuntimeEnvironmentConfig = _ref2 => {
1293
+ var _context2;
1286
1294
  let isProd = _ref2.isProd,
1287
1295
  configurationData = _ref2.configurationData,
1288
1296
  additionalAppEnv = _ref2.additionalAppEnv,
@@ -1301,7 +1309,7 @@ const getRuntimeEnvironmentConfig = _ref2 => {
1301
1309
  // In development, we prefix the entry point with the "__local" prefix.
1302
1310
  // This is important to determine to which URL the MC should redirect to
1303
1311
  // after successful login.
1304
- const applicationIdentifier = isProd ? `${configurationData.id}:${entryPointUriPath}` : `__local:${entryPointUriPath}`;
1312
+ const applicationIdentifier = isProd ? _concatInstanceProperty__default["default"](_context2 = "".concat(configurationData.id, ":")).call(_context2, entryPointUriPath) : "__local:".concat(entryPointUriPath);
1305
1313
  const developmentConfig = getRuntimeEnvironmentConfigForDevelopment({
1306
1314
  isProd,
1307
1315
  configurationData,
@@ -1333,7 +1341,7 @@ const getRuntimeEnvironmentConfig = _ref2 => {
1333
1341
  // again will result in returning the cached value.
1334
1342
  let cachedConfig;
1335
1343
  const processConfig = async function () {
1336
- var _context;
1344
+ var _ref4, _processEnv$MC_APP_EN, _appConfig$additional, _ref5, _appConfig$headers, _appConfig$headers2, _context3, _appConfig$headers3, _appConfig$headers4;
1337
1345
  let _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1338
1346
  _ref3$disableCache = _ref3.disableCache,
1339
1347
  disableCache = _ref3$disableCache === void 0 ? false : _ref3$disableCache,
@@ -1352,22 +1360,22 @@ const processConfig = async function () {
1352
1360
  processEnv
1353
1361
  });
1354
1362
  const configurationData = transformConfigurationToData(configType, appConfig);
1355
- const appEnvKey = processEnv.MC_APP_ENV ?? processEnv.NODE_ENV ?? 'development';
1363
+ const appEnvKey = (_ref4 = (_processEnv$MC_APP_EN = processEnv.MC_APP_ENV) !== null && _processEnv$MC_APP_EN !== void 0 ? _processEnv$MC_APP_EN : processEnv.NODE_ENV) !== null && _ref4 !== void 0 ? _ref4 : 'development';
1356
1364
  const isProd = getIsProd(processEnv);
1357
- const additionalAppEnv = appConfig.additionalEnv ?? {};
1358
- const revision = additionalAppEnv.revision ?? '';
1365
+ const additionalAppEnv = (_appConfig$additional = appConfig.additionalEnv) !== null && _appConfig$additional !== void 0 ? _appConfig$additional : {};
1366
+ const revision = (_ref5 = additionalAppEnv.revision) !== null && _ref5 !== void 0 ? _ref5 : '';
1359
1367
 
1360
1368
  // Parse all the supported URLs, which gets implicitly validated
1361
1369
 
1362
1370
  const envAppUrl = isProd ? configurationData.url : developmentAppUrl;
1363
- const appUrl = getOrThrow(() => new _URL__default["default"](envAppUrl), `Invalid application URL: "${envAppUrl}"`);
1371
+ const appUrl = getOrThrow(() => new _URL__default["default"](envAppUrl), "Invalid application URL: \"".concat(envAppUrl, "\""));
1364
1372
 
1365
1373
  // Use `||` instead of `??` to include empty string values.
1366
1374
  const envCdnUrl = isProd ? appConfig.env.production.cdnUrl || appUrl.href : developmentAppUrl;
1367
- const cdnUrl = getOrThrow(() => new _URL__default["default"](envCdnUrl), `Invalid application CDN URL: "${envCdnUrl}"`);
1375
+ const cdnUrl = getOrThrow(() => new _URL__default["default"](envCdnUrl), "Invalid application CDN URL: \"".concat(envCdnUrl, "\""));
1368
1376
  const mcApiUrl = getOrThrow(() => new _URL__default["default"](
1369
1377
  // Use `||` instead of `??` to include empty string values.
1370
- appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), `Invalid MC API URL: "${appConfig.mcApiUrl}"`);
1378
+ appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), "Invalid MC API URL: \"".concat(appConfig.mcApiUrl, "\""));
1371
1379
  cachedConfig = {
1372
1380
  data: configurationData,
1373
1381
  env: getRuntimeEnvironmentConfig({
@@ -1382,16 +1390,16 @@ const processConfig = async function () {
1382
1390
  revision
1383
1391
  }),
1384
1392
  headers: _objectSpread(_objectSpread({}, appConfig.headers), {}, {
1385
- csp: _objectSpread(_objectSpread({}, appConfig.headers?.csp), {}, {
1393
+ csp: _objectSpread(_objectSpread({}, (_appConfig$headers = appConfig.headers) === null || _appConfig$headers === void 0 ? void 0 : _appConfig$headers.csp), {}, {
1386
1394
  // We need to make sure the URL we use in these CSP headers have a slash in the end,
1387
1395
  // otherwise it might create an invalid value when application/CDN URL points to a
1388
1396
  // non-root directory (ex: https://www.my-domain.com/app). This is a valid URL but from
1389
1397
  // the CSP point of view, it will say only the file `app` can be used as a source, so
1390
1398
  // any other file from that domain will be forbidden. Using the slash (ex: https://www.my-domain.com/app/)
1391
1399
  // at the end it's like using a wildcard so anything 'below' `app` will be allowed.
1392
- 'connect-src': getUniqueValues(appConfig.headers?.csp?.['connect-src'], _concatInstanceProperty__default["default"](_context = [mcApiUrl.origin]).call(_context, isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])),
1393
- 'script-src': getUniqueValues(appConfig.headers?.csp?.['script-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : []),
1394
- 'style-src': getUniqueValues(appConfig.headers?.csp?.['style-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])
1400
+ 'connect-src': getUniqueValues((_appConfig$headers2 = appConfig.headers) === null || _appConfig$headers2 === void 0 || (_appConfig$headers2 = _appConfig$headers2.csp) === null || _appConfig$headers2 === void 0 ? void 0 : _appConfig$headers2['connect-src'], _concatInstanceProperty__default["default"](_context3 = [mcApiUrl.origin]).call(_context3, isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/"), "".concat(trimTrailingSlash(cdnUrl.href), "/")] : [])),
1401
+ 'script-src': getUniqueValues((_appConfig$headers3 = appConfig.headers) === null || _appConfig$headers3 === void 0 || (_appConfig$headers3 = _appConfig$headers3.csp) === null || _appConfig$headers3 === void 0 ? void 0 : _appConfig$headers3['script-src'], isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/"), "".concat(trimTrailingSlash(cdnUrl.href), "/")] : []),
1402
+ 'style-src': getUniqueValues((_appConfig$headers4 = appConfig.headers) === null || _appConfig$headers4 === void 0 || (_appConfig$headers4 = _appConfig$headers4.csp) === null || _appConfig$headers4 === void 0 ? void 0 : _appConfig$headers4['style-src'], isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/"), "".concat(trimTrailingSlash(cdnUrl.href), "/")] : [])
1395
1403
  })
1396
1404
  })
1397
1405
  };