@commercetools-frontend/application-config 21.2.1 → 21.3.3

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.
@@ -28,13 +28,16 @@ var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
28
28
  var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
29
29
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
30
30
  var Ajv = require('ajv');
31
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
32
+ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
33
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
31
34
  var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
32
35
  var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
33
36
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
34
37
  var uniq = require('lodash/uniq');
35
- var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
36
- var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
37
- var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
38
+ var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
39
+ var formatters = require('./formatters-40251cfd.cjs.prod.js');
40
+ require('lodash/upperFirst');
38
41
 
39
42
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
40
43
 
@@ -54,11 +57,12 @@ var path__default = /*#__PURE__*/_interopDefault(path);
54
57
  var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
55
58
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
56
59
  var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
60
+ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
61
+ var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
57
62
  var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
58
63
  var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
59
64
  var uniq__default = /*#__PURE__*/_interopDefault(uniq);
60
- var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
61
- var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
65
+ var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
62
66
 
63
67
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
64
68
 
@@ -126,6 +130,15 @@ var explorer = cosmiconfig.cosmiconfigSync(moduleName, {
126
130
  '.ts': loadJsModule
127
131
  }
128
132
  });
133
+ var getConfigPath = function getConfigPath() {
134
+ var configFile = explorer.search();
135
+
136
+ if (!configFile) {
137
+ throw new Error("Missing or invalid Custom Application configuration file.");
138
+ }
139
+
140
+ return configFile.filepath;
141
+ };
129
142
 
130
143
  var loadConfig = function loadConfig(applicationPath) {
131
144
  var configFile = explorer.search(applicationPath);
@@ -512,74 +525,6 @@ var validateConfig = function validateConfig(config) {
512
525
  }
513
526
  };
514
527
 
515
- var CLOUD_IDENTIFIERS = {
516
- GCP_AU: 'gcp-au',
517
- GCP_EU: 'gcp-eu',
518
- GCP_US: 'gcp-us',
519
- AWS_FRA: 'aws-fra',
520
- AWS_OHIO: 'aws-ohio'
521
- };
522
- var MC_API_URLS = {
523
- GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
524
- GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
525
- GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
526
- AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
527
- AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
528
- };
529
-
530
- var mapCloudIdentifierToApiUrl = function mapCloudIdentifierToApiUrl(key) {
531
- var _context;
532
-
533
- switch (key) {
534
- case CLOUD_IDENTIFIERS.GCP_AU:
535
- return MC_API_URLS.GCP_AU;
536
-
537
- case CLOUD_IDENTIFIERS.GCP_EU:
538
- return MC_API_URLS.GCP_EU;
539
-
540
- case CLOUD_IDENTIFIERS.GCP_US:
541
- return MC_API_URLS.GCP_US;
542
-
543
- case CLOUD_IDENTIFIERS.AWS_FRA:
544
- return MC_API_URLS.AWS_FRA;
545
-
546
- case CLOUD_IDENTIFIERS.AWS_OHIO:
547
- return MC_API_URLS.AWS_OHIO;
548
-
549
- default:
550
- // We would probably never get to this point, as the JSON schema validation
551
- // kicks in before.
552
- throw new Error(_concatInstanceProperty__default["default"](_context = "Unknown cloud identifier \"".concat(key, "\". Supported values: ")).call(_context, _Object$values__default["default"](CLOUD_IDENTIFIERS).toString()));
553
- }
554
- };
555
-
556
- var getUniqueValues = function getUniqueValues() {
557
- var _context2;
558
-
559
- var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
560
- var additionalValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
561
- return uniq__default["default"](_concatInstanceProperty__default["default"](_context2 = []).call(_context2, _toConsumableArray(initialValues), _toConsumableArray(additionalValues)));
562
- };
563
-
564
- var nonProductionEnvironment = ['development', 'test'];
565
-
566
- var getIsProd = function getIsProd(env) {
567
- return (// TL;DR: in case the `MC_APP_ENV` is defined, we consider that it's
568
- // a production environment unless it's one of `development` or `test`.
569
- // This allows to use for example the `staging` value, which from the
570
- // application perspective is still considered a production environment.
571
- env.MC_APP_ENV ? !_includesInstanceProperty__default["default"](nonProductionEnvironment).call(nonProductionEnvironment, env.MC_APP_ENV) : env.NODE_ENV === 'production'
572
- );
573
- };
574
-
575
- var getOrThrow = function getOrThrow(fn, errorMessage) {
576
- try {
577
- return fn();
578
- } catch (error) {
579
- throw new Error(errorMessage);
580
- }
581
- };
582
-
583
528
  /**
584
529
  * NOTE:
585
530
  * Allows variable placeholders. Supported types are:
@@ -613,12 +558,12 @@ var isFilePathVariablePlaceholder = function isFilePathVariablePlaceholder(value
613
558
  return Boolean(valueOfPlaceholder.match(filePathRefSyntax));
614
559
  };
615
560
 
616
- var substituteEnvVariablePlaceholder = function substituteEnvVariablePlaceholder(valueOfPlaceholder, matchedString, valueOfEnvConfig, meta) {
561
+ var substituteEnvVariablePlaceholder = function substituteEnvVariablePlaceholder(valueOfPlaceholder, matchedString, valueOfEnvConfig, loadingOptions) {
617
562
  var _valueOfPlaceholder$s = valueOfPlaceholder.split(':'),
618
563
  _valueOfPlaceholder$s2 = _slicedToArray(_valueOfPlaceholder$s, 2),
619
564
  requestedEnvVar = _valueOfPlaceholder$s2[1];
620
565
 
621
- var hasEnvField = meta.processEnv.hasOwnProperty(requestedEnvVar);
566
+ var hasEnvField = loadingOptions.processEnv.hasOwnProperty(requestedEnvVar);
622
567
 
623
568
  if (!hasEnvField) {
624
569
  var _context;
@@ -627,17 +572,17 @@ var substituteEnvVariablePlaceholder = function substituteEnvVariablePlaceholder
627
572
  }
628
573
 
629
574
  var escapedMatchedString = matchedString.replace(/[${}:]/g, '\\$&');
630
- return valueOfEnvConfig.replace(new RegExp("(".concat(escapedMatchedString, ")+"), 'g'), meta.processEnv[requestedEnvVar]);
575
+ return valueOfEnvConfig.replace(new RegExp("(".concat(escapedMatchedString, ")+"), 'g'), loadingOptions.processEnv[requestedEnvVar]);
631
576
  };
632
577
 
633
- var substituteIntlVariablePlaceholder = function substituteIntlVariablePlaceholder(valueOfPlaceholder, matchedString, valueOfEnvConfig, meta) {
578
+ var substituteIntlVariablePlaceholder = function substituteIntlVariablePlaceholder(valueOfPlaceholder, matchedString, valueOfEnvConfig, loadingOptions) {
634
579
  var _valueOfPlaceholder$s3 = valueOfPlaceholder.split(':'),
635
580
  _valueOfPlaceholder$s4 = _slicedToArray(_valueOfPlaceholder$s3, 3),
636
581
  locale = _valueOfPlaceholder$s4[1],
637
582
  requestedIntlMessageId = _valueOfPlaceholder$s4[2];
638
583
 
639
584
  var translationsFilePath = require.resolve("./i18n/data/".concat(locale, ".json"), {
640
- paths: ["".concat(meta.applicationPath, "/src"), meta.applicationPath]
585
+ paths: ["".concat(loadingOptions.applicationPath, "/src"), loadingOptions.applicationPath]
641
586
  });
642
587
 
643
588
  var translations = require(translationsFilePath);
@@ -654,14 +599,14 @@ var substituteIntlVariablePlaceholder = function substituteIntlVariablePlacehold
654
599
  return valueOfEnvConfig.replace(new RegExp("(".concat(escapedMatchedString, ")+"), 'g'), translations[requestedIntlMessageId]);
655
600
  };
656
601
 
657
- var substituteFilePathVariablePlaceholder = function substituteFilePathVariablePlaceholder(valueOfPlaceholder, matchedString, valueOfEnvConfig, meta) {
602
+ var substituteFilePathVariablePlaceholder = function substituteFilePathVariablePlaceholder(valueOfPlaceholder, matchedString, valueOfEnvConfig, loadingOptions) {
658
603
  var _valueOfPlaceholder$s5 = valueOfPlaceholder.split(':'),
659
604
  _valueOfPlaceholder$s6 = _slicedToArray(_valueOfPlaceholder$s5, 2),
660
605
  filePathOrModule = _valueOfPlaceholder$s6[1];
661
606
 
662
607
  var content = fs__default["default"].readFileSync(require.resolve(filePathOrModule, {
663
608
  // Relative paths should be resolved from the application folder.
664
- paths: [meta.applicationPath]
609
+ paths: [loadingOptions.applicationPath]
665
610
  }), {
666
611
  encoding: 'utf-8'
667
612
  });
@@ -675,7 +620,7 @@ var getValueOfPlaceholder = function getValueOfPlaceholder(valueWithPlaceholder)
675
620
  }).replace(/\s/g, '');
676
621
  };
677
622
 
678
- var substituteVariablePlaceholders = function substituteVariablePlaceholders(config, meta) {
623
+ var substituteVariablePlaceholders = function substituteVariablePlaceholders(config, loadingOptions) {
679
624
  return JSON.parse(_JSON$stringify__default["default"](config), function (_key, value) {
680
625
  // Only strings are allowed
681
626
  var substitutedValue = value;
@@ -688,11 +633,11 @@ var substituteVariablePlaceholders = function substituteVariablePlaceholders(con
688
633
  var valueOfPlaceholder = getValueOfPlaceholder(matchedString);
689
634
 
690
635
  if (isEnvVariablePlaceholder(valueOfPlaceholder)) {
691
- substitutedValue = substituteEnvVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, meta);
636
+ substitutedValue = substituteEnvVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, loadingOptions);
692
637
  } else if (isIntlVariablePlaceholder(valueOfPlaceholder)) {
693
- substitutedValue = substituteIntlVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, meta);
638
+ substitutedValue = substituteIntlVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, loadingOptions);
694
639
  } else if (isFilePathVariablePlaceholder(valueOfPlaceholder)) {
695
- substitutedValue = substituteFilePathVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, meta);
640
+ substitutedValue = substituteFilePathVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, loadingOptions);
696
641
  }
697
642
  });
698
643
  }
@@ -702,6 +647,121 @@ var substituteVariablePlaceholders = function substituteVariablePlaceholders(con
702
647
  });
703
648
  };
704
649
 
650
+ var CLOUD_IDENTIFIERS = {
651
+ GCP_AU: 'gcp-au',
652
+ GCP_EU: 'gcp-eu',
653
+ GCP_US: 'gcp-us',
654
+ AWS_FRA: 'aws-fra',
655
+ AWS_OHIO: 'aws-ohio'
656
+ };
657
+ var MC_API_URLS = {
658
+ GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
659
+ GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
660
+ GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
661
+ AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
662
+ AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
663
+ };
664
+
665
+ var mapCloudIdentifierToApiUrl = function mapCloudIdentifierToApiUrl(key) {
666
+ var _context;
667
+
668
+ switch (key) {
669
+ case CLOUD_IDENTIFIERS.GCP_AU:
670
+ return MC_API_URLS.GCP_AU;
671
+
672
+ case CLOUD_IDENTIFIERS.GCP_EU:
673
+ return MC_API_URLS.GCP_EU;
674
+
675
+ case CLOUD_IDENTIFIERS.GCP_US:
676
+ return MC_API_URLS.GCP_US;
677
+
678
+ case CLOUD_IDENTIFIERS.AWS_FRA:
679
+ return MC_API_URLS.AWS_FRA;
680
+
681
+ case CLOUD_IDENTIFIERS.AWS_OHIO:
682
+ return MC_API_URLS.AWS_OHIO;
683
+
684
+ default:
685
+ // We would probably never get to this point, as the JSON schema validation
686
+ // kicks in before.
687
+ throw new Error(_concatInstanceProperty__default["default"](_context = "Unknown cloud identifier \"".concat(key, "\". Supported values: ")).call(_context, _Object$values__default["default"](CLOUD_IDENTIFIERS).toString()));
688
+ }
689
+ };
690
+
691
+ var getUniqueValues = function getUniqueValues() {
692
+ var _context2;
693
+
694
+ var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
695
+ var additionalValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
696
+ return uniq__default["default"](_concatInstanceProperty__default["default"](_context2 = []).call(_context2, _toConsumableArray(initialValues), _toConsumableArray(additionalValues)));
697
+ };
698
+
699
+ var nonProductionEnvironment = ['development', 'test'];
700
+
701
+ var getIsProd = function getIsProd(env) {
702
+ return (// TL;DR: in case the `MC_APP_ENV` is defined, we consider that it's
703
+ // a production environment unless it's one of `development` or `test`.
704
+ // This allows to use for example the `staging` value, which from the
705
+ // application perspective is still considered a production environment.
706
+ env.MC_APP_ENV ? !_includesInstanceProperty__default["default"](nonProductionEnvironment).call(nonProductionEnvironment, env.MC_APP_ENV) : env.NODE_ENV === 'production'
707
+ );
708
+ };
709
+
710
+ var getOrThrow = function getOrThrow(fn, errorMessage) {
711
+ try {
712
+ return fn();
713
+ } catch (error) {
714
+ throw new Error(errorMessage);
715
+ }
716
+ };
717
+
718
+ function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
719
+
720
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$1(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
721
+ // to the `entryPointUriPath`. Computing the full path is done internally to keep
722
+ // the configuration simple.
723
+
724
+ var computeUriPath = function computeUriPath(uriPath, entryPointUriPath) {
725
+ var _context;
726
+
727
+ // In case the `uriPath` is only `/`, it means that the link is supposed to be
728
+ // treated the same as the main application path. In this case, the return value
729
+ // should not contain any unnecessary trailing slash and therefore we use the `entryPointUriPath`.
730
+ if (uriPath === '/') return entryPointUriPath; // In case the `uriPath` is already configured including the `entryPointUriPath`,
731
+ // we return the `uriPath` as-is.
732
+
733
+ if (_startsWithInstanceProperty__default["default"](uriPath).call(uriPath, "".concat(entryPointUriPath, "/"))) return uriPath; // Return the full path including the `entryPointUriPath` as a prefix.
734
+
735
+ return _concatInstanceProperty__default["default"](_context = "".concat(entryPointUriPath, "/")).call(_context, uriPath);
736
+ };
737
+
738
+ function transformCustomApplicationConfigToData(appConfig) {
739
+ var _context2;
740
+
741
+ var permissionKeys = formatters.entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath);
742
+ return {
743
+ id: appConfig.env.production.applicationId,
744
+ name: appConfig.name,
745
+ description: appConfig.description,
746
+ entryPointUriPath: appConfig.entryPointUriPath,
747
+ url: appConfig.env.production.url,
748
+ permissions: [{
749
+ name: permissionKeys.view,
750
+ oAuthScopes: appConfig.oAuthScopes.view
751
+ }, {
752
+ name: permissionKeys.manage,
753
+ oAuthScopes: appConfig.oAuthScopes.manage
754
+ }],
755
+ icon: appConfig.icon,
756
+ mainMenuLink: appConfig.mainMenuLink,
757
+ submenuLinks: _mapInstanceProperty__default["default"](_context2 = appConfig.submenuLinks).call(_context2, function (submenuLink) {
758
+ return _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
759
+ uriPath: computeUriPath(submenuLink.uriPath, appConfig.entryPointUriPath)
760
+ });
761
+ })
762
+ };
763
+ }
764
+
705
765
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
706
766
 
707
767
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
@@ -731,19 +791,19 @@ var processConfig = function processConfig() {
731
791
  applicationPath = _ref$applicationPath === void 0 ? fs__default["default"].realpathSync(process.cwd()) : _ref$applicationPath;
732
792
 
733
793
  if (cachedConfig && !disableCache) return cachedConfig;
794
+ var rawConfig = loadConfig(applicationPath);
795
+ validateConfig(rawConfig);
796
+ var appConfig = substituteVariablePlaceholders(rawConfig, {
797
+ applicationPath: applicationPath,
798
+ processEnv: processEnv
799
+ });
800
+ var customApplicationData = transformCustomApplicationConfigToData(appConfig);
734
801
  var appEnvKey = (_ref2 = (_processEnv$MC_APP_EN = processEnv.MC_APP_ENV) !== null && _processEnv$MC_APP_EN !== void 0 ? _processEnv$MC_APP_EN : processEnv.NODE_ENV) !== null && _ref2 !== void 0 ? _ref2 : 'development';
735
802
  var isProd = getIsProd(processEnv);
736
- var loadedAppConfig = loadConfig(applicationPath);
737
- validateConfig(loadedAppConfig);
738
- var validatedLoadedAppConfig = loadedAppConfig;
739
- var appConfig = substituteVariablePlaceholders(validatedLoadedAppConfig, {
740
- processEnv: processEnv,
741
- applicationPath: applicationPath
742
- });
743
803
  var additionalAppEnv = (_appConfig$additional = appConfig.additionalEnv) !== null && _appConfig$additional !== void 0 ? _appConfig$additional : {};
744
804
  var revision = (_ref3 = additionalAppEnv.revision) !== null && _ref3 !== void 0 ? _ref3 : ''; // Parse all the supported URLs, which gets implicitly validated
745
805
 
746
- var envAppUrl = isProd ? appConfig.env.production.url : developmentAppUrl;
806
+ var envAppUrl = isProd ? customApplicationData.url : developmentAppUrl;
747
807
  var appUrl = getOrThrow(function () {
748
808
  return new _URL__default["default"](envAppUrl);
749
809
  }, "Invalid application URL: \"".concat(envAppUrl, "\"")); // Use `||` instead of `??` to include empty string values.
@@ -760,30 +820,31 @@ var processConfig = function processConfig() {
760
820
  // This is important to determine to which URL the MC should redirect to
761
821
  // after successful login.
762
822
 
763
- var applicationId = isProd ? _concatInstanceProperty__default["default"](_context = "".concat(appConfig.env.production.applicationId, ":")).call(_context, appConfig.entryPointUriPath) : "__local:".concat(appConfig.entryPointUriPath);
823
+ var applicationId = isProd ? _concatInstanceProperty__default["default"](_context = "".concat(customApplicationData.id, ":")).call(_context, customApplicationData.entryPointUriPath) : "__local:".concat(customApplicationData.entryPointUriPath);
764
824
  var developmentConfig = isProd ? undefined : omitDevConfigIfEmpty({
765
825
  oidc: omitEmpty__default["default"]({
766
826
  authorizeUrl: [// In case the MC API url points to localhost, we need to point
767
827
  // to a local running dev login page to handle the workflow properly.
768
828
  mcApiUrl.hostname === 'localhost' ? mcApiUrl.origin.replace(mcApiUrl.port, String(developmentPort)) : mcApiUrl.origin.replace('mc-api', 'mc'), '/login/authorize'].join(''),
769
829
  initialProjectKey: // For the `account` application, we should unset the projectKey.
770
- appConfig.entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey,
830
+ customApplicationData.entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey,
771
831
  teamId: (_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.teamId,
772
832
  oAuthScopes: appConfig.oAuthScopes
773
833
  }),
774
834
  menuLinks: _objectSpread(_objectSpread({
775
- icon: appConfig.icon
776
- }, appConfig.mainMenuLink), {}, {
777
- submenuLinks: appConfig.submenuLinks
835
+ icon: customApplicationData.icon
836
+ }, customApplicationData.mainMenuLink), {}, {
837
+ submenuLinks: customApplicationData.submenuLinks
778
838
  }),
779
839
  // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
780
840
  accountLinks: appConfig.accountLinks
781
841
  });
782
842
  cachedConfig = {
843
+ data: customApplicationData,
783
844
  env: _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default["default"](additionalAppEnv)), {}, {
784
845
  applicationId: applicationId,
785
- applicationName: appConfig.name,
786
- entryPointUriPath: appConfig.entryPointUriPath
846
+ applicationName: customApplicationData.name,
847
+ entryPointUriPath: customApplicationData.entryPointUriPath
787
848
  }, isProd || !developmentConfig ? {} : {
788
849
  __DEVELOPMENT__: developmentConfig
789
850
  }), {}, {
@@ -807,4 +868,5 @@ var processConfig = function processConfig() {
807
868
  };
808
869
 
809
870
  exports.MissingOrInvalidConfigError = MissingOrInvalidConfigError;
871
+ exports.getConfigPath = getConfigPath;
810
872
  exports.processConfig = processConfig;