@commercetools-frontend/application-config 20.12.1 → 21.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,47 +4,4 @@
4
4
  <a href="https://www.npmjs.com/package/@commercetools-frontend/application-config"><img src="https://badgen.net/npm/v/@commercetools-frontend/application-config" alt="Latest release (latest dist-tag)" /></a> <a href="https://www.npmjs.com/package/@commercetools-frontend/application-config"><img src="https://badgen.net/npm/v/@commercetools-frontend/application-config/next" alt="Latest release (next dist-tag)" /></a> <a href="https://bundlephobia.com/result?p=@commercetools-frontend/application-config"><img src="https://badgen.net/bundlephobia/minzip/@commercetools-frontend/application-config" alt="Minified + GZipped size" /></a> <a href="https://github.com/commercetools/merchant-center-application-kit/blob/main/LICENSE"><img src="https://badgen.net/github/license/commercetools/merchant-center-application-kit" alt="GitHub license" /></a>
5
5
  </p>
6
6
 
7
- This package contains utilities for configuring Custom Applications.
8
-
9
- ## Install
10
-
11
- ```bash
12
- $ npm install --save @commercetools-frontend/application-config
13
- ```
14
-
15
- ## Configuration format
16
-
17
- A Custom Application must be configured with a single JSON configuration file. The file name can be one of:
18
-
19
- - `.custom-application-configrc`
20
- - `.custom-application-config.json`
21
- - `custom-application-config.json`
22
-
23
- The file is automatically loaded, as long as it is found in the project's root folder. For that, the package uses the [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) library.
24
-
25
- The configuration file is in the format of a JSON schema that is also part of this package. The configuration file itself is validated when starting the Custom Application against the JSON schema.
26
-
27
- By default the configuration file uses the `NODE_ENV` variable to determine which configuration to use. This can be overridden by using the custom environment variable `MC_APP_ENV`.
28
-
29
- In the [test fixtures](./test/fixtures) folder you can see some examples of configuration.
30
-
31
- ### JSON Schema
32
-
33
- To enable JSON schema validation for the Custom Application configuration, you can add a reference as a URL to the `schema.json` file provided in this package.
34
-
35
- **Example setup for VSCode**
36
-
37
- In the VSCode settings (either user settings or workspace settings), reference the schema JSON as described below:
38
-
39
- ```json
40
- "json.schemas": [
41
- {
42
- "fileMatch": [
43
- "/.custom-application-configrc",
44
- "/.custom-application-config.json",
45
- "/custom-application-config.json"
46
- ],
47
- "url": "https://docs.commercetools.com/custom-applications/schema.json"
48
- }
49
- ]
50
- ```
7
+ Check out the [documentation](https://docs.commercetools.com/custom-applications/api-reference/application-config) for more information.
@@ -19,6 +19,7 @@ var path = require('path');
19
19
  var child_process = require('child_process');
20
20
  var cosmiconfig = require('cosmiconfig');
21
21
  var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
22
+ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
22
23
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
23
24
  var _assertThisInitialized = require('@babel/runtime-corejs3/helpers/assertThisInitialized');
24
25
  var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
@@ -82,7 +83,7 @@ var MissingOrInvalidConfigError = /*#__PURE__*/function (_Error) {
82
83
  return _this;
83
84
  }
84
85
 
85
- return MissingOrInvalidConfigError;
86
+ return _createClass(MissingOrInvalidConfigError);
86
87
  }( /*#__PURE__*/_wrapNativeSuper(Error));
87
88
 
88
89
  // for instance in respect to both source files and dist files.
@@ -156,15 +157,20 @@ var schemaJson = {
156
157
  },
157
158
  properties: {
158
159
  name: {
159
- description: "The name of the Custom Application",
160
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#name",
160
161
  type: "string"
161
162
  },
162
- entryPointUriPath: {
163
- description: "The unique route path of the Custom Application. This is the identifier that the Merchant Center Proxy uses to match the HTTP request and to forward it to the Custom Application URL. This value also needs to be used in the application client side routes. The value must be the same as the `navbarMenu.uriPath` in the `menu.json` and the application route path when registering the Custom Application. For example, if the Custom Application should be served at the route `/:projectKey/avengers`, the `entryPointUriPath` must be set to `avengers` and the same for the application routes.",
163
+ description: {
164
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#description",
164
165
  type: "string"
165
166
  },
167
+ entryPointUriPath: {
168
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#entrypointuripath",
169
+ type: "string",
170
+ pattern: "^[^\\-_]([0-9a-z]|[\\-_](?![\\-_])){2,64}[^\\-_]$"
171
+ },
166
172
  cloudIdentifier: {
167
- description: "The cloud identifier where the Custom Application is running. This value is used to derive the Merchant Center API URL. Alternatively you can use the `mcApiUrl` property.",
173
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#cloudidentifier",
168
174
  type: "string",
169
175
  oneOf: [
170
176
  {
@@ -182,16 +188,18 @@ var schemaJson = {
182
188
  ]
183
189
  },
184
190
  mcApiUrl: {
185
- description: "The URL of the Merchant Center API. We usually recommend to use the `cloudIdentifier` option to avoid possible typos.",
191
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mcapiurl",
186
192
  type: "string"
187
193
  },
188
194
  oAuthScopes: {
189
- description: "The requested OAuth Scopes for this Custom Application.",
195
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#oauthscopes",
190
196
  type: "object",
191
197
  properties: {
192
198
  view: {
193
- description: "The list of view-only OAuth Scopes (https://docs.commercetools.com/api/scopes).",
199
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#oauthscopesview",
194
200
  type: "array",
201
+ "default": [
202
+ ],
195
203
  items: {
196
204
  type: "string",
197
205
  pattern: "view_(.*)"
@@ -199,8 +207,10 @@ var schemaJson = {
199
207
  uniqueItems: true
200
208
  },
201
209
  manage: {
202
- description: "The list of manage-only OAuth Scopes (https://docs.commercetools.com/api/scopes).",
210
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#oauthscopesmanage",
203
211
  type: "array",
212
+ "default": [
213
+ ],
204
214
  items: {
205
215
  type: "string",
206
216
  pattern: "manage_(.*)"
@@ -215,62 +225,64 @@ var schemaJson = {
215
225
  ]
216
226
  },
217
227
  env: {
218
- description: "This is an object of keys that represents different environments (for example `production`). The environment used depends on the environment variable `MC_APP_ENV`. If `MC_APP_ENV` isn't set then `NODE_ENV` will be used. If neither is set, it defaults to `development`",
228
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#env",
219
229
  type: "object",
220
230
  properties: {
221
231
  development: {
222
- description: "Configuration for development only",
223
232
  type: "object",
224
233
  properties: {
225
234
  initialProjectKey: {
226
- description: "The initial project key that the Custom Application is requesting access for. This is only used in development.",
235
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#envdevelopmentinitialprojectkey",
227
236
  type: "string"
228
237
  },
229
238
  teamId: {
230
- description: "The ID of an existing team. This can be used for granting access on behalf of the permissions assigned to that team and project.",
231
239
  type: "string"
232
240
  }
233
241
  },
234
- additionalProperties: false
242
+ additionalProperties: false,
243
+ required: [
244
+ "initialProjectKey"
245
+ ]
235
246
  },
236
247
  production: {
237
- description: "Configuration for production only",
238
248
  type: "object",
239
249
  properties: {
240
250
  applicationId: {
241
- description: "The ID of the Custom Application (when you register the application in the Merchant Center)",
251
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#envproductionapplicationid",
242
252
  type: "string"
243
253
  },
244
254
  url: {
245
- description: "The URL where the Custom Application is hosted",
255
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#envproductionurl",
246
256
  type: "string"
247
257
  },
248
258
  cdnUrl: {
249
- description: "The URL where the Custom Application static assets are hosted, like an external CDN. If the static assets are hosted alongside the Custom Application, you can omit this option and the Custom Application URL will be used instead.",
259
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#envproductioncdnurl",
250
260
  type: "string"
251
261
  }
252
262
  },
253
263
  additionalProperties: false,
254
264
  required: [
265
+ "applicationId",
255
266
  "url"
256
267
  ]
257
268
  }
258
269
  },
259
270
  additionalProperties: false,
260
271
  required: [
272
+ "development",
261
273
  "production"
262
274
  ]
263
275
  },
264
276
  additionalEnv: {
265
- description: "Additional environment values unique to your Custom Application that are injected in the application context.",
277
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#additionalenv",
266
278
  type: "object"
267
279
  },
268
280
  headers: {
269
- description: "Configuration for HTTP headers",
281
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#headers",
270
282
  type: "object",
271
283
  properties: {
272
284
  csp: {
273
- description: "Configuration for the HTTP Content-Security-Policy header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy)",
285
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#headerscsp",
274
286
  type: "object",
275
287
  properties: {
276
288
  "connect-src": {
@@ -298,15 +310,15 @@ var schemaJson = {
298
310
  ]
299
311
  },
300
312
  featurePolicies: {
301
- description: "Configuration for the HTTP Feature-Policy header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy/Using_Feature_Policy)",
313
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#headersfeaturepolicies",
302
314
  type: "object"
303
315
  },
304
316
  permissionsPolicies: {
305
- description: "Configuration for the HTTP Permissions-Policy header (https://github.com/w3c/webappsec-permissions-policy/blob/main/permissions-policy-explainer.md)",
317
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#headerspermissionspolicies",
306
318
  type: "object"
307
319
  },
308
320
  strictTransportSecurity: {
309
- description: "Additional configuration for the HTTP Strict-Transport-Security header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security)",
321
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#headersstricttransportsecurity",
310
322
  type: "array",
311
323
  items: {
312
324
  "enum": [
@@ -317,25 +329,22 @@ var schemaJson = {
317
329
  uniqueItems: true
318
330
  }
319
331
  },
320
- additionalProperties: false,
321
- required: [
322
- "csp"
323
- ]
332
+ additionalProperties: false
333
+ },
334
+ icon: {
335
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#icon",
336
+ type: "string"
324
337
  },
325
- menuLinks: {
326
- description: "Configuration for the menu links on the left-side navbar.",
338
+ mainMenuLink: {
339
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mainmenulink",
327
340
  type: "object",
328
341
  properties: {
329
- icon: {
330
- description: "The SVG icon that represents this application. Pass the raw SVG string or a path to an SVG file, for example a relative path `${path:./app.svg}`, or a path from a module `${path:@commercetools-frontend/assets/application-icons/Rocket.svg}`.",
331
- type: "string"
332
- },
333
342
  defaultLabel: {
334
- description: "A default label to be rendered if there is no matching localized label for the user locale.",
343
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mainmenulinkdefaultlabel",
335
344
  type: "string"
336
345
  },
337
346
  labelAllLocales: {
338
- description: "Localized label based on the application locales available from the user profile.",
347
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mainmenulinklabelalllocales",
339
348
  type: "array",
340
349
  "default": [
341
350
  ],
@@ -354,7 +363,6 @@ var schemaJson = {
354
363
  ]
355
364
  },
356
365
  value: {
357
- description: "A label for the specific locale or a reference to a translated message. For example `${intl:en:Menu.Avengers}` which looks for the message key `Menu.Avengers` in the `src/i18n/data/en.json`",
358
366
  type: "string"
359
367
  }
360
368
  },
@@ -366,89 +374,86 @@ var schemaJson = {
366
374
  }
367
375
  },
368
376
  permissions: {
369
- description: "Set the visibility of the menu link. Users must have at least one permission to see the Custom Application in the Merchant Center menu.",
377
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mainmenulinkpermissions",
370
378
  type: "array",
371
379
  "default": [
372
380
  ],
373
381
  items: {
374
382
  type: "string"
375
383
  }
376
- },
377
- submenuLinks: {
378
- description: "Configuration for the submenu links on the left-side navbar.",
379
- "default": [
380
- ],
381
- type: "array",
382
- items: {
383
- type: "object",
384
- properties: {
385
- uriPath: {
386
- description: "Route path relative to the entry point URI path of the Custom Application.",
387
- type: "string"
388
- },
389
- defaultLabel: {
390
- description: "A default label to be rendered if there is no matching localized label for the user locale.",
391
- type: "string"
392
- },
393
- labelAllLocales: {
394
- description: "Localized label based on the application locales available from the user profile.",
395
- type: "array",
396
- "default": [
397
- ],
398
- items: {
399
- type: "object",
400
- properties: {
401
- locale: {
402
- type: "string",
403
- "enum": [
404
- "en",
405
- "de",
406
- "es",
407
- "fr-FR",
408
- "zh-CN",
409
- "ja"
410
- ]
411
- },
412
- value: {
413
- description: "A label for the specific locale or a reference to a translated message. For example `${intl:en:Menu.Avengers}` which looks for the message key `Menu.Avengers` in the `src/i18n/data/en.json`",
414
- type: "string"
415
- }
416
- },
417
- additionalProperties: false,
418
- required: [
419
- "locale",
420
- "value"
421
- ]
422
- }
423
- },
424
- permissions: {
425
- description: "Set the visibility of the menu link. Users must have at least one permission to see the Custom Application in the Merchant Center menu.",
426
- type: "array",
427
- "default": [
428
- ],
429
- items: {
430
- type: "string"
431
- }
432
- }
433
- },
434
- additionalProperties: true,
435
- required: [
436
- "uriPath",
437
- "defaultLabel",
438
- "labelAllLocales",
439
- "permissions"
440
- ]
441
- }
442
384
  }
443
385
  },
444
386
  additionalProperties: true,
445
387
  required: [
446
- "icon",
447
388
  "defaultLabel",
448
389
  "labelAllLocales",
449
- "permissions",
450
- "submenuLinks"
390
+ "permissions"
451
391
  ]
392
+ },
393
+ submenuLinks: {
394
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#submenulinks",
395
+ "default": [
396
+ ],
397
+ type: "array",
398
+ items: {
399
+ type: "object",
400
+ properties: {
401
+ uriPath: {
402
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#submenulinksuripath",
403
+ type: "string"
404
+ },
405
+ defaultLabel: {
406
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#submenulinksdefaultlabel",
407
+ type: "string"
408
+ },
409
+ labelAllLocales: {
410
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#submenulinkslabelalllocales",
411
+ type: "array",
412
+ "default": [
413
+ ],
414
+ items: {
415
+ type: "object",
416
+ properties: {
417
+ locale: {
418
+ type: "string",
419
+ "enum": [
420
+ "en",
421
+ "de",
422
+ "es",
423
+ "fr-FR",
424
+ "zh-CN",
425
+ "ja"
426
+ ]
427
+ },
428
+ value: {
429
+ type: "string"
430
+ }
431
+ },
432
+ additionalProperties: false,
433
+ required: [
434
+ "locale",
435
+ "value"
436
+ ]
437
+ }
438
+ },
439
+ permissions: {
440
+ description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#submenulinkspermissions",
441
+ type: "array",
442
+ "default": [
443
+ ],
444
+ items: {
445
+ type: "string"
446
+ }
447
+ }
448
+ },
449
+ additionalProperties: true,
450
+ required: [
451
+ "uriPath",
452
+ "defaultLabel",
453
+ "labelAllLocales",
454
+ "permissions"
455
+ ]
456
+ }
452
457
  }
453
458
  },
454
459
  additionalProperties: true,
@@ -456,7 +461,11 @@ var schemaJson = {
456
461
  "name",
457
462
  "entryPointUriPath",
458
463
  "cloudIdentifier",
459
- "env"
464
+ "env",
465
+ "oAuthScopes",
466
+ "icon",
467
+ "mainMenuLink",
468
+ "submenuLinks"
460
469
  ]
461
470
  };
462
471
 
@@ -570,7 +579,7 @@ var getOrThrow = function getOrThrow(fn, errorMessage) {
570
579
  * Allows variable placeholders. Supported types are:
571
580
  * - `env`: For example `${env:MC_API_URL}`.
572
581
  * - `intl`: For example `${intl:en:Menu.title}`.
573
- * - `path`: For example `${path:./app.svg}`, or `${path:@commercetools-frontend/assets/application-icons/Rocket.svg}`.
582
+ * - `path`: For example `${path:./app.svg}`, or `${path:@commercetools-frontend/assets/application-icons/rocket.svg}`.
574
583
  */
575
584
  var variableSyntax = /\${([ ~:\w.'",\-/()@]+?)}/g;
576
585
  var envRefSyntax = /^env:/g;
@@ -687,9 +696,9 @@ var substituteVariablePlaceholders = function substituteVariablePlaceholders(con
687
696
  });
688
697
  };
689
698
 
690
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (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; }
699
+ 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; }
691
700
 
692
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context4; _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; }
701
+ 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; }
693
702
  // TODO: make it configurable.
694
703
  var developmentPort = 3001;
695
704
  var developmentAppUrl = "http://localhost:".concat(developmentPort);
@@ -705,7 +714,7 @@ var omitDevConfigIfEmpty = function omitDevConfigIfEmpty(devConfig) {
705
714
  var cachedConfig;
706
715
 
707
716
  var processConfig = function processConfig() {
708
- var _ref2, _processEnv$MC_APP_EN, _appConfig$additional, _ref3, _appConfig$env$develo, _appConfig$env$develo2, _appConfig$headers, _appConfig$headers2, _context2, _appConfig$headers3, _appConfig$headers4;
717
+ 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;
709
718
 
710
719
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
711
720
  _ref$disableCache = _ref.disableCache,
@@ -726,9 +735,7 @@ var processConfig = function processConfig() {
726
735
  applicationPath: applicationPath
727
736
  });
728
737
  var additionalAppEnv = (_appConfig$additional = appConfig.additionalEnv) !== null && _appConfig$additional !== void 0 ? _appConfig$additional : {};
729
- var revision = (_ref3 = additionalAppEnv.revision) !== null && _ref3 !== void 0 ? _ref3 : ''; // Feature flags
730
-
731
- var isOidcForDevelopmentEnabled = Boolean(JSON.parse(processEnv.ENABLE_OIDC_FOR_DEVELOPMENT || 'false')); // Parse all the supported URLs, which gets implicitly validated
738
+ var revision = (_ref3 = additionalAppEnv.revision) !== null && _ref3 !== void 0 ? _ref3 : ''; // Parse all the supported URLs, which gets implicitly validated
732
739
 
733
740
  var envAppUrl = isProd ? appConfig.env.production.url : developmentAppUrl;
734
741
  var appUrl = getOrThrow(function () {
@@ -747,37 +754,27 @@ var processConfig = function processConfig() {
747
754
  // This is important to determine to which URL the MC should redirect to
748
755
  // after successful login.
749
756
 
750
- var applicationId = isOidcForDevelopmentEnabled ? "__local:".concat(appConfig.entryPointUriPath) : undefined;
751
-
752
- if (isProd) {
753
- // TODO: decide if we do require the application ID or not.
754
- if (appConfig.env.production.applicationId) {
755
- var _context;
756
-
757
- applicationId = _concatInstanceProperty__default["default"](_context = "".concat(appConfig.env.production.applicationId, ":")).call(_context, appConfig.entryPointUriPath);
758
- } else {
759
- // As long as we don't require the application ID in production, we should
760
- // fall back to unset the value.
761
- applicationId = undefined;
762
- }
763
- }
764
-
757
+ var applicationId = isProd ? _concatInstanceProperty__default["default"](_context = "".concat(appConfig.env.production.applicationId, ":")).call(_context, appConfig.entryPointUriPath) : "__local:".concat(appConfig.entryPointUriPath);
765
758
  var developmentConfig = isProd ? undefined : omitDevConfigIfEmpty({
766
- oidc: isOidcForDevelopmentEnabled ? omitEmpty__default["default"]({
759
+ oidc: omitEmpty__default["default"]({
767
760
  authorizeUrl: [// In case the MC API url points to localhost, we need to point
768
761
  // to a local running dev login page to handle the workflow properly.
769
762
  mcApiUrl.hostname === 'localhost' ? mcApiUrl.origin.replace(mcApiUrl.port, String(developmentPort)) : mcApiUrl.origin.replace('mc-api', 'mc'), '/login/authorize'].join(''),
770
- initialProjectKey: (_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.initialProjectKey,
771
- teamId: (_appConfig$env$develo2 = appConfig.env.development) === null || _appConfig$env$develo2 === void 0 ? void 0 : _appConfig$env$develo2.teamId,
763
+ initialProjectKey: // For the `account` application, we should unset the projectKey.
764
+ appConfig.entryPointUriPath === 'account' ? undefined : appConfig.env.development.initialProjectKey,
765
+ teamId: (_appConfig$env$develo = appConfig.env.development) === null || _appConfig$env$develo === void 0 ? void 0 : _appConfig$env$develo.teamId,
772
766
  oAuthScopes: appConfig.oAuthScopes
773
- }) : undefined,
774
- menuLinks: appConfig.menuLinks,
767
+ }),
768
+ menuLinks: _objectSpread(_objectSpread({
769
+ icon: appConfig.icon
770
+ }, appConfig.mainMenuLink), {}, {
771
+ submenuLinks: appConfig.submenuLinks
772
+ }),
775
773
  // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
776
774
  accountLinks: appConfig.accountLinks
777
775
  });
778
776
  cachedConfig = {
779
777
  env: _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default["default"](additionalAppEnv)), {}, {
780
- // TODO: how else should we provide the app identifier?
781
778
  applicationId: applicationId,
782
779
  applicationName: appConfig.name,
783
780
  entryPointUriPath: appConfig.entryPointUriPath
@@ -794,9 +791,9 @@ var processConfig = function processConfig() {
794
791
  }),
795
792
  headers: _objectSpread(_objectSpread({}, appConfig.headers), {}, {
796
793
  csp: _objectSpread(_objectSpread({}, (_appConfig$headers = appConfig.headers) === null || _appConfig$headers === void 0 ? void 0 : _appConfig$headers.csp), {}, {
797
- 'connect-src': getUniqueValues((_appConfig$headers2 = appConfig.headers) === null || _appConfig$headers2 === void 0 ? void 0 : _appConfig$headers2.csp['connect-src'], _concatInstanceProperty__default["default"](_context2 = [mcApiUrl.origin]).call(_context2, isProd ? [appUrl.href] : [])),
798
- 'script-src': getUniqueValues((_appConfig$headers3 = appConfig.headers) === null || _appConfig$headers3 === void 0 ? void 0 : _appConfig$headers3.csp['script-src'], isProd ? [appUrl.href, cdnUrl.href] : []),
799
- 'style-src': getUniqueValues((_appConfig$headers4 = appConfig.headers) === null || _appConfig$headers4 === void 0 ? void 0 : _appConfig$headers4.csp['style-src'], isProd ? [appUrl.href, cdnUrl.href] : [])
794
+ '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 ? [appUrl.href] : [])),
795
+ '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 ? [appUrl.href, cdnUrl.href] : []),
796
+ '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 ? [appUrl.href, cdnUrl.href] : [])
800
797
  })
801
798
  })
802
799
  };