@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
|
@@ -44,44 +44,37 @@ var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
|
44
44
|
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
45
45
|
|
|
46
46
|
// NOTE: This string will be replaced on build time with the package version.
|
|
47
|
-
var version = "22.
|
|
47
|
+
var version = "22.3.0";
|
|
48
48
|
|
|
49
49
|
const mcHostnameRegex = /^mc(-(\d){4,})?\.(.*)$/;
|
|
50
50
|
const mcPreviewHostnameRegex = /^.*\.mc-preview\.(.*)$/;
|
|
51
|
-
|
|
52
51
|
const getMcOriginTld = host => {
|
|
53
52
|
if (host.match(mcPreviewHostnameRegex)) {
|
|
54
53
|
return host.replace(mcPreviewHostnameRegex, '$1');
|
|
55
54
|
}
|
|
56
|
-
|
|
57
55
|
return host.replace(mcHostnameRegex, '$3');
|
|
58
56
|
};
|
|
59
|
-
|
|
60
57
|
const getMcApiUrlFromOrigin = origin => {
|
|
61
58
|
var _context;
|
|
62
|
-
|
|
63
59
|
const url = new _URL__default["default"](origin);
|
|
64
60
|
const originTld = getMcOriginTld(url.host);
|
|
65
61
|
return _concatInstanceProperty__default["default"](_context = "".concat(url.protocol, "//mc-api.")).call(_context, originTld);
|
|
66
62
|
};
|
|
67
|
-
|
|
68
63
|
const parseAsBoolean = value => value === true || value === 'true';
|
|
69
|
-
|
|
70
64
|
function getMcApiUrl() {
|
|
71
65
|
let environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.app;
|
|
72
66
|
let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.origin;
|
|
73
67
|
const isServedByProxy = parseAsBoolean(environment.servedByProxy);
|
|
68
|
+
|
|
74
69
|
/**
|
|
75
70
|
* Prefer using the origin URL for the MC API based on the origin value
|
|
76
71
|
* of the browser's `window.location`.
|
|
77
72
|
* This ensures that the application always uses the correct URL associated
|
|
78
73
|
* with that environment, instead of relying on the config value.
|
|
79
74
|
*/
|
|
80
|
-
|
|
81
75
|
if (isServedByProxy) {
|
|
82
76
|
return getMcApiUrlFromOrigin(origin);
|
|
83
77
|
}
|
|
84
|
-
|
|
85
78
|
return environment.mcApiUrl;
|
|
86
79
|
}
|
|
87
80
|
|
|
@@ -90,20 +83,20 @@ const getDisplayName = Component => {
|
|
|
90
83
|
if (typeof Component === 'string') {
|
|
91
84
|
return Component;
|
|
92
85
|
}
|
|
93
|
-
|
|
94
86
|
if (!Component) {
|
|
95
87
|
return undefined;
|
|
96
88
|
}
|
|
97
|
-
|
|
98
89
|
return Component.displayName || Component.name || 'Component';
|
|
99
90
|
};
|
|
100
91
|
|
|
101
92
|
function ownKeys$2(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; }
|
|
102
|
-
|
|
103
93
|
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__default["default"](_context2 = ownKeys$2(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$2(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
104
94
|
// Menu visibilities
|
|
95
|
+
|
|
105
96
|
// Permissions
|
|
97
|
+
|
|
106
98
|
// Action rights
|
|
99
|
+
|
|
107
100
|
// Data fences
|
|
108
101
|
|
|
109
102
|
/**
|
|
@@ -128,7 +121,6 @@ const normalizeAllAppliedPermissions = allAppliedPermissions => {
|
|
|
128
121
|
if (!allAppliedPermissions || allAppliedPermissions.length === 0) {
|
|
129
122
|
return null;
|
|
130
123
|
}
|
|
131
|
-
|
|
132
124
|
return _reduceInstanceProperty__default["default"](allAppliedPermissions).call(allAppliedPermissions, (transformedAllApplied, allApplied) => {
|
|
133
125
|
if (!allApplied) return transformedAllApplied;
|
|
134
126
|
return _objectSpread$2(_objectSpread$2({}, transformedAllApplied), {}, {
|
|
@@ -140,7 +132,6 @@ const normalizeAllAppliedMenuVisibilities = allAppliedMenuVisibilities => {
|
|
|
140
132
|
if (!allAppliedMenuVisibilities || allAppliedMenuVisibilities.length === 0) {
|
|
141
133
|
return null;
|
|
142
134
|
}
|
|
143
|
-
|
|
144
135
|
return _reduceInstanceProperty__default["default"](allAppliedMenuVisibilities).call(allAppliedMenuVisibilities, (transformedAllApplied, allApplied) => {
|
|
145
136
|
if (!allApplied) return transformedAllApplied;
|
|
146
137
|
return _objectSpread$2(_objectSpread$2({}, transformedAllApplied), {}, {
|
|
@@ -152,7 +143,6 @@ const normalizeAllAppliedActionRights = allAppliedActionRights => {
|
|
|
152
143
|
if (!allAppliedActionRights || allAppliedActionRights.length === 0) {
|
|
153
144
|
return null;
|
|
154
145
|
}
|
|
155
|
-
|
|
156
146
|
return _reduceInstanceProperty__default["default"](allAppliedActionRights).call(allAppliedActionRights, (transformedAllApplied, allApplied) => {
|
|
157
147
|
if (!allApplied) return transformedAllApplied;
|
|
158
148
|
const previousAllAppliedGroup = transformedAllApplied[allApplied.group];
|
|
@@ -163,10 +153,8 @@ const normalizeAllAppliedActionRights = allAppliedActionRights => {
|
|
|
163
153
|
});
|
|
164
154
|
}, {});
|
|
165
155
|
};
|
|
166
|
-
|
|
167
156
|
const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
168
157
|
var _context;
|
|
169
|
-
|
|
170
158
|
const groupedByResourceType = _reduceInstanceProperty__default["default"](dataFences).call(dataFences, (previousGroupsOfSameType, appliedDataFence) => {
|
|
171
159
|
if (!appliedDataFence) return previousGroupsOfSameType;
|
|
172
160
|
const previousGroup = previousGroupsOfSameType[appliedDataFence.group];
|
|
@@ -174,12 +162,10 @@ const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
|
174
162
|
[appliedDataFence.group]: [...(previousGroup || []), appliedDataFence]
|
|
175
163
|
});
|
|
176
164
|
}, {});
|
|
177
|
-
|
|
178
165
|
return _reduceInstanceProperty__default["default"](_context = _Object$entries__default["default"](groupedByResourceType)).call(_context, (previousGroupedByResourceType, _ref) => {
|
|
179
166
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
167
|
+
resourceType = _ref2[0],
|
|
168
|
+
dataFences = _ref2[1];
|
|
183
169
|
const groupByDataFenceName = _reduceInstanceProperty__default["default"](dataFences).call(dataFences, (nextDataFenceValues, dataFence) => {
|
|
184
170
|
const dataFenceByName = nextDataFenceValues[dataFence.name] || {
|
|
185
171
|
values: []
|
|
@@ -190,12 +176,13 @@ const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
|
190
176
|
})
|
|
191
177
|
});
|
|
192
178
|
}, {});
|
|
193
|
-
|
|
194
179
|
return _objectSpread$2(_objectSpread$2({}, previousGroupedByResourceType), {}, {
|
|
195
180
|
[resourceType]: groupByDataFenceName
|
|
196
181
|
});
|
|
197
182
|
}, {});
|
|
198
|
-
};
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// input:
|
|
199
186
|
// [
|
|
200
187
|
// {
|
|
201
188
|
// type: 'store',
|
|
@@ -226,12 +213,10 @@ const normalizeAppliedDataFencesForStoresByResourceType = dataFences => {
|
|
|
226
213
|
// }
|
|
227
214
|
// }
|
|
228
215
|
|
|
229
|
-
|
|
230
216
|
const normalizeAllAppliedDataFences = allAppliedDataFences => {
|
|
231
217
|
if (!allAppliedDataFences || allAppliedDataFences.length === 0) {
|
|
232
218
|
return null;
|
|
233
219
|
}
|
|
234
|
-
|
|
235
220
|
const groupedByType = _reduceInstanceProperty__default["default"](allAppliedDataFences).call(allAppliedDataFences, (previousGroupsOfSameType, appliedDataFence) => {
|
|
236
221
|
if (!appliedDataFence) return previousGroupsOfSameType;
|
|
237
222
|
const previousGroup = previousGroupsOfSameType[appliedDataFence.type];
|
|
@@ -239,22 +224,20 @@ const normalizeAllAppliedDataFences = allAppliedDataFences => {
|
|
|
239
224
|
[appliedDataFence.type]: [...(previousGroup || []), appliedDataFence]
|
|
240
225
|
});
|
|
241
226
|
}, {});
|
|
242
|
-
|
|
243
227
|
const normalizedDataFences = _objectSpread$2({}, 'store' in groupedByType ? {
|
|
244
228
|
store: normalizeAppliedDataFencesForStoresByResourceType(groupedByType.store)
|
|
245
229
|
} : {});
|
|
246
|
-
|
|
247
230
|
if (_Object$keys__default["default"](normalizedDataFences).length > 0) return normalizedDataFences;
|
|
248
231
|
return null;
|
|
249
232
|
};
|
|
250
233
|
|
|
251
234
|
function ownKeys$1(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; }
|
|
252
|
-
|
|
253
235
|
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__default["default"](_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
254
236
|
const Context$1 = /*#__PURE__*/react.createContext({});
|
|
255
|
-
const defaultTimeZone = moment__default["default"].tz.guess() || 'Etc/UTC';
|
|
256
|
-
// be used internally in the AppShell
|
|
237
|
+
const defaultTimeZone = moment__default["default"].tz.guess() || 'Etc/UTC';
|
|
257
238
|
|
|
239
|
+
// Expose only certain fields as some of them are only meant to
|
|
240
|
+
// be used internally in the AppShell
|
|
258
241
|
const mapUserToApplicationContextUser = user => {
|
|
259
242
|
if (!user) return null;
|
|
260
243
|
let applicationContextUser = {
|
|
@@ -269,11 +252,11 @@ const mapUserToApplicationContextUser = user => {
|
|
|
269
252
|
locale: user.language,
|
|
270
253
|
timeZone: user.timeZone || defaultTimeZone,
|
|
271
254
|
projects: user.projects
|
|
272
|
-
};
|
|
255
|
+
};
|
|
273
256
|
|
|
257
|
+
// This property will only be populated when user has logged in using SSO
|
|
274
258
|
if (user.idTokenUserInfo) {
|
|
275
259
|
let additionalClaims = {};
|
|
276
|
-
|
|
277
260
|
try {
|
|
278
261
|
additionalClaims = JSON.parse(user.idTokenUserInfo.additionalClaims || '{}');
|
|
279
262
|
} catch (error) {
|
|
@@ -283,21 +266,21 @@ const mapUserToApplicationContextUser = user => {
|
|
|
283
266
|
}
|
|
284
267
|
});
|
|
285
268
|
}
|
|
286
|
-
|
|
287
269
|
applicationContextUser.idTokenUserInfo = _objectSpread$1(_objectSpread$1({}, user.idTokenUserInfo), {}, {
|
|
288
270
|
additionalClaims
|
|
289
271
|
});
|
|
290
272
|
}
|
|
291
|
-
|
|
292
273
|
return applicationContextUser;
|
|
293
|
-
};
|
|
274
|
+
};
|
|
294
275
|
|
|
276
|
+
// Adjust certain fields which depend e.g. on the origin
|
|
295
277
|
const mapEnvironmentToApplicationContextEnvironment = (environment, origin) => _objectSpread$1(_objectSpread$1({}, environment), {}, {
|
|
296
278
|
// NOTE: The `mcApiUrl` depends on `servedByProxy`
|
|
297
279
|
mcApiUrl: getMcApiUrl(environment, origin)
|
|
298
|
-
});
|
|
299
|
-
// be used internally in the AppShell
|
|
280
|
+
});
|
|
300
281
|
|
|
282
|
+
// Expose only certain fields as some of them are only meant to
|
|
283
|
+
// be used internally in the AppShell
|
|
301
284
|
const mapProjectToApplicationContextProject = project => {
|
|
302
285
|
if (!project) return null;
|
|
303
286
|
return {
|
|
@@ -311,7 +294,6 @@ const mapProjectToApplicationContextProject = project => {
|
|
|
311
294
|
ownerName: project.owner.name
|
|
312
295
|
};
|
|
313
296
|
};
|
|
314
|
-
|
|
315
297
|
const createApplicationContext = (environment, user, project, projectDataLocale) => ({
|
|
316
298
|
environment: mapEnvironmentToApplicationContextEnvironment(environment),
|
|
317
299
|
user: mapUserToApplicationContextUser(user),
|
|
@@ -321,15 +303,12 @@ const createApplicationContext = (environment, user, project, projectDataLocale)
|
|
|
321
303
|
dataFences: normalizeAllAppliedDataFences(project === null || project === void 0 ? void 0 : project.allAppliedDataFences),
|
|
322
304
|
dataLocale: projectDataLocale || null
|
|
323
305
|
});
|
|
324
|
-
|
|
325
306
|
const ApplicationContextProvider = props => jsxRuntime.jsx(Context$1.Provider, {
|
|
326
307
|
value: createApplicationContext(props.environment, props.user, props.project, props.projectDataLocale),
|
|
327
308
|
children: props.children
|
|
328
309
|
});
|
|
329
|
-
|
|
330
310
|
ApplicationContextProvider.propTypes = {};
|
|
331
311
|
ApplicationContextProvider.displayName = 'ApplicationContextProvider';
|
|
332
|
-
|
|
333
312
|
const ApplicationContext = props => jsxRuntime.jsx(Context$1.Consumer, {
|
|
334
313
|
children: context => {
|
|
335
314
|
// Because of the way the ApplicationShell configures the Context.Provider,
|
|
@@ -340,10 +319,8 @@ const ApplicationContext = props => jsxRuntime.jsx(Context$1.Consumer, {
|
|
|
340
319
|
return props.render(applicationContext);
|
|
341
320
|
}
|
|
342
321
|
});
|
|
343
|
-
|
|
344
322
|
ApplicationContext.propTypes = {};
|
|
345
323
|
ApplicationContext.displayName = 'ApplicationContext';
|
|
346
|
-
|
|
347
324
|
function withApplicationContext(mapApplicationContextToProps) {
|
|
348
325
|
return Component => {
|
|
349
326
|
const WrappedComponent = props => jsxRuntime.jsx(ApplicationContext, {
|
|
@@ -354,67 +331,60 @@ function withApplicationContext(mapApplicationContextToProps) {
|
|
|
354
331
|
return jsxRuntime.jsx(Component, _objectSpread$1(_objectSpread$1({}, props), mappedProps));
|
|
355
332
|
}
|
|
356
333
|
});
|
|
357
|
-
|
|
358
334
|
WrappedComponent.displayName = "withApplicationContext(".concat(getDisplayName(Component), ")");
|
|
359
335
|
return WrappedComponent;
|
|
360
336
|
};
|
|
361
|
-
}
|
|
362
|
-
// distict return types, based on the selector function argument.
|
|
363
|
-
|
|
337
|
+
}
|
|
364
338
|
|
|
339
|
+
// Use function overloading to declare two possible signatures with two
|
|
340
|
+
// distict return types, based on the selector function argument.
|
|
365
341
|
// Then implement the function. Typescript will pick the appropriate signature
|
|
366
342
|
// based on the function arguments.
|
|
367
343
|
function useApplicationContextHook(selector) {
|
|
368
|
-
const context = react.useContext(Context$1);
|
|
344
|
+
const context = react.useContext(Context$1);
|
|
345
|
+
// Because of the way the ApplicationShell configures the Context.Provider,
|
|
369
346
|
// we ensure that, when we read from the context, we always get actual
|
|
370
347
|
// context object and not the initial value.
|
|
371
348
|
// Therefore, we can safely cast the value to be out `TApplicationContext` type.
|
|
372
|
-
|
|
373
349
|
const applicationContext = context;
|
|
374
350
|
return selector ? selector(applicationContext) : applicationContext;
|
|
375
|
-
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// This is a workaround to trick babel/rollup to correctly export the function.
|
|
376
354
|
// Most likely the problem arises with the use of overloading.
|
|
377
355
|
// See related issue: https://github.com/babel/babel/issues/8361
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const useApplicationContext = useApplicationContextHook; // Exports
|
|
356
|
+
const useApplicationContext = useApplicationContextHook;
|
|
381
357
|
|
|
382
358
|
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; }
|
|
383
|
-
|
|
384
359
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
385
360
|
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 } } } };
|
|
386
|
-
|
|
387
361
|
const useWarning = (condition, message) => {
|
|
388
362
|
react.useEffect(() => {
|
|
363
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
389
364
|
}, []);
|
|
390
365
|
};
|
|
391
|
-
|
|
392
366
|
const Context = /*#__PURE__*/react.createContext({
|
|
393
367
|
isLoading: false
|
|
394
368
|
});
|
|
395
|
-
|
|
396
369
|
const useProjectExtensionImageRegex = () => {
|
|
397
370
|
const _useContext = react.useContext(Context),
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
371
|
+
isLoading = _useContext.isLoading,
|
|
372
|
+
imageRegex = _useContext.imageRegex;
|
|
401
373
|
return {
|
|
402
374
|
isLoading,
|
|
403
375
|
imageRegex
|
|
404
376
|
};
|
|
405
377
|
};
|
|
406
|
-
|
|
407
378
|
const ProjectExtensionProviderForImageRegex = props => {
|
|
408
379
|
const _useQuery = react$1.useQuery(FetchProjectExtensionImageRegex, {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
380
|
+
skip: props.skip,
|
|
381
|
+
onError: sentry.reportErrorToSentry,
|
|
382
|
+
context: {
|
|
383
|
+
target: constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
384
|
+
}
|
|
385
|
+
}),
|
|
386
|
+
loading = _useQuery.loading,
|
|
387
|
+
data = _useQuery.data;
|
|
418
388
|
return jsxRuntime.jsx(Context.Provider, {
|
|
419
389
|
value: {
|
|
420
390
|
isLoading: loading,
|
|
@@ -423,20 +393,16 @@ const ProjectExtensionProviderForImageRegex = props => {
|
|
|
423
393
|
children: props.children
|
|
424
394
|
});
|
|
425
395
|
};
|
|
426
|
-
|
|
427
396
|
ProjectExtensionProviderForImageRegex.propTypes = {};
|
|
428
397
|
ProjectExtensionProviderForImageRegex.displayName = 'ProjectExtensionProviderForImageRegex';
|
|
429
|
-
|
|
430
398
|
const GetProjectExtensionImageRegex = props => {
|
|
431
399
|
useWarning();
|
|
432
400
|
return jsxRuntime.jsx(Context.Consumer, {
|
|
433
401
|
children: imageRegexContext => props.render(imageRegexContext)
|
|
434
402
|
});
|
|
435
403
|
};
|
|
436
|
-
|
|
437
404
|
GetProjectExtensionImageRegex.propTypes = {};
|
|
438
405
|
GetProjectExtensionImageRegex.displayName = 'GetProjectExtensionImageRegex';
|
|
439
|
-
|
|
440
406
|
function withProjectExtensionImageRegex() {
|
|
441
407
|
let propKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'imageRegexData';
|
|
442
408
|
return Component => {
|
|
@@ -449,11 +415,10 @@ function withProjectExtensionImageRegex() {
|
|
|
449
415
|
}))
|
|
450
416
|
});
|
|
451
417
|
};
|
|
452
|
-
|
|
453
418
|
WrappedComponent.displayName = "withProjectExtensionImageRegex(".concat(getDisplayName(Component), ")");
|
|
454
419
|
return WrappedComponent;
|
|
455
420
|
};
|
|
456
|
-
}
|
|
421
|
+
}
|
|
457
422
|
|
|
458
423
|
exports.ApplicationContext = ApplicationContext;
|
|
459
424
|
exports.ApplicationContextProvider = ApplicationContextProvider;
|