@commercetools-frontend/constants 0.0.0-CRAFT-1791-20251006162610
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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/commercetools-frontend-constants.cjs.d.ts +2 -0
- package/dist/commercetools-frontend-constants.cjs.dev.js +265 -0
- package/dist/commercetools-frontend-constants.cjs.js +7 -0
- package/dist/commercetools-frontend-constants.cjs.prod.js +265 -0
- package/dist/commercetools-frontend-constants.esm.js +230 -0
- package/dist/declarations/src/constants.d.ts +288 -0
- package/dist/declarations/src/feature-toggles.d.ts +7 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/types/generated/settings.d.ts +1653 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +38 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
2
|
+
var version = "24.7.2";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The project key must be between 2 and 36 characters long. It can only contain alphanumeric lowercase characters (a-z, 0-9),
|
|
6
|
+
* up to two consecutive underscores (_) and hyphens (-). Leading and trailing underscore and hyphens are also not allowed.
|
|
7
|
+
*
|
|
8
|
+
* This regular expression has been generated using ChatGPT.
|
|
9
|
+
* Explanation of the regular expression:
|
|
10
|
+
* 1. ^: Asserts the start of the string.
|
|
11
|
+
* 2. (?!.*(?:[-_]{3}|^[-_]|[-_]$)): Negative lookahead assertion ensures that there are no three consecutive hyphens or underscores ([-_]{3}), no leading hyphen or underscore (^[-_]), and no trailing hyphen or underscore ([-_]$).
|
|
12
|
+
* 3. (?=.{2,36}$): Positive lookahead assertion ensures that the length of the string is between 2 and 36 characters.
|
|
13
|
+
* 4. (?:[a-z1-9][a-z0-9]*)?: Non-capturing group matches an optional first character that cannot be '0' ([a-z1-9]) followed by zero or more lowercase alphanumeric characters ([a-z0-9]*).
|
|
14
|
+
* 5. (?:[-_]{0,2}[a-z0-9]+)*: Non-capturing group matches zero, one, or two hyphens or underscores followed by one or more lowercase alphanumeric characters. This group can repeat zero or more times.
|
|
15
|
+
* 6. $: Asserts the end of the string.
|
|
16
|
+
*/
|
|
17
|
+
const PROJECT_KEY_REGEX = /^(?!.*(?:[-_]{3}|^[-_]|[-_]$))(?=.{2,36}$)(?:[a-z1-9][a-z0-9]*)?(?:[-_]{0,2}[a-z0-9]+)*$/;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The entryPointUriPath may be between 2 and 64 characters and only contain alphabetic lowercase characters,
|
|
21
|
+
* non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
|
|
22
|
+
*
|
|
23
|
+
* This regular expression has been generated using ChatGPT.
|
|
24
|
+
* Explanation of the regular expression:
|
|
25
|
+
* 1. ^: Asserts the start of the string.
|
|
26
|
+
* 2. (?!.*(?:[-_]{2}|^[-_]|[-_]$)): Negative lookahead assertion ensures that there are no two consecutive hyphens or underscores ([-_]{2}), no leading hyphen or underscore (^[-_]), and no trailing hyphen or underscore ([-_]$).
|
|
27
|
+
* 3. (?=.{2,64}$): Positive lookahead assertion ensures that the length of the string is between 2 and 64 characters.
|
|
28
|
+
* 4. (?:[a-z1-9][a-z0-9]*)?: Non-capturing group matches an optional first character that cannot be '0' ([a-z1-9]) followed by zero or more lowercase alphanumeric characters ([a-z0-9]*).
|
|
29
|
+
* 5. (?:[-_]{0,1}[a-z0-9]+)*: Non-capturing group matches zero, or one hyphen or underscore followed by one or more lowercase alphanumeric characters. This group can repeat zero or more times.
|
|
30
|
+
* 6. $: Asserts the end of the string.
|
|
31
|
+
*/
|
|
32
|
+
const ENTRY_POINT_URI_PATH_REGEX = /^(?!.*(?:[-_]{2}|^[-_]|[-_]$))(?=.{2,64}$)(?:[a-z1-9][a-z0-9]*)?(?:[-_]{0,1}[a-z0-9]+)*$/;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The permission group name may be between 2 and 64 characters and only contain alphanumeric lowercase characters and non-consecutive hyphens.
|
|
36
|
+
* Leading and trailing hyphens are also not allowed.
|
|
37
|
+
*/
|
|
38
|
+
const PERMISSION_GROUP_NAME_REGEX = /^[^-#\W]([a-z]|[-](?![-])){0,62}[^-#\W]$/;
|
|
39
|
+
|
|
40
|
+
// DOM elements
|
|
41
|
+
const PORTALS_CONTAINER_ID = 'portals-container';
|
|
42
|
+
const PORTALS_CONTAINER_INDENTATION_SIZE = '48px';
|
|
43
|
+
|
|
44
|
+
// Links
|
|
45
|
+
const SUPPORT_PORTAL_URL = 'https://support.commercetools.com';
|
|
46
|
+
|
|
47
|
+
// Notification actions
|
|
48
|
+
const SHOW_LOADING = 'SHOW_LOADING';
|
|
49
|
+
const HIDE_LOADING = 'HIDE_LOADING';
|
|
50
|
+
const HIDE_ALL_PAGE_NOTIFICATIONS = 'HIDE_ALL_PAGE_NOTIFICATIONS';
|
|
51
|
+
|
|
52
|
+
// Notifications
|
|
53
|
+
const NOTIFICATION_DOMAINS = {
|
|
54
|
+
GLOBAL: 'global',
|
|
55
|
+
PAGE: 'page',
|
|
56
|
+
SIDE: 'side'
|
|
57
|
+
};
|
|
58
|
+
const NOTIFICATION_KINDS_SIDE = {
|
|
59
|
+
error: 'error',
|
|
60
|
+
warning: 'warning',
|
|
61
|
+
info: 'info',
|
|
62
|
+
success: 'success'
|
|
63
|
+
};
|
|
64
|
+
const NOTIFICATION_KINDS_GLOBAL = {
|
|
65
|
+
error: 'error',
|
|
66
|
+
warning: 'warning',
|
|
67
|
+
info: 'info',
|
|
68
|
+
success: 'success',
|
|
69
|
+
'unexpected-error': 'unexpected-error'
|
|
70
|
+
};
|
|
71
|
+
const NOTIFICATION_KINDS_PAGE = {
|
|
72
|
+
error: 'error',
|
|
73
|
+
warning: 'warning',
|
|
74
|
+
info: 'info',
|
|
75
|
+
success: 'success',
|
|
76
|
+
'unexpected-error': 'unexpected-error',
|
|
77
|
+
'api-error': 'api-error'
|
|
78
|
+
};
|
|
79
|
+
// Alias to `NOTIFICATION_DOMAINS` for backwards compatibility
|
|
80
|
+
const DOMAINS = NOTIFICATION_DOMAINS;
|
|
81
|
+
// Fallback string when there is no localized value
|
|
82
|
+
const NO_VALUE_FALLBACK = '- -';
|
|
83
|
+
|
|
84
|
+
// HTTP requests and responses
|
|
85
|
+
const STATUS_CODES = {
|
|
86
|
+
UNAUTHORIZED: 401,
|
|
87
|
+
FORBIDDEN: 403,
|
|
88
|
+
UNAUTHENTICATED: 299,
|
|
89
|
+
NOT_FOUND: 404
|
|
90
|
+
};
|
|
91
|
+
const LOGOUT_REASONS = {
|
|
92
|
+
USER: 'user',
|
|
93
|
+
UNAUTHORIZED: 'unauthorized',
|
|
94
|
+
INVALID: 'invalid',
|
|
95
|
+
DELETED: 'deleted',
|
|
96
|
+
NO_PROJECTS: 'no-projects'
|
|
97
|
+
};
|
|
98
|
+
const GRAPHQL_TARGETS = {
|
|
99
|
+
MERCHANT_CENTER_BACKEND: 'mc',
|
|
100
|
+
COMMERCETOOLS_PLATFORM: 'ctp',
|
|
101
|
+
DASHBOARD_SERVICE: 'dashboard',
|
|
102
|
+
CHANGE_HISTORY_SERVICE: 'change-history',
|
|
103
|
+
PIM_INDEXER: 'pim-indexer',
|
|
104
|
+
ORDER_INDEXER: 'order-indexer',
|
|
105
|
+
SETTINGS_SERVICE: 'settings',
|
|
106
|
+
ADMINISTRATION_SERVICE: 'administration',
|
|
107
|
+
STANDALONE_PRICES_INDEXER: 'standalone-prices-indexer',
|
|
108
|
+
PLATFORM_INSIGHTS: 'platform-insights'
|
|
109
|
+
};
|
|
110
|
+
const MC_API_PROXY_TARGETS = {
|
|
111
|
+
COMMERCETOOLS_PLATFORM: 'ctp',
|
|
112
|
+
MACHINE_LEARNING: 'ml',
|
|
113
|
+
PIM_SEARCH: 'pim-search',
|
|
114
|
+
ORDER_SEARCH: 'order-search',
|
|
115
|
+
IMPORT: 'import',
|
|
116
|
+
EXPORT: 'export',
|
|
117
|
+
STANDALONE_PRICES_SEARCH: 'standalone-prices-search'
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Global application environment on window object
|
|
121
|
+
|
|
122
|
+
// Used for Custom Views, as we want to keep the `entryPointUriPath` value required in the runtime config.
|
|
123
|
+
const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = '@@custom-view-host@@';
|
|
124
|
+
const SUPPORTED_HEADERS = {
|
|
125
|
+
ACCEPT: 'Accept',
|
|
126
|
+
ACCEPT_VERSION: 'Accept-version',
|
|
127
|
+
AUTHORIZATION: 'Authorization',
|
|
128
|
+
CONTENT_TYPE: 'Content-Type',
|
|
129
|
+
X_APPLICATION_ID: 'X-Application-Id',
|
|
130
|
+
X_CUSTOM_VIEW_ID: 'X-Custom-View-Id',
|
|
131
|
+
X_CORRELATION_ID: 'X-Correlation-Id',
|
|
132
|
+
X_FEATURE_FLAG: 'X-Feature-Flag',
|
|
133
|
+
X_FORWARD_TO: 'X-Forward-To',
|
|
134
|
+
X_FORWARD_TO_AUDIENCE_POLICY: 'X-Forward-To-Audience-Policy',
|
|
135
|
+
X_FORWARD_TO_CLAIMS: 'X-Forward-To-Claims',
|
|
136
|
+
X_GRAPHQL_TARGET: 'X-Graphql-Target',
|
|
137
|
+
X_GRAPHQL_OPERATION_NAME: 'X-Graphql-Operation-Name',
|
|
138
|
+
X_PROJECT_KEY: 'X-Project-Key',
|
|
139
|
+
X_TEAM_ID: 'X-Team-Id',
|
|
140
|
+
X_TOKEN_RETRY: 'X-Force-Token',
|
|
141
|
+
X_USER_AGENT: 'X-User-Agent'
|
|
142
|
+
};
|
|
143
|
+
const STORAGE_KEYS = {
|
|
144
|
+
NONCE: 'nonce',
|
|
145
|
+
IS_AUTHENTICATED: 'isAuthenticated',
|
|
146
|
+
SESSION_TOKEN: 'sessionToken',
|
|
147
|
+
SESSION_SCOPE: 'sessionScope',
|
|
148
|
+
ACTIVE_PROJECT_KEY: 'activeProjectKey',
|
|
149
|
+
ACTIVE_TEAM_ID: 'activeTeamId',
|
|
150
|
+
SELECTED_DATA_LOCALE: 'selectedDataLocale',
|
|
151
|
+
IS_FORCED_MENU_OPEN: 'isForcedMenuOpen',
|
|
152
|
+
LOGIN_STRATEGY: 'loginStrategy'
|
|
153
|
+
};
|
|
154
|
+
const HTTP_SECURITY_HEADER_KEYS = {
|
|
155
|
+
'Content-Security-Policy': 'Content-Security-Policy',
|
|
156
|
+
'Permissions-Policy': 'Permissions-Policy',
|
|
157
|
+
'Referrer-Policy': 'Referrer-Policy',
|
|
158
|
+
'Strict-Transport-Security': 'Strict-Transport-Security',
|
|
159
|
+
'X-Content-Type-Options': 'X-Content-Type-Options',
|
|
160
|
+
'X-Frame-Options': 'X-Frame-Options',
|
|
161
|
+
// @deprecated: this header is not supported by the browser anymore. Use `Content-Security-Policy` instead.
|
|
162
|
+
'X-XSS-Protection': 'X-XSS-Protection'
|
|
163
|
+
};
|
|
164
|
+
const HTTP_SECURITY_HEADERS = {
|
|
165
|
+
[HTTP_SECURITY_HEADER_KEYS['Referrer-Policy']]: 'same-origin',
|
|
166
|
+
[HTTP_SECURITY_HEADER_KEYS['Permissions-Policy']]:
|
|
167
|
+
// Note: we need to use `(self)` to ensure that Custom Views (rendered within an `<iframe>`)
|
|
168
|
+
// can inherit the main application permissions policy and override other directives if needed.
|
|
169
|
+
'microphone=(self), camera=(self), payment=(self), usb=(self), geolocation=(self)',
|
|
170
|
+
[HTTP_SECURITY_HEADER_KEYS['Strict-Transport-Security']]: 'max-age=31536000; includeSubDomains; preload',
|
|
171
|
+
[HTTP_SECURITY_HEADER_KEYS['X-Content-Type-Options']]: 'nosniff',
|
|
172
|
+
[HTTP_SECURITY_HEADER_KEYS['X-Frame-Options']]: 'SAMEORIGIN'
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Custom Views events (messages sent between the host application and the custom view)
|
|
176
|
+
const CUSTOM_VIEWS_EVENTS_NAMES = {
|
|
177
|
+
CUSTOM_VIEW_BOOTSTRAP: 'custom-view-bootstrap',
|
|
178
|
+
CUSTOM_VIEW_INITIALIZATION: 'custom-view-initialization',
|
|
179
|
+
CUSTOM_VIEW_CLOSE: 'custom-view-close',
|
|
180
|
+
CUSTOM_VIEW_READY: 'custom-view-ready',
|
|
181
|
+
CUSTOM_VIEW_ON_CLOSE_AFTER: 'custom-view-on-close-after'
|
|
182
|
+
};
|
|
183
|
+
const CUSTOM_VIEWS_EVENTS_META = {
|
|
184
|
+
HOST_APPLICATION_CODE: 'mc-host-application',
|
|
185
|
+
CUSTOM_VIEW_KEY_PREFIX: 'custom-view-'
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// SSO
|
|
189
|
+
const ORGANIZATION_GENERAL_ERROR = 'organizationGeneralError';
|
|
190
|
+
const LOGIN_STRATEGY_DEFAULT = 'default';
|
|
191
|
+
const LOGIN_STRATEGY_OIDC = 'oidc';
|
|
192
|
+
const LOGIN_STRATEGY_SSO = 'sso';
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
* This file contains a list of all feature toggles used within
|
|
196
|
+
* the app shell. Each feature toggle should be a constant.
|
|
197
|
+
*
|
|
198
|
+
* ```
|
|
199
|
+
* export const FEATURE_TOGGLE_NAME = 'featureToggleName';
|
|
200
|
+
* export const FLAGS = {
|
|
201
|
+
* [FEATURE_TOGGLE_NAME]: false,
|
|
202
|
+
* };
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* NOTE:
|
|
206
|
+
* Default values are not yet passed to flopflip and it has to be decided
|
|
207
|
+
* how the integrate with the plugin API.
|
|
208
|
+
* The default values would be used whenever feature toggles have not been
|
|
209
|
+
* fetched from LaunchDarkly (without default values flopflip will default
|
|
210
|
+
* them to off until fetched).
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
const CUSTOM_VIEWS = 'enableCustomViews';
|
|
214
|
+
const FLAGS = {};
|
|
215
|
+
|
|
216
|
+
// Long-lived feature flags, defined in the MC API.
|
|
217
|
+
const DEFAULT_FLAGS = {
|
|
218
|
+
[CUSTOM_VIEWS]: {
|
|
219
|
+
value: true
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var featureToggles = /*#__PURE__*/Object.freeze({
|
|
224
|
+
__proto__: null,
|
|
225
|
+
CUSTOM_VIEWS: CUSTOM_VIEWS,
|
|
226
|
+
FLAGS: FLAGS,
|
|
227
|
+
DEFAULT_FLAGS: DEFAULT_FLAGS
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
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, 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 };
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import type { TCustomView } from "./types/generated/settings.js";
|
|
2
|
+
/**
|
|
3
|
+
* The project key must be between 2 and 36 characters long. It can only contain alphanumeric lowercase characters (a-z, 0-9),
|
|
4
|
+
* up to two consecutive underscores (_) and hyphens (-). Leading and trailing underscore and hyphens are also not allowed.
|
|
5
|
+
*
|
|
6
|
+
* This regular expression has been generated using ChatGPT.
|
|
7
|
+
* Explanation of the regular expression:
|
|
8
|
+
* 1. ^: Asserts the start of the string.
|
|
9
|
+
* 2. (?!.*(?:[-_]{3}|^[-_]|[-_]$)): Negative lookahead assertion ensures that there are no three consecutive hyphens or underscores ([-_]{3}), no leading hyphen or underscore (^[-_]), and no trailing hyphen or underscore ([-_]$).
|
|
10
|
+
* 3. (?=.{2,36}$): Positive lookahead assertion ensures that the length of the string is between 2 and 36 characters.
|
|
11
|
+
* 4. (?:[a-z1-9][a-z0-9]*)?: Non-capturing group matches an optional first character that cannot be '0' ([a-z1-9]) followed by zero or more lowercase alphanumeric characters ([a-z0-9]*).
|
|
12
|
+
* 5. (?:[-_]{0,2}[a-z0-9]+)*: Non-capturing group matches zero, one, or two hyphens or underscores followed by one or more lowercase alphanumeric characters. This group can repeat zero or more times.
|
|
13
|
+
* 6. $: Asserts the end of the string.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PROJECT_KEY_REGEX: RegExp;
|
|
16
|
+
/**
|
|
17
|
+
* The entryPointUriPath may be between 2 and 64 characters and only contain alphabetic lowercase characters,
|
|
18
|
+
* non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
|
|
19
|
+
*
|
|
20
|
+
* This regular expression has been generated using ChatGPT.
|
|
21
|
+
* Explanation of the regular expression:
|
|
22
|
+
* 1. ^: Asserts the start of the string.
|
|
23
|
+
* 2. (?!.*(?:[-_]{2}|^[-_]|[-_]$)): Negative lookahead assertion ensures that there are no two consecutive hyphens or underscores ([-_]{2}), no leading hyphen or underscore (^[-_]), and no trailing hyphen or underscore ([-_]$).
|
|
24
|
+
* 3. (?=.{2,64}$): Positive lookahead assertion ensures that the length of the string is between 2 and 64 characters.
|
|
25
|
+
* 4. (?:[a-z1-9][a-z0-9]*)?: Non-capturing group matches an optional first character that cannot be '0' ([a-z1-9]) followed by zero or more lowercase alphanumeric characters ([a-z0-9]*).
|
|
26
|
+
* 5. (?:[-_]{0,1}[a-z0-9]+)*: Non-capturing group matches zero, or one hyphen or underscore followed by one or more lowercase alphanumeric characters. This group can repeat zero or more times.
|
|
27
|
+
* 6. $: Asserts the end of the string.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ENTRY_POINT_URI_PATH_REGEX: RegExp;
|
|
30
|
+
/**
|
|
31
|
+
* The permission group name may be between 2 and 64 characters and only contain alphanumeric lowercase characters and non-consecutive hyphens.
|
|
32
|
+
* Leading and trailing hyphens are also not allowed.
|
|
33
|
+
*/
|
|
34
|
+
export declare const PERMISSION_GROUP_NAME_REGEX: RegExp;
|
|
35
|
+
export declare const PORTALS_CONTAINER_ID = "portals-container";
|
|
36
|
+
export declare const PORTALS_CONTAINER_INDENTATION_SIZE = "48px";
|
|
37
|
+
export declare const SUPPORT_PORTAL_URL = "https://support.commercetools.com";
|
|
38
|
+
export declare const SHOW_LOADING = "SHOW_LOADING";
|
|
39
|
+
export declare const HIDE_LOADING = "HIDE_LOADING";
|
|
40
|
+
export declare const HIDE_ALL_PAGE_NOTIFICATIONS = "HIDE_ALL_PAGE_NOTIFICATIONS";
|
|
41
|
+
export declare const NOTIFICATION_DOMAINS: {
|
|
42
|
+
readonly GLOBAL: "global";
|
|
43
|
+
readonly PAGE: "page";
|
|
44
|
+
readonly SIDE: "side";
|
|
45
|
+
};
|
|
46
|
+
export declare const NOTIFICATION_KINDS_SIDE: {
|
|
47
|
+
readonly error: "error";
|
|
48
|
+
readonly warning: "warning";
|
|
49
|
+
readonly info: "info";
|
|
50
|
+
readonly success: "success";
|
|
51
|
+
};
|
|
52
|
+
export declare const NOTIFICATION_KINDS_GLOBAL: {
|
|
53
|
+
readonly error: "error";
|
|
54
|
+
readonly warning: "warning";
|
|
55
|
+
readonly info: "info";
|
|
56
|
+
readonly success: "success";
|
|
57
|
+
readonly 'unexpected-error': "unexpected-error";
|
|
58
|
+
};
|
|
59
|
+
export declare const NOTIFICATION_KINDS_PAGE: {
|
|
60
|
+
readonly error: "error";
|
|
61
|
+
readonly warning: "warning";
|
|
62
|
+
readonly info: "info";
|
|
63
|
+
readonly success: "success";
|
|
64
|
+
readonly 'unexpected-error': "unexpected-error";
|
|
65
|
+
readonly 'api-error': "api-error";
|
|
66
|
+
};
|
|
67
|
+
export type TAppNotificationDomain = (typeof NOTIFICATION_DOMAINS)[keyof typeof NOTIFICATION_DOMAINS];
|
|
68
|
+
export declare const DOMAINS: {
|
|
69
|
+
readonly GLOBAL: "global";
|
|
70
|
+
readonly PAGE: "page";
|
|
71
|
+
readonly SIDE: "side";
|
|
72
|
+
};
|
|
73
|
+
export type TAppNotificationKindSide = (typeof NOTIFICATION_KINDS_SIDE)[keyof typeof NOTIFICATION_KINDS_SIDE];
|
|
74
|
+
export type TAppNotificationKindGlobal = (typeof NOTIFICATION_KINDS_GLOBAL)[keyof typeof NOTIFICATION_KINDS_GLOBAL];
|
|
75
|
+
export type TAppNotificationKindPage = (typeof NOTIFICATION_KINDS_PAGE)[keyof typeof NOTIFICATION_KINDS_PAGE];
|
|
76
|
+
export type TAppNotificationKind = TAppNotificationKindSide | TAppNotificationKindGlobal | TAppNotificationKindPage;
|
|
77
|
+
export type TAppNotificationOfDomain = {
|
|
78
|
+
domain: TAppNotificationDomain;
|
|
79
|
+
};
|
|
80
|
+
export type TAppNotificationOfKind<T extends TAppNotificationOfDomain> = TAppNotificationOfDomain & {
|
|
81
|
+
kind: 'global' extends T['domain'] ? TAppNotificationKindGlobal : 'page' extends T['domain'] ? TAppNotificationKindPage : 'side' extends T['domain'] ? TAppNotificationKindSide : never;
|
|
82
|
+
};
|
|
83
|
+
export type TAppNotificationApiError<ExtraFields extends {} = {}> = {
|
|
84
|
+
message: string;
|
|
85
|
+
/** @deprecated Use `extensions.code` */
|
|
86
|
+
code?: string;
|
|
87
|
+
extensions?: {
|
|
88
|
+
code?: string;
|
|
89
|
+
};
|
|
90
|
+
} & ExtraFields;
|
|
91
|
+
export type TAppNotificationValuesApiError<ExtraFields extends {} = {}> = {
|
|
92
|
+
errors: TAppNotificationApiError<ExtraFields>[];
|
|
93
|
+
};
|
|
94
|
+
export type TAppNotificationValuesUnexpectedError = {
|
|
95
|
+
errorId?: string;
|
|
96
|
+
};
|
|
97
|
+
export type TAppNotification<T extends TAppNotificationOfKind<T>> = TAppNotificationOfKind<T> & {
|
|
98
|
+
id: number;
|
|
99
|
+
text?: TAppNotificationKindSide extends T['kind'] ? string : never;
|
|
100
|
+
values?: 'api-error' extends T['kind'] ? TAppNotificationValuesApiError : 'unexpected-error' extends T['kind'] ? TAppNotificationValuesUnexpectedError : never;
|
|
101
|
+
};
|
|
102
|
+
export type TAppNotificationGlobal = TAppNotification<{
|
|
103
|
+
domain: typeof NOTIFICATION_DOMAINS.GLOBAL;
|
|
104
|
+
kind: TAppNotificationKindGlobal;
|
|
105
|
+
}>;
|
|
106
|
+
export type TAppNotificationPage = TAppNotification<{
|
|
107
|
+
domain: typeof NOTIFICATION_DOMAINS.PAGE;
|
|
108
|
+
kind: TAppNotificationKindPage;
|
|
109
|
+
}>;
|
|
110
|
+
export type TAppNotificationSide = TAppNotification<{
|
|
111
|
+
domain: typeof NOTIFICATION_DOMAINS.SIDE;
|
|
112
|
+
kind: TAppNotificationKindSide;
|
|
113
|
+
}>;
|
|
114
|
+
export declare const NO_VALUE_FALLBACK = "- -";
|
|
115
|
+
export declare const STATUS_CODES: {
|
|
116
|
+
readonly UNAUTHORIZED: 401;
|
|
117
|
+
readonly FORBIDDEN: 403;
|
|
118
|
+
readonly UNAUTHENTICATED: 299;
|
|
119
|
+
readonly NOT_FOUND: 404;
|
|
120
|
+
};
|
|
121
|
+
export type TStatusCode = (typeof STATUS_CODES)[keyof typeof STATUS_CODES];
|
|
122
|
+
export declare const LOGOUT_REASONS: {
|
|
123
|
+
readonly USER: "user";
|
|
124
|
+
readonly UNAUTHORIZED: "unauthorized";
|
|
125
|
+
readonly INVALID: "invalid";
|
|
126
|
+
readonly DELETED: "deleted";
|
|
127
|
+
readonly NO_PROJECTS: "no-projects";
|
|
128
|
+
};
|
|
129
|
+
export type TLogoutReason = (typeof LOGOUT_REASONS)[keyof typeof LOGOUT_REASONS];
|
|
130
|
+
export declare const GRAPHQL_TARGETS: {
|
|
131
|
+
readonly MERCHANT_CENTER_BACKEND: "mc";
|
|
132
|
+
readonly COMMERCETOOLS_PLATFORM: "ctp";
|
|
133
|
+
readonly DASHBOARD_SERVICE: "dashboard";
|
|
134
|
+
readonly CHANGE_HISTORY_SERVICE: "change-history";
|
|
135
|
+
readonly PIM_INDEXER: "pim-indexer";
|
|
136
|
+
readonly ORDER_INDEXER: "order-indexer";
|
|
137
|
+
readonly SETTINGS_SERVICE: "settings";
|
|
138
|
+
readonly ADMINISTRATION_SERVICE: "administration";
|
|
139
|
+
readonly STANDALONE_PRICES_INDEXER: "standalone-prices-indexer";
|
|
140
|
+
readonly PLATFORM_INSIGHTS: "platform-insights";
|
|
141
|
+
};
|
|
142
|
+
export type TGraphQLTargets = (typeof GRAPHQL_TARGETS)[keyof typeof GRAPHQL_TARGETS];
|
|
143
|
+
export declare const MC_API_PROXY_TARGETS: {
|
|
144
|
+
readonly COMMERCETOOLS_PLATFORM: "ctp";
|
|
145
|
+
readonly MACHINE_LEARNING: "ml";
|
|
146
|
+
readonly PIM_SEARCH: "pim-search";
|
|
147
|
+
readonly ORDER_SEARCH: "order-search";
|
|
148
|
+
readonly IMPORT: "import";
|
|
149
|
+
readonly EXPORT: "export";
|
|
150
|
+
readonly STANDALONE_PRICES_SEARCH: "standalone-prices-search";
|
|
151
|
+
};
|
|
152
|
+
export type TMcApiProxyTargets = (typeof MC_API_PROXY_TARGETS)[keyof typeof MC_API_PROXY_TARGETS];
|
|
153
|
+
export type TLocalizedField = {
|
|
154
|
+
locale: string;
|
|
155
|
+
value: string;
|
|
156
|
+
};
|
|
157
|
+
export type TPermissionData = {
|
|
158
|
+
name: string;
|
|
159
|
+
oAuthScopes: string[];
|
|
160
|
+
};
|
|
161
|
+
export type ApplicationMenuLinksForDevelopmentConfig = {
|
|
162
|
+
icon: string;
|
|
163
|
+
defaultLabel: string;
|
|
164
|
+
labelAllLocales: TLocalizedField[];
|
|
165
|
+
permissions: string[];
|
|
166
|
+
submenuLinks: {
|
|
167
|
+
uriPath: string;
|
|
168
|
+
defaultLabel: string;
|
|
169
|
+
labelAllLocales: TLocalizedField[];
|
|
170
|
+
permissions: string[];
|
|
171
|
+
}[];
|
|
172
|
+
};
|
|
173
|
+
export type ApplicationOidcForDevelopmentConfig = {
|
|
174
|
+
authorizeUrl: string;
|
|
175
|
+
initialProjectKey?: string;
|
|
176
|
+
teamId?: string;
|
|
177
|
+
applicationId?: string;
|
|
178
|
+
customViewId?: string;
|
|
179
|
+
oAuthScopes?: {
|
|
180
|
+
view: string[];
|
|
181
|
+
manage: string[];
|
|
182
|
+
};
|
|
183
|
+
additionalOAuthScopes?: {
|
|
184
|
+
name: string;
|
|
185
|
+
view: string[];
|
|
186
|
+
manage: string[];
|
|
187
|
+
}[];
|
|
188
|
+
};
|
|
189
|
+
export type CustomViewData = {
|
|
190
|
+
id: string;
|
|
191
|
+
defaultLabel: string;
|
|
192
|
+
labelAllLocales: TLocalizedField[];
|
|
193
|
+
description?: string;
|
|
194
|
+
url: string;
|
|
195
|
+
permissions: TPermissionData[];
|
|
196
|
+
locators: string[];
|
|
197
|
+
type: TCustomView['type'];
|
|
198
|
+
typeSettings?: TCustomView['typeSettings'];
|
|
199
|
+
};
|
|
200
|
+
export type ApplicationRuntimeEnvironmentForDevelopment = {
|
|
201
|
+
oidc?: ApplicationOidcForDevelopmentConfig;
|
|
202
|
+
menuLinks?: ApplicationMenuLinksForDevelopmentConfig;
|
|
203
|
+
customViewHostUrl?: string;
|
|
204
|
+
customViewConfig?: CustomViewData;
|
|
205
|
+
};
|
|
206
|
+
export type ApplicationRuntimeEnvironment = {
|
|
207
|
+
applicationId: string;
|
|
208
|
+
applicationIdentifier: string;
|
|
209
|
+
applicationName: string;
|
|
210
|
+
entryPointUriPath: string;
|
|
211
|
+
customViewId?: string;
|
|
212
|
+
revision: string;
|
|
213
|
+
env: string;
|
|
214
|
+
location: string;
|
|
215
|
+
cdnUrl: string;
|
|
216
|
+
mcApiUrl: string;
|
|
217
|
+
frontendHost: string;
|
|
218
|
+
servedByProxy: boolean;
|
|
219
|
+
ldClientSideId?: string;
|
|
220
|
+
trackingSentry?: string;
|
|
221
|
+
__DEVELOPMENT__?: ApplicationRuntimeEnvironmentForDevelopment;
|
|
222
|
+
};
|
|
223
|
+
export interface ApplicationWindow extends Window {
|
|
224
|
+
app: ApplicationRuntimeEnvironment;
|
|
225
|
+
}
|
|
226
|
+
export declare const CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH = "@@custom-view-host@@";
|
|
227
|
+
export declare const SUPPORTED_HEADERS: {
|
|
228
|
+
readonly ACCEPT: "Accept";
|
|
229
|
+
readonly ACCEPT_VERSION: "Accept-version";
|
|
230
|
+
readonly AUTHORIZATION: "Authorization";
|
|
231
|
+
readonly CONTENT_TYPE: "Content-Type";
|
|
232
|
+
readonly X_APPLICATION_ID: "X-Application-Id";
|
|
233
|
+
readonly X_CUSTOM_VIEW_ID: "X-Custom-View-Id";
|
|
234
|
+
readonly X_CORRELATION_ID: "X-Correlation-Id";
|
|
235
|
+
readonly X_FEATURE_FLAG: "X-Feature-Flag";
|
|
236
|
+
readonly X_FORWARD_TO: "X-Forward-To";
|
|
237
|
+
readonly X_FORWARD_TO_AUDIENCE_POLICY: "X-Forward-To-Audience-Policy";
|
|
238
|
+
readonly X_FORWARD_TO_CLAIMS: "X-Forward-To-Claims";
|
|
239
|
+
readonly X_GRAPHQL_TARGET: "X-Graphql-Target";
|
|
240
|
+
readonly X_GRAPHQL_OPERATION_NAME: "X-Graphql-Operation-Name";
|
|
241
|
+
readonly X_PROJECT_KEY: "X-Project-Key";
|
|
242
|
+
readonly X_TEAM_ID: "X-Team-Id";
|
|
243
|
+
readonly X_TOKEN_RETRY: "X-Force-Token";
|
|
244
|
+
readonly X_USER_AGENT: "X-User-Agent";
|
|
245
|
+
};
|
|
246
|
+
export declare const STORAGE_KEYS: {
|
|
247
|
+
readonly NONCE: "nonce";
|
|
248
|
+
readonly IS_AUTHENTICATED: "isAuthenticated";
|
|
249
|
+
readonly SESSION_TOKEN: "sessionToken";
|
|
250
|
+
readonly SESSION_SCOPE: "sessionScope";
|
|
251
|
+
readonly ACTIVE_PROJECT_KEY: "activeProjectKey";
|
|
252
|
+
readonly ACTIVE_TEAM_ID: "activeTeamId";
|
|
253
|
+
readonly SELECTED_DATA_LOCALE: "selectedDataLocale";
|
|
254
|
+
readonly IS_FORCED_MENU_OPEN: "isForcedMenuOpen";
|
|
255
|
+
readonly LOGIN_STRATEGY: "loginStrategy";
|
|
256
|
+
};
|
|
257
|
+
export declare const HTTP_SECURITY_HEADER_KEYS: {
|
|
258
|
+
readonly 'Content-Security-Policy': "Content-Security-Policy";
|
|
259
|
+
readonly 'Permissions-Policy': "Permissions-Policy";
|
|
260
|
+
readonly 'Referrer-Policy': "Referrer-Policy";
|
|
261
|
+
readonly 'Strict-Transport-Security': "Strict-Transport-Security";
|
|
262
|
+
readonly 'X-Content-Type-Options': "X-Content-Type-Options";
|
|
263
|
+
readonly 'X-Frame-Options': "X-Frame-Options";
|
|
264
|
+
readonly 'X-XSS-Protection': "X-XSS-Protection";
|
|
265
|
+
};
|
|
266
|
+
export type THttpSecurityHeaders = Exclude<keyof typeof HTTP_SECURITY_HEADER_KEYS, 'X-XSS-Protection'>;
|
|
267
|
+
export declare const HTTP_SECURITY_HEADERS: {
|
|
268
|
+
readonly "Referrer-Policy": "same-origin";
|
|
269
|
+
readonly "Permissions-Policy": "microphone=(self), camera=(self), payment=(self), usb=(self), geolocation=(self)";
|
|
270
|
+
readonly "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload";
|
|
271
|
+
readonly "X-Content-Type-Options": "nosniff";
|
|
272
|
+
readonly "X-Frame-Options": "SAMEORIGIN";
|
|
273
|
+
};
|
|
274
|
+
export declare const CUSTOM_VIEWS_EVENTS_NAMES: {
|
|
275
|
+
CUSTOM_VIEW_BOOTSTRAP: string;
|
|
276
|
+
CUSTOM_VIEW_INITIALIZATION: string;
|
|
277
|
+
CUSTOM_VIEW_CLOSE: string;
|
|
278
|
+
CUSTOM_VIEW_READY: string;
|
|
279
|
+
CUSTOM_VIEW_ON_CLOSE_AFTER: string;
|
|
280
|
+
};
|
|
281
|
+
export declare const CUSTOM_VIEWS_EVENTS_META: {
|
|
282
|
+
HOST_APPLICATION_CODE: string;
|
|
283
|
+
CUSTOM_VIEW_KEY_PREFIX: string;
|
|
284
|
+
};
|
|
285
|
+
export declare const ORGANIZATION_GENERAL_ERROR = "organizationGeneralError";
|
|
286
|
+
export declare const LOGIN_STRATEGY_DEFAULT = "default";
|
|
287
|
+
export declare const LOGIN_STRATEGY_OIDC = "oidc";
|
|
288
|
+
export declare const LOGIN_STRATEGY_SSO = "sso";
|