@commercetools-frontend/application-components 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-components.cjs.dev.js +86 -97
- package/dist/commercetools-frontend-application-components.cjs.prod.js +75 -88
- package/dist/commercetools-frontend-application-components.esm.js +86 -96
- package/dist/declarations/src/components/detail-pages/custom-form-detail-page/custom-form-detail-page.d.ts +30 -1
- package/dist/declarations/src/components/detail-pages/form-detail-page/form-detail-page.d.ts +54 -1
- package/dist/declarations/src/components/detail-pages/info-detail-page/info-detail-page.d.ts +21 -0
- package/dist/declarations/src/components/detail-pages/tabular-detail-page/tabular-detail-page.d.ts +30 -0
- package/dist/declarations/src/components/dialogs/form-dialog/form-dialog.d.ts +1 -0
- package/dist/declarations/src/components/dialogs/internals/dialog-footer.d.ts +2 -1
- package/dist/declarations/src/components/internals/page-header.d.ts +3 -0
- package/dist/declarations/src/components/main-pages/custom-form-main-page/custom-form-main-page.d.ts +35 -3
- package/dist/declarations/src/components/main-pages/form-main-page/form-main-page.d.ts +51 -2
- package/dist/declarations/src/components/main-pages/info-main-page/info-main-page.d.ts +15 -0
- package/dist/declarations/src/components/main-pages/tabular-main-page/tabular-main-page.d.ts +27 -1
- package/dist/declarations/src/components/modal-pages/custom-form-modal-page/custom-form-modal-page.d.ts +9 -0
- package/dist/declarations/src/components/modal-pages/form-modal-page/form-modal-page.d.ts +12 -1
- package/dist/declarations/src/components/modal-pages/info-modal-page/info-modal-page.d.ts +9 -0
- package/dist/declarations/src/components/modal-pages/internals/modal-page.d.ts +6 -0
- package/dist/declarations/src/components/modal-pages/tabular-modal-page/tabular-modal-page.d.ts +9 -0
- package/dist/declarations/src/components/portals-container/portals-container.d.ts +29 -0
- package/dist/declarations/src/components/public-page-layout/public-page-layout.d.ts +17 -0
- package/dist/declarations/src/components/tab-header/tab-header.d.ts +19 -0
- package/dist/declarations/src/types/generated/settings.d.ts +22 -0
- package/dist/{public-page-layout-684509fb.esm.js → public-page-layout-2b41c29a.esm.js} +1 -1
- package/dist/{public-page-layout-eae1f3c9.cjs.dev.js → public-page-layout-a290e3fe.cjs.dev.js} +1 -1
- package/dist/{public-page-layout-6cc4616e.cjs.prod.js → public-page-layout-b24f0bd7.cjs.prod.js} +1 -1
- package/package.json +26 -26
|
@@ -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 react$1 = require('react');
|
|
24
23
|
var _styled = require('@emotion/styled/base');
|
|
@@ -65,7 +64,6 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
|
|
|
65
64
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
66
65
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
67
66
|
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
68
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
69
67
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
70
68
|
var Modal__default = /*#__PURE__*/_interopDefault(Modal);
|
|
71
69
|
var Card__default = /*#__PURE__*/_interopDefault(Card);
|
|
@@ -90,20 +88,18 @@ var Stamp__default = /*#__PURE__*/_interopDefault(Stamp);
|
|
|
90
88
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
91
89
|
|
|
92
90
|
// NOTE: This string will be replaced on build time with the package version.
|
|
93
|
-
var version = "22.
|
|
94
|
-
|
|
95
|
-
var _context, _context2, _context3, _context4, _context5;
|
|
91
|
+
var version = "22.31.0";
|
|
96
92
|
|
|
97
93
|
// We keep these tokens as they are related to page layout components which should have
|
|
98
94
|
// a slightly different layout (margins/paddings) when used within a Custom View panel.
|
|
99
95
|
// https://github.com/commercetools/merchant-center-application-kit/pull/3353
|
|
100
96
|
const themesOverrides = {
|
|
101
97
|
default: {
|
|
102
|
-
marginForCustomViewsSelectorAsTabular:
|
|
103
|
-
marginForPageContent:
|
|
104
|
-
paddingForDetailPageHeader:
|
|
105
|
-
paddingForMainPageHeader:
|
|
106
|
-
paddingForTabularPageHeader:
|
|
98
|
+
marginForCustomViewsSelectorAsTabular: `0 ${designSystem.designTokens.spacing55}`,
|
|
99
|
+
marginForPageContent: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55}`,
|
|
100
|
+
paddingForDetailPageHeader: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55} ${designSystem.designTokens.spacing40}`,
|
|
101
|
+
paddingForMainPageHeader: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55} 0`,
|
|
102
|
+
paddingForTabularPageHeader: `${designSystem.designTokens.spacing40} ${designSystem.designTokens.spacing55} 0`,
|
|
107
103
|
backgroundColorForNavbar: designSystem.designTokens.colorPrimary10,
|
|
108
104
|
backgroundColorForNavbarHeader: designSystem.designTokens.colorPrimary10,
|
|
109
105
|
fontColorForTabLabelWhenActive: designSystem.designTokens.colorPrimary
|
|
@@ -207,12 +203,13 @@ const getModalContentStyles = props => {
|
|
|
207
203
|
const baseStyles = /*#__PURE__*/react.css("display:grid;height:100%;width:100%;outline:none;pointer-events:none;", gridStyle, ";" + ("" ), "" );
|
|
208
204
|
return baseStyles;
|
|
209
205
|
};
|
|
210
|
-
const getOverlayStyles$1 = props => /*#__PURE__*/react.css("display:flex;position:absolute;z-index:", typeof props.zIndex === 'number' ?
|
|
211
|
-
|
|
206
|
+
const getOverlayStyles$1 = props => /*#__PURE__*/react.css("display:flex;position:absolute;z-index:", typeof props.zIndex === 'number' ?
|
|
207
|
+
// Use `!important` to overwrite the default value assigned by the Stacking Layer System.
|
|
208
|
+
`${props.zIndex} !important` : 'auto', ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ), "" );
|
|
212
209
|
|
|
213
210
|
function ownKeys$7(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; }
|
|
214
211
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
215
|
-
const getDefaultParentSelector$1 = () => document.querySelector(
|
|
212
|
+
const getDefaultParentSelector$1 = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
216
213
|
const getOverlayElement$1 = (props, contentElement) =>
|
|
217
214
|
// Assign the `data-role` to the overlay container, which is used as
|
|
218
215
|
// the CSS selector in the `<PortalsContainer>`.
|
|
@@ -320,7 +317,7 @@ const DialogHeader = props => jsxRuntime.jsx("div", {
|
|
|
320
317
|
label: "Close dialog",
|
|
321
318
|
onClick: props.onClose,
|
|
322
319
|
icon: jsxRuntime.jsx(icons.CloseIcon, {}),
|
|
323
|
-
size: "
|
|
320
|
+
size: "30"
|
|
324
321
|
})]
|
|
325
322
|
})
|
|
326
323
|
});
|
|
@@ -366,18 +363,24 @@ const DialogFooter = props => {
|
|
|
366
363
|
return jsxRuntime.jsx("div", {
|
|
367
364
|
css: /*#__PURE__*/react.css("margin-top:", designSystem.designTokens.spacing50, ";" + ("" ), "" ),
|
|
368
365
|
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
369
|
-
scale: "m",
|
|
370
366
|
alignItems: "center",
|
|
371
|
-
justifyContent: "
|
|
372
|
-
children: [jsxRuntime.jsx(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
367
|
+
justifyContent: "space-between",
|
|
368
|
+
children: [jsxRuntime.jsx("div", {
|
|
369
|
+
children: props.footerContent
|
|
370
|
+
}), jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
371
|
+
scale: "m",
|
|
372
|
+
alignItems: "center",
|
|
373
|
+
justifyContent: "flex-end",
|
|
374
|
+
children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$6({
|
|
375
|
+
label: getFormattedLabel(props.labelSecondary, intl),
|
|
376
|
+
onClick: props.onCancel,
|
|
377
|
+
iconLeft: props.iconLeftSecondaryButton
|
|
378
|
+
}, filterDataAttributes(props.dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$6({
|
|
379
|
+
label: getFormattedLabel(props.labelPrimary, intl),
|
|
380
|
+
onClick: props.onConfirm,
|
|
381
|
+
isDisabled: props.isPrimaryButtonDisabled
|
|
382
|
+
}, filterDataAttributes(props.dataAttributesPrimaryButton)))]
|
|
383
|
+
})]
|
|
381
384
|
})
|
|
382
385
|
});
|
|
383
386
|
};
|
|
@@ -447,7 +450,8 @@ const FormDialog = props => jsxRuntime.jsxs(DialogContainer, {
|
|
|
447
450
|
onConfirm: props.onPrimaryButtonClick,
|
|
448
451
|
dataAttributesSecondaryButton: props.dataAttributesSecondaryButton,
|
|
449
452
|
dataAttributesPrimaryButton: props.dataAttributesPrimaryButton,
|
|
450
|
-
iconLeftSecondaryButton: props.iconLeftSecondaryButton
|
|
453
|
+
iconLeftSecondaryButton: props.iconLeftSecondaryButton,
|
|
454
|
+
footerContent: props.footerContent
|
|
451
455
|
})]
|
|
452
456
|
});
|
|
453
457
|
FormDialog.propTypes = {};
|
|
@@ -527,7 +531,7 @@ const ModalPageTopBar = props => {
|
|
|
527
531
|
icon: jsxRuntime.jsx(LargeIconWrapper, {
|
|
528
532
|
children: jsxRuntime.jsx(icons.CloseIcon, {})
|
|
529
533
|
}),
|
|
530
|
-
size: "
|
|
534
|
+
size: "40"
|
|
531
535
|
})]
|
|
532
536
|
});
|
|
533
537
|
};
|
|
@@ -553,14 +557,13 @@ const stylesBySize = {
|
|
|
553
557
|
transitionTime: 300
|
|
554
558
|
}
|
|
555
559
|
};
|
|
556
|
-
const getContainerStyles = props =>
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
"".concat(props.zIndex, " !important") : 'auto', ";top:0;left:0;width:100%;height:100%;background-color:hsla(195, 35%, 20%, 0.05);opacity:0;transition:transform ", stylesBySize[props.size].transitionTime, "ms ease;" + ("" ), "" );
|
|
560
|
+
const getContainerStyles = props => /*#__PURE__*/react.css("position:absolute;top:0;right:0;height:100%;width:", props.size !== 'scale' ?
|
|
561
|
+
// In case we're using a specific size, we want it to be used until there's no space left.
|
|
562
|
+
// In such scenario, we want the modal to be as wide as possible, but using the shared indentation width size.
|
|
563
|
+
`min(${stylesBySize[props.size].width}, calc(100% - ${constants.PORTALS_CONTAINER_INDENTATION_SIZE})) !important` : stylesBySize.scale.width, ";display:flex;flex-direction:column;background-color:", designSystem.customProperties.colorSurface, ";box-shadow:0px 0px 40px 0px rgba(0, 0, 0, 0.1);outline:0;transform:translate3d(\n ", props.size !== 'scale' ? stylesBySize[props.size].width : '30px', ",\n 0,\n 0\n );transition:transform ", stylesBySize[props.size].transitionTime, "ms ease;" + ("" ), "" );
|
|
564
|
+
const getOverlayStyles = props => /*#__PURE__*/react.css("position:absolute;z-index:", typeof props.zIndex === 'number' ?
|
|
565
|
+
// Use `!important` to overwrite the default value assigned by the Stacking Layer System.
|
|
566
|
+
`${props.zIndex} !important` : 'auto', ";top:0;left:0;width:100%;height:100%;background-color:hsla(195, 35%, 20%, 0.05);opacity:0;transition:transform ", stylesBySize[props.size].transitionTime, "ms ease;" + ("" ), "" );
|
|
564
567
|
var _ref3 = {
|
|
565
568
|
name: "1ffv7m4",
|
|
566
569
|
styles: "transform:translate3d(0, 0, 0)!important"
|
|
@@ -580,7 +583,7 @@ const getBeforeCloseOverlayAnimation = () => _ref$5;
|
|
|
580
583
|
|
|
581
584
|
function ownKeys$5(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; }
|
|
582
585
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
583
|
-
const getDefaultParentSelector = () => document.querySelector(
|
|
586
|
+
const getDefaultParentSelector = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
584
587
|
const getOverlayElement = (props, contentElement) =>
|
|
585
588
|
// Assign the `data-role` to the overlay container, which is used as
|
|
586
589
|
// the CSS selector in the `<PortalsContainer>`.
|
|
@@ -629,7 +632,6 @@ const ModalPage = props => {
|
|
|
629
632
|
}, [onClose, props.shouldDelayOnClose, TRANSITION_DURATION]);
|
|
630
633
|
return jsxRuntime.jsx(react.ClassNames, {
|
|
631
634
|
children: _ref => {
|
|
632
|
-
var _props$afterOpenStyle;
|
|
633
635
|
let makeClassName = _ref.css;
|
|
634
636
|
return jsxRuntime.jsxs(Modal__default["default"], {
|
|
635
637
|
isOpen: forceClose === true ? false : props.isOpen,
|
|
@@ -644,7 +646,7 @@ const ModalPage = props => {
|
|
|
644
646
|
},
|
|
645
647
|
className: {
|
|
646
648
|
base: makeClassName(getContainerStyles(props)),
|
|
647
|
-
afterOpen: typeof props.afterOpenStyles === 'string' ? props.afterOpenStyles : makeClassName(
|
|
649
|
+
afterOpen: typeof props.afterOpenStyles === 'string' ? props.afterOpenStyles : makeClassName(props.afterOpenStyles ?? getAfterOpenContainerAnimation()),
|
|
648
650
|
beforeClose: makeClassName(getBeforeCloseContainerAnimation(props))
|
|
649
651
|
},
|
|
650
652
|
contentLabel: props.title,
|
|
@@ -683,8 +685,7 @@ const messages$4 = reactIntl.defineMessages({
|
|
|
683
685
|
|
|
684
686
|
const isIframeReady = iFrameElementRef => {
|
|
685
687
|
try {
|
|
686
|
-
|
|
687
|
-
return (iFrameElementRef === null || iFrameElementRef === void 0 || (_iFrameElementRef$con = iFrameElementRef.contentWindow) === null || _iFrameElementRef$con === void 0 ? void 0 : _iFrameElementRef$con.document.readyState) === 'complete';
|
|
688
|
+
return iFrameElementRef?.contentWindow?.document.readyState === 'complete';
|
|
688
689
|
} catch {
|
|
689
690
|
// Trying to access the contentWindow of a cross-origin iFrame will throw an error.
|
|
690
691
|
// We are not supposed to even get here because the iFrame must use
|
|
@@ -705,13 +706,9 @@ const CustomPanelIframe = /*#__PURE__*/_styled__default["default"]("iframe", {
|
|
|
705
706
|
styles: "height:100%;width:100%;border:none"
|
|
706
707
|
} );
|
|
707
708
|
function CustomViewLoader(props) {
|
|
708
|
-
var _props$customView$typ;
|
|
709
709
|
const iFrameElementRef = react$1.useRef(null);
|
|
710
710
|
const dataLocale = applicationShellConnectors.useApplicationContext(context => context.dataLocale);
|
|
711
|
-
const projectKey = applicationShellConnectors.useApplicationContext(context =>
|
|
712
|
-
var _context$project;
|
|
713
|
-
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
714
|
-
});
|
|
711
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
715
712
|
const featureFlags = reactBroadcast.useAllFeatureToggles();
|
|
716
713
|
const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
|
|
717
714
|
const showNotification = actionsGlobal.useShowNotification();
|
|
@@ -729,7 +726,6 @@ function CustomViewLoader(props) {
|
|
|
729
726
|
// onLoad handler is called from the iFrame even where the URL is not valid
|
|
730
727
|
// (blocked by CORS, 404, etc.) so we need to make sure the iFrame is ready
|
|
731
728
|
const onLoadSuccessHandler = react$1.useCallback(() => {
|
|
732
|
-
var _iFrameElementRef$cur, _context;
|
|
733
729
|
// Show error and block if the iFrame is not ready
|
|
734
730
|
// (error loading it)
|
|
735
731
|
if (!isIframeReady(iFrameElementRef.current)) {
|
|
@@ -745,12 +741,12 @@ function CustomViewLoader(props) {
|
|
|
745
741
|
iFrameCommunicationChannel.current.port1.onmessage = messageFromIFrameHandler;
|
|
746
742
|
|
|
747
743
|
// Transfer port2 to the iFrame so it can send messages back privately
|
|
748
|
-
|
|
744
|
+
iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
|
|
749
745
|
|
|
750
746
|
// Send the initialization message to the iFrame
|
|
751
747
|
iFrameCommunicationChannel.current.port1.postMessage({
|
|
752
748
|
source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
|
|
753
|
-
destination:
|
|
749
|
+
destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
|
|
754
750
|
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
|
|
755
751
|
eventData: {
|
|
756
752
|
context: {
|
|
@@ -770,31 +766,31 @@ function CustomViewLoader(props) {
|
|
|
770
766
|
// Close the channel when the component unmounts
|
|
771
767
|
const communicationChannel = iFrameCommunicationChannel.current;
|
|
772
768
|
return () => {
|
|
773
|
-
communicationChannel
|
|
769
|
+
communicationChannel?.port1.close();
|
|
774
770
|
};
|
|
775
771
|
}, []);
|
|
776
772
|
|
|
777
773
|
// Currently we only support custom panels
|
|
778
774
|
if (props.customView.type !== 'CustomPanel') {
|
|
779
|
-
sentry.reportErrorToSentry(new Error(
|
|
775
|
+
sentry.reportErrorToSentry(new Error(`CustomViewLoader: Provided Custom View has an unsupported type: ${props.customView.type}. Supported types: ['CustomPanel'].`));
|
|
780
776
|
return null;
|
|
781
777
|
}
|
|
782
|
-
const panelSize =
|
|
778
|
+
const panelSize = props.customView.typeSettings?.size?.toLocaleLowerCase() || 'large';
|
|
783
779
|
const iFrameUrl = [window.location.origin, 'custom-views', props.customView.id, 'projects', projectKey].join('/');
|
|
784
780
|
return jsxRuntime.jsx(ModalPage, {
|
|
785
781
|
isOpen: true,
|
|
786
782
|
onClose: props.onClose,
|
|
787
783
|
size: panelSize === 'small' ? 10 : 30,
|
|
788
|
-
title:
|
|
784
|
+
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
789
785
|
hideTopBar: true,
|
|
790
786
|
children: jsxRuntime.jsx(ContentWrapper$2, {
|
|
791
787
|
children: jsxRuntime.jsx(CustomPanelIframe, {
|
|
792
|
-
id:
|
|
793
|
-
title:
|
|
788
|
+
id: `custom-view-${props.customView.id}`,
|
|
789
|
+
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
794
790
|
ref: iFrameElementRef,
|
|
795
791
|
src: iFrameUrl,
|
|
796
792
|
onLoad: onLoadSuccessHandler
|
|
797
|
-
},
|
|
793
|
+
}, `custom-view-${props.customView.id}`)
|
|
798
794
|
})
|
|
799
795
|
});
|
|
800
796
|
}
|
|
@@ -809,12 +805,11 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
809
805
|
|
|
810
806
|
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 } } } };
|
|
811
807
|
const useCustomViewsConnector = _ref => {
|
|
812
|
-
var _enableCustomViews$va, _data$allCustomViewsI;
|
|
813
808
|
let customViewLocatorCode = _ref.customViewLocatorCode;
|
|
814
809
|
const enableCustomViews = reactBroadcast.useFlagVariation(constants.featureFlags.CUSTOM_VIEWS);
|
|
815
810
|
const areCustomViewsEnabled =
|
|
816
811
|
// @ts-ignore In case it's coming from the MC API, it's an object { value: boolean }.
|
|
817
|
-
(
|
|
812
|
+
(enableCustomViews?.value ?? enableCustomViews) && process.env.DISABLE_CUSTOM_VIEWS_FEATURE !== 'true';
|
|
818
813
|
const _useMcQuery = applicationShellConnectors.useMcQuery(FetchCustomViewsQuery, {
|
|
819
814
|
variables: {
|
|
820
815
|
customViewLocatorCode
|
|
@@ -828,7 +823,7 @@ const useCustomViewsConnector = _ref => {
|
|
|
828
823
|
error = _useMcQuery.error,
|
|
829
824
|
loading = _useMcQuery.loading;
|
|
830
825
|
return {
|
|
831
|
-
customViews:
|
|
826
|
+
customViews: data?.allCustomViewsInstallationsByLocator?.map(installation => installation.customView) || [],
|
|
832
827
|
error,
|
|
833
828
|
loading
|
|
834
829
|
};
|
|
@@ -916,7 +911,7 @@ function CustomViewSelector(props) {
|
|
|
916
911
|
const isNotLastItem = index !== customViews.length - 1;
|
|
917
912
|
return jsxRuntime.jsxs(react$1.Fragment, {
|
|
918
913
|
children: [jsxRuntime.jsx(CustomViewSelectorItem, {
|
|
919
|
-
selected:
|
|
914
|
+
selected: selectedCustomView?.id === customView.id,
|
|
920
915
|
onClick: () => {
|
|
921
916
|
setSelectedCustomView(customView);
|
|
922
917
|
},
|
|
@@ -1031,7 +1026,7 @@ const PageHeader = props => {
|
|
|
1031
1026
|
truncate: true
|
|
1032
1027
|
}), props.children]
|
|
1033
1028
|
}), jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1034
|
-
margin:
|
|
1029
|
+
margin: `${designSystem.designTokens.spacing40} 0 0 0`,
|
|
1035
1030
|
customViewLocatorCode: props.customViewLocatorCode
|
|
1036
1031
|
})]
|
|
1037
1032
|
});
|
|
@@ -1219,7 +1214,7 @@ const useCustomViewLocatorSelector = function () {
|
|
|
1219
1214
|
});
|
|
1220
1215
|
});
|
|
1221
1216
|
return {
|
|
1222
|
-
currentCustomViewLocatorCode: customViewLocator
|
|
1217
|
+
currentCustomViewLocatorCode: customViewLocator?.[0]
|
|
1223
1218
|
};
|
|
1224
1219
|
};
|
|
1225
1220
|
|
|
@@ -1284,7 +1279,7 @@ const TabularModalPage = props => {
|
|
|
1284
1279
|
})
|
|
1285
1280
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1286
1281
|
children: jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1287
|
-
margin:
|
|
1282
|
+
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1288
1283
|
customViewLocatorCode: currentCustomViewLocatorCode
|
|
1289
1284
|
})
|
|
1290
1285
|
}), jsxRuntime.jsx(ModalContentWrapper, {
|
|
@@ -1333,10 +1328,7 @@ const DetailPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
1333
1328
|
const HeaderControlsWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1334
1329
|
target: "etkdonc0"
|
|
1335
1330
|
} )("margin-top:", designSystem.designTokens.spacingS, ";" + ("" ));
|
|
1336
|
-
const getCustomViewsSelectorMargin = hasContentBelow => {
|
|
1337
|
-
var _context;
|
|
1338
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(designSystem.designTokens.spacing40, " 0 ")).call(_context, hasContentBelow ? designSystem.designTokens.spacing40 : '0', " 0");
|
|
1339
|
-
};
|
|
1331
|
+
const getCustomViewsSelectorMargin = hasContentBelow => `${designSystem.designTokens.spacing40} 0 ${hasContentBelow ? designSystem.designTokens.spacing40 : '0'} 0`;
|
|
1340
1332
|
|
|
1341
1333
|
// NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
|
|
1342
1334
|
// However, we need to explicitly define this otherwise the prop-types babel plugin
|
|
@@ -1346,7 +1338,6 @@ const defaultProps$7 = {
|
|
|
1346
1338
|
hideControls: false
|
|
1347
1339
|
};
|
|
1348
1340
|
const CustomFormDetailPage = props => {
|
|
1349
|
-
var _props$title;
|
|
1350
1341
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1351
1342
|
children: [jsxRuntime.jsxs(DetailPageContainer, {
|
|
1352
1343
|
children: [jsxRuntime.jsx(PageTopBar, {
|
|
@@ -1354,7 +1345,7 @@ const CustomFormDetailPage = props => {
|
|
|
1354
1345
|
previousPathLabel: props.previousPathLabel,
|
|
1355
1346
|
onClick: props.onPreviousPathClick
|
|
1356
1347
|
}), props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1357
|
-
title:
|
|
1348
|
+
title: props.title ?? '',
|
|
1358
1349
|
subtitle: props.subtitle,
|
|
1359
1350
|
titleSize: "big"
|
|
1360
1351
|
}), jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
@@ -1444,7 +1435,6 @@ const defaultProps$5 = {
|
|
|
1444
1435
|
hideControls: false
|
|
1445
1436
|
};
|
|
1446
1437
|
const TabularDetailPage = props => {
|
|
1447
|
-
var _props$title;
|
|
1448
1438
|
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
1449
1439
|
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
1450
1440
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
@@ -1454,7 +1444,7 @@ const TabularDetailPage = props => {
|
|
|
1454
1444
|
previousPathLabel: props.previousPathLabel,
|
|
1455
1445
|
onClick: props.onPreviousPathClick
|
|
1456
1446
|
}), props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1457
|
-
title:
|
|
1447
|
+
title: props.title ?? '',
|
|
1458
1448
|
subtitle: props.subtitle,
|
|
1459
1449
|
titleSize: "big"
|
|
1460
1450
|
}), jsxRuntime.jsx(ControlsContainter, {
|
|
@@ -1468,7 +1458,7 @@ const TabularDetailPage = props => {
|
|
|
1468
1458
|
})]
|
|
1469
1459
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1470
1460
|
children: jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1471
|
-
margin:
|
|
1461
|
+
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1472
1462
|
customViewLocatorCode: currentCustomViewLocatorCode
|
|
1473
1463
|
})
|
|
1474
1464
|
}), jsxRuntime.jsx(ContentWrapper$1, {
|
|
@@ -1490,7 +1480,7 @@ TabularDetailPage.PageHeaderTitle = PageHeaderTitle;
|
|
|
1490
1480
|
// This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
|
|
1491
1481
|
TabularDetailPage.Intl = i18n.sharedMessages;
|
|
1492
1482
|
|
|
1493
|
-
const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-
|
|
1483
|
+
const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-b24f0bd7.cjs.prod.js' /* webpackChunkName: "public-page-layout" */); }));
|
|
1494
1484
|
|
|
1495
1485
|
const MainPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1496
1486
|
target: "ev8m2jf2"
|
|
@@ -1504,13 +1494,12 @@ const MainPageContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
1504
1494
|
target: "ev8m2jf0"
|
|
1505
1495
|
} )("flex:1;flex-basis:0;overflow:auto;margin:", designTokens.marginForPageContent, ";" + ("" ));
|
|
1506
1496
|
|
|
1507
|
-
const headerRowMargin =
|
|
1497
|
+
const headerRowMargin = `${designSystem.designTokens.spacing40} 0 0 0`;
|
|
1508
1498
|
const CustomFormMainPage = props => {
|
|
1509
|
-
var _props$title;
|
|
1510
1499
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1511
1500
|
children: [jsxRuntime.jsxs(MainPageContainer, {
|
|
1512
1501
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1513
|
-
title:
|
|
1502
|
+
title: props.title ?? '',
|
|
1514
1503
|
subtitle: props.subtitle,
|
|
1515
1504
|
titleSize: "big"
|
|
1516
1505
|
}), jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
@@ -1612,13 +1601,12 @@ const defaultProps$2 = {
|
|
|
1612
1601
|
hideControls: false
|
|
1613
1602
|
};
|
|
1614
1603
|
const TabularMainPage = props => {
|
|
1615
|
-
var _props$title;
|
|
1616
1604
|
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
1617
1605
|
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
1618
1606
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1619
1607
|
children: [jsxRuntime.jsxs(TabularPageContainer, {
|
|
1620
1608
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1621
|
-
title:
|
|
1609
|
+
title: props.title ?? '',
|
|
1622
1610
|
subtitle: props.subtitle,
|
|
1623
1611
|
titleSize: "big"
|
|
1624
1612
|
}), jsxRuntime.jsx(ControlsContainter, {
|
|
@@ -1632,7 +1620,7 @@ const TabularMainPage = props => {
|
|
|
1632
1620
|
})]
|
|
1633
1621
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1634
1622
|
children: jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1635
|
-
margin:
|
|
1623
|
+
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1636
1624
|
customViewLocatorCode: currentCustomViewLocatorCode
|
|
1637
1625
|
})
|
|
1638
1626
|
}), jsxRuntime.jsx(ContentWrapper$1, {
|
|
@@ -1923,7 +1911,7 @@ function Drawer(props) {
|
|
|
1923
1911
|
icon: jsxRuntime.jsx(LargeIconWrapper, {
|
|
1924
1912
|
children: jsxRuntime.jsx(icons.CloseIcon, {})
|
|
1925
1913
|
}),
|
|
1926
|
-
size: "
|
|
1914
|
+
size: "40"
|
|
1927
1915
|
})]
|
|
1928
1916
|
}), jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
1929
1917
|
justifyContent: "flex-end",
|
|
@@ -2056,21 +2044,20 @@ var _ref = {
|
|
|
2056
2044
|
styles: "display:flex;height:1px;margin-top:-1px"
|
|
2057
2045
|
} ;
|
|
2058
2046
|
const PortalsContainer = /*#__PURE__*/react$1.forwardRef((props, ref) => {
|
|
2059
|
-
var _props$offsetTop, _props$offsetLeft, _props$offsetLeftOnEx, _props$containerSelec, _props$zIndex, _props$baseModalZInde, _current, _current2;
|
|
2060
2047
|
// Initialize props with default values.
|
|
2061
2048
|
// NOTE: using `defaultProps` with `forwardRef` results in the type declarations
|
|
2062
2049
|
// to ignore the `defaultProps`. Therefore, the default props are typed
|
|
2063
2050
|
// as optional and we initialize the value here with the default values.
|
|
2064
|
-
const offsetTop =
|
|
2065
|
-
const offsetLeft =
|
|
2066
|
-
const offsetLeftOnExpandedMenu =
|
|
2067
|
-
const containerSelectorToPreventScrollingOnOpen =
|
|
2068
|
-
const zIndex =
|
|
2069
|
-
const baseModalZIndex =
|
|
2051
|
+
const offsetTop = props.offsetTop ?? '0px';
|
|
2052
|
+
const offsetLeft = props.offsetLeft ?? '0px';
|
|
2053
|
+
const offsetLeftOnExpandedMenu = props.offsetLeftOnExpandedMenu ?? '0px';
|
|
2054
|
+
const containerSelectorToPreventScrollingOnOpen = props.containerSelectorToPreventScrollingOnOpen ?? 'main';
|
|
2055
|
+
const zIndex = props.zIndex ?? 10000;
|
|
2056
|
+
const baseModalZIndex = props.baseModalZIndex ?? 1000;
|
|
2070
2057
|
const modalWidthTransition = 'width 150ms cubic-bezier(1, 0, 0.58, 1)';
|
|
2071
2058
|
const portalsContainerRef = react$1.useRef(null);
|
|
2072
|
-
const globalNotificationsElementDimensions = useObserverElementDimensions(ref
|
|
2073
|
-
const pageNotificationsElementDimensions = useObserverElementDimensions(ref
|
|
2059
|
+
const globalNotificationsElementDimensions = useObserverElementDimensions(ref?.current?.notificationsGlobalRef);
|
|
2060
|
+
const pageNotificationsElementDimensions = useObserverElementDimensions(ref?.current?.notificationsPageRef);
|
|
2074
2061
|
const _useState3 = react$1.useState([]),
|
|
2075
2062
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
2076
2063
|
stackingLayers = _useState4[0],
|