@commercetools-frontend/application-shell-connectors 22.2.0 → 22.3.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.
- package/dist/commercetools-frontend-application-shell-connectors.cjs.dev.js +42 -77
- package/dist/commercetools-frontend-application-shell-connectors.cjs.prod.js +41 -76
- package/dist/commercetools-frontend-application-shell-connectors.esm.js +42 -77
- package/dist/declarations/src/components/application-context/application-context.d.ts +2 -2
- package/dist/declarations/src/components/project-extension-image-regex/project-extension-image-regex.d.ts +3 -3
- package/dist/declarations/src/types/generated/settings.d.ts +89 -1151
- package/package.json +26 -9
- package/test-utils/dist/commercetools-frontend-application-shell-connectors-test-utils.cjs.dev.js +0 -1
- package/test-utils/dist/commercetools-frontend-application-shell-connectors-test-utils.cjs.prod.js +0 -1
- package/test-utils/dist/commercetools-frontend-application-shell-connectors-test-utils.esm.js +0 -1
|
@@ -23,44 +23,37 @@ import warning from 'tiny-warning';
|
|
|
23
23
|
import { GRAPHQL_TARGETS } from '@commercetools-frontend/constants';
|
|
24
24
|
|
|
25
25
|
// NOTE: This string will be replaced on build time with the package version.
|
|
26
|
-
var version = "22.
|
|
26
|
+
var version = "22.3.0";
|
|
27
27
|
|
|
28
28
|
const mcHostnameRegex = /^mc(-(\d){4,})?\.(.*)$/;
|
|
29
29
|
const mcPreviewHostnameRegex = /^.*\.mc-preview\.(.*)$/;
|
|
30
|
-
|
|
31
30
|
const getMcOriginTld = host => {
|
|
32
31
|
if (host.match(mcPreviewHostnameRegex)) {
|
|
33
32
|
return host.replace(mcPreviewHostnameRegex, '$1');
|
|
34
33
|
}
|
|
35
|
-
|
|
36
34
|
return host.replace(mcHostnameRegex, '$3');
|
|
37
35
|
};
|
|
38
|
-
|
|
39
36
|
const getMcApiUrlFromOrigin = origin => {
|
|
40
37
|
var _context;
|
|
41
|
-
|
|
42
38
|
const url = new _URL(origin);
|
|
43
39
|
const originTld = getMcOriginTld(url.host);
|
|
44
40
|
return _concatInstanceProperty(_context = "".concat(url.protocol, "//mc-api.")).call(_context, originTld);
|
|
45
41
|
};
|
|
46
|
-
|
|
47
42
|
const parseAsBoolean = value => value === true || value === 'true';
|
|
48
|
-
|
|
49
43
|
function getMcApiUrl() {
|
|
50
44
|
let environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.app;
|
|
51
45
|
let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.origin;
|
|
52
46
|
const isServedByProxy = parseAsBoolean(environment.servedByProxy);
|
|
47
|
+
|
|
53
48
|
/**
|
|
54
49
|
* Prefer using the origin URL for the MC API based on the origin value
|
|
55
50
|
* of the browser's `window.location`.
|
|
56
51
|
* This ensures that the application always uses the correct URL associated
|
|
57
52
|
* with that environment, instead of relying on the config value.
|
|
58
53
|
*/
|
|
59
|
-
|
|
60
54
|
if (isServedByProxy) {
|
|
61
55
|
return getMcApiUrlFromOrigin(origin);
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
return environment.mcApiUrl;
|
|
65
58
|
}
|
|
66
59
|
|
|
@@ -69,20 +62,20 @@ const getDisplayName = Component => {
|
|
|
69
62
|
if (typeof Component === 'string') {
|
|
70
63
|
return Component;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
if (!Component) {
|
|
74
66
|
return undefined;
|
|
75
67
|
}
|
|
76
|
-
|
|
77
68
|
return Component.displayName || Component.name || 'Component';
|
|
78
69
|
};
|
|
79
70
|
|
|
80
71
|
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
81
|
-
|
|
82
72
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys$2(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys$2(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
83
73
|
// Menu visibilities
|
|
74
|
+
|
|
84
75
|
// Permissions
|
|
76
|
+
|
|
85
77
|
// Action rights
|
|
78
|
+
|
|
86
79
|
// Data fences
|
|
87
80
|
|
|
88
81
|
/**
|
|
@@ -107,7 +100,6 @@ const normalizeAllAppliedPermissions = allAppliedPermissions => {
|
|
|
107
100
|
if (!allAppliedPermissions || allAppliedPermissions.length === 0) {
|
|
108
101
|
return null;
|
|
109
102
|
}
|
|
110
|
-
|
|
111
103
|
return _reduceInstanceProperty(allAppliedPermissions).call(allAppliedPermissions, (transformedAllApplied, allApplied) => {
|
|
112
104
|
if (!allApplied) return transformedAllApplied;
|
|
113
105
|
return _objectSpread$2(_objectSpread$2({}, transformedAllApplied), {}, {
|
|
@@ -119,7 +111,6 @@ const normalizeAllAppliedMenuVisibilities = allAppliedMenuVisibilities => {
|
|
|
119
111
|
if (!allAppliedMenuVisibilities || allAppliedMenuVisibilities.length === 0) {
|
|
120
112
|
return null;
|
|
121
113
|
}
|
|
122
|
-
|
|
123
114
|
return _reduceInstanceProperty(allAppliedMenuVisibilities).call(allAppliedMenuVisibilities, (transformedAllApplied, allApplied) => {
|
|
124
115
|
if (!allApplied) return transformedAllApplied;
|
|
125
116
|
return _objectSpread$2(_objectSpread$2({}, transformedAllApplied), {}, {
|
|
@@ -131,7 +122,6 @@ const normalizeAllAppliedActionRights = allAppliedActionRights => {
|
|
|
131
122
|
if (!allAppliedActionRights || allAppliedActionRights.length === 0) {
|
|
132
123
|
return null;
|
|
133
124
|
}
|
|
134
|
-
|
|
135
125
|
return _reduceInstanceProperty(allAppliedActionRights).call(allAppliedActionRights, (transformedAllApplied, allApplied) => {
|
|
136
126
|
if (!allApplied) return transformedAllApplied;
|
|
137
127
|
const previousAllAppliedGroup = transformedAllApplied[allApplied.group];
|
|
@@ -142,10 +132,8 @@ const normalizeAllAppliedActionRights = allAppliedActionRights => {
|
|
|
142
132
|
});
|
|
143
133
|
}, {});
|
|
144
134
|
};
|
|
145
|
-
|
|
146
135
|
const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
147
136
|
var _context;
|
|
148
|
-
|
|
149
137
|
const groupedByResourceType = _reduceInstanceProperty(dataFences).call(dataFences, (previousGroupsOfSameType, appliedDataFence) => {
|
|
150
138
|
if (!appliedDataFence) return previousGroupsOfSameType;
|
|
151
139
|
const previousGroup = previousGroupsOfSameType[appliedDataFence.group];
|
|
@@ -153,12 +141,10 @@ const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
|
153
141
|
[appliedDataFence.group]: [...(previousGroup || []), appliedDataFence]
|
|
154
142
|
});
|
|
155
143
|
}, {});
|
|
156
|
-
|
|
157
144
|
return _reduceInstanceProperty(_context = _Object$entries(groupedByResourceType)).call(_context, (previousGroupedByResourceType, _ref) => {
|
|
158
145
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
146
|
+
resourceType = _ref2[0],
|
|
147
|
+
dataFences = _ref2[1];
|
|
162
148
|
const groupByDataFenceName = _reduceInstanceProperty(dataFences).call(dataFences, (nextDataFenceValues, dataFence) => {
|
|
163
149
|
const dataFenceByName = nextDataFenceValues[dataFence.name] || {
|
|
164
150
|
values: []
|
|
@@ -169,12 +155,13 @@ const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
|
169
155
|
})
|
|
170
156
|
});
|
|
171
157
|
}, {});
|
|
172
|
-
|
|
173
158
|
return _objectSpread$2(_objectSpread$2({}, previousGroupedByResourceType), {}, {
|
|
174
159
|
[resourceType]: groupByDataFenceName
|
|
175
160
|
});
|
|
176
161
|
}, {});
|
|
177
|
-
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// input:
|
|
178
165
|
// [
|
|
179
166
|
// {
|
|
180
167
|
// type: 'store',
|
|
@@ -205,12 +192,10 @@ const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
|
205
192
|
// }
|
|
206
193
|
// }
|
|
207
194
|
|
|
208
|
-
|
|
209
195
|
const normalizeAllAppliedDataFences = allAppliedDataFences => {
|
|
210
196
|
if (!allAppliedDataFences || allAppliedDataFences.length === 0) {
|
|
211
197
|
return null;
|
|
212
198
|
}
|
|
213
|
-
|
|
214
199
|
const groupedByType = _reduceInstanceProperty(allAppliedDataFences).call(allAppliedDataFences, (previousGroupsOfSameType, appliedDataFence) => {
|
|
215
200
|
if (!appliedDataFence) return previousGroupsOfSameType;
|
|
216
201
|
const previousGroup = previousGroupsOfSameType[appliedDataFence.type];
|
|
@@ -218,22 +203,20 @@ const normalizeAllAppliedDataFences = allAppliedDataFences => {
|
|
|
218
203
|
[appliedDataFence.type]: [...(previousGroup || []), appliedDataFence]
|
|
219
204
|
});
|
|
220
205
|
}, {});
|
|
221
|
-
|
|
222
206
|
const normalizedDataFences = _objectSpread$2({}, 'store' in groupedByType ? {
|
|
223
207
|
store: normalizeAppliedDataFencesForStoresByResourceType(groupedByType.store)
|
|
224
208
|
} : {});
|
|
225
|
-
|
|
226
209
|
if (_Object$keys(normalizedDataFences).length > 0) return normalizedDataFences;
|
|
227
210
|
return null;
|
|
228
211
|
};
|
|
229
212
|
|
|
230
213
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
231
|
-
|
|
232
214
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
233
215
|
const Context$1 = /*#__PURE__*/createContext({});
|
|
234
|
-
const defaultTimeZone = moment.tz.guess() || 'Etc/UTC';
|
|
235
|
-
// be used internally in the AppShell
|
|
216
|
+
const defaultTimeZone = moment.tz.guess() || 'Etc/UTC';
|
|
236
217
|
|
|
218
|
+
// Expose only certain fields as some of them are only meant to
|
|
219
|
+
// be used internally in the AppShell
|
|
237
220
|
const mapUserToApplicationContextUser = user => {
|
|
238
221
|
if (!user) return null;
|
|
239
222
|
let applicationContextUser = {
|
|
@@ -248,11 +231,11 @@ const mapUserToApplicationContextUser = user => {
|
|
|
248
231
|
locale: user.language,
|
|
249
232
|
timeZone: user.timeZone || defaultTimeZone,
|
|
250
233
|
projects: user.projects
|
|
251
|
-
};
|
|
234
|
+
};
|
|
252
235
|
|
|
236
|
+
// This property will only be populated when user has logged in using SSO
|
|
253
237
|
if (user.idTokenUserInfo) {
|
|
254
238
|
let additionalClaims = {};
|
|
255
|
-
|
|
256
239
|
try {
|
|
257
240
|
additionalClaims = JSON.parse(user.idTokenUserInfo.additionalClaims || '{}');
|
|
258
241
|
} catch (error) {
|
|
@@ -262,21 +245,21 @@ const mapUserToApplicationContextUser = user => {
|
|
|
262
245
|
}
|
|
263
246
|
});
|
|
264
247
|
}
|
|
265
|
-
|
|
266
248
|
applicationContextUser.idTokenUserInfo = _objectSpread$1(_objectSpread$1({}, user.idTokenUserInfo), {}, {
|
|
267
249
|
additionalClaims
|
|
268
250
|
});
|
|
269
251
|
}
|
|
270
|
-
|
|
271
252
|
return applicationContextUser;
|
|
272
|
-
};
|
|
253
|
+
};
|
|
273
254
|
|
|
255
|
+
// Adjust certain fields which depend e.g. on the origin
|
|
274
256
|
const mapEnvironmentToApplicationContextEnvironment = (environment, origin) => _objectSpread$1(_objectSpread$1({}, environment), {}, {
|
|
275
257
|
// NOTE: The `mcApiUrl` depends on `servedByProxy`
|
|
276
258
|
mcApiUrl: getMcApiUrl(environment, origin)
|
|
277
|
-
});
|
|
278
|
-
// be used internally in the AppShell
|
|
259
|
+
});
|
|
279
260
|
|
|
261
|
+
// Expose only certain fields as some of them are only meant to
|
|
262
|
+
// be used internally in the AppShell
|
|
280
263
|
const mapProjectToApplicationContextProject = project => {
|
|
281
264
|
if (!project) return null;
|
|
282
265
|
return {
|
|
@@ -290,7 +273,6 @@ const mapProjectToApplicationContextProject = project => {
|
|
|
290
273
|
ownerName: project.owner.name
|
|
291
274
|
};
|
|
292
275
|
};
|
|
293
|
-
|
|
294
276
|
const createApplicationContext = (environment, user, project, projectDataLocale) => ({
|
|
295
277
|
environment: mapEnvironmentToApplicationContextEnvironment(environment),
|
|
296
278
|
user: mapUserToApplicationContextUser(user),
|
|
@@ -300,18 +282,15 @@ const createApplicationContext = (environment, user, project, projectDataLocale)
|
|
|
300
282
|
dataFences: normalizeAllAppliedDataFences(project === null || project === void 0 ? void 0 : project.allAppliedDataFences),
|
|
301
283
|
dataLocale: projectDataLocale || null
|
|
302
284
|
});
|
|
303
|
-
|
|
304
285
|
const ApplicationContextProvider = props => jsx(Context$1.Provider, {
|
|
305
286
|
value: createApplicationContext(props.environment, props.user, props.project, props.projectDataLocale),
|
|
306
287
|
children: props.children
|
|
307
288
|
});
|
|
308
|
-
|
|
309
289
|
ApplicationContextProvider.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
310
290
|
projectDataLocale: _pt.string,
|
|
311
291
|
children: _pt.node.isRequired
|
|
312
292
|
} : {};
|
|
313
293
|
ApplicationContextProvider.displayName = 'ApplicationContextProvider';
|
|
314
|
-
|
|
315
294
|
const ApplicationContext = props => jsx(Context$1.Consumer, {
|
|
316
295
|
children: context => {
|
|
317
296
|
// Because of the way the ApplicationShell configures the Context.Provider,
|
|
@@ -322,12 +301,10 @@ const ApplicationContext = props => jsx(Context$1.Consumer, {
|
|
|
322
301
|
return props.render(applicationContext);
|
|
323
302
|
}
|
|
324
303
|
});
|
|
325
|
-
|
|
326
304
|
ApplicationContext.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
327
305
|
render: _pt.func.isRequired
|
|
328
306
|
} : {};
|
|
329
307
|
ApplicationContext.displayName = 'ApplicationContext';
|
|
330
|
-
|
|
331
308
|
function withApplicationContext(mapApplicationContextToProps) {
|
|
332
309
|
return Component => {
|
|
333
310
|
const WrappedComponent = props => jsx(ApplicationContext, {
|
|
@@ -338,68 +315,61 @@ function withApplicationContext(mapApplicationContextToProps) {
|
|
|
338
315
|
return jsx(Component, _objectSpread$1(_objectSpread$1({}, props), mappedProps));
|
|
339
316
|
}
|
|
340
317
|
});
|
|
341
|
-
|
|
342
318
|
WrappedComponent.displayName = "withApplicationContext(".concat(getDisplayName(Component), ")");
|
|
343
319
|
return WrappedComponent;
|
|
344
320
|
};
|
|
345
|
-
}
|
|
346
|
-
// distict return types, based on the selector function argument.
|
|
347
|
-
|
|
321
|
+
}
|
|
348
322
|
|
|
323
|
+
// Use function overloading to declare two possible signatures with two
|
|
324
|
+
// distict return types, based on the selector function argument.
|
|
349
325
|
// Then implement the function. Typescript will pick the appropriate signature
|
|
350
326
|
// based on the function arguments.
|
|
351
327
|
function useApplicationContextHook(selector) {
|
|
352
|
-
const context = useContext(Context$1);
|
|
328
|
+
const context = useContext(Context$1);
|
|
329
|
+
// Because of the way the ApplicationShell configures the Context.Provider,
|
|
353
330
|
// we ensure that, when we read from the context, we always get actual
|
|
354
331
|
// context object and not the initial value.
|
|
355
332
|
// Therefore, we can safely cast the value to be out `TApplicationContext` type.
|
|
356
|
-
|
|
357
333
|
const applicationContext = context;
|
|
358
334
|
return selector ? selector(applicationContext) : applicationContext;
|
|
359
|
-
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// This is a workaround to trick babel/rollup to correctly export the function.
|
|
360
338
|
// Most likely the problem arises with the use of overloading.
|
|
361
339
|
// See related issue: https://github.com/babel/babel/issues/8361
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const useApplicationContext = useApplicationContextHook; // Exports
|
|
340
|
+
const useApplicationContext = useApplicationContextHook;
|
|
365
341
|
|
|
366
342
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
367
|
-
|
|
368
343
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
369
344
|
var FetchProjectExtensionImageRegex = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProjectExtensionImageRegex" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "projectExtension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "imageRegex" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "thumb" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "ImageRegex" }, directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "small" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "ImageRegex" }, directives: [] }] } }] } }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "ImageRegex" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ImageRegexOptions" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "flag" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "search" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "replace" }, arguments: [], directives: [] }] } }], loc: { start: 0, end: 256, source: { body: "query FetchProjectExtensionImageRegex {\n projectExtension {\n id\n imageRegex {\n thumb {\n ...ImageRegex\n }\n small {\n ...ImageRegex\n }\n }\n }\n}\nfragment ImageRegex on ImageRegexOptions {\n flag\n search\n replace\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
370
|
-
|
|
371
345
|
const useWarning = (condition, message) => {
|
|
372
346
|
useEffect(() => {
|
|
373
|
-
process.env.NODE_ENV !== "production" ? warning(condition, message) : void 0;
|
|
347
|
+
process.env.NODE_ENV !== "production" ? warning(condition, message) : void 0;
|
|
348
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
374
349
|
}, []);
|
|
375
350
|
};
|
|
376
|
-
|
|
377
351
|
const Context = /*#__PURE__*/createContext({
|
|
378
352
|
isLoading: false
|
|
379
353
|
});
|
|
380
|
-
|
|
381
354
|
const useProjectExtensionImageRegex = () => {
|
|
382
355
|
const _useContext = useContext(Context),
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
356
|
+
isLoading = _useContext.isLoading,
|
|
357
|
+
imageRegex = _useContext.imageRegex;
|
|
386
358
|
return {
|
|
387
359
|
isLoading,
|
|
388
360
|
imageRegex
|
|
389
361
|
};
|
|
390
362
|
};
|
|
391
|
-
|
|
392
363
|
const ProjectExtensionProviderForImageRegex = props => {
|
|
393
364
|
const _useQuery = useQuery(FetchProjectExtensionImageRegex, {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
365
|
+
skip: props.skip,
|
|
366
|
+
onError: reportErrorToSentry,
|
|
367
|
+
context: {
|
|
368
|
+
target: GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
369
|
+
}
|
|
370
|
+
}),
|
|
371
|
+
loading = _useQuery.loading,
|
|
372
|
+
data = _useQuery.data;
|
|
403
373
|
return jsx(Context.Provider, {
|
|
404
374
|
value: {
|
|
405
375
|
isLoading: loading,
|
|
@@ -408,25 +378,21 @@ const ProjectExtensionProviderForImageRegex = props => {
|
|
|
408
378
|
children: props.children
|
|
409
379
|
});
|
|
410
380
|
};
|
|
411
|
-
|
|
412
381
|
ProjectExtensionProviderForImageRegex.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
413
382
|
skip: _pt.bool,
|
|
414
383
|
children: _pt.node.isRequired
|
|
415
384
|
} : {};
|
|
416
385
|
ProjectExtensionProviderForImageRegex.displayName = 'ProjectExtensionProviderForImageRegex';
|
|
417
|
-
|
|
418
386
|
const GetProjectExtensionImageRegex = props => {
|
|
419
387
|
useWarning(false, "@commercetools-frontend/application-shell-connectors: It is not recommended to use the 'GetProjectExtensionImageRegex' anymore. Please use the 'useProjectExtensionImageRegex' hook instead.");
|
|
420
388
|
return jsx(Context.Consumer, {
|
|
421
389
|
children: imageRegexContext => props.render(imageRegexContext)
|
|
422
390
|
});
|
|
423
391
|
};
|
|
424
|
-
|
|
425
392
|
GetProjectExtensionImageRegex.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
426
393
|
render: _pt.func.isRequired
|
|
427
394
|
} : {};
|
|
428
395
|
GetProjectExtensionImageRegex.displayName = 'GetProjectExtensionImageRegex';
|
|
429
|
-
|
|
430
396
|
function withProjectExtensionImageRegex() {
|
|
431
397
|
let propKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'imageRegexData';
|
|
432
398
|
return Component => {
|
|
@@ -439,10 +405,9 @@ function withProjectExtensionImageRegex() {
|
|
|
439
405
|
}))
|
|
440
406
|
});
|
|
441
407
|
};
|
|
442
|
-
|
|
443
408
|
WrappedComponent.displayName = "withProjectExtensionImageRegex(".concat(getDisplayName(Component), ")");
|
|
444
409
|
return WrappedComponent;
|
|
445
410
|
};
|
|
446
|
-
}
|
|
411
|
+
}
|
|
447
412
|
|
|
448
413
|
export { ApplicationContext, ApplicationContextProvider, Context$1 as Context, GetProjectExtensionImageRegex, ProjectExtensionProviderForImageRegex, getMcApiUrl, normalizeAllAppliedActionRights, normalizeAllAppliedDataFences, normalizeAllAppliedMenuVisibilities, normalizeAllAppliedPermissions, useApplicationContext, useProjectExtensionImageRegex, version, withApplicationContext, withProjectExtensionImageRegex };
|
|
@@ -98,11 +98,11 @@ type ConsumerProps<AdditionalEnvironmentProperties extends {}> = {
|
|
|
98
98
|
children?: never;
|
|
99
99
|
};
|
|
100
100
|
declare const ApplicationContextProvider: {
|
|
101
|
-
<AdditionalEnvironmentProperties extends {}>(props: ProviderProps<AdditionalEnvironmentProperties>): import("@emotion/react/jsx-
|
|
101
|
+
<AdditionalEnvironmentProperties extends {}>(props: ProviderProps<AdditionalEnvironmentProperties>): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
102
102
|
displayName: string;
|
|
103
103
|
};
|
|
104
104
|
declare const ApplicationContext: {
|
|
105
|
-
<AdditionalEnvironmentProperties extends {}>(props: ConsumerProps<AdditionalEnvironmentProperties>): import("@emotion/react/jsx-
|
|
105
|
+
<AdditionalEnvironmentProperties extends {}>(props: ConsumerProps<AdditionalEnvironmentProperties>): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
106
106
|
displayName: string;
|
|
107
107
|
};
|
|
108
108
|
declare function withApplicationContext<OwnProps extends {}, AdditionalEnvironmentProperties extends {}, MappedProps extends {} = {
|
|
@@ -23,15 +23,15 @@ declare const useProjectExtensionImageRegex: () => {
|
|
|
23
23
|
} | null | undefined;
|
|
24
24
|
};
|
|
25
25
|
declare const ProjectExtensionProviderForImageRegex: {
|
|
26
|
-
(props: ProviderProps): import("@emotion/react/jsx-
|
|
26
|
+
(props: ProviderProps): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
27
27
|
displayName: string;
|
|
28
28
|
};
|
|
29
29
|
declare const GetProjectExtensionImageRegex: {
|
|
30
|
-
(props: ConsumerProps): import("@emotion/react/jsx-
|
|
30
|
+
(props: ConsumerProps): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
31
31
|
displayName: string;
|
|
32
32
|
};
|
|
33
33
|
declare function withProjectExtensionImageRegex<Props extends {}>(propKey?: string): (Component: ComponentType<Props>) => {
|
|
34
|
-
(props: Props): import("@emotion/react/jsx-
|
|
34
|
+
(props: Props): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
35
35
|
displayName: string;
|
|
36
36
|
};
|
|
37
37
|
export { GetProjectExtensionImageRegex, ProjectExtensionProviderForImageRegex, withProjectExtensionImageRegex, useProjectExtensionImageRegex, };
|