@commercetools-frontend/constants 27.9.6 → 27.11.0

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.9.6";
12
+ var version = "27.11.0";
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),
@@ -129,6 +135,31 @@ const MC_API_PROXY_TARGETS = {
129
135
 
130
136
  // Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
131
137
  const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
138
+ const STATIC_URL_PATHS = {
139
+ LOGIN: 'login',
140
+ LOGOUT: 'logout',
141
+ ACCOUNT: 'account',
142
+ AGENT_SPHERE: 'agent-sphere'
143
+ };
144
+ const includesStaticUrlPath = (list, value) => {
145
+ var _context;
146
+ return _includesInstanceProperty__default["default"](_context = list).call(_context, value);
147
+ };
148
+
149
+ /** First path segment of an entry point or URL path (e.g. `agent-sphere/registry` → `agent-sphere`). */
150
+ const topLevelPathSegment = value => value.split('/')[0] ?? value;
151
+
152
+ /** First URL segment is never a `:projectKey`. */
153
+ 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];
154
+ const isStaticUrlPathInPositionOfProjectKey = value => includesStaticUrlPath(STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, topLevelPathSegment(value));
155
+
156
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
157
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = [STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
158
+ const isProjectKeylessApplicationEntryPoint = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, topLevelPathSegment(value));
159
+
160
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
161
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = [STATIC_URL_PATHS.AGENT_SPHERE];
162
+ const isProjectKeylessApplicationEntryPointInProjectContext = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, topLevelPathSegment(value));
132
163
  const SUPPORTED_HEADERS = {
133
164
  ACCEPT: 'Accept',
134
165
  ACCEPT_VERSION: 'Accept-version',
@@ -262,11 +293,18 @@ exports.ORGANIZATION_GENERAL_ERROR = ORGANIZATION_GENERAL_ERROR;
262
293
  exports.PERMISSION_GROUP_NAME_REGEX = PERMISSION_GROUP_NAME_REGEX;
263
294
  exports.PORTALS_CONTAINER_ID = PORTALS_CONTAINER_ID;
264
295
  exports.PORTALS_CONTAINER_INDENTATION_SIZE = PORTALS_CONTAINER_INDENTATION_SIZE;
296
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS;
297
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT;
265
298
  exports.PROJECT_KEY_REGEX = PROJECT_KEY_REGEX;
266
299
  exports.SHOW_LOADING = SHOW_LOADING;
300
+ exports.STATIC_URL_PATHS = STATIC_URL_PATHS;
301
+ exports.STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY;
267
302
  exports.STATUS_CODES = STATUS_CODES;
268
303
  exports.STORAGE_KEYS = STORAGE_KEYS;
269
304
  exports.SUPPORTED_HEADERS = SUPPORTED_HEADERS;
270
305
  exports.SUPPORT_PORTAL_URL = SUPPORT_PORTAL_URL;
271
306
  exports.featureFlags = featureToggles;
307
+ exports.isProjectKeylessApplicationEntryPoint = isProjectKeylessApplicationEntryPoint;
308
+ exports.isProjectKeylessApplicationEntryPointInProjectContext = isProjectKeylessApplicationEntryPointInProjectContext;
309
+ exports.isStaticUrlPathInPositionOfProjectKey = isStaticUrlPathInPositionOfProjectKey;
272
310
  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.9.6";
12
+ var version = "27.11.0";
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),
@@ -129,6 +135,31 @@ const MC_API_PROXY_TARGETS = {
129
135
 
130
136
  // Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
131
137
  const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
138
+ const STATIC_URL_PATHS = {
139
+ LOGIN: 'login',
140
+ LOGOUT: 'logout',
141
+ ACCOUNT: 'account',
142
+ AGENT_SPHERE: 'agent-sphere'
143
+ };
144
+ const includesStaticUrlPath = (list, value) => {
145
+ var _context;
146
+ return _includesInstanceProperty__default["default"](_context = list).call(_context, value);
147
+ };
148
+
149
+ /** First path segment of an entry point or URL path (e.g. `agent-sphere/registry` → `agent-sphere`). */
150
+ const topLevelPathSegment = value => value.split('/')[0] ?? value;
151
+
152
+ /** First URL segment is never a `:projectKey`. */
153
+ 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];
154
+ const isStaticUrlPathInPositionOfProjectKey = value => includesStaticUrlPath(STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, topLevelPathSegment(value));
155
+
156
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
157
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = [STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
158
+ const isProjectKeylessApplicationEntryPoint = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, topLevelPathSegment(value));
159
+
160
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
161
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = [STATIC_URL_PATHS.AGENT_SPHERE];
162
+ const isProjectKeylessApplicationEntryPointInProjectContext = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, topLevelPathSegment(value));
132
163
  const SUPPORTED_HEADERS = {
133
164
  ACCEPT: 'Accept',
134
165
  ACCEPT_VERSION: 'Accept-version',
@@ -262,11 +293,18 @@ exports.ORGANIZATION_GENERAL_ERROR = ORGANIZATION_GENERAL_ERROR;
262
293
  exports.PERMISSION_GROUP_NAME_REGEX = PERMISSION_GROUP_NAME_REGEX;
263
294
  exports.PORTALS_CONTAINER_ID = PORTALS_CONTAINER_ID;
264
295
  exports.PORTALS_CONTAINER_INDENTATION_SIZE = PORTALS_CONTAINER_INDENTATION_SIZE;
296
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS;
297
+ exports.PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT;
265
298
  exports.PROJECT_KEY_REGEX = PROJECT_KEY_REGEX;
266
299
  exports.SHOW_LOADING = SHOW_LOADING;
300
+ exports.STATIC_URL_PATHS = STATIC_URL_PATHS;
301
+ exports.STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY = STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY;
267
302
  exports.STATUS_CODES = STATUS_CODES;
268
303
  exports.STORAGE_KEYS = STORAGE_KEYS;
269
304
  exports.SUPPORTED_HEADERS = SUPPORTED_HEADERS;
270
305
  exports.SUPPORT_PORTAL_URL = SUPPORT_PORTAL_URL;
271
306
  exports.featureFlags = featureToggles;
307
+ exports.isProjectKeylessApplicationEntryPoint = isProjectKeylessApplicationEntryPoint;
308
+ exports.isProjectKeylessApplicationEntryPointInProjectContext = isProjectKeylessApplicationEntryPointInProjectContext;
309
+ exports.isStaticUrlPathInPositionOfProjectKey = isStaticUrlPathInPositionOfProjectKey;
272
310
  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.9.6";
4
+ var version = "27.11.0";
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),
@@ -125,6 +127,31 @@ const MC_API_PROXY_TARGETS = {
125
127
 
126
128
  // Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
127
129
  const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
130
+ const STATIC_URL_PATHS = {
131
+ LOGIN: 'login',
132
+ LOGOUT: 'logout',
133
+ ACCOUNT: 'account',
134
+ AGENT_SPHERE: 'agent-sphere'
135
+ };
136
+ const includesStaticUrlPath = (list, value) => {
137
+ var _context;
138
+ return _includesInstanceProperty(_context = list).call(_context, value);
139
+ };
140
+
141
+ /** First path segment of an entry point or URL path (e.g. `agent-sphere/registry` → `agent-sphere`). */
142
+ const topLevelPathSegment = value => value.split('/')[0] ?? value;
143
+
144
+ /** First URL segment is never a `:projectKey`. */
145
+ 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];
146
+ const isStaticUrlPathInPositionOfProjectKey = value => includesStaticUrlPath(STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY, topLevelPathSegment(value));
147
+
148
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
149
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS = [STATIC_URL_PATHS.ACCOUNT, STATIC_URL_PATHS.AGENT_SPHERE];
150
+ const isProjectKeylessApplicationEntryPoint = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS, topLevelPathSegment(value));
151
+
152
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
153
+ const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT = [STATIC_URL_PATHS.AGENT_SPHERE];
154
+ const isProjectKeylessApplicationEntryPointInProjectContext = value => includesStaticUrlPath(PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT, topLevelPathSegment(value));
128
155
  const SUPPORTED_HEADERS = {
129
156
  ACCEPT: 'Accept',
130
157
  ACCEPT_VERSION: 'Accept-version',
@@ -233,4 +260,4 @@ var featureToggles = /*#__PURE__*/Object.freeze({
233
260
  DEFAULT_FLAGS: DEFAULT_FLAGS
234
261
  });
235
262
 
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 };
263
+ 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 };
@@ -229,6 +229,21 @@ export interface ApplicationWindow extends Window {
229
229
  app: ApplicationRuntimeEnvironment;
230
230
  }
