@commercetools-frontend/constants 27.10.0 → 27.11.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,8 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
+
9
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
10
+
5
11
  // NOTE: This string will be replaced on build time with the package version.
6
- var version = "27.10.0";
12
+ var version = "27.11.1";
7
13
 
8
14
  /**
9
15
  * The project key must be between 2 and 36 characters long. It can only contain alphanumeric lowercase characters (a-z, 0-9),
@@ -125,10 +131,37 @@ const MC_API_PROXY_TARGETS = {
125
131
  STORES_SEARCGH: 'stores-search'
126
132
  };
127
133
 
134
+ /** Development-only navbar group header for the local menuLinks cache. */
135
+
128
136
  // Global application environment on window object
129
137
 
130
138
  // Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
131
139
  const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
140
+ const STATIC_URL_PATHS = {
141
+ LOGIN: 'login',
142
+ LOGOUT: 'logout',
143
+ ACCOUNT: 'account',
144
+ AGENT_SPHERE: 'agent-sphere'
145
+ };
146
+ const includesStaticUrlPath = (list, value) => {
147
+ var _context;
148
+ return _includesInstanceProperty__default["default"](_context = list).call(_context, value);
149
+ };
150
+
151
+ /** First path segment of an entry point or URL path (e.g. `agent-sphere/registry` → `agent-sphere`). */
152
+ const topLevelPathSegment = value => value.split('/')[0] ?? value;
153
+
154
+ /** First URL segment is never a `:projectKey`. */
155
+ const STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = [STATIC_URL_PATHS.LOGIN, STATIC_URL_PATHS.LOGOUT, STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
156
+ const isStaticUrlPathInPositionOfProjectKey = value => includesStaticUrlPath(STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, topLevelPathSegment(value));
157
+
158
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
159
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = [STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
160
+ const isProjectKeylessApplicationEntryPoint = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, topLevelPathSegment(value));
161
+
162
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
163
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = [STATIC_URL_PATHS.AGENT_SPHERE];
164
+ const isProjectKeylessApplicationEntryPointInProjectContext = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, topLevelPathSegment(value));
132
165
  const SUPPORTED_HEADERS = {
133
166
  ACCEPT: 'Accept',
134
167
  ACCEPT_VERSION: 'Accept-version',
@@ -262,11 +295,18 @@ exports.ORGANIZATION_GENERAL_ERROR = ORGANIZATION_GENERAL_ERROR;
262
295
  exports.PERMISSION_GROUP_NAME_REGEX = PERMISSION_GROUP_NAME_REGEX;
263
296
  exports.PORTALS_CONTAINER_ID = PORTALS_CONTAINER_ID;
264
297
  exports.PORTALS_CONTAINER_INDENTATION_SIZE = PORTALS_CONTAINER_INDENTATION_SIZE;
298
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS;
299
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT;
265
300
  exports.PROJECT_KEY_REGEX = PROJECT_KEY_REGEX;
266
301
  exports.SHOW_LOADING = SHOW_LOADING;
302
+ exports.STATIC_URL_PATHS = STATIC_URL_PATHS;
303
+ exports.STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY;
267
304
  exports.STATUS_CODES = STATUS_CODES;
268
305
  exports.STORAGE_KEYS = STORAGE_KEYS;
269
306
  exports.SUPPORTED_HEADERS = SUPPORTED_HEADERS;
270
307
  exports.SUPPORT_PORTAL_URL = SUPPORT_PORTAL_URL;
271
308
  exports.featureFlags = featureToggles;
309
+ exports.isProjectKeylessApplicationEntryPoint = isProjectKeylessApplicationEntryPoint;
310
+ exports.isProjectKeylessApplicationEntryPointInProjectContext = isProjectKeylessApplicationEntryPointInProjectContext;
311
+ exports.isStaticUrlPathInPositionOfProjectKey = isStaticUrlPathInPositionOfProjectKey;
272
312
  exports.version = version;
@@ -2,8 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
+
9
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
10
+
5
11
  // NOTE: This string will be replaced on build time with the package version.
6
- var version = "27.10.0";
12
+ var version = "27.11.1";
7
13
 
8
14
  /**
9
15
  * The project key must be between 2 and 36 characters long. It can only contain alphanumeric lowercase characters (a-z, 0-9),
@@ -125,10 +131,37 @@ const MC_API_PROXY_TARGETS = {
125
131
  STORES_SEARCGH: 'stores-search'
126
132
  };
127
133
 
134
+ /** Development-only navbar group header for the local menuLinks cache. */
135
+
128
136
  // Global application environment on window object
129
137
 
130
138
  // Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
131
139
  const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
140
+ const STATIC_URL_PATHS = {
141
+ LOGIN: 'login',
142
+ LOGOUT: 'logout',
143
+ ACCOUNT: 'account',
144
+ AGENT_SPHERE: 'agent-sphere'
145
+ };
146
+ const includesStaticUrlPath = (list, value) => {
147
+ var _context;
148
+ return _includesInstanceProperty__default["default"](_context = list).call(_context, value);
149
+ };
150
+
151
+ /** First path segment of an entry point or URL path (e.g. `agent-sphere/registry` → `agent-sphere`). */
152
+ const topLevelPathSegment = value => value.split('/')[0] ?? value;
153
+
154
+ /** First URL segment is never a `:projectKey`. */
155
+ const STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = [STATIC_URL_PATHS.LOGIN, STATIC_URL_PATHS.LOGOUT, STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
156
+ const isStaticUrlPathInPositionOfProjectKey = value => includesStaticUrlPath(STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, topLevelPathSegment(value));
157
+
158
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
159
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = [STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
160
+ const isProjectKeylessApplicationEntryPoint = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, topLevelPathSegment(value));
161
+
162
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
163
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = [STATIC_URL_PATHS.AGENT_SPHERE];
164
+ const isProjectKeylessApplicationEntryPointInProjectContext = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, topLevelPathSegment(value));
132
165
  const SUPPORTED_HEADERS = {
133
166
  ACCEPT: 'Accept',
134
167
  ACCEPT_VERSION: 'Accept-version',
@@ -262,11 +295,18 @@ exports.ORGANIZATION_GENERAL_ERROR = ORGANIZATION_GENERAL_ERROR;
262
295
  exports.PERMISSION_GROUP_NAME_REGEX = PERMISSION_GROUP_NAME_REGEX;
263
296
  exports.PORTALS_CONTAINER_ID = PORTALS_CONTAINER_ID;
264
297
  exports.PORTALS_CONTAINER_INDENTATION_SIZE = PORTALS_CONTAINER_INDENTATION_SIZE;
298
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS;
299
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT;
265
300
  exports.PROJECT_KEY_REGEX = PROJECT_KEY_REGEX;
266
301
  exports.SHOW_LOADING = SHOW_LOADING;
302
+ exports.STATIC_URL_PATHS = STATIC_URL_PATHS;
303
+ exports.STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY;
267
304
  exports.STATUS_CODES = STATUS_CODES;
268
305
  exports.STORAGE_KEYS = STORAGE_KEYS;
269
306
  exports.SUPPORTED_HEADERS = SUPPORTED_HEADERS;
270
307
  exports.SUPPORT_PORTAL_URL = SUPPORT_PORTAL_URL;
271
308
  exports.featureFlags = featureToggles;
309
+ exports.isProjectKeylessApplicationEntryPoint = isProjectKeylessApplicationEntryPoint;
310
+ exports.isProjectKeylessApplicationEntryPointInProjectContext = isProjectKeylessApplicationEntryPointInProjectContext;
311
+ exports.isStaticUrlPathInPositionOfProjectKey = isStaticUrlPathInPositionOfProjectKey;
272
312
  exports.version = version;
@@ -1,5 +1,7 @@
1
+ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
2
+
1
3
  // NOTE: This string will be replaced on build time with the package version.
2
- var version = "27.10.0";
4
+ var version = "27.11.1";
3
5
 
4
6
  /**
5
7
  * The project key must be between 2 and 36 characters long. It can only contain alphanumeric lowercase characters (a-z, 0-9),
@@ -121,10 +123,37 @@ const MC_API_PROXY_TARGETS = {
121
123
  STORES_SEARCGH: 'stores-search'
122
124
  };
123
125
 
126
+ /** Development-only navbar group header for the local menuLinks cache. */
127
+
124
128
  // Global application environment on window object
125
129
 
126
130
  // Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
127
131
  const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
132
+ const STATIC_URL_PATHS = {
133
+ LOGIN: 'login',
134
+ LOGOUT: 'logout',
135
+ ACCOUNT: 'account',
136
+ AGENT_SPHERE: 'agent-sphere'
137
+ };
138
+ const includesStaticUrlPath = (list, value) => {
139
+ var _context;
140
+ return _includesInstanceProperty(_context = list).call(_context, value);
141
+ };
142
+
143
+ /** First path segment of an entry point or URL path (e.g. `agent-sphere/registry` → `agent-sphere`). */
144
+ const topLevelPathSegment = value => value.split('/')[0] ?? value;
145
+
146
+ /** First URL segment is never a `:projectKey`. */
147
+ const STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = [STATIC_URL_PATHS.LOGIN, STATIC_URL_PATHS.LOGOUT, STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
148
+ const isStaticUrlPathInPositionOfProjectKey = value => includesStaticUrlPath(STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, topLevelPathSegment(value));
149
+
150
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
151
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = [STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
152
+ const isProjectKeylessApplicationEntryPoint = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, topLevelPathSegment(value));
153
+
154
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
155
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = [STATIC_URL_PATHS.AGENT_SPHERE];
156
+ const isProjectKeylessApplicationEntryPointInProjectContext = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, topLevelPathSegment(value));
128
157
  const SUPPORTED_HEADERS = {
129
158
  ACCEPT: 'Accept',
130
159
  ACCEPT_VERSION: 'Accept-version',
@@ -233,4 +262,4 @@ var featureToggles = /*#__PURE__*/Object.freeze({
233
262
  DEFAULT_FLAGS: DEFAULT_FLAGS
234
263
  });
235
264
 
236
- export { CUSTOM_VIEWS_EVENTS_META, CUSTOM_VIEWS_EVENTS_NAMES, CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, DOMAINS, ENTRY_POINT_URI_PATH_REGEX, GRAPHQL_TARGETS, HIDE_ALL_PAGE_NOTIFICATIONS, HIDE_LOADING, HTTP_SECURITY_HEADERS, HTTP_SECURITY_HEADER_KEYS, LOGIN_STRATEGY_DEFAULT, LOGIN_STRATEGY_OIDC, LOGIN_STRATEGY_SSO, LOGOUT_REASONS, MC_API_PROXY_TARGETS, MC_MAIN_CONTAINER_PORTAL_ID, NOTIFICATION_DOMAINS, NOTIFICATION_KINDS_GLOBAL, NOTIFICATION_KINDS_PAGE, NOTIFICATION_KINDS_SIDE, NO_VALUE_FALLBACK, ORGANIZATION_GENERAL_ERROR, PERMISSION_GROUP_NAME_REGEX, PORTALS_CONTAINER_ID, PORTALS_CONTAINER_INDENTATION_SIZE, PROJECT_KEY_REGEX, SHOW_LOADING, STATUS_CODES, STORAGE_KEYS, SUPPORTED_HEADERS, SUPPORT_PORTAL_URL, featureToggles as featureFlags, version };
265
+ export { CUSTOM_VIEWS_EVENTS_META, CUSTOM_VIEWS_EVENTS_NAMES, CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, DOMAINS, ENTRY_POINT_URI_PATH_REGEX, GRAPHQL_TARGETS, HIDE_ALL_PAGE_NOTIFICATIONS, HIDE_LOADING, HTTP_SECURITY_HEADERS, HTTP_SECURITY_HEADER_KEYS, LOGIN_STRATEGY_DEFAULT, LOGIN_STRATEGY_OIDC, LOGIN_STRATEGY_SSO, LOGOUT_REASONS, MC_API_PROXY_TARGETS, MC_MAIN_CONTAINER_PORTAL_ID, NOTIFICATION_DOMAINS, NOTIFICATION_KINDS_GLOBAL, NOTIFICATION_KINDS_PAGE, NOTIFICATION_KINDS_SIDE, NO_VALUE_FALLBACK, ORGANIZATION_GENERAL_ERROR, PERMISSION_GROUP_NAME_REGEX, PORTALS_CONTAINER_ID, PORTALS_CONTAINER_INDENTATION_SIZE, PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, PROJECT_KEY_REGEX, SHOW_LOADING, STATIC_URL_PATHS, STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, STATUS_CODES, STORAGE_KEYS, SUPPORTED_HEADERS, SUPPORT_PORTAL_URL, featureToggles as featureFlags, isProjectKeylessApplicationEntryPoint, isProjectKeylessApplicationEntryPointInProjectContext, isStaticUrlPathInPositionOfProjectKey, version };
@@ -190,6 +190,11 @@ export type ApplicationOidcForDevelopmentConfig = {
190
190
  manage: string[];
191
191
  }[];
192
192
  };
193
+ /** Development-only navbar group header for the local menuLinks cache. */
194
+ export type ApplicationNavBarGroupForDevelopmentConfig = {
195
+ label?: string;
196
+ isNew?: boolean;
197
+ };
193
198
  export type CustomViewData = {
194
199
  id: string;
195
200
  defaultLabel: string;
@@ -204,6 +209,7 @@ export type CustomViewData = {
204
209
  export type ApplicationRuntimeEnvironmentForDevelopment = {
205
210
  oidc?: ApplicationOidcForDevelopmentConfig;
206
211
  menuLinks?: ApplicationMenuLinksForDevelopmentConfig;
212
+ menuGroup?: ApplicationNavBarGroupForDevelopmentConfig;
207
213
  customViewHostUrl?: string;
208
214
  customViewConfig?: CustomViewData;
209
215
  mcIdentityLoginModeOverride?: 'legacy';
@@ -229,6 +235,21 @@ export interface ApplicationWindow extends Window {
229
235
  app: ApplicationRuntimeEnvironment;
230
236
  }
231
237
  export declare const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = "@@custom-view-host@@";
238
+ export declare const STATIC_URL_PATHS: {
239
+ readonly LOGIN: "login";
240
+ readonly LOGOUT: "logout";
241
+ readonly ACCOUNT: "account";
242
+ readonly AGENT_SPHERE: "agent-sphere";
243
+ };
244
+ /** First URL segment is never a `:projectKey`. */
245
+ export declare const STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY: readonly ["login", "logout", "account", "agent-sphere"];
246
+ export declare const isStaticUrlPathInPositionOfProjectKey: (value: string) => boolean;
247
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
248
+ export declare const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS: readonly ["account", "agent-sphere"];
249
+ export declare const isProjectKeylessApplicationEntryPoint: (value: string) => boolean;
250
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
251
+ export declare const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT: readonly ["agent-sphere"];
252
+ export declare const isProjectKeylessApplicationEntryPointInProjectContext: (value: string) => boolean;
232
253
  export declare const SUPPORTED_HEADERS: {
233
254
  readonly ACCEPT: "Accept";
234
255
  readonly ACCEPT_VERSION: "Accept-version";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/constants",
3
- "version": "27.10.0",
3
+ "version": "27.11.1",
4
4
  "description": "Shared constants for MC applications",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {