@commercetools-frontend/application-config 22.7.1 → 22.8.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.
@@ -2,9 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
- var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
7
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
8
5
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
9
6
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
10
7
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
@@ -13,10 +10,15 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
13
10
  var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
14
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
15
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
16
- var fs = require('fs');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
15
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
16
+ var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
17
+ var fs = require('node:fs');
18
+ var path = require('node:path');
17
19
  var omitEmpty = require('omit-empty-es');
18
- var child_process = require('child_process');
19
- var path = require('path');
20
+ var constants = require('@commercetools-frontend/constants');
21
+ var node_child_process = require('node:child_process');
20
22
  var cosmiconfig = require('cosmiconfig');
21
23
  var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
22
24
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
@@ -32,12 +34,11 @@ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/string
32
34
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
33
35
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
34
36
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
35
- var formatters = require('./formatters-c6356c75.cjs.dev.js');
37
+ var formatters = require('./formatters-1566eda7.cjs.dev.js');
36
38
  var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
37
39
  var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
38
40
  var Ajv = require('ajv');
39
41
  var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
40
- var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
41
42
  var uniq = require('lodash/uniq');
42
43
  var createDOMPurify = require('dompurify');
43
44
  var jsdom$1 = require('jsdom');
@@ -46,8 +47,6 @@ require('lodash/upperFirst');
46
47
 
47
48
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
48
49
 
49
- var _URL__default = /*#__PURE__*/_interopDefault(_URL);
50
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
51
50
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
52
51
  var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
53
52
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
@@ -56,9 +55,12 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
56
55
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
57
56
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
58
57
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
58
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
59
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
60
+ var _URL__default = /*#__PURE__*/_interopDefault(_URL);
59
61
  var fs__default = /*#__PURE__*/_interopDefault(fs);
60
- var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
61
62
  var path__default = /*#__PURE__*/_interopDefault(path);
63
+ var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
62
64
  var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
63
65
  var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
64
66
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
@@ -69,10 +71,40 @@ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
69
71
  var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
70
72
  var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
71
73
  var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
72
- var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
73
74
  var uniq__default = /*#__PURE__*/_interopDefault(uniq);
74
75
  var createDOMPurify__default = /*#__PURE__*/_interopDefault(createDOMPurify);
75
76
 
77
+ /**
78
+ * The entryPointUriPath may be between 2 and 64 characters and only contain alphabetic lowercase characters,
79
+ * non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
80
+ */
81
+ const ENTRY_POINT_URI_PATH_REGEX = /^[^-_#]([0-9a-z]|[-_](?![-_])){0,62}[^-_#]$/g;
82
+
83
+ /**
84
+ * The permission group name may be between 2 and 64 characters and only contain alphanumeric lowercase characters and non-consecutive hyphens. Leading and trailing hyphens are also not allowed.
85
+ */
86
+ const PERMISSION_GROUP_NAME_REGEX = /^[^-#]([a-z]|[-](?![-])){0,62}[^-#]$/g;
87
+ const CLOUD_IDENTIFIERS = {
88
+ GCP_AU: 'gcp-au',
89
+ GCP_EU: 'gcp-eu',
90
+ GCP_US: 'gcp-us',
91
+ AWS_FRA: 'aws-fra',
92
+ AWS_OHIO: 'aws-ohio',
93
+ AWS_CN: 'aws-cn'
94
+ };
95
+ const MC_API_URLS = {
96
+ GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
97
+ GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
98
+ GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
99
+ AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
100
+ AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com',
101
+ AWS_CN: 'https://mc-api.cn-northwest-1.aws.commercetools.cn'
102
+ };
103
+ const LOADED_CONFIG_TYPES = {
104
+ CUSTOM_APPLICATION: 'custom-application',
105
+ CUSTOM_VIEW: 'custom-view'
106
+ };
107
+
76
108
  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); }; }
77
109
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
78
110
  let MissingOrInvalidConfigError = /*#__PURE__*/function (_Error) {
@@ -110,36 +142,44 @@ const loadJsModule = filePath => {
110
142
  // and uses `@babel/register` to correctly parse and execute the file.
111
143
  // The "required module output" is then written into `stdout` and parsed
112
144
  // as JSON.
113
- const output = child_process.execFileSync('node', [path__default["default"].join(packageRootPath, 'scripts/load-js-module.js'), filePath], {
145
+ const output = node_child_process.execFileSync('node', [path__default["default"].join(packageRootPath, 'scripts/load-js-module.js'), filePath], {
114
146
  encoding: 'utf8'
115
147
  });
116
148
  return JSON.parse(output);
117
149
  };
118
- const moduleName = 'custom-application-config';
119
- const explorer = cosmiconfig.cosmiconfigSync(moduleName, {
120
- // Restrict the supported file formats / names
121
- searchPlaces: [".".concat(moduleName, "rc"), ".".concat(moduleName, ".json"), ".".concat(moduleName, ".js"), ".".concat(moduleName, ".cjs"), ".".concat(moduleName, ".mjs"), ".".concat(moduleName, ".ts"), "".concat(moduleName, ".json"), "".concat(moduleName, ".js"), "".concat(moduleName, ".cjs"), "".concat(moduleName, ".mjs"), "".concat(moduleName, ".ts")],
122
- loaders: {
123
- noExt: cosmiconfig.defaultLoaders['.json'],
124
- '.js': loadJsModule,
125
- '.cjs': loadJsModule,
126
- '.mjs': loadJsModule,
127
- '.ts': loadJsModule
128
- }
129
- });
150
+ const createExplorerFor = configFileName => {
151
+ return cosmiconfig.cosmiconfigSync(configFileName, {
152
+ // Restrict the supported file formats / names
153
+ searchPlaces: [".".concat(configFileName, "rc"), ".".concat(configFileName, ".json"), ".".concat(configFileName, ".js"), ".".concat(configFileName, ".cjs"), ".".concat(configFileName, ".mjs"), ".".concat(configFileName, ".ts"), "".concat(configFileName, ".json"), "".concat(configFileName, ".js"), "".concat(configFileName, ".cjs"), "".concat(configFileName, ".mjs"), "".concat(configFileName, ".ts")],
154
+ loaders: {
155
+ noExt: cosmiconfig.defaultLoaders['.json'],
156
+ '.js': loadJsModule,
157
+ '.cjs': loadJsModule,
158
+ '.mjs': loadJsModule,
159
+ '.ts': loadJsModule
160
+ }
161
+ });
162
+ };
163
+ const customApplicationExplorer = createExplorerFor('custom-application-config');
164
+ const customViewExplorer = createExplorerFor('custom-view-config');
130
165
  const getConfigPath = () => {
131
- const configFile = explorer.search();
132
- if (!configFile) {
133
- throw new Error("Missing or invalid Custom Application configuration file.");
166
+ const customApplicationConfigFile = customApplicationExplorer.search();
167
+ const customViewConfigFile = customViewExplorer.search();
168
+ if (!customApplicationConfigFile && !customViewConfigFile) {
169
+ throw new Error("Missing or invalid configuration file.");
134
170
  }
135
- return configFile.filepath;
171
+ return (customApplicationConfigFile === null || customApplicationConfigFile === void 0 ? void 0 : customApplicationConfigFile.filepath) || (customViewConfigFile === null || customViewConfigFile === void 0 ? void 0 : customViewConfigFile.filepath);
136
172
  };
137
173
  const loadConfig = applicationPath => {
138
- const configFile = explorer.search(applicationPath);
139
- if (!configFile || !configFile.config) {
140
- throw new MissingOrInvalidConfigError("Missing or invalid Custom Application configuration file.");
174
+ const customApplicationConfigFile = customApplicationExplorer.search(applicationPath);
175
+ const customViewConfigFile = customViewExplorer.search(applicationPath);
176
+ if ((!customApplicationConfigFile || !customApplicationConfigFile.config) && (!customViewConfigFile || !customViewConfigFile.config)) {
177
+ throw new MissingOrInvalidConfigError("Missing or invalid configuration file.");
141
178
  }
142
- return configFile.config;
179
+ if (customApplicationConfigFile && customViewConfigFile) {
180
+ throw new MissingOrInvalidConfigError("Found configuration files for both Custom Application and Custom View. Please remove one of them.");
181
+ }
182
+ return customViewConfigFile || customApplicationConfigFile;
143
183
  };
144
184
 
145
185
  // Transifex's Structured JSON format.
@@ -232,7 +272,7 @@ const substituteVariablePlaceholders = (config, loadingOptions) => JSON.parse(_J
232
272
  return substitutedValue;
233
273
  });
234
274
 
235
- var schemaJson = {
275
+ var customApplicationSchemaJson = {
236
276
  $schema: "http://json-schema.org/draft-07/schema",
237
277
  $id: "https://docs.commercetools.com/custom-applications/schema.json",
238
278
  title: "JSON schema for Custom Application configuration files",
@@ -585,38 +625,300 @@ var schemaJson = {
585
625
  ]
586
626
  };
587
627
 
588
- /**
589
- * The entryPointUriPath may be between 2 and 64 characters and only contain alphabetic lowercase characters,
590
- * non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
591
- */
592
- const ENTRY_POINT_URI_PATH_REGEX = /^[^-_#]([0-9a-z]|[-_](?![-_])){0,62}[^-_#]$/g;
593
-
594
- /**
595
- * The permission group name may be between 2 and 64 characters and only contain alphanumeric lowercase characters and non-consecutive hyphens. Leading and trailing hyphens are also not allowed.
596
- */
597
- const PERMISSION_GROUP_NAME_REGEX = /^[^-#]([a-z]|[-](?![-])){0,62}[^-#]$/g;
598
- const CLOUD_IDENTIFIERS = {
599
- GCP_AU: 'gcp-au',
600
- GCP_EU: 'gcp-eu',
601
- GCP_US: 'gcp-us',
602
- AWS_FRA: 'aws-fra',
603
- AWS_OHIO: 'aws-ohio',
604
- AWS_CN: 'aws-cn'
605
- };
606
- const MC_API_URLS = {
607
- GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
608
- GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
609
- GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
610
- AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
611
- AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com',
612
- AWS_CN: 'https://mc-api.cn-northwest-1.aws.commercetools.cn'
628
+ var customViewSchemaJson = {
629
+ $schema: "http://json-schema.org/draft-07/schema",
630
+ $id: "https://docs.commercetools.com/custom-applications/custom-view.schema.json",
631
+ title: "JSON schema for Custom View configuration files",
632
+ type: "object",
633
+ definitions: {
634
+ cspDirective: {
635
+ type: "array",
636
+ items: {
637
+ type: "string"
638
+ },
639
+ uniqueItems: true
640
+ }
641
+ },
642
+ properties: {
643
+ name: {
644
+ description: "See https://docs.commercetools.com/TODO",
645
+ type: "string"
646
+ },
647
+ description: {
648
+ description: "See https://docs.commercetools.com/TODO",
649
+ type: "string"
650
+ },
651
+ cloudIdentifier: {
652
+ description: "See https://docs.commercetools.com/TODO",
653
+ type: "string"
654
+ },
655
+ mcApiUrl: {
656
+ description: "See https://docs.commercetools.com/TODO",
657
+ type: "string"
658
+ },
659
+ oAuthScopes: {
660
+ description: "See https://docs.commercetools.com/TODO",
661
+ type: "object",
662
+ properties: {
663
+ view: {
664
+ description: "See https://docs.commercetools.com/TODO",
665
+ type: "array",
666
+ "default": [
667
+ ],
668
+ items: {
669
+ type: "string",
670
+ pattern: "view_(.*)"
671
+ },
672
+ uniqueItems: true
673
+ },
674
+ manage: {
675
+ description: "See https://docs.commercetools.com/TODO",
676
+ type: "array",
677
+ "default": [
678
+ ],
679
+ items: {
680
+ type: "string",
681
+ pattern: "manage_(.*)"
682
+ },
683
+ uniqueItems: true
684
+ }
685
+ },
686
+ additionalProperties: false,
687
+ required: [
688
+ "view",
689
+ "manage"
690
+ ]
691
+ },
692
+ additionalOAuthScopes: {
693
+ description: "See https://docs.commercetools.com/TODO",
694
+ type: "array",
695
+ "default": [
696
+ ],
697
+ uniqueItems: true,
698
+ items: {
699
+ type: "object",
700
+ properties: {
701
+ name: {
702
+ description: "See https://docs.commercetools.com/TODO",
703
+ type: "string"
704
+ },
705
+ view: {
706
+ description: "See https://docs.commercetools.com/TODO",
707
+ type: "array",
708
+ "default": [
709
+ ],
710
+ items: {
711
+ type: "string",
712
+ pattern: "view_(.*)"
713
+ },
714
+ uniqueItems: true
715
+ },
716
+ manage: {
717
+ description: "See https://docs.commercetools.com/TODO",
718
+ type: "array",
719
+ "default": [
720
+ ],
721
+ items: {
722
+ type: "string",
723
+ pattern: "manage_(.*)"
724
+ },
725
+ uniqueItems: true
726
+ }
727
+ },
728
+ additionalProperties: false,
729
+ required: [
730
+ "name",
731
+ "view",
732
+ "manage"
733
+ ]
734
+ }
735
+ },
736
+ env: {
737
+ description: "See https://docs.commercetools.com/TODO",
738
+ type: "object",
739
+ properties: {
740
+ development: {
741
+ type: "object",
742
+ properties: {
743
+ initialProjectKey: {
744
+ description: "See https://docs.commercetools.com/TODO",
745
+ type: "string"
746
+ },
747
+ teamId: {
748
+ type: "string"
749
+ },
750
+ hostUriPath: {
751
+ description: "See https://docs.commercetools.com/TODO",
752
+ type: "string"
753
+ }
754
+ },
755
+ additionalProperties: false,
756
+ required: [
757
+ "initialProjectKey"
758
+ ]
759
+ },
760
+ production: {
761
+ type: "object",
762
+ properties: {
763
+ customViewId: {
764
+ description: "See https://docs.commercetools.com/TODO",
765
+ type: "string"
766
+ },
767
+ url: {
768
+ description: "See https://docs.commercetools.com/TODO",
769
+ type: "string"
770
+ },
771
+ cdnUrl: {
772
+ description: "See https://docs.commercetools.com/TODO",
773
+ type: "string"
774
+ }
775
+ },
776
+ additionalProperties: false,
777
+ required: [
778
+ "customViewId",
779
+ "url"
780
+ ]
781
+ }
782
+ },
783
+ additionalProperties: false,
784
+ required: [
785
+ "development",
786
+ "production"
787
+ ]
788
+ },
789
+ additionalEnv: {
790
+ description: "See https://docs.commercetools.com/TODO",
791
+ type: "object"
792
+ },
793
+ headers: {
794
+ description: "See https://docs.commercetools.com/TODO",
795
+ type: "object",
796
+ properties: {
797
+ csp: {
798
+ description: "See https://docs.commercetools.com/TODO",
799
+ type: "object",
800
+ properties: {
801
+ "connect-src": {
802
+ $ref: "#/definitions/cspDirective"
803
+ },
804
+ "font-src": {
805
+ $ref: "#/definitions/cspDirective"
806
+ },
807
+ "img-src": {
808
+ $ref: "#/definitions/cspDirective"
809
+ },
810
+ "script-src": {
811
+ $ref: "#/definitions/cspDirective"
812
+ },
813
+ "style-src": {
814
+ $ref: "#/definitions/cspDirective"
815
+ },
816
+ "frame-src": {
817
+ $ref: "#/definitions/cspDirective"
818
+ }
819
+ },
820
+ additionalProperties: false,
821
+ required: [
822
+ "connect-src"
823
+ ]
824
+ },
825
+ permissionsPolicies: {
826
+ description: "See https://docs.commercetools.com/TODO",
827
+ type: "object"
828
+ },
829
+ strictTransportSecurity: {
830
+ description: "See https://docs.commercetools.com/TODO",
831
+ type: "array",
832
+ items: {
833
+ "enum": [
834
+ "includeSubDomains",
835
+ "preload"
836
+ ]
837
+ },
838
+ uniqueItems: true
839
+ }
840
+ },
841
+ additionalProperties: false
842
+ },
843
+ labelAllLocales: {
844
+ description: "See https://docs.commercetools.com/TODO",
845
+ type: "array",
846
+ "default": [
847
+ ],
848
+ items: {
849
+ type: "object",
850
+ properties: {
851
+ locale: {
852
+ type: "string",
853
+ "enum": [
854
+ "en",
855
+ "de",
856
+ "es",
857
+ "fr-FR",
858
+ "pt-BR",
859
+ "zh-CN"
860
+ ]
861
+ },
862
+ value: {
863
+ type: "string"
864
+ }
865
+ },
866
+ additionalProperties: false,
867
+ required: [
868
+ "locale",
869
+ "value"
870
+ ]
871
+ }
872
+ },
873
+ type: {
874
+ description: "See https://docs.commercetools.com/TODO",
875
+ type: "string",
876
+ "enum": [
877
+ "CustomPanel"
878
+ ]
879
+ },
880
+ typeSettings: {
881
+ description: "See https://docs.commercetools.com/TODO",
882
+ type: "object",
883
+ properties: {
884
+ size: {
885
+ description: "See https://docs.commercetools.com/TODO",
886
+ type: "string",
887
+ "enum": [
888
+ "SMALL",
889
+ "LARGE"
890
+ ]
891
+ }
892
+ }
893
+ },
894
+ locators: {
895
+ description: "See https://docs.commercetools.com/TODO",
896
+ type: "array",
897
+ "default": [
898
+ ],
899
+ items: {
900
+ type: "string"
901
+ }
902
+ }
903
+ },
904
+ additionalProperties: true,
905
+ required: [
906
+ "name",
907
+ "cloudIdentifier",
908
+ "env",
909
+ "oAuthScopes",
910
+ "labelAllLocales",
911
+ "type",
912
+ "locators"
913
+ ]
613
914
  };
614
915
 
615
916
  const ajv = new Ajv__default["default"]({
616
917
  strict: true,
617
918
  useDefaults: true
618
919
  });
619
- const validate = ajv.compile(schemaJson);
920
+ const validateCustomApplicationConfig = ajv.compile(customApplicationSchemaJson);
921
+ const validateCustomViewConfig = ajv.compile(customViewSchemaJson);
620
922
  const printErrors = errors => {
621
923
  if (!errors) {
622
924
  return 'No errors';
@@ -634,10 +936,19 @@ const printErrors = errors => {
634
936
  }
635
937
  }).join('\n');
636
938
  };
637
- const validateConfig = config => {
638
- const valid = validate(config);
639
- if (!valid) {
640
- throw new Error(printErrors(validate.errors));
939
+ const validateConfig = (configType, config) => {
940
+ let validation;
941
+ if (configType === LOADED_CONFIG_TYPES.CUSTOM_APPLICATION) {
942
+ validation = validateCustomApplicationConfig;
943
+ } else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
944
+ validation = validateCustomViewConfig;
945
+ } else {
946
+ var _context4;
947
+ throw new Error(_concatInstanceProperty__default["default"](_context4 = "Invalid config type \"".concat(configType, "\", expected ")).call(_context4, _Object$keys__default["default"](LOADED_CONFIG_TYPES).toString()));
948
+ }
949
+ const isValid = validation(config);
950
+ if (!isValid) {
951
+ throw new Error(printErrors(validation.errors));
641
952
  }
642
953
  };
643
954
  const validateEntryPointUriPath = config => {
@@ -646,9 +957,9 @@ const validateEntryPointUriPath = config => {
646
957
  }
647
958
  };
648
959
  const validateSubmenuLinks = config => {
649
- var _context4;
960
+ var _context5;
650
961
  const uriPathSet = new _Set__default["default"]();
651
- _forEachInstanceProperty__default["default"](_context4 = config.submenuLinks).call(_context4, _ref => {
962
+ _forEachInstanceProperty__default["default"](_context5 = config.submenuLinks).call(_context5, _ref => {
652
963
  let uriPath = _ref.uriPath;
653
964
  if (uriPathSet.has(uriPath)) {
654
965
  throw new Error('Duplicate URI path. Every submenu link must have a unique URI path value');
@@ -659,7 +970,7 @@ const validateSubmenuLinks = config => {
659
970
  const validateAdditionalOAuthScopes = config => {
660
971
  var _config$additionalOAu;
661
972
  const additionalPermissionNames = new _Set__default["default"]();
662
- (_config$additionalOAu = config.additionalOAuthScopes) === null || _config$additionalOAu === void 0 ? void 0 : _forEachInstanceProperty__default["default"](_config$additionalOAu).call(_config$additionalOAu, _ref2 => {
973
+ (_config$additionalOAu = config.additionalOAuthScopes) === null || _config$additionalOAu === void 0 || _forEachInstanceProperty__default["default"](_config$additionalOAu).call(_config$additionalOAu, _ref2 => {
663
974
  let name = _ref2.name,
664
975
  view = _ref2.view,
665
976
  manage = _ref2.manage;
@@ -675,8 +986,8 @@ const validateAdditionalOAuthScopes = config => {
675
986
  });
676
987
  };
677
988
 
678
- 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; }
679
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$1(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$1(Object(source))).call(_context6, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
989
+ 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; }
990
+ 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; }
680
991
 
681
992
  // The `uriPath` of each submenu link is supposed to be defined relative
682
993
  // to the `entryPointUriPath`. Computing the full path is done internally to keep
@@ -709,7 +1020,7 @@ const getPermissions = appConfig => {
709
1020
  let name = _ref2.name;
710
1021
  return name;
711
1022
  })) || [];
712
- const permissionKeys = formatters.entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath, additionalPermissionNames);
1023
+ const permissionKeys = formatters.entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath || appConfig.env.production.customViewId, additionalPermissionNames);
713
1024
  const additionalPermissions = _mapInstanceProperty__default["default"](_context3 = _Object$keys__default["default"](additionalResourceAccessKeyToOauthScopeMap)).call(_context3, additionalResourceAccessKey => ({
714
1025
  name: permissionKeys[additionalResourceAccessKey],
715
1026
  oAuthScopes: additionalResourceAccessKeyToOauthScopeMap[additionalResourceAccessKey]
@@ -741,6 +1052,29 @@ function transformCustomApplicationConfigToData(appConfig) {
741
1052
  }))
742
1053
  };
743
1054
  }
1055
+ function transformCustomViewConfigToData(customViewConfig) {
1056
+ validateAdditionalOAuthScopes(customViewConfig);
1057
+ return {
1058
+ id: customViewConfig.env.production.customViewId,
1059
+ defaultLabel: customViewConfig.name,
1060
+ labelAllLocales: customViewConfig.labelAllLocales,
1061
+ description: customViewConfig.description,
1062
+ url: customViewConfig.env.production.url,
1063
+ permissions: getPermissions(customViewConfig),
1064
+ locators: customViewConfig.locators,
1065
+ type: customViewConfig.type,
1066
+ typeSettings: customViewConfig.typeSettings
1067
+ };
1068
+ }
1069
+ function transformConfigurationToData(configType, configuration) {
1070
+ if (configType === LOADED_CONFIG_TYPES.CUSTOM_APPLICATION) {
1071
+ return transformCustomApplicationConfigToData(configuration);
1072
+ } else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
1073
+ return transformCustomViewConfigToData(configuration);
1074
+ } else {
1075
+ throw new Error("Invalid config type: ".concat(configType));
1076
+ }
1077
+ }
744
1078
 
745
1079
  const mapCloudIdentifierToApiUrl = key => {
746
1080
  var _context;
@@ -783,47 +1117,154 @@ const getOrThrow = (fn, errorMessage) => {
783
1117
  }
784
1118
  };
785
1119
 
786
- 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; }
787
- 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; }
1120
+ 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; }
1121
+ 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; }
788
1122
  // TODO: make it configurable.
789
1123
  const developmentPort = 3001;
790
1124
  const developmentAppUrl = "http://localhost:".concat(developmentPort);
1125
+ const getLoadedConfigurationType = configFileName => {
1126
+ if (_includesInstanceProperty__default["default"](configFileName).call(configFileName, 'custom-view-config')) {
1127
+ return LOADED_CONFIG_TYPES.CUSTOM_VIEW;
1128
+ }
1129
+ return LOADED_CONFIG_TYPES.CUSTOM_APPLICATION;
1130
+ };
791
1131
  const trimTrailingSlash = value => value.replace(/\/$/, '');
792
1132
  const omitDevConfigIfEmpty = devConfig => {
793
- if (
794
- // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
795
- devConfig !== null && devConfig !== void 0 && devConfig.accountLinks || devConfig !== null && devConfig !== void 0 && devConfig.menuLinks || devConfig !== null && devConfig !== void 0 && devConfig.oidc) return devConfig;
1133
+ if (devConfig && (Object.hasOwn(devConfig, 'accountLinks') || Object.hasOwn(devConfig, 'menuLinks') || Object.hasOwn(devConfig, 'customViewHostUrl') || Object.hasOwn(devConfig, 'oidc'))) {
1134
+ return devConfig;
1135
+ }
796
1136
  return undefined;
797
1137
  };
1138
+ const isCustomViewData = data => data.entryPointUriPath === undefined;
1139
+ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
1140
+ var _appConfig$env$develo;
1141
+ let isProd = _ref.isProd,
1142
+ configurationData = _ref.configurationData,
1143
+ mcApiUrl = _ref.mcApiUrl,
1144
+ appConfig = _ref.appConfig,
1145
+ entryPointUriPath = _ref.entryPointUriPath;
1146
+ if (isProd) {
1147
+ return undefined;
1148
+ }
1149
+ const oidcConfig = omitEmpty__default["default"](_objectSpread(_objectSpread({
1150
+ authorizeUrl: [
1151
+ // In case the MC API url points to localhost, we need to point
1152
+ // to a local running dev login page to handle the workflow properly.
1153
+ mcApiUrl.hostname === 'localhost' ? mcApiUrl.origin.replace(mcApiUrl.port, String(developmentPort)) : mcApiUrl.origin.replace('mc-api', 'mc'), '/login/authorize'].join(''),
1154
+ initialProjectKey:
1155
+ // For the `account` application, we should unset the projectKey.
1156
+ entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey
1157
+ }, ((_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.teamId) && _objectSpread({
1158
+ teamId: appConfig.env.development.teamId
1159
+ }, isCustomViewData(configurationData) ? {
1160
+ customViewId: configurationData.id
1161
+ } : {
1162
+ applicationId: configurationData.id
1163
+ })), {}, {
1164
+ oAuthScopes: appConfig.oAuthScopes,
1165
+ additionalOAuthScopes: appConfig === null || appConfig === void 0 ? void 0 : appConfig.additionalOAuthScopes
1166
+ }));
1167
+ if (isCustomViewData(configurationData)) {
1168
+ var _context;
1169
+ const hostUriPath = appConfig.env.development.hostUriPath;
1170
+ const defaultHostUriPath = oidcConfig.initialProjectKey ? _concatInstanceProperty__default["default"](_context = "/".concat(oidcConfig.initialProjectKey, "/")).call(_context, entryPointUriPath) : "/".concat(entryPointUriPath);
1171
+ const hostUrl = new _URL__default["default"](hostUriPath || defaultHostUriPath, developmentAppUrl);
1172
+ return omitDevConfigIfEmpty({
1173
+ oidc: oidcConfig,
1174
+ customViewConfig: configurationData,
1175
+ customViewHostUrl: hostUrl.href
1176
+ });
1177
+ }
1178
+ return omitDevConfigIfEmpty({
1179
+ oidc: oidcConfig,
1180
+ menuLinks: _objectSpread(_objectSpread({
1181
+ icon: configurationData.icon
1182
+ }, configurationData.mainMenuLink), {}, {
1183
+ submenuLinks: configurationData.submenuLinks
1184
+ }),
1185
+ // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
1186
+ accountLinks: appConfig.accountLinks
1187
+ });
1188
+ };
1189
+ const getRuntimeEnvironmentConfig = _ref2 => {
1190
+ var _context2;
1191
+ let isProd = _ref2.isProd,
1192
+ configurationData = _ref2.configurationData,
1193
+ additionalAppEnv = _ref2.additionalAppEnv,
1194
+ mcApiUrl = _ref2.mcApiUrl,
1195
+ cdnUrl = _ref2.cdnUrl,
1196
+ appUrl = _ref2.appUrl,
1197
+ appEnvKey = _ref2.appEnvKey,
1198
+ revision = _ref2.revision,
1199
+ appConfig = _ref2.appConfig;
1200
+ const entryPointUriPath = isCustomViewData(configurationData) ?
1201
+ // When the application acts as the host for Custom Views, there is no real
1202
+ // entry point to be used, therefore we use a special identifier.
1203
+ constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH : configurationData.entryPointUriPath;
1204
+
1205
+ // The real application ID is only used in production.
1206
+ // In development, we prefix the entry point with the "__local" prefix.
1207
+ // This is important to determine to which URL the MC should redirect to
1208
+ // after successful login.
1209
+ const applicationIdentifier = isProd ? _concatInstanceProperty__default["default"](_context2 = "".concat(configurationData.id, ":")).call(_context2, entryPointUriPath) : "__local:".concat(entryPointUriPath);
1210
+ const developmentConfig = getRuntimeEnvironmentConfigForDevelopment({
1211
+ isProd,
1212
+ configurationData,
1213
+ mcApiUrl,
1214
+ appConfig,
1215
+ entryPointUriPath
1216
+ });
1217
+ return _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default["default"](additionalAppEnv)), {}, {
1218
+ cdnUrl: cdnUrl.href,
1219
+ env: appEnvKey,
1220
+ frontendHost: appUrl.host,
1221
+ location: appConfig.cloudIdentifier,
1222
+ mcApiUrl: mcApiUrl.origin,
1223
+ revision,
1224
+ servedByProxy: isProd,
1225
+ // Application config
1226
+ applicationId: applicationIdentifier,
1227
+ applicationIdentifier,
1228
+ applicationName: isCustomViewData(configurationData) ? configurationData.defaultLabel : configurationData.name,
1229
+ entryPointUriPath
1230
+ }, isCustomViewData(configurationData) ? {
1231
+ customViewId: configurationData.id
1232
+ } : {}), developmentConfig ? {
1233
+ __DEVELOPMENT__: developmentConfig
1234
+ } : {});
1235
+ };
798
1236
 
799
1237
  // Keep a reference to the config so that requiring the module
800
1238
  // again will result in returning the cached value.
801
1239
  let cachedConfig;
802
1240
  const processConfig = function () {
803
- var _ref2, _processEnv$MC_APP_EN, _appConfig$additional, _ref3, _context, _appConfig$env$develo, _appConfig$headers, _appConfig$headers2, _appConfig$headers2$c, _context2, _appConfig$headers3, _appConfig$headers3$c, _appConfig$headers4, _appConfig$headers4$c;
804
- let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
805
- _ref$disableCache = _ref.disableCache,
806
- disableCache = _ref$disableCache === void 0 ? false : _ref$disableCache,
807
- _ref$processEnv = _ref.processEnv,
808
- processEnv = _ref$processEnv === void 0 ? process.env : _ref$processEnv,
809
- _ref$applicationPath = _ref.applicationPath,
810
- applicationPath = _ref$applicationPath === void 0 ? fs__default["default"].realpathSync(process.cwd()) : _ref$applicationPath;
1241
+ var _ref4, _processEnv$MC_APP_EN, _appConfig$additional, _ref5, _appConfig$headers, _appConfig$headers2, _context3, _appConfig$headers3, _appConfig$headers4;
1242
+ let _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1243
+ _ref3$disableCache = _ref3.disableCache,
1244
+ disableCache = _ref3$disableCache === void 0 ? false : _ref3$disableCache,
1245
+ _ref3$processEnv = _ref3.processEnv,
1246
+ processEnv = _ref3$processEnv === void 0 ? process.env : _ref3$processEnv,
1247
+ _ref3$applicationPath = _ref3.applicationPath,
1248
+ applicationPath = _ref3$applicationPath === void 0 ? fs__default["default"].realpathSync(process.cwd()) : _ref3$applicationPath;
811
1249
  if (cachedConfig && !disableCache) return cachedConfig;
812
- const rawConfig = loadConfig(applicationPath);
813
- validateConfig(rawConfig);
1250
+ const _loadConfig = loadConfig(applicationPath),
1251
+ filepath = _loadConfig.filepath,
1252
+ rawConfig = _loadConfig.config;
1253
+ const configType = getLoadedConfigurationType(path.parse(filepath).name);
1254
+ validateConfig(configType, rawConfig);
814
1255
  const appConfig = substituteVariablePlaceholders(rawConfig, {
815
1256
  applicationPath,
816
1257
  processEnv
817
1258
  });
818
- const customApplicationData = transformCustomApplicationConfigToData(appConfig);
819
- const 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';
1259
+ const configurationData = transformConfigurationToData(configType, appConfig);
1260
+ 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';
820
1261
  const isProd = getIsProd(processEnv);
821
1262
  const additionalAppEnv = (_appConfig$additional = appConfig.additionalEnv) !== null && _appConfig$additional !== void 0 ? _appConfig$additional : {};
822
- const revision = (_ref3 = additionalAppEnv.revision) !== null && _ref3 !== void 0 ? _ref3 : '';
1263
+ const revision = (_ref5 = additionalAppEnv.revision) !== null && _ref5 !== void 0 ? _ref5 : '';
823
1264
 
824
1265
  // Parse all the supported URLs, which gets implicitly validated
825
1266
 
826
- const envAppUrl = isProd ? customApplicationData.url : developmentAppUrl;
1267
+ const envAppUrl = isProd ? configurationData.url : developmentAppUrl;
827
1268
  const appUrl = getOrThrow(() => new _URL__default["default"](envAppUrl), "Invalid application URL: \"".concat(envAppUrl, "\""));
828
1269
 
829
1270
  // Use `||` instead of `??` to include empty string values.
@@ -832,52 +1273,18 @@ const processConfig = function () {
832
1273
  const mcApiUrl = getOrThrow(() => new _URL__default["default"](
833
1274
  // Use `||` instead of `??` to include empty string values.
834
1275
  appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), "Invalid MC API URL: \"".concat(appConfig.mcApiUrl, "\""));
835
-
836
- // The real application ID is only used in production.
837
- // In development, we prefix the entry point with the "__local" prefix.
838
- // This is important to determine to which URL the MC should redirect to
839
- // after successful login.
840
- const applicationId = isProd ? _concatInstanceProperty__default["default"](_context = "".concat(customApplicationData.id, ":")).call(_context, customApplicationData.entryPointUriPath) : "__local:".concat(customApplicationData.entryPointUriPath);
841
- const developmentConfig = isProd ? undefined : omitDevConfigIfEmpty({
842
- oidc: omitEmpty__default["default"](_objectSpread(_objectSpread({
843
- authorizeUrl: [
844
- // In case the MC API url points to localhost, we need to point
845
- // to a local running dev login page to handle the workflow properly.
846
- mcApiUrl.hostname === 'localhost' ? mcApiUrl.origin.replace(mcApiUrl.port, String(developmentPort)) : mcApiUrl.origin.replace('mc-api', 'mc'), '/login/authorize'].join(''),
847
- initialProjectKey:
848
- // For the `account` application, we should unset the projectKey.
849
- customApplicationData.entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey
850
- }, ((_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.teamId) && {
851
- teamId: appConfig.env.development.teamId,
852
- applicationId: appConfig.env.production.applicationId
853
- }), {}, {
854
- oAuthScopes: appConfig.oAuthScopes,
855
- additionalOAuthScopes: appConfig === null || appConfig === void 0 ? void 0 : appConfig.additionalOAuthScopes
856
- })),
857
- menuLinks: _objectSpread(_objectSpread({
858
- icon: customApplicationData.icon
859
- }, customApplicationData.mainMenuLink), {}, {
860
- submenuLinks: customApplicationData.submenuLinks
861
- }),
862
- // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
863
- accountLinks: appConfig.accountLinks
864
- });
865
1276
  cachedConfig = {
866
- data: customApplicationData,
867
- env: _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default["default"](additionalAppEnv)), {}, {
868
- applicationId,
869
- applicationName: customApplicationData.name,
870
- entryPointUriPath: customApplicationData.entryPointUriPath
871
- }, isProd || !developmentConfig ? {} : {
872
- __DEVELOPMENT__: developmentConfig
873
- }), {}, {
874
- cdnUrl: cdnUrl.href,
875
- env: appEnvKey,
876
- frontendHost: appUrl.host,
877
- location: appConfig.cloudIdentifier,
878
- mcApiUrl: mcApiUrl.origin,
879
- revision,
880
- servedByProxy: isProd
1277
+ data: configurationData,
1278
+ env: getRuntimeEnvironmentConfig({
1279
+ isProd,
1280
+ configurationData,
1281
+ additionalAppEnv,
1282
+ appConfig,
1283
+ appEnvKey,
1284
+ appUrl,
1285
+ cdnUrl,
1286
+ mcApiUrl,
1287
+ revision
881
1288
  }),
882
1289
  headers: _objectSpread(_objectSpread({}, appConfig.headers), {}, {
883
1290
  csp: _objectSpread(_objectSpread({}, (_appConfig$headers = appConfig.headers) === null || _appConfig$headers === void 0 ? void 0 : _appConfig$headers.csp), {}, {
@@ -887,9 +1294,9 @@ const processConfig = function () {
887
1294
  // the CSP point of view, it will say only the file `app` can be used as a source, so
888
1295
  // any other file from that domain will be forbidden. Using the slash (ex: https://www.my-domain.com/app/)
889
1296
  // at the end it's like using a wildcard so anything 'below' `app` will be allowed.
890
- 'connect-src': getUniqueValues((_appConfig$headers2 = appConfig.headers) === null || _appConfig$headers2 === void 0 ? void 0 : (_appConfig$headers2$c = _appConfig$headers2.csp) === null || _appConfig$headers2$c === void 0 ? void 0 : _appConfig$headers2$c['connect-src'], _concatInstanceProperty__default["default"](_context2 = [mcApiUrl.origin]).call(_context2, isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/")] : [])),
891
- 'script-src': getUniqueValues((_appConfig$headers3 = appConfig.headers) === null || _appConfig$headers3 === void 0 ? void 0 : (_appConfig$headers3$c = _appConfig$headers3.csp) === null || _appConfig$headers3$c === void 0 ? void 0 : _appConfig$headers3$c['script-src'], isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/"), "".concat(trimTrailingSlash(cdnUrl.href), "/")] : []),
892
- 'style-src': getUniqueValues((_appConfig$headers4 = appConfig.headers) === null || _appConfig$headers4 === void 0 ? void 0 : (_appConfig$headers4$c = _appConfig$headers4.csp) === null || _appConfig$headers4$c === void 0 ? void 0 : _appConfig$headers4$c['style-src'], isProd ? ["".concat(trimTrailingSlash(appUrl.href), "/"), "".concat(trimTrailingSlash(cdnUrl.href), "/")] : [])
1297
+ '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), "/")] : [])),
1298
+ '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), "/")] : []),
1299
+ '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), "/")] : [])
893
1300
  })
894
1301
  })
895
1302
  };
@@ -913,6 +1320,7 @@ function sanitizeSvg(data) {
913
1320
 
914
1321
  exports.CLOUD_IDENTIFIERS = CLOUD_IDENTIFIERS;
915
1322
  exports.ENTRY_POINT_URI_PATH_REGEX = ENTRY_POINT_URI_PATH_REGEX;
1323
+ exports.LOADED_CONFIG_TYPES = LOADED_CONFIG_TYPES;
916
1324
  exports.MC_API_URLS = MC_API_URLS;
917
1325
  exports.MissingOrInvalidConfigError = MissingOrInvalidConfigError;
918
1326
  exports.PERMISSION_GROUP_NAME_REGEX = PERMISSION_GROUP_NAME_REGEX;