231
231
  export declare const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = "@@custom-view-host@@";
232
+ export declare const STATIC_URL_PATHS: {
233
+ readonly LOGIN: "login";
234
+ readonly LOGOUT: "logout";
235
+ readonly ACCOUNT: "account";
236
+ readonly AGENT_SPHERE: "agent-sphere";
237
+ };
238
+ /** First URL segment is never a `:projectKey`. */
239
+ export declare const STATIC_URL_PATHS_IN_POSITION_OF_PROJECT_KEY: readonly ["login", "logout", "account", "agent-sphere"];
240
+ export declare const isStaticUrlPathInPositionOfProjectKey: (value: string) => boolean;
241
+ /** Apps whose `entryPointUriPath` is the first URL segment (no `/:projectKey` prefix). */
242
+ export declare const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS: readonly ["account", "agent-sphere"];
243
+ export declare const isProjectKeylessApplicationEntryPoint: (value: string) => boolean;
244
+ /** Subset that still loads a project (navbar, FetchProject from storage). */
245
+ export declare const PROJECT_KEYLESS_APPLICATION_ENTRY_POINTS_IN_PROJECT_CONTEXT: readonly ["agent-sphere"];
246
+ export declare const isProjectKeylessApplicationEntryPointInProjectContext: (value: string) => boolean;
232
247
  export declare const SUPPORTED_HEADERS: {
233
248
  readonly ACCEPT: "Accept";
234
249
  readonly ACCEPT_VERSION: "Accept-version";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/constants",
3
- "version": "27.9.6",
3
+ "version": "27.11.0",
4
4
  "description": "Shared constants for MC applications",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {