@commercetools-frontend/application-config 22.30.2 → 22.31.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-config.cjs.dev.js +57 -67
- package/dist/commercetools-frontend-application-config.cjs.prod.js +57 -67
- package/dist/commercetools-frontend-application-config.esm.js +56 -66
- package/dist/declarations/src/formatters.d.ts +20 -0
- package/dist/declarations/src/schemas/generated/custom-application.schema.d.ts +97 -0
- package/dist/declarations/src/schemas/generated/custom-view.schema.d.ts +82 -0
- package/dist/declarations/src/types/generated/settings.d.ts +15 -0
- package/dist/declarations/src/types.d.ts +38 -0
- package/dist/{formatters-2a857809.cjs.prod.js → formatters-7f327585.cjs.prod.js} +10 -13
- package/dist/{formatters-80a6c235.esm.js → formatters-882eafa8.esm.js} +10 -12
- package/dist/{formatters-a09672cf.cjs.dev.js → formatters-a76b45b9.cjs.dev.js} +10 -13
- package/package.json +4 -4
- package/ssr/dist/commercetools-frontend-application-config-ssr.cjs.dev.js +1 -2
- package/ssr/dist/commercetools-frontend-application-config-ssr.cjs.prod.js +1 -2
- package/ssr/dist/commercetools-frontend-application-config-ssr.esm.js +1 -2
- package/tsconfig-mc-app.json +1 -1
|
@@ -1,34 +1,95 @@
|
|
|
1
|
+
|
|
1
2
|
export type CspDirective = string[];
|
|
2
3
|
export interface JSONSchemaForCustomViewConfigurationFiles {
|
|
4
|
+
/**
|
|
5
|
+
* See https://docs.commercetools.com/TODO
|
|
6
|
+
*/
|
|
3
7
|
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* See https://docs.commercetools.com/TODO
|
|
10
|
+
*/
|
|
4
11
|
description?: string;
|
|
12
|
+
/**
|
|
13
|
+
* See https://docs.commercetools.com/TODO
|
|
14
|
+
*/
|
|
5
15
|
cloudIdentifier: string;
|
|
16
|
+
/**
|
|
17
|
+
* See https://docs.commercetools.com/TODO
|
|
18
|
+
*/
|
|
6
19
|
mcApiUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* See https://docs.commercetools.com/TODO
|
|
22
|
+
*/
|
|
7
23
|
oAuthScopes: {
|
|
24
|
+
/**
|
|
25
|
+
* See https://docs.commercetools.com/TODO
|
|
26
|
+
*/
|
|
8
27
|
view: string[];
|
|
28
|
+
/**
|
|
29
|
+
* See https://docs.commercetools.com/TODO
|
|
30
|
+
*/
|
|
9
31
|
manage: string[];
|
|
10
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* See https://docs.commercetools.com/TODO
|
|
35
|
+
*/
|
|
11
36
|
additionalOAuthScopes?: {
|
|
37
|
+
/**
|
|
38
|
+
* See https://docs.commercetools.com/TODO
|
|
39
|
+
*/
|
|
12
40
|
name: string;
|
|
41
|
+
/**
|
|
42
|
+
* See https://docs.commercetools.com/TODO
|
|
43
|
+
*/
|
|
13
44
|
view: string[];
|
|
45
|
+
/**
|
|
46
|
+
* See https://docs.commercetools.com/TODO
|
|
47
|
+
*/
|
|
14
48
|
manage: string[];
|
|
15
49
|
}[];
|
|
50
|
+
/**
|
|
51
|
+
* See https://docs.commercetools.com/TODO
|
|
52
|
+
*/
|
|
16
53
|
env: {
|
|
17
54
|
development: {
|
|
55
|
+
/**
|
|
56
|
+
* See https://docs.commercetools.com/TODO
|
|
57
|
+
*/
|
|
18
58
|
initialProjectKey: string;
|
|
19
59
|
teamId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* See https://docs.commercetools.com/TODO
|
|
62
|
+
*/
|
|
20
63
|
hostUriPath?: string;
|
|
21
64
|
};
|
|
22
65
|
production: {
|
|
66
|
+
/**
|
|
67
|
+
* See https://docs.commercetools.com/TODO
|
|
68
|
+
*/
|
|
23
69
|
customViewId: string;
|
|
70
|
+
/**
|
|
71
|
+
* See https://docs.commercetools.com/TODO
|
|
72
|
+
*/
|
|
24
73
|
url: string;
|
|
74
|
+
/**
|
|
75
|
+
* See https://docs.commercetools.com/TODO
|
|
76
|
+
*/
|
|
25
77
|
cdnUrl?: string;
|
|
26
78
|
};
|
|
27
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* See https://docs.commercetools.com/TODO
|
|
82
|
+
*/
|
|
28
83
|
additionalEnv?: {
|
|
29
84
|
[k: string]: unknown;
|
|
30
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* See https://docs.commercetools.com/TODO
|
|
88
|
+
*/
|
|
31
89
|
headers?: {
|
|
90
|
+
/**
|
|
91
|
+
* See https://docs.commercetools.com/TODO
|
|
92
|
+
*/
|
|
32
93
|
csp?: {
|
|
33
94
|
'connect-src': CspDirective;
|
|
34
95
|
'font-src'?: CspDirective;
|
|
@@ -37,20 +98,41 @@ export interface JSONSchemaForCustomViewConfigurationFiles {
|
|
|
37
98
|
'style-src'?: CspDirective;
|
|
38
99
|
'frame-src'?: CspDirective;
|
|
39
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* See https://docs.commercetools.com/TODO
|
|
103
|
+
*/
|
|
40
104
|
permissionsPolicies?: {
|
|
41
105
|
[k: string]: unknown;
|
|
42
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* See https://docs.commercetools.com/TODO
|
|
109
|
+
*/
|
|
43
110
|
strictTransportSecurity?: ('includeSubDomains' | 'preload')[];
|
|
44
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* See https://docs.commercetools.com/TODO
|
|
114
|
+
*/
|
|
45
115
|
labelAllLocales: {
|
|
46
116
|
locale: 'en' | 'de' | 'es' | 'fr-FR' | 'pt-BR' | 'zh-CN';
|
|
47
117
|
value: string;
|
|
48
118
|
}[];
|
|
119
|
+
/**
|
|
120
|
+
* See https://docs.commercetools.com/TODO
|
|
121
|
+
*/
|
|
49
122
|
type: 'CustomPanel';
|
|
123
|
+
/**
|
|
124
|
+
* See https://docs.commercetools.com/TODO
|
|
125
|
+
*/
|
|
50
126
|
typeSettings?: {
|
|
127
|
+
/**
|
|
128
|
+
* See https://docs.commercetools.com/TODO
|
|
129
|
+
*/
|
|
51
130
|
size?: 'SMALL' | 'LARGE';
|
|
52
131
|
[k: string]: unknown;
|
|
53
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* See https://docs.commercetools.com/TODO
|
|
135
|
+
*/
|
|
54
136
|
locators: string[];
|
|
55
137
|
[k: string]: unknown;
|
|
56
138
|
}
|
|
@@ -11,6 +11,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
|
11
11
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
12
12
|
[SubKey in K]: Maybe<T[SubKey]>;
|
|
13
13
|
};
|
|
14
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
14
15
|
export type Scalars = {
|
|
15
16
|
ID: string;
|
|
16
17
|
String: string;
|
|
@@ -169,11 +170,14 @@ export type TCustomApplicationMenuLink = {
|
|
|
169
170
|
__typename?: 'CustomApplicationMenuLink';
|
|
170
171
|
createdAt: Scalars['DateTime'];
|
|
171
172
|
defaultLabel: Scalars['String'];
|
|
173
|
+
/** @deprecated This field has been moved outside of the menu link. */
|
|
172
174
|
icon: Scalars['String'];
|
|
175
|
+
/** @deprecated This field has been renamed to icon. */
|
|
173
176
|
iconName?: Maybe<Scalars['String']>;
|
|
174
177
|
id: Scalars['ID'];
|
|
175
178
|
labelAllLocales: Array<TLocalizedField>;
|
|
176
179
|
permissions: Array<Scalars['String']>;
|
|
180
|
+
/** @deprecated This field has been moved outside of the menu link and is now a top level field. */
|
|
177
181
|
submenuLinks: Array<TCustomApplicationSubmenuLink>;
|
|
178
182
|
updatedAt: Scalars['DateTime'];
|
|
179
183
|
};
|
|
@@ -267,6 +271,10 @@ export type TCustomViewDraftDataInput = {
|
|
|
267
271
|
locators: Array<Scalars['String']>;
|
|
268
272
|
permissions: Array<TCustomViewPermissionDataInput>;
|
|
269
273
|
type: TCustomViewType;
|
|
274
|
+
/**
|
|
275
|
+
* The value of this property depends on the value of the 'type' property value.
|
|
276
|
+
* In case the `type` value is `CustomPanel`, you are supposed to provide it's size.
|
|
277
|
+
*/
|
|
270
278
|
typeSettings?: InputMaybe<TCustomViewTypeSettingsInput>;
|
|
271
279
|
url: Scalars['String'];
|
|
272
280
|
};
|
|
@@ -1104,6 +1112,7 @@ export type TProductTypeAttributesViewUpdateInput = {
|
|
|
1104
1112
|
};
|
|
1105
1113
|
export type TProjectExtension = {
|
|
1106
1114
|
__typename?: 'ProjectExtension';
|
|
1115
|
+
/** @deprecated Feature not available anymore */
|
|
1107
1116
|
applications?: Maybe<Array<TApplicationExtension>>;
|
|
1108
1117
|
categoryRecommendationSettings?: Maybe<TCategoryRecommendationSettings>;
|
|
1109
1118
|
createdAt: Scalars['DateTime'];
|
|
@@ -1167,16 +1176,20 @@ export type TQuery = {
|
|
|
1167
1176
|
activePimSearchListView?: Maybe<TPimSearchListView>;
|
|
1168
1177
|
activeProductDiscountsCustomView?: Maybe<TDiscountsCustomView>;
|
|
1169
1178
|
activeProductTypeAttributesView?: Maybe<TProductTypeAttributesView>;
|
|
1179
|
+
/** @deprecated Experimental feature - For internal usage only */
|
|
1170
1180
|
allAppliedCustomApplicationPermissions: Array<TCustomApplicationInstallationPermission>;
|
|
1181
|
+
/** @deprecated Experimental feature - For internal usage only */
|
|
1171
1182
|
allCustomApplications: TCustomApplicationsPagedQueryResult;
|
|
1172
1183
|
allCustomViewInstallationByOrganization?: Maybe<TCustomViewInstallation>;
|
|
1173
1184
|
allCustomViewsByOrganization: Array<Maybe<TCustomView>>;
|
|
1174
1185
|
allFeatures: Array<TFeature>;
|
|
1186
|
+
/** @deprecated Experimental feature - For internal usage only */
|
|
1175
1187
|
allOrganizationExtensions: Array<TOrganizationExtension>;
|
|
1176
1188
|
allProjectExtensions: Array<TProjectExtension>;
|
|
1177
1189
|
allPublicCustomApplicationsDevelopedByCommercetools: Array<TPublicCustomApplicationDevelopedByCommercetools>;
|
|
1178
1190
|
cartDiscountsCustomView?: Maybe<TDiscountsCustomView>;
|
|
1179
1191
|
cartDiscountsCustomViews: Array<Maybe<TDiscountsCustomView>>;
|
|
1192
|
+
/** @deprecated Experimental feature - For internal usage only */
|
|
1180
1193
|
customApplication?: Maybe<TCustomApplication>;
|
|
1181
1194
|
customView?: Maybe<TCustomView>;
|
|
1182
1195
|
customViewInstallation?: Maybe<TCustomViewInstallation>;
|
|
@@ -1186,6 +1199,7 @@ export type TQuery = {
|
|
|
1186
1199
|
dashboardViews: Array<Maybe<TDashboardView>>;
|
|
1187
1200
|
discountCodesCustomView?: Maybe<TDiscountsCustomView>;
|
|
1188
1201
|
discountCodesCustomViews: Array<Maybe<TDiscountsCustomView>>;
|
|
1202
|
+
/** @deprecated Experimental feature - For internal usage only */
|
|
1189
1203
|
globalOrganizationExtension?: Maybe<TOrganizationExtension>;
|
|
1190
1204
|
myCustomApplications: Array<TMyCustomApplication>;
|
|
1191
1205
|
ordersListView?: Maybe<TOrdersListView>;
|
|
@@ -1330,6 +1344,7 @@ export type TRestrictedCustomApplicationForProject = {
|
|
|
1330
1344
|
icon: Scalars['String'];
|
|
1331
1345
|
id: Scalars['ID'];
|
|
1332
1346
|
mainMenuLink: TCustomApplicationMenuLink;
|
|
1347
|
+
/** @deprecated This field has been renamed to mainMenuLink field. The nested submenuLinks is also now a top level field. */
|
|
1333
1348
|
menuLinks?: Maybe<TCustomApplicationMenuLink>;
|
|
1334
1349
|
name: Scalars['String'];
|
|
1335
1350
|
permissions: Array<TCustomApplicationPermission>;
|
|
@@ -61,11 +61,49 @@ export type LoadingConfigOptions = {
|
|
|
61
61
|
applicationPath: string;
|
|
62
62
|
};
|
|
63
63
|
export type WordSeparators = '-';
|
|
64
|
+
/**
|
|
65
|
+
Represents an array of strings split using a given character or character set.
|
|
66
|
+
|
|
67
|
+
source: https://github.com/sindresorhus/type-fest/blob/fedbc441a314c1f9f5f6225c993860d0886261da/source/split.d.ts#L22:L29
|
|
68
|
+
|
|
69
|
+
@example
|
|
70
|
+
```
|
|
71
|
+
declare function split<S extends string, D extends string>(string: S, separator: D): Split<S, D>;
|
|
72
|
+
type Item = 'foo' | 'bar' | 'baz' | 'waldo';
|
|
73
|
+
const items = 'foo,bar,baz,waldo';
|
|
74
|
+
let array: Item[];
|
|
75
|
+
array = split(items, ',');
|
|
76
|
+
```
|
|
77
|
+
*/
|
|
64
78
|
export type Split<S extends string, Delimiter extends string> = S extends `${infer Head}${Delimiter}${infer Tail}` ? [Head, ...Split<Tail, Delimiter>] : S extends Delimiter ? [] : [S];
|
|
79
|
+
/**
|
|
80
|
+
Step by step takes the first item in an array literal, formats it and adds it to a string literal, and then recursively appends the remainder.
|
|
81
|
+
Only to be used by `CamelCaseStringArray<>`.
|
|
82
|
+
|
|
83
|
+
source: https://github.com/sindresorhus/type-fest/blob/fedbc441a314c1f9f5f6225c993860d0886261da/source/camel-case.d.ts#L11:L18
|
|
84
|
+
*/
|
|
65
85
|
type InnerCamelCaseStringArray<Parts extends readonly unknown[], PreviousPart> = Parts extends [`${infer FirstPart}`, ...infer RemainingParts] ? FirstPart extends undefined ? '' : FirstPart extends '' ? InnerCamelCaseStringArray<RemainingParts, PreviousPart> : `${PreviousPart extends '' ? FirstPart : Capitalize<FirstPart>}${InnerCamelCaseStringArray<RemainingParts, FirstPart>}` : '';
|
|
86
|
+
/**
|
|
87
|
+
Starts fusing the output of `Split<>`, an array literal of strings, into a camel-cased string literal.
|
|
88
|
+
It's separate from `InnerCamelCaseStringArray<>` to keep a clean API outwards to the rest of the code.
|
|
89
|
+
|
|
90
|
+
source: https://github.com/sindresorhus/type-fest/blob/fedbc441a314c1f9f5f6225c993860d0886261da/source/camel-case.d.ts#L27:L30
|
|
91
|
+
*/
|
|
66
92
|
type CamelCaseStringArray<Parts extends readonly string[]> = Parts extends [
|
|
67
93
|
`${infer FirstPart}`,
|
|
68
94
|
...infer RemainingParts
|
|
69
95
|
] ? Uncapitalize<`${FirstPart}${InnerCamelCaseStringArray<RemainingParts, FirstPart>}`> : never;
|
|
96
|
+
/**
|
|
97
|
+
Convert a string literal to camel-case.
|
|
98
|
+
This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result.
|
|
99
|
+
|
|
100
|
+
source: https://github.com/sindresorhus/type-fest/blob/fedbc441a314c1f9f5f6225c993860d0886261da/source/camel-case.d.ts#L73
|
|
101
|
+
|
|
102
|
+
@example
|
|
103
|
+
```
|
|
104
|
+
const someVariable: CamelCase<'foo-bar'> = 'fooBar';
|
|
105
|
+
const anotherVariable: CamelCase<'foo_bar'> = 'foo_Bar';
|
|
106
|
+
```
|
|
107
|
+
*/
|
|
70
108
|
export type CamelCase<K> = K extends string ? CamelCaseStringArray<Split<K extends Uppercase<K> ? Uppercase<K> : K, WordSeparators>> : K;
|
|
71
109
|
export {};
|
|
@@ -12,7 +12,6 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
|
12
12
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
13
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
14
14
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
15
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
16
15
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
17
16
|
var upperFirst = require('lodash/upperFirst');
|
|
18
17
|
var constants = require('@commercetools-frontend/constants');
|
|
@@ -29,12 +28,11 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
29
28
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
30
29
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
31
30
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
32
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
33
31
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
34
32
|
var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
|
|
35
33
|
|
|
36
34
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
38
36
|
/**
|
|
39
37
|
* The function formats the `entryPointUriPath` to a resource access key.
|
|
40
38
|
* It makes the first character of the string and the next character after a special character an uppercase.
|
|
@@ -62,7 +60,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
62
60
|
// If the word after the hyphen is numeric, replace the hyphen with a forward slash.
|
|
63
61
|
// If not, omit the hyphen and uppercase the first character
|
|
64
62
|
if (i > 0 && /^-?\d+$/.test(word[0])) {
|
|
65
|
-
return
|
|
63
|
+
return `/${word}`;
|
|
66
64
|
}
|
|
67
65
|
return upperFirst__default["default"](word);
|
|
68
66
|
}).join('');
|
|
@@ -86,15 +84,14 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
|
|
|
86
84
|
var _context4;
|
|
87
85
|
const resourceAccessKey = constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH === entryPointUriPath ? '' : formatEntryPointUriPathToResourceAccessKey(entryPointUriPath);
|
|
88
86
|
const defaultResourceAccesses = {
|
|
89
|
-
view:
|
|
90
|
-
manage:
|
|
87
|
+
view: `view${resourceAccessKey}`,
|
|
88
|
+
manage: `manage${resourceAccessKey}`
|
|
91
89
|
};
|
|
92
|
-
const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames
|
|
93
|
-
var _context5, _context6;
|
|
90
|
+
const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
|
|
94
91
|
const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
|
|
95
92
|
return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
|
|
96
|
-
[
|
|
97
|
-
[
|
|
93
|
+
[`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
|
|
94
|
+
[`manage${additionalResourceAccessKey}`]: `${defaultResourceAccesses.manage}${additionalResourceAccessKey}`
|
|
98
95
|
});
|
|
99
96
|
}, {});
|
|
100
97
|
return _objectSpread(_objectSpread({}, defaultResourceAccesses), additionalResourceAccesses);
|
|
@@ -106,9 +103,9 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
|
|
|
106
103
|
return entryPointUriPathToPermissionKeys(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, permissionGroupNames || []);
|
|
107
104
|
}
|
|
108
105
|
function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
|
|
109
|
-
var
|
|
110
|
-
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames
|
|
111
|
-
return _reduceInstanceProperty__default["default"](
|
|
106
|
+
var _context5;
|
|
107
|
+
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
|
|
108
|
+
return _reduceInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
|
|
112
109
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
113
110
|
resourceAccessKey = _ref2[0],
|
|
114
111
|
resourceAccessValue = _ref2[1];
|
|
@@ -10,13 +10,12 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
|
10
10
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
11
11
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
12
12
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
13
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
14
13
|
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
15
14
|
import upperFirst from 'lodash/upperFirst';
|
|
16
15
|
import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants';
|
|
17
16
|
|
|
18
17
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
19
|
/**
|
|
21
20
|
* The function formats the `entryPointUriPath` to a resource access key.
|
|
22
21
|
* It makes the first character of the string and the next character after a special character an uppercase.
|
|
@@ -44,7 +43,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
44
43
|
// If the word after the hyphen is numeric, replace the hyphen with a forward slash.
|
|
45
44
|
// If not, omit the hyphen and uppercase the first character
|
|
46
45
|
if (i > 0 && /^-?\d+$/.test(word[0])) {
|
|
47
|
-
return
|
|
46
|
+
return `/${word}`;
|
|
48
47
|
}
|
|
49
48
|
return upperFirst(word);
|
|
50
49
|
}).join('');
|
|
@@ -68,15 +67,14 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
|
|
|
68
67
|
var _context4;
|
|
69
68
|
const resourceAccessKey = CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH === entryPointUriPath ? '' : formatEntryPointUriPathToResourceAccessKey(entryPointUriPath);
|
|
70
69
|
const defaultResourceAccesses = {
|
|
71
|
-
view:
|
|
72
|
-
manage:
|
|
70
|
+
view: `view${resourceAccessKey}`,
|
|
71
|
+
manage: `manage${resourceAccessKey}`
|
|
73
72
|
};
|
|
74
|
-
const additionalResourceAccesses = _reduceInstanceProperty(_context4 = permissionGroupNames
|
|
75
|
-
var _context5, _context6;
|
|
73
|
+
const additionalResourceAccesses = _reduceInstanceProperty(_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
|
|
76
74
|
const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
|
|
77
75
|
return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
|
|
78
|
-
[
|
|
79
|
-
[
|
|
76
|
+
[`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
|
|
77
|
+
[`manage${additionalResourceAccessKey}`]: `${defaultResourceAccesses.manage}${additionalResourceAccessKey}`
|
|
80
78
|
});
|
|
81
79
|
}, {});
|
|
82
80
|
return _objectSpread(_objectSpread({}, defaultResourceAccesses), additionalResourceAccesses);
|
|
@@ -88,9 +86,9 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
|
|
|
88
86
|
return entryPointUriPathToPermissionKeys(CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, permissionGroupNames || []);
|
|
89
87
|
}
|
|
90
88
|
function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
|
|
91
|
-
var
|
|
92
|
-
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames
|
|
93
|
-
return _reduceInstanceProperty(
|
|
89
|
+
var _context5;
|
|
90
|
+
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
|
|
91
|
+
return _reduceInstanceProperty(_context5 = _Object$entries(resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
|
|
94
92
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
95
93
|
resourceAccessKey = _ref2[0],
|
|
96
94
|
resourceAccessValue = _ref2[1];
|
|
@@ -12,7 +12,6 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
|
12
12
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
13
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
14
14
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
15
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
16
15
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
17
16
|
var upperFirst = require('lodash/upperFirst');
|
|
18
17
|
var constants = require('@commercetools-frontend/constants');
|
|
@@ -29,12 +28,11 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
29
28
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
30
29
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
31
30
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
32
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
33
31
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
34
32
|
var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
|
|
35
33
|
|
|
36
34
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
38
36
|
/**
|
|
39
37
|
* The function formats the `entryPointUriPath` to a resource access key.
|
|
40
38
|
* It makes the first character of the string and the next character after a special character an uppercase.
|
|
@@ -62,7 +60,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
62
60
|
// If the word after the hyphen is numeric, replace the hyphen with a forward slash.
|
|
63
61
|
// If not, omit the hyphen and uppercase the first character
|
|
64
62
|
if (i > 0 && /^-?\d+$/.test(word[0])) {
|
|
65
|
-
return
|
|
63
|
+
return `/${word}`;
|
|
66
64
|
}
|
|
67
65
|
return upperFirst__default["default"](word);
|
|
68
66
|
}).join('');
|
|
@@ -86,15 +84,14 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
|
|
|
86
84
|
var _context4;
|
|
87
85
|
const resourceAccessKey = constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH === entryPointUriPath ? '' : formatEntryPointUriPathToResourceAccessKey(entryPointUriPath);
|
|
88
86
|
const defaultResourceAccesses = {
|
|
89
|
-
view:
|
|
90
|
-
manage:
|
|
87
|
+
view: `view${resourceAccessKey}`,
|
|
88
|
+
manage: `manage${resourceAccessKey}`
|
|
91
89
|
};
|
|
92
|
-
const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames
|
|
93
|
-
var _context5, _context6;
|
|
90
|
+
const additionalResourceAccesses = _reduceInstanceProperty__default["default"](_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
|
|
94
91
|
const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
|
|
95
92
|
return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
|
|
96
|
-
[
|
|
97
|
-
[
|
|
93
|
+
[`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
|
|
94
|
+
[`manage${additionalResourceAccessKey}`]: `${defaultResourceAccesses.manage}${additionalResourceAccessKey}`
|
|
98
95
|
});
|
|
99
96
|
}, {});
|
|
100
97
|
return _objectSpread(_objectSpread({}, defaultResourceAccesses), additionalResourceAccesses);
|
|
@@ -106,9 +103,9 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
|
|
|
106
103
|
return entryPointUriPathToPermissionKeys(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, permissionGroupNames || []);
|
|
107
104
|
}
|
|
108
105
|
function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
|
|
109
|
-
var
|
|
110
|
-
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames
|
|
111
|
-
return _reduceInstanceProperty__default["default"](
|
|
106
|
+
var _context5;
|
|
107
|
+
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
|
|
108
|
+
return _reduceInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
|
|
112
109
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
113
110
|
resourceAccessKey = _ref2[0],
|
|
114
111
|
resourceAccessValue = _ref2[1];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-config",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.31.0",
|
|
4
4
|
"description": "Configuration utilities for building Custom Applications",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@babel/register": "^7.22.15",
|
|
46
46
|
"@babel/runtime": "^7.22.15",
|
|
47
47
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
48
|
-
"@commercetools-frontend/babel-preset-mc-app": "22.
|
|
49
|
-
"@commercetools-frontend/constants": "22.
|
|
48
|
+
"@commercetools-frontend/babel-preset-mc-app": "22.31.0",
|
|
49
|
+
"@commercetools-frontend/constants": "22.31.0",
|
|
50
50
|
"@types/dompurify": "^2.4.0",
|
|
51
51
|
"@types/lodash": "^4.14.198",
|
|
52
52
|
"@types/react": "^17.0.80",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@types/jsdom": "^21.1.2",
|
|
63
63
|
"json-schema-to-typescript": "13.1.2",
|
|
64
64
|
"shelljs": "0.8.5",
|
|
65
|
-
"@commercetools-frontend/assets": "22.
|
|
65
|
+
"@commercetools-frontend/assets": "22.31.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": "16.x || >=18.0.0"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var formatters = require('../../dist/formatters-
|
|
5
|
+
var formatters = require('../../dist/formatters-a76b45b9.cjs.dev.js');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
7
7
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
8
8
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -15,7 +15,6 @@ require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
|
15
15
|
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
16
16
|
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
17
17
|
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
18
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
19
18
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
20
19
|
require('lodash/upperFirst');
|
|
21
20
|
require('@commercetools-frontend/constants');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var formatters = require('../../dist/formatters-
|
|
5
|
+
var formatters = require('../../dist/formatters-7f327585.cjs.prod.js');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
7
7
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
8
8
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -15,7 +15,6 @@ require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
|
15
15
|
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
16
16
|
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
17
17
|
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
18
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
19
18
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
20
19
|
require('lodash/upperFirst');
|
|
21
20
|
require('@commercetools-frontend/constants');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as computeCustomViewPermissionsKeys, c as computeCustomViewResourceAccesses, a as entryPointUriPathToPermissionKeys, e as entryPointUriPathToResourceAccesses, f as formatEntryPointUriPathToResourceAccessKey, b as formatPermissionGroupNameToResourceAccessKey } from '../../dist/formatters-
|
|
1
|
+
export { d as computeCustomViewPermissionsKeys, c as computeCustomViewResourceAccesses, a as entryPointUriPathToPermissionKeys, e as entryPointUriPathToResourceAccesses, f as formatEntryPointUriPathToResourceAccessKey, b as formatPermissionGroupNameToResourceAccessKey } from '../../dist/formatters-882eafa8.esm.js';
|
|
2
2
|
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
3
|
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
4
|
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -11,7 +11,6 @@ import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
|
11
11
|
import '@babel/runtime-corejs3/helpers/defineProperty';
|
|
12
12
|
import '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
13
13
|
import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
14
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
15
14
|
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
16
15
|
import 'lodash/upperFirst';
|
|
17
16
|
import '@commercetools-frontend/constants';
|