@commercetools-frontend/application-components 25.0.0 → 25.2.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-components.cjs.dev.js +61 -73
- package/dist/commercetools-frontend-application-components.cjs.prod.js +61 -73
- package/dist/commercetools-frontend-application-components.esm.js +61 -72
- package/dist/{custom-views-selector-352b7403.esm.js → custom-views-selector-042deb62.esm.js} +7 -8
- package/dist/{custom-views-selector-71abb548.cjs.dev.js → custom-views-selector-8cde3a16.cjs.dev.js} +8 -8
- package/dist/{custom-views-selector-2027a7d5.cjs.prod.js → custom-views-selector-aa3a81ae.cjs.prod.js} +8 -8
- package/dist/{public-page-layout-2fea64b6.esm.js → public-page-layout-7d1cb99f.esm.js} +1 -1
- package/dist/{public-page-layout-a0d532d4.cjs.prod.js → public-page-layout-b182d2dd.cjs.prod.js} +1 -1
- package/dist/{public-page-layout-c0f5e884.cjs.dev.js → public-page-layout-b92fb7e4.cjs.dev.js} +1 -1
- package/package.json +10 -10
package/dist/{custom-views-selector-71abb548.cjs.dev.js → custom-views-selector-8cde3a16.cjs.dev.js}
RENAMED
|
@@ -26,13 +26,13 @@ var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entr
|
|
|
26
26
|
var reactRouterDom = require('react-router-dom');
|
|
27
27
|
var dist_commercetoolsFrontendApplicationComponents = require('./commercetools-frontend-application-components.cjs.dev.js');
|
|
28
28
|
var reactIntl = require('react-intl');
|
|
29
|
+
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
29
30
|
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
30
31
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
31
32
|
var constants = require('@commercetools-frontend/constants');
|
|
32
33
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
33
34
|
require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
34
35
|
require('@commercetools-uikit/utils');
|
|
35
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
36
36
|
require('@radix-ui/react-dialog');
|
|
37
37
|
require('@commercetools-uikit/card');
|
|
38
38
|
require('@commercetools-uikit/secondary-icon-button');
|
|
@@ -44,7 +44,6 @@ require('lodash/omitBy');
|
|
|
44
44
|
require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
45
45
|
require('@babel/runtime-corejs3/core-js-stable/set-timeout');
|
|
46
46
|
require('@commercetools-uikit/flat-button');
|
|
47
|
-
require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
48
47
|
require('@commercetools-uikit/icon-button');
|
|
49
48
|
require('@commercetools-frontend/assets/images/page-not-found.svg');
|
|
50
49
|
require('@commercetools-frontend/assets/images/doors-closed.svg');
|
|
@@ -72,6 +71,7 @@ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
|
72
71
|
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
73
72
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
74
73
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
74
|
+
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
75
75
|
|
|
76
76
|
const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
|
|
77
77
|
const useCustomViewLocatorSelector = function () {
|
|
@@ -94,7 +94,7 @@ const useCustomViewLocatorSelector = function () {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
return {
|
|
97
|
-
currentCustomViewLocatorCode: customViewLocator
|
|
97
|
+
currentCustomViewLocatorCode: customViewLocator?.[0]
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -107,12 +107,12 @@ var messages = reactIntl.defineMessages({
|
|
|
107
107
|
|
|
108
108
|
var FetchCustomViewsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomViewsByLocator" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "customViewLocatorCode" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "allCustomViewsInstallationsByLocator" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "locator" }, value: { kind: "Variable", name: { kind: "Name", value: "customViewLocatorCode" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "customView" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "typeSettings" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "size" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "locators" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "oAuthScopes" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 405, source: { body: "query FetchCustomViewsByLocator($customViewLocatorCode: String!) {\n allCustomViewsInstallationsByLocator(locator: $customViewLocatorCode) {\n id\n customView {\n id\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n url\n type\n typeSettings {\n size\n }\n locators\n permissions {\n name\n oAuthScopes\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
109
109
|
const useCustomViewsConnector = _ref => {
|
|
110
|
-
var
|
|
110
|
+
var _context, _context2;
|
|
111
111
|
let customViewLocatorCode = _ref.customViewLocatorCode;
|
|
112
112
|
const enableCustomViews = reactBroadcast.useFlagVariation(constants.featureFlags.CUSTOM_VIEWS);
|
|
113
113
|
const areCustomViewsEnabled =
|
|
114
114
|
// @ts-ignore In case it's coming from the MC API, it's an object { value: boolean }.
|
|
115
|
-
(
|
|
115
|
+
(enableCustomViews?.value ?? enableCustomViews) && process.env.DISABLE_CUSTOM_VIEWS_FEATURE !== 'true';
|
|
116
116
|
const _useMcQuery = applicationShellConnectors.useMcQuery(FetchCustomViewsQuery, {
|
|
117
117
|
variables: {
|
|
118
118
|
customViewLocatorCode
|
|
@@ -126,7 +126,7 @@ const useCustomViewsConnector = _ref => {
|
|
|
126
126
|
error = _useMcQuery.error,
|
|
127
127
|
loading = _useMcQuery.loading;
|
|
128
128
|
return {
|
|
129
|
-
customViews: (
|
|
129
|
+
customViews: ((_context = data?.allCustomViewsInstallationsByLocator) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _mapInstanceProperty__default["default"](_context), _context))?.(installation => installation.customView) || [],
|
|
130
130
|
error,
|
|
131
131
|
loading
|
|
132
132
|
};
|
|
@@ -234,7 +234,7 @@ function CustomViewSelector(props) {
|
|
|
234
234
|
const isNotLastItem = index !== customViews.length - 1;
|
|
235
235
|
return jsxRuntime.jsxs(react$1.Fragment, {
|
|
236
236
|
children: [jsxRuntime.jsx(CustomViewSelectorItem, {
|
|
237
|
-
selected:
|
|
237
|
+
selected: selectedCustomView?.id === customView.id,
|
|
238
238
|
onClick: () => {
|
|
239
239
|
setSelectedCustomView(customView);
|
|
240
240
|
},
|
|
@@ -257,7 +257,7 @@ CustomViewSelector.displayName = 'CustomViewSelector';
|
|
|
257
257
|
const CustomViewSelectorOrNothing = props => {
|
|
258
258
|
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
259
259
|
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
260
|
-
const locatorCode = currentCustomViewLocatorCode
|
|
260
|
+
const locatorCode = currentCustomViewLocatorCode ?? props.customViewLocatorCode;
|
|
261
261
|
if (!locatorCode) {
|
|
262
262
|
return null;
|
|
263
263
|
}
|
|
@@ -26,13 +26,13 @@ var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entr
|
|
|
26
26
|
var reactRouterDom = require('react-router-dom');
|
|
27
27
|
var dist_commercetoolsFrontendApplicationComponents = require('./commercetools-frontend-application-components.cjs.prod.js');
|
|
28
28
|
var reactIntl = require('react-intl');
|
|
29
|
+
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
29
30
|
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
30
31
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
31
32
|
var constants = require('@commercetools-frontend/constants');
|
|
32
33
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
33
34
|
require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
34
35
|
require('@commercetools-uikit/utils');
|
|
35
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
36
36
|
require('@radix-ui/react-dialog');
|
|
37
37
|
require('@commercetools-uikit/card');
|
|
38
38
|
require('@commercetools-uikit/secondary-icon-button');
|
|
@@ -44,7 +44,6 @@ require('lodash/omitBy');
|
|
|
44
44
|
require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
45
45
|
require('@babel/runtime-corejs3/core-js-stable/set-timeout');
|
|
46
46
|
require('@commercetools-uikit/flat-button');
|
|
47
|
-
require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
48
47
|
require('@commercetools-uikit/icon-button');
|
|
49
48
|
require('@commercetools-frontend/assets/images/page-not-found.svg');
|
|
50
49
|
require('@commercetools-frontend/assets/images/doors-closed.svg');
|
|
@@ -72,6 +71,7 @@ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
|
72
71
|
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
73
72
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
74
73
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
74
|
+
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
75
75
|
|
|
76
76
|
const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
|
|
77
77
|
const useCustomViewLocatorSelector = function () {
|
|
@@ -94,7 +94,7 @@ const useCustomViewLocatorSelector = function () {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
return {
|
|
97
|
-
currentCustomViewLocatorCode: customViewLocator
|
|
97
|
+
currentCustomViewLocatorCode: customViewLocator?.[0]
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -107,12 +107,12 @@ var messages = reactIntl.defineMessages({
|
|
|
107
107
|
|
|
108
108
|
var FetchCustomViewsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomViewsByLocator" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "customViewLocatorCode" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "allCustomViewsInstallationsByLocator" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "locator" }, value: { kind: "Variable", name: { kind: "Name", value: "customViewLocatorCode" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "customView" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "typeSettings" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "size" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "locators" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "oAuthScopes" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 405, source: { body: "query FetchCustomViewsByLocator($customViewLocatorCode: String!) {\n allCustomViewsInstallationsByLocator(locator: $customViewLocatorCode) {\n id\n customView {\n id\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n url\n type\n typeSettings {\n size\n }\n locators\n permissions {\n name\n oAuthScopes\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
109
109
|
const useCustomViewsConnector = _ref => {
|
|
110
|
-
var
|
|
110
|
+
var _context, _context2;
|
|
111
111
|
let customViewLocatorCode = _ref.customViewLocatorCode;
|
|
112
112
|
const enableCustomViews = reactBroadcast.useFlagVariation(constants.featureFlags.CUSTOM_VIEWS);
|
|
113
113
|
const areCustomViewsEnabled =
|
|
114
114
|
// @ts-ignore In case it's coming from the MC API, it's an object { value: boolean }.
|
|
115
|
-
(
|
|
115
|
+
(enableCustomViews?.value ?? enableCustomViews) && process.env.DISABLE_CUSTOM_VIEWS_FEATURE !== 'true';
|
|
116
116
|
const _useMcQuery = applicationShellConnectors.useMcQuery(FetchCustomViewsQuery, {
|
|
117
117
|
variables: {
|
|
118
118
|
customViewLocatorCode
|
|
@@ -126,7 +126,7 @@ const useCustomViewsConnector = _ref => {
|
|
|
126
126
|
error = _useMcQuery.error,
|
|
127
127
|
loading = _useMcQuery.loading;
|
|
128
128
|
return {
|
|
129
|
-
customViews: (
|
|
129
|
+
customViews: ((_context = data?.allCustomViewsInstallationsByLocator) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _mapInstanceProperty__default["default"](_context), _context))?.(installation => installation.customView) || [],
|
|
130
130
|
error,
|
|
131
131
|
loading
|
|
132
132
|
};
|
|
@@ -213,7 +213,7 @@ function CustomViewSelector(props) {
|
|
|
213
213
|
const isNotLastItem = index !== customViews.length - 1;
|
|
214
214
|
return jsxRuntime.jsxs(react$1.Fragment, {
|
|
215
215
|
children: [jsxRuntime.jsx(CustomViewSelectorItem, {
|
|
216
|
-
selected:
|
|
216
|
+
selected: selectedCustomView?.id === customView.id,
|
|
217
217
|
onClick: () => {
|
|
218
218
|
setSelectedCustomView(customView);
|
|
219
219
|
},
|
|
@@ -236,7 +236,7 @@ CustomViewSelector.displayName = 'CustomViewSelector';
|
|
|
236
236
|
const CustomViewSelectorOrNothing = props => {
|
|
237
237
|
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
238
238
|
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
239
|
-
const locatorCode = currentCustomViewLocatorCode
|
|
239
|
+
const locatorCode = currentCustomViewLocatorCode ?? props.customViewLocatorCode;
|
|
240
240
|
if (!locatorCode) {
|
|
241
241
|
return null;
|
|
242
242
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-components",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.2.0",
|
|
4
4
|
"description": "Generic components for building Merchant Center applications",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/runtime": "^7.22.15",
|
|
38
38
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
39
|
-
"@commercetools-frontend/actions-global": "25.
|
|
40
|
-
"@commercetools-frontend/application-config": "25.
|
|
41
|
-
"@commercetools-frontend/application-shell-connectors": "25.
|
|
42
|
-
"@commercetools-frontend/assets": "25.
|
|
43
|
-
"@commercetools-frontend/constants": "25.
|
|
44
|
-
"@commercetools-frontend/i18n": "25.
|
|
45
|
-
"@commercetools-frontend/l10n": "25.
|
|
46
|
-
"@commercetools-frontend/sentry": "25.
|
|
39
|
+
"@commercetools-frontend/actions-global": "25.2.0",
|
|
40
|
+
"@commercetools-frontend/application-config": "25.2.0",
|
|
41
|
+
"@commercetools-frontend/application-shell-connectors": "25.2.0",
|
|
42
|
+
"@commercetools-frontend/assets": "25.2.0",
|
|
43
|
+
"@commercetools-frontend/constants": "25.2.0",
|
|
44
|
+
"@commercetools-frontend/i18n": "25.2.0",
|
|
45
|
+
"@commercetools-frontend/l10n": "25.2.0",
|
|
46
|
+
"@commercetools-frontend/sentry": "25.2.0",
|
|
47
47
|
"@commercetools-uikit/accessible-button": "^20.3.0",
|
|
48
48
|
"@commercetools-uikit/card": "^20.3.0",
|
|
49
49
|
"@commercetools-uikit/constraints": "^20.3.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@types/react-dom": "^19.0.2",
|
|
75
75
|
"@types/react-router-dom": "^5.3.3",
|
|
76
76
|
"history": "4.10.1",
|
|
77
|
-
"lodash": "4.17.
|
|
77
|
+
"lodash": "4.17.23",
|
|
78
78
|
"prop-types": "15.8.1",
|
|
79
79
|
"raf-schd": "^4.0.3"
|
|
80
80
|
},
|