@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
|
@@ -18,7 +18,6 @@ var Text = require('@commercetools-uikit/text');
|
|
|
18
18
|
var utils = require('@commercetools-uikit/utils');
|
|
19
19
|
var react = require('@emotion/react');
|
|
20
20
|
var designSystem = require('@commercetools-uikit/design-system');
|
|
21
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
22
21
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
23
22
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
24
23
|
var _styled = require('@emotion/styled/base');
|
|
@@ -37,7 +36,6 @@ var omitBy = require('lodash/omitBy');
|
|
|
37
36
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
38
37
|
var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
|
|
39
38
|
var FlatButton = require('@commercetools-uikit/flat-button');
|
|
40
|
-
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
41
39
|
var IconButton = require('@commercetools-uikit/icon-button');
|
|
42
40
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
43
41
|
var PageNotFoundSVG = require('@commercetools-frontend/assets/images/page-not-found.svg');
|
|
@@ -63,7 +61,6 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
|
|
|
63
61
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
64
62
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
65
63
|
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
66
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
67
64
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
68
65
|
var Card__default = /*#__PURE__*/_interopDefault(Card);
|
|
69
66
|
var SecondaryIconButton__default = /*#__PURE__*/_interopDefault(SecondaryIconButton);
|
|
@@ -85,20 +82,18 @@ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstancePro
|
|
|
85
82
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
86
83
|
|
|
87
84
|
// NOTE: This string will be replaced on build time with the package version.
|
|
88
|
-
var version = "25.
|
|
89
|
-
|
|
90
|
-
var _context, _context2, _context3, _context4, _context5;
|
|
85
|
+
var version = "25.2.0";
|
|
91
86
|
|
|
92
87
|
// We keep these tokens as they are related to page layout components which should have
|
|
93
88
|
// a slightly different layout (margins/paddings) when used within a Custom View panel.
|
|
94
89
|
// https://github.com/commercetools/merchant-center-application-kit/pull/3353
|
|
95
90
|
const themesOverrides = {
|
|
96
91
|
default: {
|
|
97
|
-
marginForCustomViewsSelectorAsTabular:
|
|
98
|
-
marginForPageContent:
|
|
99
|
-
paddingForDetailPageHeader:
|
|
100
|
-
paddingForMainPageHeader:
|
|
101
|
-
paddingForTabularPageHeader:
|
|
92
|
+
marginForCustomViewsSelectorAsTabular: `0 ${designSystem.designTokens.spacing55}`,
|
|
93
|
+
marginForPageContent: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55}`,
|
|
94
|
+
paddingForDetailPageHeader: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55} ${designSystem.designTokens.spacing40}`,
|
|
95
|
+
paddingForMainPageHeader: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55} 0`,
|
|
96
|
+
paddingForTabularPageHeader: `${designSystem.designTokens.spacing40} ${designSystem.designTokens.spacing55} 0`,
|
|
102
97
|
backgroundColorForNavbar: designSystem.designTokens.colorPrimary10,
|
|
103
98
|
backgroundColorForNavbarHeader: designSystem.designTokens.colorPrimary10,
|
|
104
99
|
fontColorForTabLabelWhenActive: designSystem.designTokens.colorPrimary
|
|
@@ -201,10 +196,11 @@ const getModalContentStyles = props => {
|
|
|
201
196
|
|
|
202
197
|
// To ensure that the mouse click on the overlay surface goes "through"
|
|
203
198
|
// and triggers the modal to close, we need to turn off the pointer events.
|
|
204
|
-
const baseStyles = /*#__PURE__*/react.css("display:grid;height:100%;width:100%;outline:none;position:relative;pointer-events:none;z-index:", typeof props.zIndex === 'number' ?
|
|
199
|
+
const baseStyles = /*#__PURE__*/react.css("display:grid;height:100%;width:100%;outline:none;position:relative;pointer-events:none;z-index:", typeof props.zIndex === 'number' ?
|
|
200
|
+
// Use `!important` to overwrite the default value assigned by the Stacking Layer System.
|
|
205
201
|
// We're assigning value 1 unit higher than the overlay to ensure the content is on top.
|
|
206
202
|
// It's safe to do that since the modal is topmost in the stacking layer.
|
|
207
|
-
|
|
203
|
+
`${props.zIndex + 1} !important` : 'auto', ";", gridStyle, ";" + ("" ), "" );
|
|
208
204
|
return baseStyles;
|
|
209
205
|
};
|
|
210
206
|
const ClickableDialogContent = /*#__PURE__*/_styled__default["default"](reactDialog.Content, {
|
|
@@ -216,7 +212,7 @@ const DialogOverlay = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
216
212
|
let zIndex = _ref.zIndex;
|
|
217
213
|
return (
|
|
218
214
|
// Use `!important` to overwrite the default value assigned by the Stacking Layer System.
|
|
219
|
-
typeof zIndex === 'number' ?
|
|
215
|
+
typeof zIndex === 'number' ? `${zIndex} !important` : 'auto'
|
|
220
216
|
);
|
|
221
217
|
}, ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ));
|
|
222
218
|
const DialogContent$1 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
@@ -227,7 +223,7 @@ const DialogContent$1 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
227
223
|
} );
|
|
228
224
|
|
|
229
225
|
const _excluded$j = ["size", "getParentSelector"];
|
|
230
|
-
const getDefaultParentSelector$1 = () => document.querySelector(
|
|
226
|
+
const getDefaultParentSelector$1 = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
231
227
|
const GridArea = /*#__PURE__*/_styled__default["default"]("div", {
|
|
232
228
|
target: "elx55gk0"
|
|
233
229
|
} )("grid-area:", props => props.name, ";" + ("" ));
|
|
@@ -495,7 +491,7 @@ FormDialog.TextTitle = TextTitle;
|
|
|
495
491
|
|
|
496
492
|
const CustomViewSelector = /*#__PURE__*/react$1.lazy(() => {
|
|
497
493
|
if (typeof window !== 'undefined' && typeof window.app !== 'undefined') {
|
|
498
|
-
return Promise.resolve().then(function () { return require('./custom-views-selector-
|
|
494
|
+
return Promise.resolve().then(function () { return require('./custom-views-selector-aa3a81ae.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
|
|
499
495
|
}
|
|
500
496
|
return _Promise__default["default"].resolve({
|
|
501
497
|
default: () => null
|
|
@@ -589,7 +585,7 @@ const PageHeader = props => {
|
|
|
589
585
|
truncate: true
|
|
590
586
|
}), props.children]
|
|
591
587
|
}), jsxRuntime.jsx(CustomViewSelector, {
|
|
592
|
-
margin:
|
|
588
|
+
margin: `${designSystem.designTokens.spacing40} 0 0 0`,
|
|
593
589
|
customViewLocatorCode: props.customViewLocatorCode
|
|
594
590
|
})]
|
|
595
591
|
});
|
|
@@ -683,7 +679,6 @@ const ModalPageTopBar = _ref3 => {
|
|
|
683
679
|
};
|
|
684
680
|
ModalPageTopBar.displayName = 'ModalPageTopBar';
|
|
685
681
|
|
|
686
|
-
var _templateObject;
|
|
687
682
|
const stylesBySize = {
|
|
688
683
|
'10': {
|
|
689
684
|
width: '600px',
|
|
@@ -702,7 +697,14 @@ const stylesBySize = {
|
|
|
702
697
|
transitionTime: 300
|
|
703
698
|
}
|
|
704
699
|
};
|
|
705
|
-
const overlayShow = react.keyframes
|
|
700
|
+
const overlayShow = react.keyframes`
|
|
701
|
+
0% {
|
|
702
|
+
opacity: 0;
|
|
703
|
+
}
|
|
704
|
+
100% {
|
|
705
|
+
opacity: 1;
|
|
706
|
+
}
|
|
707
|
+
`;
|
|
706
708
|
|
|
707
709
|
// we can't use Overlay from Radix-ui because it doesn't appear in DOM when Dialog.Root is rendered with `modal={false}`
|
|
708
710
|
const ModalOverlay = /*#__PURE__*/_styled__default["default"]("div", {
|
|
@@ -711,7 +713,7 @@ const ModalOverlay = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
711
713
|
let zIndex = _ref.zIndex;
|
|
712
714
|
return (
|
|
713
715
|
// Use `!important` to overwrite the default value assigned by the Stacking Layer System.
|
|
714
|
-
typeof zIndex === 'number' ?
|
|
716
|
+
typeof zIndex === 'number' ? `${zIndex} !important` : 'inherit'
|
|
715
717
|
);
|
|
716
718
|
}, ";opacity:0;", _ref2 => {
|
|
717
719
|
let size = _ref2.size;
|
|
@@ -721,32 +723,32 @@ const ModalOverlay = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
721
723
|
const getContentShowAnimation = size => react.keyframes({
|
|
722
724
|
'0%': {
|
|
723
725
|
opacity: 0,
|
|
724
|
-
transform:
|
|
726
|
+
transform: `translate3d(${size !== 'scale' ? stylesBySize[size].width : '30px'}, 0, 0)`
|
|
725
727
|
},
|
|
726
728
|
'100%': {
|
|
727
729
|
opacity: 1,
|
|
728
|
-
transform:
|
|
730
|
+
transform: `translate3d(0, 0, 0)`
|
|
729
731
|
}
|
|
730
732
|
});
|
|
731
733
|
const getContentHideAnimation = size => react.keyframes({
|
|
732
734
|
'0%': {
|
|
733
735
|
opacity: 1,
|
|
734
|
-
transform:
|
|
736
|
+
transform: `translate3d(0, 0, 0)`
|
|
735
737
|
},
|
|
736
738
|
'100%': {
|
|
737
739
|
opacity: 0,
|
|
738
|
-
transform:
|
|
740
|
+
transform: `translate3d(${size !== 'scale' ? stylesBySize[size].width : '30px'}, 0, 0)`
|
|
739
741
|
}
|
|
740
742
|
});
|
|
741
743
|
const ModalContent = /*#__PURE__*/_styled__default["default"](reactDialog.Content, {
|
|
742
744
|
shouldForwardProp: prop => prop !== 'size',
|
|
743
745
|
target: "e1jbmsa0"
|
|
744
746
|
} )("position:absolute;top:0;right:0;height:100%;width:", _ref3 => {
|
|
745
|
-
var _context;
|
|
746
747
|
let size = _ref3.size;
|
|
747
|
-
return size !== 'scale' ?
|
|
748
|
+
return size !== 'scale' ?
|
|
749
|
+
// In case we're using a specific size, we want it to be used until there's no space left.
|
|
748
750
|
// In such scenario, we want the modal to be as wide as possible, but using the shared indentation width size.
|
|
749
|
-
|
|
751
|
+
`min(${stylesBySize[size].width}, calc(100% - ${constants.PORTALS_CONTAINER_INDENTATION_SIZE})) !important` : stylesBySize.scale.width;
|
|
750
752
|
}, ";display:flex;flex-direction:column;background-color:", designSystem.designTokens.colorSurface, ";box-shadow:0px 0px 40px 0px rgba(0, 0, 0, 0.1);outline:0;z-index:inherit;&[data-state='open']{animation:", _ref4 => {
|
|
751
753
|
let size = _ref4.size;
|
|
752
754
|
return getContentShowAnimation(size);
|
|
@@ -777,7 +779,7 @@ const HiddenEmptyDialogTitle = () => jsxRuntime.jsx("div", {
|
|
|
777
779
|
// instead of a specific element that will be cleaned up, resulting in
|
|
778
780
|
// console errors (even though the test passes). We only need to to this in
|
|
779
781
|
// test environment.
|
|
780
|
-
const getDefaultParentSelector = () => document.querySelector(
|
|
782
|
+
const getDefaultParentSelector = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
781
783
|
|
|
782
784
|
// NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
|
|
783
785
|
// However, we need to explicitly define this otherwise the prop-types babel plugin
|
|
@@ -850,7 +852,7 @@ const ModalPage = _ref => {
|
|
|
850
852
|
onInteractOutside: e => {
|
|
851
853
|
// Prevent only the modal from closing, handle all other events
|
|
852
854
|
const overlay = document.querySelector('[data-role="modal-overlay-clickable"]');
|
|
853
|
-
if (!
|
|
855
|
+
if (!overlay?.contains(e.target)) {
|
|
854
856
|
e.preventDefault();
|
|
855
857
|
}
|
|
856
858
|
},
|
|
@@ -1084,7 +1086,7 @@ const TabularModalPage = _ref => {
|
|
|
1084
1086
|
})
|
|
1085
1087
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1086
1088
|
children: jsxRuntime.jsx(CustomViewSelector, {
|
|
1087
|
-
margin:
|
|
1089
|
+
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1088
1090
|
customViewLocatorCodes: props.customViewLocatorCodes
|
|
1089
1091
|
})
|
|
1090
1092
|
}), jsxRuntime.jsx(ModalContentWrapper, {
|
|
@@ -1131,17 +1133,13 @@ const DetailPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
1131
1133
|
const HeaderControlsWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1132
1134
|
target: "etkdonc0"
|
|
1133
1135
|
} )("margin-top:", designSystem.designTokens.spacingS, ";" + ("" ));
|
|
1134
|
-
const getCustomViewsSelectorMargin = hasContentBelow => {
|
|
1135
|
-
var _context;
|
|
1136
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(designSystem.designTokens.spacing40, " 0 ")).call(_context, hasContentBelow ? designSystem.designTokens.spacing40 : '0', " 0");
|
|
1137
|
-
};
|
|
1136
|
+
const getCustomViewsSelectorMargin = hasContentBelow => `${designSystem.designTokens.spacing40} 0 ${hasContentBelow ? designSystem.designTokens.spacing40 : '0'} 0`;
|
|
1138
1137
|
|
|
1139
1138
|
// NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
|
|
1140
1139
|
// However, we need to explicitly define this otherwise the prop-types babel plugin
|
|
1141
1140
|
// does not recognize the object shape.
|
|
1142
1141
|
|
|
1143
1142
|
const CustomFormDetailPage = _ref => {
|
|
1144
|
-
var _props$title;
|
|
1145
1143
|
let _ref$hideControls = _ref.hideControls,
|
|
1146
1144
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1147
1145
|
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
@@ -1152,7 +1150,7 @@ const CustomFormDetailPage = _ref => {
|
|
|
1152
1150
|
previousPathLabel: props.previousPathLabel,
|
|
1153
1151
|
onClick: props.onPreviousPathClick
|
|
1154
1152
|
}), props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1155
|
-
title:
|
|
1153
|
+
title: props.title ?? '',
|
|
1156
1154
|
subtitle: props.subtitle,
|
|
1157
1155
|
titleSize: "big"
|
|
1158
1156
|
}), jsxRuntime.jsx(CustomViewSelector, {
|
|
@@ -1238,7 +1236,6 @@ InfoDetailPage.PageHeaderTitle = PageHeaderTitle;
|
|
|
1238
1236
|
|
|
1239
1237
|
const _excluded$6 = ["hideControls"];
|
|
1240
1238
|
const TabularDetailPage = _ref => {
|
|
1241
|
-
var _props$title;
|
|
1242
1239
|
let _ref$hideControls = _ref.hideControls,
|
|
1243
1240
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1244
1241
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
@@ -1249,7 +1246,7 @@ const TabularDetailPage = _ref => {
|
|
|
1249
1246
|
previousPathLabel: props.previousPathLabel,
|
|
1250
1247
|
onClick: props.onPreviousPathClick
|
|
1251
1248
|
}), props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1252
|
-
title:
|
|
1249
|
+
title: props.title ?? '',
|
|
1253
1250
|
subtitle: props.subtitle,
|
|
1254
1251
|
titleSize: "big"
|
|
1255
1252
|
}), jsxRuntime.jsx(ControlsContainter, {
|
|
@@ -1263,7 +1260,7 @@ const TabularDetailPage = _ref => {
|
|
|
1263
1260
|
})]
|
|
1264
1261
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1265
1262
|
children: jsxRuntime.jsx(CustomViewSelector, {
|
|
1266
|
-
margin:
|
|
1263
|
+
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1267
1264
|
customViewLocatorCodes: props.customViewLocatorCodes
|
|
1268
1265
|
})
|
|
1269
1266
|
}), jsxRuntime.jsx(ContentWrapper$2, {
|
|
@@ -1283,7 +1280,7 @@ TabularDetailPage.PageHeaderTitle = PageHeaderTitle;
|
|
|
1283
1280
|
// This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
|
|
1284
1281
|
TabularDetailPage.Intl = i18n.sharedMessages;
|
|
1285
1282
|
|
|
1286
|
-
const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-
|
|
1283
|
+
const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-b182d2dd.cjs.prod.js' /* webpackChunkName: "public-page-layout" */); }));
|
|
1287
1284
|
|
|
1288
1285
|
const MainPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1289
1286
|
target: "ev8m2jf2"
|
|
@@ -1298,9 +1295,8 @@ const MainPageContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
1298
1295
|
} )("flex:1;flex-basis:0;overflow:auto;margin:", designTokens.marginForPageContent, ";" + ("" ));
|
|
1299
1296
|
|
|
1300
1297
|
const _excluded$5 = ["hideControls", "hideDivider"];
|
|
1301
|
-
const headerRowMargin =
|
|
1298
|
+
const headerRowMargin = `${designSystem.designTokens.spacing40} 0 0 0`;
|
|
1302
1299
|
const CustomFormMainPage = _ref => {
|
|
1303
|
-
var _props$title;
|
|
1304
1300
|
let _ref$hideControls = _ref.hideControls,
|
|
1305
1301
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1306
1302
|
_ref$hideDivider = _ref.hideDivider,
|
|
@@ -1309,7 +1305,7 @@ const CustomFormMainPage = _ref => {
|
|
|
1309
1305
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1310
1306
|
children: [jsxRuntime.jsxs(MainPageContainer, {
|
|
1311
1307
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1312
|
-
title:
|
|
1308
|
+
title: props.title ?? '',
|
|
1313
1309
|
subtitle: props.subtitle,
|
|
1314
1310
|
titleSize: "big"
|
|
1315
1311
|
}), jsxRuntime.jsx(CustomViewSelector, {
|
|
@@ -1401,14 +1397,13 @@ InfoMainPage.PageHeaderTitle = PageHeaderTitle;
|
|
|
1401
1397
|
|
|
1402
1398
|
const _excluded$3 = ["hideControls"];
|
|
1403
1399
|
const TabularMainPage = _ref => {
|
|
1404
|
-
var _props$title;
|
|
1405
1400
|
let _ref$hideControls = _ref.hideControls,
|
|
1406
1401
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1407
1402
|
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1408
1403
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1409
1404
|
children: [jsxRuntime.jsxs(TabularPageContainer, {
|
|
1410
1405
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1411
|
-
title:
|
|
1406
|
+
title: props.title ?? '',
|
|
1412
1407
|
subtitle: props.subtitle,
|
|
1413
1408
|
titleSize: "big"
|
|
1414
1409
|
}), jsxRuntime.jsx(ControlsContainter, {
|
|
@@ -1422,7 +1417,7 @@ const TabularMainPage = _ref => {
|
|
|
1422
1417
|
})]
|
|
1423
1418
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1424
1419
|
children: jsxRuntime.jsx(CustomViewSelector, {
|
|
1425
|
-
margin:
|
|
1420
|
+
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1426
1421
|
customViewLocatorCodes: props.customViewLocatorCodes
|
|
1427
1422
|
})
|
|
1428
1423
|
}), jsxRuntime.jsx(ContentWrapper$2, {
|
|
@@ -1755,9 +1750,8 @@ const messages$1 = reactIntl.defineMessages({
|
|
|
1755
1750
|
|
|
1756
1751
|
const isIframeReady = iFrameElementRef => {
|
|
1757
1752
|
try {
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
} catch (_unused) {
|
|
1753
|
+
return iFrameElementRef?.contentWindow?.document.readyState === 'complete';
|
|
1754
|
+
} catch {
|
|
1761
1755
|
// Trying to access the contentWindow of a cross-origin iFrame will throw an error.
|
|
1762
1756
|
// We are not supposed to even get here because the iFrame must use
|
|
1763
1757
|
// a URL from our very same domain (the custom view is proxied through our http-proxy service).
|
|
@@ -1777,20 +1771,15 @@ const CustomPanelIframe = /*#__PURE__*/_styled__default["default"]("iframe", {
|
|
|
1777
1771
|
styles: "height:100%;width:100%;border:none"
|
|
1778
1772
|
} );
|
|
1779
1773
|
function CustomViewLoader(props) {
|
|
1780
|
-
var _props$customView$typ;
|
|
1781
1774
|
const iFrameElementRef = react$1.useRef(null);
|
|
1782
1775
|
const dataLocale = applicationShellConnectors.useApplicationContext(context => context.dataLocale);
|
|
1783
|
-
const projectKey = applicationShellConnectors.useApplicationContext(context =>
|
|
1784
|
-
var _context$project;
|
|
1785
|
-
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
1786
|
-
});
|
|
1776
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
1787
1777
|
const featureFlags = reactBroadcast.useAllFeatureToggles();
|
|
1788
1778
|
const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
|
|
1789
1779
|
const showNotification = actionsGlobal.useShowNotification();
|
|
1790
1780
|
const intl = reactIntl.useIntl();
|
|
1791
1781
|
const hasSentInitializationMessages = react$1.useRef(false);
|
|
1792
1782
|
const sendInitializationMessages = react$1.useCallback(() => {
|
|
1793
|
-
var _iFrameElementRef$cur, _context;
|
|
1794
1783
|
// If we have already sent the initialization messages, do not send them again.
|
|
1795
1784
|
// The message can be sent either as a response to the CUSTOM_VIEW_READY message
|
|
1796
1785
|
// or as a result of a setTimeout after 500ms. In any case, this message should be sent only once.
|
|
@@ -1799,12 +1788,12 @@ function CustomViewLoader(props) {
|
|
|
1799
1788
|
}
|
|
1800
1789
|
|
|
1801
1790
|
// Transfer port2 to the iFrame so it can send messages back privately
|
|
1802
|
-
|
|
1791
|
+
iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
|
|
1803
1792
|
|
|
1804
1793
|
// Send the initialization message to the iFrame
|
|
1805
1794
|
iFrameCommunicationChannel.current.port1.postMessage({
|
|
1806
1795
|
source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
|
|
1807
|
-
destination:
|
|
1796
|
+
destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
|
|
1808
1797
|
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
|
|
1809
1798
|
eventData: {
|
|
1810
1799
|
context: {
|
|
@@ -1874,31 +1863,31 @@ function CustomViewLoader(props) {
|
|
|
1874
1863
|
window.addEventListener('message', messageFromIFrameHandler);
|
|
1875
1864
|
return () => {
|
|
1876
1865
|
window.removeEventListener('message', messageFromIFrameHandler);
|
|
1877
|
-
communicationChannel
|
|
1866
|
+
communicationChannel?.port1.close();
|
|
1878
1867
|
};
|
|
1879
1868
|
}, []);
|
|
1880
1869
|
|
|
1881
1870
|
// Currently we only support custom panels
|
|
1882
1871
|
if (props.customView.type !== 'CustomPanel') {
|
|
1883
|
-
sentry.reportErrorToSentry(new Error(
|
|
1872
|
+
sentry.reportErrorToSentry(new Error(`CustomViewLoader: Provided Custom View has an unsupported type: ${props.customView.type}. Supported types: ['CustomPanel'].`));
|
|
1884
1873
|
return null;
|
|
1885
1874
|
}
|
|
1886
|
-
const panelSize =
|
|
1875
|
+
const panelSize = props.customView.typeSettings?.size?.toLocaleLowerCase() || 'large';
|
|
1887
1876
|
const iFrameUrl = [window.location.origin, 'custom-views', props.customView.id, 'projects', projectKey].join('/');
|
|
1888
1877
|
return jsxRuntime.jsx(ModalPage, {
|
|
1889
1878
|
isOpen: true,
|
|
1890
1879
|
onClose: props.onClose,
|
|
1891
1880
|
size: panelSize === 'small' ? 10 : 30,
|
|
1892
|
-
title:
|
|
1881
|
+
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
1893
1882
|
hideTopBar: true,
|
|
1894
1883
|
children: jsxRuntime.jsx(ContentWrapper, {
|
|
1895
1884
|
children: jsxRuntime.jsx(CustomPanelIframe, {
|
|
1896
|
-
id:
|
|
1897
|
-
title:
|
|
1885
|
+
id: `custom-view-${props.customView.id}`,
|
|
1886
|
+
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
1898
1887
|
ref: iFrameElementRef,
|
|
1899
1888
|
src: iFrameUrl,
|
|
1900
1889
|
onLoad: onLoadSuccessHandler
|
|
1901
|
-
},
|
|
1890
|
+
}, `custom-view-${props.customView.id}`)
|
|
1902
1891
|
})
|
|
1903
1892
|
});
|
|
1904
1893
|
}
|
|
@@ -1999,21 +1988,20 @@ var _ref = {
|
|
|
1999
1988
|
styles: "display:flex;height:1px;margin-top:-1px"
|
|
2000
1989
|
} ;
|
|
2001
1990
|
const PortalsContainer = /*#__PURE__*/react$1.forwardRef((props, ref) => {
|
|
2002
|
-
var _props$offsetTop, _props$offsetLeft, _props$offsetLeftOnEx, _props$containerSelec, _props$zIndex, _props$baseModalZInde, _current, _current2;
|
|
2003
1991
|
// Initialize props with default values.
|
|
2004
1992
|
// NOTE: using `defaultProps` with `forwardRef` results in the type declarations
|
|
2005
1993
|
// to ignore the `defaultProps`. Therefore, the default props are typed
|
|
2006
1994
|
// as optional and we initialize the value here with the default values.
|
|
2007
|
-
const offsetTop =
|
|
2008
|
-
const offsetLeft =
|
|
2009
|
-
const offsetLeftOnExpandedMenu =
|
|
2010
|
-
const containerSelectorToPreventScrollingOnOpen =
|
|
2011
|
-
const zIndex =
|
|
2012
|
-
const baseModalZIndex =
|
|
1995
|
+
const offsetTop = props.offsetTop ?? '0px';
|
|
1996
|
+
const offsetLeft = props.offsetLeft ?? '0px';
|
|
1997
|
+
const offsetLeftOnExpandedMenu = props.offsetLeftOnExpandedMenu ?? '0px';
|
|
1998
|
+
const containerSelectorToPreventScrollingOnOpen = props.containerSelectorToPreventScrollingOnOpen ?? 'main';
|
|
1999
|
+
const zIndex = props.zIndex ?? 10000;
|
|
2000
|
+
const baseModalZIndex = props.baseModalZIndex ?? 1000;
|
|
2013
2001
|
const modalWidthTransition = 'width 150ms cubic-bezier(1, 0, 0.58, 1)';
|
|
2014
2002
|
const portalsContainerRef = react$1.useRef(null);
|
|
2015
|
-
const globalNotificationsElementDimensions = useObserverElementDimensions(ref
|
|
2016
|
-
const pageNotificationsElementDimensions = useObserverElementDimensions(ref
|
|
2003
|
+
const globalNotificationsElementDimensions = useObserverElementDimensions(ref?.current?.notificationsGlobalRef);
|
|
2004
|
+
const pageNotificationsElementDimensions = useObserverElementDimensions(ref?.current?.notificationsPageRef);
|
|
2017
2005
|
const _useState3 = react$1.useState([]),
|
|
2018
2006
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
2019
2007
|
stackingLayers = _useState4[0],
|