@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.
@@ -8,8 +8,8 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
10
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
11
- import _URL from '@babel/runtime-corejs3/core-js-stable/url';
12
11
  import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
12
+ import _URL from '@babel/runtime-corejs3/core-js-stable/url';
13
13
  import fs$1 from 'node:fs';
14
14
  import path, { parse } from 'node:path';
15
15
  import omitEmpty from 'omit-empty-es';
@@ -33,8 +33,7 @@ import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instanc
33
33
  import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
34
34
  import path$1 from 'path';
35
35
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
36
- import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
37
- import { f as formatEntryPointUriPathToResourceAccessKey, e as entryPointUriPathToResourceAccesses } from './formatters-5629a23b.esm.js';
36
+ import { f as formatEntryPointUriPathToResourceAccessKey, e as entryPointUriPathToResourceAccesses } from './formatters-e218c305.esm.js';
38
37
  import _Set from '@babel/runtime-corejs3/core-js-stable/set';
39
38
  import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
40
39
  import Ajv from 'ajv';
@@ -114,10 +113,11 @@ const isDynamicAwaitSupported = () => {
114
113
  const isEsmModule = async cwd => {
115
114
  const packagePath = path.join(cwd, 'package.json');
116
115
  try {
116
+ var _JSON$parse;
117
117
  const packageJSON = await fs.readFile(packagePath, {
118
118
  encoding: 'utf-8'
119
119
  });
120
- return JSON.parse(packageJSON)?.type === 'module';
120
+ return ((_JSON$parse = JSON.parse(packageJSON)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.type) === 'module';
121
121
  } catch (error) {
122
122
  return false;
123
123
  }
@@ -137,7 +137,7 @@ const createExplorerFor = async configFileName => {
137
137
  const loaders = isDynamicAwaitSupported() || (await isEsmModule(process.cwd())) ? defaultLoaders : defaultLoadersSync;
138
138
  return cosmiconfig(configFileName, {
139
139
  searchStrategy: 'project',
140
- searchPlaces: [`${configFileName}.js`, `${configFileName}.cjs`, `${configFileName}.mjs`, `${configFileName}.ts`],
140
+ searchPlaces: ["".concat(configFileName, ".js"), "".concat(configFileName, ".cjs"), "".concat(configFileName, ".mjs"), "".concat(configFileName, ".ts")],
141
141
  loaders: {
142
142
  '.js': loaders['.js'],
143
143
  '.cjs': loaders['.cjs'],
@@ -152,9 +152,9 @@ const getConfigPath = async () => {
152
152
  const customApplicationConfigFile = await customApplicationExplorer.search();
153
153
  const customViewConfigFile = await customViewExplorer.search();
154
154
  if (!customApplicationConfigFile && !customViewConfigFile) {
155
- throw new Error(`Missing or invalid configuration file.`);
155
+ throw new Error("Missing or invalid configuration file.");
156
156
  }
157
- return customApplicationConfigFile?.filepath || customViewConfigFile?.filepath;
157
+ return (customApplicationConfigFile === null || customApplicationConfigFile === void 0 ? void 0 : customApplicationConfigFile.filepath) || (customViewConfigFile === null || customViewConfigFile === void 0 ? void 0 : customViewConfigFile.filepath);
158
158
  };
159
159
  const loadConfig = async applicationPath => {
160
160
  const customApplicationExplorer = await createExplorerFor('custom-application-config');
@@ -162,10 +162,10 @@ const loadConfig = async applicationPath => {
162
162
  const customApplicationConfigFile = await customApplicationExplorer.search(applicationPath);
163
163
  const customViewConfigFile = await customViewExplorer.search(applicationPath);
164
164
  if ((!customApplicationConfigFile || !customApplicationConfigFile.config) && (!customViewConfigFile || !customViewConfigFile.config)) {
165
- throw new MissingOrInvalidConfigError(`Missing or invalid configuration file.`);
165
+ throw new MissingOrInvalidConfigError("Missing or invalid configuration file.");
166
166
  }
167
167
  if (customApplicationConfigFile && customViewConfigFile) {
168
- throw new MissingOrInvalidConfigError(`Found configuration files for both Custom Application and Custom View. Please remove one of them.`);
168
+ throw new MissingOrInvalidConfigError("Found configuration files for both Custom Application and Custom View. Please remove one of them.");
169
169
  }
170
170
  return customViewConfigFile || customApplicationConfigFile;
171
171
  };
@@ -199,14 +199,15 @@ Boolean(valueOfEnvConfig.match(variableSyntax));
199
199
  const isEnvVariablePlaceholder = valueOfPlaceholder => Boolean(valueOfPlaceholder.match(envRefSyntax));
200
200
  const isIntlVariablePlaceholder = valueOfPlaceholder => Boolean(valueOfPlaceholder.match(intlRefSyntax));
201
201
  const isFilePathVariablePlaceholder = valueOfPlaceholder => Boolean(valueOfPlaceholder.match(filePathRefSyntax));
202
- const isStructuredJson = message => message?.string !== undefined;
202
+ const isStructuredJson = message => (message === null || message === void 0 ? void 0 : message.string) !== undefined;
203
203
  const substituteEnvVariablePlaceholder = (valueOfPlaceholder, matchedString, valueOfEnvConfig, loadingOptions) => {
204
204
  const _valueOfPlaceholder$s = valueOfPlaceholder.split(':'),
205
205
  _valueOfPlaceholder$s2 = _slicedToArray(_valueOfPlaceholder$s, 2),
206
206
  requestedEnvVar = _valueOfPlaceholder$s2[1];
207
207
  const hasEnvField = loadingOptions.processEnv.hasOwnProperty(requestedEnvVar);
208
208
  if (!hasEnvField) {
209
- throw new Error(`Missing environment variable '${requestedEnvVar}' specified in config as 'env:${requestedEnvVar}'.`);
209
+ var _context;
210
+ throw new Error(_concatInstanceProperty(_context = "Missing environment variable '".concat(requestedEnvVar, "' specified in config as 'env:")).call(_context, requestedEnvVar, "'."));
210
211
  }
211
212
  return valueOfEnvConfig.replace(new RegExp(escapeRegExp(matchedString), 'g'), loadingOptions.processEnv[requestedEnvVar]);
212
213
  };
@@ -215,13 +216,14 @@ const substituteIntlVariablePlaceholder = (valueOfPlaceholder, matchedString, va
215
216
  _valueOfPlaceholder$s4 = _slicedToArray(_valueOfPlaceholder$s3, 3),
216
217
  locale = _valueOfPlaceholder$s4[1],
217
218
  requestedIntlMessageId = _valueOfPlaceholder$s4[2];
218
- const translationsFilePath = require.resolve(`./i18n/data/${locale}.json`, {
219
- paths: [`${loadingOptions.applicationPath}/src`, loadingOptions.applicationPath]
219
+ const translationsFilePath = require.resolve("./i18n/data/".concat(locale, ".json"), {
220
+ paths: ["".concat(loadingOptions.applicationPath, "/src"), loadingOptions.applicationPath]
220
221
  });
221
222
  const translations = require(translationsFilePath);
222
223
  const hasIntlMessage = translations.hasOwnProperty(requestedIntlMessageId);
223
224
  if (!hasIntlMessage) {
224
- throw new Error(`Missing message key '${requestedIntlMessageId}' specified in config as 'intl:${locale}:${requestedIntlMessageId}'.`);
225
+ var _context2, _context3;
226
+ throw new Error(_concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "Missing message key '".concat(requestedIntlMessageId, "' specified in config as 'intl:")).call(_context3, locale, ":")).call(_context2, requestedIntlMessageId, "'."));
225
227
  }
226
228
  const translation = translations[requestedIntlMessageId];
227
229
  const translationValue = isStructuredJson(translation) ? translation.string : translation;
@@ -247,7 +249,7 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
247
249
  // to /etc/passwd).
248
250
  const normalizedSpecifier = path$1.posix.normalize(filePathOrModule);
249
251
  if (_startsWithInstanceProperty(normalizedSpecifier).call(normalizedSpecifier, '..')) {
250
- throw new Error(`Path traversal in module specifiers is not allowed: ${filePathOrModule}`);
252
+ throw new Error("Path traversal in module specifiers is not allowed: ".concat(filePathOrModule));
251
253
  }
252
254
  }
253
255
  const resolvedPath = require.resolve(filePathOrModule, {
@@ -282,7 +284,7 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
282
284
  // Use path.relative() to avoid string prefix vulnerabilities (e.g., "/app" vs "/app-evil")
283
285
  const isSafePath = !_startsWithInstanceProperty(relativePath).call(relativePath, '..') && !path$1.isAbsolute(relativePath);
284
286
  if (!isSafePath) {
285
- throw new Error(`Access to files outside workspace directory is not allowed: ${filePathOrModule}`);
287
+ throw new Error("Access to files outside workspace directory is not allowed: ".concat(filePathOrModule));
286
288
  }
287
289
  }
288
290
  const content = fs$1.readFileSync(normalizedPath, {
@@ -984,12 +986,13 @@ const printErrors = errors => {
984
986
  return 'No errors';
985
987
  }
986
988
  return _mapInstanceProperty(errors).call(errors, error => {
987
- const baseMessage = `${error.instancePath} ${error.message}`;
989
+ var _context, _context2, _context3;
990
+ const baseMessage = _concatInstanceProperty(_context = "".concat(error.instancePath, " ")).call(_context, error.message);
988
991
  switch (error.keyword) {
989
992
  case 'additionalProperties':
990
- return `${baseMessage}: ${error.params.additionalProperty}`;
993
+ return _concatInstanceProperty(_context2 = "".concat(baseMessage, ": ")).call(_context2, error.params.additionalProperty);
991
994
  case 'enum':
992
- return `${baseMessage}: ${error.params.allowedValues.toString()}`;
995
+ return _concatInstanceProperty(_context3 = "".concat(baseMessage, ": ")).call(_context3, error.params.allowedValues.toString());
993
996
  default:
994
997
  return baseMessage;
995
998
  }
@@ -1002,7 +1005,8 @@ const validateConfig = (configType, config) => {
1002
1005
  } else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
1003
1006
  validation = validateCustomViewConfig;
1004
1007
  } else {
1005
- throw new Error(`Invalid config type "${configType}", expected ${_Object$keys(LOADED_CONFIG_TYPES).toString()}`);
1008
+ var _context4;
1009
+ throw new Error(_concatInstanceProperty(_context4 = "Invalid config type \"".concat(configType, "\", expected ")).call(_context4, _Object$keys(LOADED_CONFIG_TYPES).toString()));
1006
1010
  }
1007
1011
  const isValid = validation(config);
1008
1012
  if (!isValid) {
@@ -1015,9 +1019,9 @@ const validateEntryPointUriPath = config => {
1015
1019
  }
1016
1020
  };
1017
1021
  const validateSubmenuLinks = config => {
1018
- var _context;
1022
+ var _context5;
1019
1023
  const uriPathSet = new _Set();
1020
- _forEachInstanceProperty(_context = config.submenuLinks).call(_context, _ref => {
1024
+ _forEachInstanceProperty(_context5 = config.submenuLinks).call(_context5, _ref => {
1021
1025
  let uriPath = _ref.uriPath;
1022
1026
  if (uriPathSet.has(uriPath)) {
1023
1027
  throw new Error('Duplicate URI path. Every submenu link must have a unique URI path value');
@@ -1026,63 +1030,64 @@ const validateSubmenuLinks = config => {
1026
1030
  });
1027
1031
  };
1028
1032
  const validateAdditionalOAuthScopes = config => {
1029
- var _context2, _context3;
1033
+ var _config$additionalOAu;
1030
1034
  const additionalPermissionNames = new _Set();
1031
- ((_context2 = config.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty(_context3 = Function.call).call(_context3, _forEachInstanceProperty(_context2), _context2))?.(_ref2 => {
1035
+ (_config$additionalOAu = config.additionalOAuthScopes) === null || _config$additionalOAu === void 0 || _forEachInstanceProperty(_config$additionalOAu).call(_config$additionalOAu, _ref2 => {
1032
1036
  let name = _ref2.name,
1033
1037
  view = _ref2.view,
1034
1038
  manage = _ref2.manage;
1035
1039
  if ((_Array$isArray(view) && view.length === 0 || !view) && (_Array$isArray(manage) && manage.length === 0 || !manage)) {
1036
- throw new Error(`At least one OAuth Scope for permission group name "${name}" is required`);
1040
+ throw new Error("At least one OAuth Scope for permission group name \"".concat(name, "\" is required"));
1037
1041
  } else if (additionalPermissionNames.has(name)) {
1038
- throw new Error(`Duplicate additional permission group name "${name}". Every additional permission must have a unique name`);
1042
+ throw new Error("Duplicate additional permission group name \"".concat(name, "\". Every additional permission must have a unique name"));
1039
1043
  }
1040
1044
  if (!name.match(PERMISSION_GROUP_NAME_REGEX)) {
1041
- 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`);
1045
+ 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"));
1042
1046
  }
1043
1047
  additionalPermissionNames.add(name);
1044
1048
  });
1045
1049
  };
1046
1050
 
1047
1051
  function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1048
- 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(_context6 = ownKeys$1(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys$1(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
1052
+ 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(_context5 = ownKeys$1(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys$1(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
1049
1053
 
1050
1054
  // The `uriPath` of each submenu link is supposed to be defined relative
1051
1055
  // to the `entryPointUriPath`. Computing the full path is done internally to keep
1052
1056
  // the configuration simple.
1053
1057
  const computeUriPath = (uriPath, entryPointUriPath) => {
1058
+ var _context;
1054
1059
  // In case the `uriPath` is only `/`, it means that the link is supposed to be
1055
1060
  // treated the same as the main application path. In this case, the return value
1056
1061
  // should not contain any unnecessary trailing slash and therefore we use the `entryPointUriPath`.
1057
1062
  if (uriPath === '/') return entryPointUriPath;
1058
1063
  // In case the `uriPath` is already configured including the `entryPointUriPath`,
1059
1064
  // we return the `uriPath` as-is.
1060
- if (_startsWithInstanceProperty(uriPath).call(uriPath, `${entryPointUriPath}/`)) return uriPath;
1065
+ if (_startsWithInstanceProperty(uriPath).call(uriPath, "".concat(entryPointUriPath, "/"))) return uriPath;
1061
1066
  // Return the full path including the `entryPointUriPath` as a prefix.
1062
- return `${entryPointUriPath}/${uriPath}`;
1067
+ return _concatInstanceProperty(_context = "".concat(entryPointUriPath, "/")).call(_context, uriPath);
1063
1068
  };
1064
1069
  const getPermissions = appConfig => {
1065
- var _context, _context2, _context3, _context4;
1066
- const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty(_context = appConfig.additionalOAuthScopes || []).call(_context, (previousOauthScope, _ref) => {
1070
+ var _context2, _appConfig$additional, _context3;
1071
+ const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty(_context2 = appConfig.additionalOAuthScopes || []).call(_context2, (previousOauthScope, _ref) => {
1067
1072
  let name = _ref.name,
1068
1073
  view = _ref.view,
1069
1074
  manage = _ref.manage;
1070
1075
  const formattedResourceKey = formatEntryPointUriPathToResourceAccessKey(name);
1071
1076
  return _objectSpread$1(_objectSpread$1({}, previousOauthScope), {}, {
1072
- [`view${formattedResourceKey}`]: view,
1073
- [`manage${formattedResourceKey}`]: manage
1077
+ ["view".concat(formattedResourceKey)]: view,
1078
+ ["manage".concat(formattedResourceKey)]: manage
1074
1079
  });
1075
1080
  }, {});
1076
- const additionalPermissionNames = ((_context2 = appConfig.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty(_context3 = Function.call).call(_context3, _mapInstanceProperty(_context2), _context2))?.(_ref2 => {
1081
+ const additionalPermissionNames = ((_appConfig$additional = appConfig.additionalOAuthScopes) === null || _appConfig$additional === void 0 ? void 0 : _mapInstanceProperty(_appConfig$additional).call(_appConfig$additional, _ref2 => {
1077
1082
  let name = _ref2.name;
1078
1083
  return name;
1079
- }) || [];
1084
+ })) || [];
1080
1085
  const permissionKeys = entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath ||
1081
1086
  // In case the `entryPointUriPath` is not defined it is because the
1082
1087
  // configuration is for a custom view. In this case we use the
1083
1088
  // default entry point uri path.
1084
1089
  CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, additionalPermissionNames);
1085
- const additionalPermissions = _mapInstanceProperty(_context4 = _Object$keys(additionalResourceAccessKeyToOauthScopeMap)).call(_context4, additionalResourceAccessKey => ({
1090
+ const additionalPermissions = _mapInstanceProperty(_context3 = _Object$keys(additionalResourceAccessKeyToOauthScopeMap)).call(_context3, additionalResourceAccessKey => ({
1086
1091
  name: permissionKeys[additionalResourceAccessKey],
1087
1092
  oAuthScopes: additionalResourceAccessKeyToOauthScopeMap[additionalResourceAccessKey]
1088
1093
  }));
@@ -1095,7 +1100,7 @@ const getPermissions = appConfig => {
1095
1100
  }, ...additionalPermissions];
1096
1101
  };
1097
1102
  function transformCustomApplicationConfigToData(appConfig) {
1098
- var _context5;
1103
+ var _context4;
1099
1104
  validateEntryPointUriPath(appConfig);
1100
1105
  validateSubmenuLinks(appConfig);
1101
1106
  validateAdditionalOAuthScopes(appConfig);
@@ -1108,7 +1113,7 @@ function transformCustomApplicationConfigToData(appConfig) {
1108
1113
  permissions: getPermissions(appConfig),
1109
1114
  icon: appConfig.icon,
1110
1115
  mainMenuLink: appConfig.mainMenuLink,
1111
- submenuLinks: _mapInstanceProperty(_context5 = appConfig.submenuLinks).call(_context5, submenuLink => _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
1116
+ submenuLinks: _mapInstanceProperty(_context4 = appConfig.submenuLinks).call(_context4, submenuLink => _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
1112
1117
  uriPath: computeUriPath(submenuLink.uriPath, appConfig.entryPointUriPath)
1113
1118
  }))
1114
1119
  };
@@ -1133,11 +1138,12 @@ function transformConfigurationToData(configType, configuration) {
1133
1138
  } else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
1134
1139
  return transformCustomViewConfigToData(configuration);
1135
1140
  } else {
1136
- throw new Error(`Invalid config type: ${configType}`);
1141
+ throw new Error("Invalid config type: ".concat(configType));
1137
1142
  }
1138
1143
  }
1139
1144
 
1140
1145
  const mapCloudIdentifierToApiUrl = key => {
1146
+ var _context;
1141
1147
  switch (key) {
1142
1148
  case CLOUD_IDENTIFIERS.GCP_AU:
1143
1149
  return MC_API_URLS[CLOUD_IDENTIFIERS.GCP_AU];
@@ -1154,7 +1160,7 @@ const mapCloudIdentifierToApiUrl = key => {
1154
1160
  default:
1155
1161
  // We would probably never get to this point, as the JSON schema validation
1156
1162
  // kicks in before.
1157
- throw new Error(`Unknown cloud identifier "${key}". Supported values: ${_Object$values(CLOUD_IDENTIFIERS).toString()}`);
1163
+ throw new Error(_concatInstanceProperty(_context = "Unknown cloud identifier \"".concat(key, "\". Supported values: ")).call(_context, _Object$values(CLOUD_IDENTIFIERS).toString()));
1158
1164
  }
1159
1165
  };
1160
1166
  const getUniqueValues = function () {
@@ -1178,10 +1184,10 @@ const getOrThrow = (fn, errorMessage) => {
1178
1184
  };
1179
1185
 
1180
1186
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1181
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
1187
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
1182
1188
  // TODO: make it configurable.
1183
1189
  const developmentPort = 3001;
1184
- const developmentAppUrl = `http://localhost:${developmentPort}`;
1190
+ const developmentAppUrl = "http://localhost:".concat(developmentPort);
1185
1191
  const getLoadedConfigurationType = configFileName => {
1186
1192
  if (_includesInstanceProperty(configFileName).call(configFileName, 'custom-view-config')) {
1187
1193
  return LOADED_CONFIG_TYPES.CUSTOM_VIEW;
@@ -1197,6 +1203,7 @@ const omitDevConfigIfEmpty = devConfig => {
1197
1203
  };
1198
1204
  const isCustomViewData = data => data.entryPointUriPath === undefined;
1199
1205
  const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1206
+ var _appConfig$env$develo;
1200
1207
  let isProd = _ref.isProd,
1201
1208
  configurationData = _ref.configurationData,
1202
1209
  mcApiUrl = _ref.mcApiUrl,
@@ -1213,7 +1220,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1213
1220
  initialProjectKey:
1214
1221
  // For the `account` application, we should unset the projectKey.
1215
1222
  entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey
1216
- }, appConfig.env.development?.teamId && _objectSpread({
1223
+ }, ((_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.teamId) && _objectSpread({
1217
1224
  teamId: appConfig.env.development.teamId
1218
1225
  }, isCustomViewData(configurationData) ? {
1219
1226
  customViewId: configurationData.id
@@ -1221,11 +1228,12 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1221
1228
  applicationId: configurationData.id
1222
1229
  })), {}, {
1223
1230
  oAuthScopes: appConfig.oAuthScopes,
1224
- additionalOAuthScopes: appConfig?.additionalOAuthScopes
1231
+ additionalOAuthScopes: appConfig === null || appConfig === void 0 ? void 0 : appConfig.additionalOAuthScopes
1225
1232
  }));
1226
1233
  if (isCustomViewData(configurationData)) {
1234
+ var _context;
1227
1235
  const hostUriPath = appConfig.env.development.hostUriPath;
1228
- const defaultHostUriPath = oidcConfig.initialProjectKey ? `/${oidcConfig.initialProjectKey}/${entryPointUriPath}` : `/${entryPointUriPath}`;
1236
+ const defaultHostUriPath = oidcConfig.initialProjectKey ? _concatInstanceProperty(_context = "/".concat(oidcConfig.initialProjectKey, "/")).call(_context, entryPointUriPath) : "/".concat(entryPointUriPath);
1229
1237
  const hostUrl = new _URL(hostUriPath || defaultHostUriPath, developmentAppUrl);
1230
1238
  return omitDevConfigIfEmpty({
1231
1239
  oidc: oidcConfig,
@@ -1247,6 +1255,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1247
1255
  });
1248
1256
  };
1249
1257
  const getRuntimeEnvironmentConfig = _ref2 => {
1258
+ var _context2;
1250
1259
  let isProd = _ref2.isProd,
1251
1260
  configurationData = _ref2.configurationData,
1252
1261
  additionalAppEnv = _ref2.additionalAppEnv,
@@ -1265,7 +1274,7 @@ const getRuntimeEnvironmentConfig = _ref2 => {
1265
1274
  // In development, we prefix the entry point with the "__local" prefix.
1266
1275
  // This is important to determine to which URL the MC should redirect to
1267
1276
  // after successful login.
1268
- const applicationIdentifier = isProd ? `${configurationData.id}:${entryPointUriPath}` : `__local:${entryPointUriPath}`;
1277
+ const applicationIdentifier = isProd ? _concatInstanceProperty(_context2 = "".concat(configurationData.id, ":")).call(_context2, entryPointUriPath) : "__local:".concat(entryPointUriPath);
1269
1278
  const developmentConfig = getRuntimeEnvironmentConfigForDevelopment({
1270
1279
  isProd,
1271
1280
  configurationData,
@@ -1297,7 +1306,7 @@ const getRuntimeEnvironmentConfig = _ref2 => {
1297
1306
  // again will result in returning the cached value.
1298
1307
  let cachedConfig;
1299
1308
  const processConfig = async function () {
1300
- var _context;
1309
+ var _ref4, _processEnv$MC_APP_EN, _appConfig$additional, _ref5, _appConfig$headers, _appConfig$headers2, _context3, _appConfig$headers3, _appConfig$headers4;
1301
1310
  let _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1302
1311
  _ref3$disableCache = _ref3.disableCache,
1303
1312
  disableCache = _ref3$disableCache === void 0 ? false : _ref3$disableCache,
@@ -1316,22 +1325,22 @@ const processConfig = async function () {
1316
1325
  processEnv
1317
1326
  });
1318
1327
  const configurationData = transformConfigurationToData(configType, appConfig);
1319
- const appEnvKey = processEnv.MC_APP_ENV ?? processEnv.NODE_ENV ?? 'development';
1328
+ 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';
1320
1329
  const isProd = getIsProd(processEnv);
1321
- const additionalAppEnv = appConfig.additionalEnv ?? {};
1322
- const revision = additionalAppEnv.revision ?? '';
1330
+ const additionalAppEnv = (_appConfig$additional = appConfig.additionalEnv) !== null && _appConfig$additional !== void 0 ? _appConfig$additional : {};
1331
+ const revision = (_ref5 = additionalAppEnv.revision) !== null && _ref5 !== void 0 ? _ref5 : '';
1323
1332
 
1324
1333
  // Parse all the supported URLs, which gets implicitly validated
1325
1334
 
1326
1335
  const envAppUrl = isProd ? configurationData.url : developmentAppUrl;
1327
- const appUrl = getOrThrow(() => new _URL(envAppUrl), `Invalid application URL: "${envAppUrl}"`);
1336
+ const appUrl = getOrThrow(() => new _URL(envAppUrl), "Invalid application URL: \"".concat(envAppUrl, "\""));
1328
1337
 
1329
1338
  // Use `||` instead of `??` to include empty string values.
1330
1339
  const envCdnUrl = isProd ? appConfig.env.production.cdnUrl || appUrl.href : developmentAppUrl;
1331
- const cdnUrl = getOrThrow(() => new _URL(envCdnUrl), `Invalid application CDN URL: "${envCdnUrl}"`);
1340
+ const cdnUrl = getOrThrow(() => new _URL(envCdnUrl), "Invalid application CDN URL: \"".concat(envCdnUrl, "\""));
1332
1341
  const mcApiUrl = getOrThrow(() => new _URL(
1333
1342
  // Use `||` instead of `??` to include empty string values.
1334
- appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), `Invalid MC API URL: "${appConfig.mcApiUrl}"`);
1343
+ appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), "Invalid MC API URL: \"".concat(appConfig.mcApiUrl, "\""));
1335
1344
  cachedConfig = {
1336
1345
  data: configurationData,
1337
1346
  env: getRuntimeEnvironmentConfig({
@@ -1346,16 +1355,16 @@ const processConfig = async function () {
1346
1355
  revision
1347
1356
  }),
1348
1357
  headers: _objectSpread(_objectSpread({}, appConfig.headers), {}, {
1349
- csp: _objectSpread(_objectSpread({}, appConfig.headers?.csp), {}, {
1358
+ csp: _objectSpread(_objectSpread({}, (_appConfig$headers = appConfig.headers) === null || _appConfig$headers === void 0 ? void 0 : _appConfig$headers.csp), {}, {
1350
1359
  // We need to make sure the URL we use in these CSP headers have a slash in the end,
1351
1360
  // otherwise it might create an invalid value when application/CDN URL points to a
1352
1361
  // non-root directory (ex: https://www.my-domain.com/app). This is a valid URL but from
1353
1362
  // the CSP point of view, it will say only the file `app` can be used as a source, so
1354
1363
  // any other file from that domain will be forbidden. Using the slash (ex: https://www.my-domain.com/app/)
1355
1364
  // at the end it's like using a wildcard so anything 'below' `app` will be allowed.
1356
- 'connect-src': getUniqueValues(appConfig.headers?.csp?.['connect-src'], _concatInstanceProperty(_context = [mcApiUrl.origin]).call(_context, isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])),
1357
- 'script-src': getUniqueValues(appConfig.headers?.csp?.['script-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : []),
1358
- 'style-src': getUniqueValues(appConfig.headers?.csp?.['style-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])
1365
+ '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(_context3 = [mcApiUrl.origin]).call(_context3, isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/"), "".concat(trimTrailingSlash(cdnUrl.href), "/")] : [])),
1366
+ '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), "/")] : []),
1367
+ '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), "/")] : [])
1359
1368
  })
1360
1369
  })
1361
1370
  };
@@ -12,6 +12,7 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
12
12
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
13
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
14
14
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
15
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
15
16
  var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
16
17
  var upperFirst = require('lodash/upperFirst');
17
18
  var constants = require('@commercetools-frontend/constants');
@@ -28,11 +29,12 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
28
29
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
29
30
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
30
31
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
32
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
31
33
  var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
32
34
  var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
33
35
 
34
36
  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; }
35
- function _objectSpread(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(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(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
37
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(t), !0)).call(_context8, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(t))).call(_context9, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
36
38
  /**
37
39
  * The function formats the `entryPointUriPath` to a resource access key.
38
40
  * It makes the first character of the string and the next character after a special character an uppercase.
@@ -60,7 +62,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
60
62
  // If the word after the hyphen is numeric, replace the hyphen with a forward slash.
61
63
  // If not, omit the hyphen and uppercase the first character
62
64
  if (i > 0 && /^\d+$/.test(word[0])) {
63
- return `/${word}`;
65
+ return "/".concat(word);
64
66
  }
65
67
  return upperFirst__default["default"](word);
66
68
  }).join('');
@@ -84,14 +86,15 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
84
86
  var _context4;
85
87
  const resourceAccessKey = constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH === entryPointUriPath ? '' : formatEntryPointUriPathToResourceAccessKey(entryPointUriPath);
86
88
  const defaultResourceAccesses = {
87
- view: `view${resourceAccessKey}`,
88
- manage: `manage${resourceAccessKey}`
89
+ view: "view".concat(resourceAccessKey),
90
+ manage: "manage".concat(resourceAccessKey)
89
91
  };
90
- const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
92
+ const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames !== null && permissionGroupNames !== void 0 ? permissionGroupNames : []).call(_context4, (resourceAccesses, permissionGroupName) => {
93
+ var _context5, _context6;
91
94
  const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
92
95
  return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
93
- [`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
94
- [`manage${additionalResourceAccessKey}`]: `${defaultResourceAccesses.manage}${additionalResourceAccessKey}`
96
+ ["view".concat(additionalResourceAccessKey)]: _concatInstanceProperty__default["default"](_context5 = "".concat(defaultResourceAccesses.view)).call(_context5, additionalResourceAccessKey),
97
+ ["manage".concat(additionalResourceAccessKey)]: _concatInstanceProperty__default["default"](_context6 = "".concat(defaultResourceAccesses.manage)).call(_context6, additionalResourceAccessKey)
95
98
  });
96
99
  }, {});
97
100
  return _objectSpread(_objectSpread({}, defaultResourceAccesses), additionalResourceAccesses);
@@ -103,9 +106,9 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
103
106
  return entryPointUriPathToPermissionKeys(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, permissionGroupNames || []);
104
107
  }
105
108
  function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
106
- var _context5;
107
- const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
108
- return _reduceInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
109
+ var _context7;
110
+ const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames !== null && permissionGroupNames !== void 0 ? permissionGroupNames : []);
111
+ return _reduceInstanceProperty__default["default"](_context7 = _Object$entries__default["default"](resourceAccesses)).call(_context7, (permissionKeys, _ref) => {
109
112
  let _ref2 = _slicedToArray(_ref, 2),
110
113
  resourceAccessKey = _ref2[0],
111
114
  resourceAccessValue = _ref2[1];
@@ -12,6 +12,7 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
12
12
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
13
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
14
14
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
15
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
15
16
  var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
16
17
  var upperFirst = require('lodash/upperFirst');
17
18
  var constants = require('@commercetools-frontend/constants');
@@ -28,11 +29,12 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
28
29
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
29
30
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
30
31
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
32
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
31
33
  var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
32
34
  var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
33
35
 
34
36
  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; }
35
- function _objectSpread(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(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(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
37
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(t), !0)).call(_context8, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(t))).call(_context9, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
36
38
  /**
37
39
  * The function formats the `entryPointUriPath` to a resource access key.
38
40
  * It makes the first character of the string and the next character after a special character an uppercase.
@@ -60,7 +62,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
60
62
  // If the word after the hyphen is numeric, replace the hyphen with a forward slash.
61
63
  // If not, omit the hyphen and uppercase the first character
62
64
  if (i > 0 && /^\d+$/.test(word[0])) {
63
- return `/${word}`;
65
+ return "/".concat(word);
64
66
  }
65
67
  return upperFirst__default["default"](word);
66
68
  }).join('');
@@ -84,14 +86,15 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
84
86
  var _context4;
85
87
  const resourceAccessKey = constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH === entryPointUriPath ? '' : formatEntryPointUriPathToResourceAccessKey(entryPointUriPath);
86
88
  const defaultResourceAccesses = {
87
- view: `view${resourceAccessKey}`,
88
- manage: `manage${resourceAccessKey}`
89
+ view: "view".concat(resourceAccessKey),
90
+ manage: "manage".concat(resourceAccessKey)
89
91
  };
90
- const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
92
+ const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames !== null && permissionGroupNames !== void 0 ? permissionGroupNames : []).call(_context4, (resourceAccesses, permissionGroupName) => {
93
+ var _context5, _context6;
91
94
  const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
92
95
  return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
93
- [`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
94
- [`manage${additionalResourceAccessKey}`]: `${defaultResourceAccesses.manage}${additionalResourceAccessKey}`
96
+ ["view".concat(additionalResourceAccessKey)]: _concatInstanceProperty__default["default"](_context5 = "".concat(defaultResourceAccesses.view)).call(_context5, additionalResourceAccessKey),
97
+ ["manage".concat(additionalResourceAccessKey)]: _concatInstanceProperty__default["default"](_context6 = "".concat(defaultResourceAccesses.manage)).call(_context6, additionalResourceAccessKey)
95
98
  });
96
99
  }, {});
97
100
  return _objectSpread(_objectSpread({}, defaultResourceAccesses), additionalResourceAccesses);
@@ -103,9 +106,9 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
103
106
  return entryPointUriPathToPermissionKeys(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, permissionGroupNames || []);
104
107
  }
105
108
  function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
106
- var _context5;
107
- const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
108
- return _reduceInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
109
+ var _context7;
110
+ const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames !== null && permissionGroupNames !== void 0 ? permissionGroupNames : []);
111
+ return _reduceInstanceProperty__default["default"](_context7 = _Object$entries__default["default"](resourceAccesses)).call(_context7, (permissionKeys, _ref) => {
109
112
  let _ref2 = _slicedToArray(_ref, 2),
110
113
  resourceAccessKey = _ref2[0],
111
114
  resourceAccessValue = _ref2[1];
@@ -10,12 +10,13 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
10
10
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
11
11
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
12
12
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
13
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
13
14
  import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
14
15
  import upperFirst from 'lodash/upperFirst';
15
16
  import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants';
16
17
 
17
18
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
19
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context8 = ownKeys(Object(t), !0)).call(_context8, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context9 = ownKeys(Object(t))).call(_context9, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
19
20
  /**
20
21
  * The function formats the `entryPointUriPath` to a resource access key.
21
22
  * It makes the first character of the string and the next character after a special character an uppercase.
@@ -43,7 +44,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
43
44
  // If the word after the hyphen is numeric, replace the hyphen with a forward slash.
44
45
  // If not, omit the hyphen and uppercase the first character
45
46
  if (i > 0 && /^\d+$/.test(word[0])) {
46
- return `/${word}`;
47
+ return "/".concat(word);
47
48
  }
48
49
  return upperFirst(word);
49
50
  }).join('');
@@ -67,14 +68,15 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
67
68
  var _context4;
68
69
  const resourceAccessKey = CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH === entryPointUriPath ? '' : formatEntryPointUriPathToResourceAccessKey(entryPointUriPath);
69
70
  const defaultResourceAccesses = {
70
- view: `view${resourceAccessKey}`,
71
- manage: `manage${resourceAccessKey}`
71
+ view: "view".concat(resourceAccessKey),
72
+ manage: "manage".concat(resourceAccessKey)
72
73
  };
73
- const additionalResourceAccesses = _reduceInstanceProperty(_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
74
+ const additionalResourceAccesses = _reduceInstanceProperty(_context4 = permissionGroupNames !== null && permissionGroupNames !== void 0 ? permissionGroupNames : []).call(_context4, (resourceAccesses, permissionGroupName) => {
75
+ var _context5, _context6;
74
76
  const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
75
77
  return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
76
- [`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
77
- [`manage${additionalResourceAccessKey}`]: `${defaultResourceAccesses.manage}${additionalResourceAccessKey}`
78
+ ["view".concat(additionalResourceAccessKey)]: _concatInstanceProperty(_context5 = "".concat(defaultResourceAccesses.view)).call(_context5, additionalResourceAccessKey),
79
+ ["manage".concat(additionalResourceAccessKey)]: _concatInstanceProperty(_context6 = "".concat(defaultResourceAccesses.manage)).call(_context6, additionalResourceAccessKey)
78
80
  });
79
81
  }, {});
80
82
  return _objectSpread(_objectSpread({}, defaultResourceAccesses), additionalResourceAccesses);
@@ -86,9 +88,9 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
86
88
  return entryPointUriPathToPermissionKeys(CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, permissionGroupNames || []);
87
89
  }
88
90
  function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
89
- var _context5;
90
- const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
91
- return _reduceInstanceProperty(_context5 = _Object$entries(resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
91
+ var _context7;
92
+ const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames !== null && permissionGroupNames !== void 0 ? permissionGroupNames : []);
93
+ return _reduceInstanceProperty(_context7 = _Object$entries(resourceAccesses)).call(_context7, (permissionKeys, _ref) => {
92
94
  let _ref2 = _slicedToArray(_ref, 2),
93
95
  resourceAccessKey = _ref2[0],
94
96
  resourceAccessValue = _ref2[1];