@commercetools-frontend/application-components 22.8.3 → 22.9.1
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 +340 -59
- package/dist/commercetools-frontend-application-components.cjs.prod.js +281 -38
- package/dist/commercetools-frontend-application-components.esm.js +340 -61
- package/dist/declarations/src/components/custom-views/custom-view-loader/custom-view-loader.d.ts +8 -0
- package/dist/declarations/src/components/custom-views/custom-view-loader/index.d.ts +1 -0
- package/dist/declarations/src/components/custom-views/custom-view-loader/messages.d.ts +7 -0
- package/dist/declarations/src/components/custom-views/custom-views-selector/custom-views-selector.d.ts +9 -0
- package/dist/declarations/src/components/custom-views/custom-views-selector/index.d.ts +1 -0
- package/dist/declarations/src/components/custom-views/custom-views-selector/messages.d.ts +7 -0
- package/dist/declarations/src/components/custom-views/custom-views-selector/use-custom-views-connector.d.ts +11 -0
- package/dist/declarations/src/components/detail-pages/custom-form-detail-page/custom-form-detail-page.d.ts +1 -0
- package/dist/declarations/src/components/detail-pages/form-detail-page/form-detail-page.d.ts +1 -0
- package/dist/declarations/src/components/detail-pages/info-detail-page/info-detail-page.d.ts +1 -0
- package/dist/declarations/src/components/detail-pages/tabular-detail-page/tabular-detail-page.d.ts +1 -0
- package/dist/declarations/src/components/main-pages/custom-form-main-page/custom-form-main-page.d.ts +1 -0
- package/dist/declarations/src/components/main-pages/form-main-page/form-main-page.d.ts +1 -0
- package/dist/declarations/src/components/main-pages/info-main-page/info-main-page.d.ts +1 -0
- package/dist/declarations/src/components/main-pages/tabular-main-page/tabular-main-page.d.ts +1 -0
- package/dist/declarations/src/components/modal-pages/custom-form-modal-page/custom-form-modal-page.d.ts +1 -0
- package/dist/declarations/src/components/modal-pages/form-modal-page/form-modal-page.d.ts +1 -0
- package/dist/declarations/src/components/modal-pages/info-modal-page/info-modal-page.d.ts +1 -0
- package/dist/declarations/src/components/modal-pages/internals/modal-page.d.ts +1 -0
- package/dist/declarations/src/components/modal-pages/tabular-modal-page/tabular-modal-page.d.ts +1 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/types/generated/settings.d.ts +1832 -0
- package/dist/{public-page-layout-b7c648d2.esm.js → public-page-layout-055bb438.esm.js} +5 -2
- package/dist/{public-page-layout-f5b15f7b.cjs.prod.js → public-page-layout-3653aa0b.cjs.prod.js} +5 -2
- package/dist/{public-page-layout-5eb189a9.cjs.dev.js → public-page-layout-c011d275.cjs.dev.js} +5 -2
- package/package.json +14 -8
|
@@ -35,12 +35,15 @@ var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable
|
|
|
35
35
|
var omitBy = require('lodash/omitBy');
|
|
36
36
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
37
37
|
var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
|
|
38
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
39
|
+
var sentry = require('@commercetools-frontend/sentry');
|
|
40
|
+
var Constraints = require('@commercetools-uikit/constraints');
|
|
41
|
+
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
42
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
38
43
|
var FlatButton = require('@commercetools-uikit/flat-button');
|
|
39
44
|
var IconButton = require('@commercetools-uikit/icon-button');
|
|
40
|
-
var Constraints = require('@commercetools-uikit/constraints');
|
|
41
45
|
var PageNotFoundSVG = require('@commercetools-frontend/assets/images/page-not-found.svg');
|
|
42
46
|
var FailedAuthorizationSVG = require('@commercetools-frontend/assets/images/doors-closed.svg');
|
|
43
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
44
47
|
var useResizeObserver = require('@react-hook/resize-observer');
|
|
45
48
|
var hooks = require('@commercetools-uikit/hooks');
|
|
46
49
|
|
|
@@ -66,16 +69,16 @@ var SecondaryButton__default = /*#__PURE__*/_interopDefault(SecondaryButton);
|
|
|
66
69
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
67
70
|
var omitBy__default = /*#__PURE__*/_interopDefault(omitBy);
|
|
68
71
|
var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
|
|
72
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
73
|
+
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
69
74
|
var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
|
|
70
75
|
var IconButton__default = /*#__PURE__*/_interopDefault(IconButton);
|
|
71
|
-
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
72
76
|
var PageNotFoundSVG__default = /*#__PURE__*/_interopDefault(PageNotFoundSVG);
|
|
73
77
|
var FailedAuthorizationSVG__default = /*#__PURE__*/_interopDefault(FailedAuthorizationSVG);
|
|
74
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
75
78
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
76
79
|
|
|
77
80
|
// NOTE: This string will be replaced on build time with the package version.
|
|
78
|
-
var version = "22.
|
|
81
|
+
var version = "22.9.1";
|
|
79
82
|
|
|
80
83
|
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9;
|
|
81
84
|
const appKitSpacing55 = '40px';
|
|
@@ -145,8 +148,8 @@ var _ref$7 = {
|
|
|
145
148
|
} ;
|
|
146
149
|
const getLinkStyles = (isActive, isDisabled) => [/*#__PURE__*/react.css("font-size:", designSystem.designTokens.fontSizeDefault, ";padding:", designSystem.designTokens.spacingS, " ", designSystem.designTokens.spacingM, ";position:relative;text-align:center;display:inline-block;color:inherit;text-decoration:inherit;&:first-of-type{padding-left:", designTokens.paddingLeftForTabAsFirst, ";}", getBottomBorderStyles('transparent'), ";" + ("" ), "" ), isActive && /*#__PURE__*/react.css(getBottomBorderStyles(designSystem.designTokens.colorPrimary), " & h4{color:", designSystem.designTokens.colorPrimary, "!important;}" + ("" ), "" ), isDisabled && _ref$7, !isActive && !isDisabled && /*#__PURE__*/react.css(":hover,:focus,:active{& h4{color:", designSystem.designTokens.colorPrimary, "!important;}}" + ("" ), "" )];
|
|
147
150
|
|
|
148
|
-
function ownKeys$
|
|
149
|
-
function _objectSpread$
|
|
151
|
+
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; }
|
|
152
|
+
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; }
|
|
150
153
|
const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
|
|
151
154
|
const warnIfMissingContent = props => {
|
|
152
155
|
Boolean(props.intlMessage) || Boolean(props.label);
|
|
@@ -178,7 +181,7 @@ const TabHeader = props => {
|
|
|
178
181
|
label = intl.formatMessage(props.intlMessage);
|
|
179
182
|
}
|
|
180
183
|
warnIfMissingContent(props);
|
|
181
|
-
return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$
|
|
184
|
+
return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$7(_objectSpread$7({
|
|
182
185
|
role: "tab",
|
|
183
186
|
"aria-selected": isActive,
|
|
184
187
|
to: props.to,
|
|
@@ -237,13 +240,13 @@ const getModalContentStyles = props => {
|
|
|
237
240
|
const getOverlayStyles$1 = props => /*#__PURE__*/react.css("display:flex;position:absolute;z-index:", typeof props.zIndex === 'number' ? // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
|
|
238
241
|
"".concat(props.zIndex, " !important") : 'auto', ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ), "" );
|
|
239
242
|
|
|
240
|
-
function ownKeys$
|
|
241
|
-
function _objectSpread$
|
|
243
|
+
function ownKeys$6(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; }
|
|
244
|
+
function _objectSpread$6(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$6(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$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
242
245
|
const getDefaultParentSelector$1 = () => document.querySelector("#".concat(constants.PORTALS_CONTAINER_ID));
|
|
243
246
|
const getOverlayElement$1 = (props, contentElement) =>
|
|
244
247
|
// Assign the `data-role` to the overlay container, which is used as
|
|
245
248
|
// the CSS selector in the `<PortalsContainer>`.
|
|
246
|
-
jsxRuntime.jsx("div", _objectSpread$
|
|
249
|
+
jsxRuntime.jsx("div", _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
247
250
|
"data-role": "dialog-overlay",
|
|
248
251
|
children: contentElement
|
|
249
252
|
}));
|
|
@@ -371,8 +374,8 @@ function filterDataAttributes(obj) {
|
|
|
371
374
|
return omitBy__default["default"](obj, (_value, key) => !_startsWithInstanceProperty__default["default"](key).call(key, 'data-'));
|
|
372
375
|
}
|
|
373
376
|
|
|
374
|
-
function ownKeys$
|
|
375
|
-
function _objectSpread$
|
|
377
|
+
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; }
|
|
378
|
+
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; }
|
|
376
379
|
const defaultProps$g = {
|
|
377
380
|
isPrimaryButtonDisabled: false,
|
|
378
381
|
dataAttributesPrimaryButton: {},
|
|
@@ -387,11 +390,11 @@ const DialogFooter = props => {
|
|
|
387
390
|
scale: "m",
|
|
388
391
|
alignItems: "center",
|
|
389
392
|
justifyContent: "flex-end",
|
|
390
|
-
children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$
|
|
393
|
+
children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$5({
|
|
391
394
|
label: getFormattedLabel(props.labelSecondary, intl),
|
|
392
395
|
onClick: props.onCancel,
|
|
393
396
|
iconLeft: props.iconLeftSecondaryButton
|
|
394
|
-
}, filterDataAttributes(props.dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$
|
|
397
|
+
}, filterDataAttributes(props.dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$5({
|
|
395
398
|
label: getFormattedLabel(props.labelPrimary, intl),
|
|
396
399
|
onClick: props.onConfirm,
|
|
397
400
|
isDisabled: props.isPrimaryButtonDisabled
|
|
@@ -560,6 +563,243 @@ const PageWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
560
563
|
styles: "height:100%;display:flex;flex-direction:column"
|
|
561
564
|
} );
|
|
562
565
|
|
|
566
|
+
const ContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
567
|
+
target: "e1alzj9m0"
|
|
568
|
+
} )("height:100%;padding:", designSystem.designTokens.spacing40, " 40px;" + ("" ));
|
|
569
|
+
function CustomPanel(props) {
|
|
570
|
+
return jsxRuntime.jsx(ModalPage, {
|
|
571
|
+
hidePathLabel: true,
|
|
572
|
+
isOpen: true,
|
|
573
|
+
onClose: props.onClose,
|
|
574
|
+
size: props.size,
|
|
575
|
+
title: props.title,
|
|
576
|
+
children: jsxRuntime.jsx(ContentWrapper, {
|
|
577
|
+
children: props.children
|
|
578
|
+
})
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
CustomPanel.propTypes = {};
|
|
582
|
+
|
|
583
|
+
const messages$4 = reactIntl.defineMessages({
|
|
584
|
+
loadError: {
|
|
585
|
+
id: 'CustomViewLoader.error.load',
|
|
586
|
+
defaultMessage: 'We could not load the Custom View. Please contact your administrator to check its configuration.'
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
const isIframeReady = iFrameElementRef => {
|
|
591
|
+
try {
|
|
592
|
+
var _iFrameElementRef$con;
|
|
593
|
+
return (iFrameElementRef === null || iFrameElementRef === void 0 || (_iFrameElementRef$con = iFrameElementRef.contentWindow) === null || _iFrameElementRef$con === void 0 ? void 0 : _iFrameElementRef$con.document.readyState) === 'complete';
|
|
594
|
+
} catch {
|
|
595
|
+
// Trying to access the contentWindow of a cross-origin iFrame will throw an error.
|
|
596
|
+
// We are not supposed to even get here because the iFrame must use
|
|
597
|
+
// a URL from our very same domain (the custom view is proxied through our http-proxy service).
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
const CustomPanelIframe = /*#__PURE__*/_styled__default["default"]("iframe", {
|
|
602
|
+
target: "ewwxuwo0"
|
|
603
|
+
} )({
|
|
604
|
+
name: "174lt7a",
|
|
605
|
+
styles: "height:100%;width:100%;border:none"
|
|
606
|
+
} );
|
|
607
|
+
function CustomViewLoader(props) {
|
|
608
|
+
var _props$customView$typ;
|
|
609
|
+
const iFrameElementRef = react$1.useRef(null);
|
|
610
|
+
const dataLocale = applicationShellConnectors.useApplicationContext(context => context.dataLocale);
|
|
611
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => {
|
|
612
|
+
var _context$project;
|
|
613
|
+
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
614
|
+
});
|
|
615
|
+
const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
|
|
616
|
+
const showNotification = actionsGlobal.useShowNotification();
|
|
617
|
+
const intl = reactIntl.useIntl();
|
|
618
|
+
const messageFromIFrameHandler = react$1.useCallback(event => {
|
|
619
|
+
if (event.data.origin === window.location.origin) {
|
|
620
|
+
console.log('message received from iframe port: ', event);
|
|
621
|
+
}
|
|
622
|
+
}, []);
|
|
623
|
+
|
|
624
|
+
// onLoad handler is called from the iFrame even where the URL is not valid
|
|
625
|
+
// (blocked by CORS, 404, etc.) so we need to make sure the iFrame is ready
|
|
626
|
+
const onLoadSuccessHandler = react$1.useCallback(() => {
|
|
627
|
+
var _iFrameElementRef$cur, _context;
|
|
628
|
+
// Show error and block if the iFrame is not ready
|
|
629
|
+
// (error loading it)
|
|
630
|
+
if (!isIframeReady(iFrameElementRef.current)) {
|
|
631
|
+
showNotification({
|
|
632
|
+
domain: constants.DOMAINS.PAGE,
|
|
633
|
+
kind: constants.NOTIFICATION_KINDS_PAGE.error,
|
|
634
|
+
text: intl.formatMessage(messages$4.loadError)
|
|
635
|
+
});
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// Listen for messages from the iFrame
|
|
640
|
+
iFrameCommunicationChannel.current.port1.onmessage = messageFromIFrameHandler;
|
|
641
|
+
|
|
642
|
+
// Transfer port2 to the iFrame so it can send messages back privately
|
|
643
|
+
(_iFrameElementRef$cur = iFrameElementRef.current) === null || _iFrameElementRef$cur === void 0 || (_iFrameElementRef$cur = _iFrameElementRef$cur.contentWindow) === null || _iFrameElementRef$cur === void 0 || _iFrameElementRef$cur.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
|
|
644
|
+
|
|
645
|
+
// Send the initialization message to the iFrame
|
|
646
|
+
iFrameCommunicationChannel.current.port1.postMessage({
|
|
647
|
+
source: constants.CUSTOM_VIEWS_EVENTS_META.SOURCE,
|
|
648
|
+
destination: _concatInstanceProperty__default["default"](_context = "".concat(constants.CUSTOM_VIEWS_EVENTS_META.DESTINATION_PREFIX)).call(_context, props.customView.id),
|
|
649
|
+
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
|
|
650
|
+
eventData: {
|
|
651
|
+
context: {
|
|
652
|
+
dataLocale,
|
|
653
|
+
projectKey,
|
|
654
|
+
customViewConfig: props.customView,
|
|
655
|
+
hostUrl: props.hostUrl || window.location.href
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
// We want the effect to run only once so we don't need the dependencies array.
|
|
661
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
662
|
+
}, []);
|
|
663
|
+
react$1.useEffect(() => {
|
|
664
|
+
// Close the channel when the component unmounts
|
|
665
|
+
const communicationChannel = iFrameCommunicationChannel.current;
|
|
666
|
+
return () => {
|
|
667
|
+
communicationChannel === null || communicationChannel === void 0 || communicationChannel.port1.close();
|
|
668
|
+
};
|
|
669
|
+
}, []);
|
|
670
|
+
|
|
671
|
+
// Currently we only support custom panels
|
|
672
|
+
if (props.customView.type !== 'CustomPanel') {
|
|
673
|
+
sentry.reportErrorToSentry(new Error("CustomViewLoader: Provided Custom View has an unsupported type: ".concat(props.customView.type, ". Supported types: ['CustomPanel'].")));
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
676
|
+
const panelSize = ((_props$customView$typ = props.customView.typeSettings) === null || _props$customView$typ === void 0 || (_props$customView$typ = _props$customView$typ.size) === null || _props$customView$typ === void 0 ? void 0 : _props$customView$typ.toLocaleLowerCase()) || 'large';
|
|
677
|
+
const iFrameUrl = [window.location.origin, 'custom-views', props.customView.id, 'projects', projectKey].join('/');
|
|
678
|
+
return jsxRuntime.jsx(CustomPanel, {
|
|
679
|
+
title: "Custom View: ".concat(props.customView.defaultLabel),
|
|
680
|
+
onClose: props.onClose,
|
|
681
|
+
size: panelSize,
|
|
682
|
+
children: jsxRuntime.jsx(CustomPanelIframe, {
|
|
683
|
+
id: "custom-view-".concat(props.customView.id),
|
|
684
|
+
title: "Custom View: ".concat(props.customView.defaultLabel),
|
|
685
|
+
ref: iFrameElementRef,
|
|
686
|
+
src: iFrameUrl,
|
|
687
|
+
onLoad: onLoadSuccessHandler
|
|
688
|
+
}, "custom-view-".concat(props.customView.id))
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
CustomViewLoader.propTypes = {};
|
|
692
|
+
|
|
693
|
+
var messages$3 = reactIntl.defineMessages({
|
|
694
|
+
title: {
|
|
695
|
+
id: 'CustomViewsSelector.title',
|
|
696
|
+
defaultMessage: 'Custom Views:'
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
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 } } } };
|
|
701
|
+
const useCustomViewsConnector = _ref => {
|
|
702
|
+
var _data$allCustomViewsI;
|
|
703
|
+
let customViewLocatorCode = _ref.customViewLocatorCode;
|
|
704
|
+
const _useMcQuery = applicationShellConnectors.useMcQuery(FetchCustomViewsQuery, {
|
|
705
|
+
variables: {
|
|
706
|
+
customViewLocatorCode
|
|
707
|
+
},
|
|
708
|
+
context: {
|
|
709
|
+
target: constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
710
|
+
}
|
|
711
|
+
}),
|
|
712
|
+
data = _useMcQuery.data,
|
|
713
|
+
error = _useMcQuery.error,
|
|
714
|
+
loading = _useMcQuery.loading;
|
|
715
|
+
return {
|
|
716
|
+
customViews: (data === null || data === void 0 || (_data$allCustomViewsI = data.allCustomViewsInstallationsByLocator) === null || _data$allCustomViewsI === void 0 ? void 0 : _mapInstanceProperty__default["default"](_data$allCustomViewsI).call(_data$allCustomViewsI, installation => installation.customView)) || [],
|
|
717
|
+
error,
|
|
718
|
+
loading
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
function ownKeys$4(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; }
|
|
723
|
+
function _objectSpread$4(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$4(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$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
724
|
+
const COMPONENT_HEIGHT = '56px';
|
|
725
|
+
const Wrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
726
|
+
target: "e16cb3zv1"
|
|
727
|
+
} )("height:", props => props.shouldRender ? COMPONENT_HEIGHT : '0', ";overflow:hidden;transition:height 0.3s ease-in-out;" + ("" ));
|
|
728
|
+
const Container$2 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
729
|
+
target: "e16cb3zv0"
|
|
730
|
+
} )("background-color:", designSystem.designTokens.colorAccent98, ";padding:", designSystem.designTokens.spacing25, " ", designSystem.designTokens.spacing60, ";" + ("" ));
|
|
731
|
+
function CustomViewSelector(props) {
|
|
732
|
+
const _useState = react$1.useState(null),
|
|
733
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
734
|
+
selectedCustomView = _useState2[0],
|
|
735
|
+
setSelectedCustomView = _useState2[1];
|
|
736
|
+
const _useCustomViewsConnec = useCustomViewsConnector({
|
|
737
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
738
|
+
}),
|
|
739
|
+
customViews = _useCustomViewsConnec.customViews,
|
|
740
|
+
error = _useCustomViewsConnec.error,
|
|
741
|
+
loading = _useCustomViewsConnec.loading;
|
|
742
|
+
const onCustomViewsResolved = props.onCustomViewsResolved;
|
|
743
|
+
react$1.useEffect(() => {
|
|
744
|
+
if (!loading && !error && onCustomViewsResolved) {
|
|
745
|
+
onCustomViewsResolved(customViews);
|
|
746
|
+
}
|
|
747
|
+
}, [customViews, error, loading, onCustomViewsResolved]);
|
|
748
|
+
if (error) {
|
|
749
|
+
sentry.reportErrorToSentry(error, {
|
|
750
|
+
extra: {
|
|
751
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
return null;
|
|
755
|
+
}
|
|
756
|
+
return jsxRuntime.jsx(Wrapper, {
|
|
757
|
+
shouldRender: customViews.length > 0,
|
|
758
|
+
children: jsxRuntime.jsx(Container$2, {
|
|
759
|
+
children: jsxRuntime.jsxs(Constraints__default["default"].Horizontal, {
|
|
760
|
+
max: "scale",
|
|
761
|
+
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
762
|
+
scale: "m",
|
|
763
|
+
justifyContent: "flex-end",
|
|
764
|
+
alignItems: "center",
|
|
765
|
+
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
766
|
+
scale: "xs",
|
|
767
|
+
alignItems: "center",
|
|
768
|
+
children: [jsxRuntime.jsx(icons.SidebarCollapseIcon, {
|
|
769
|
+
size: "medium",
|
|
770
|
+
color: "neutral60"
|
|
771
|
+
}), jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
772
|
+
tone: "secondary",
|
|
773
|
+
intlMessage: messages$3.title
|
|
774
|
+
})]
|
|
775
|
+
}), _mapInstanceProperty__default["default"](customViews).call(customViews, customView => jsxRuntime.jsx(SecondaryButton__default["default"], {
|
|
776
|
+
label: customView.defaultLabel,
|
|
777
|
+
size: "medium",
|
|
778
|
+
onClick: () => {
|
|
779
|
+
setSelectedCustomView(customView);
|
|
780
|
+
}
|
|
781
|
+
}, customView.id))]
|
|
782
|
+
}), selectedCustomView && jsxRuntime.jsx(CustomViewLoader, {
|
|
783
|
+
customView: selectedCustomView,
|
|
784
|
+
onClose: () => {
|
|
785
|
+
setSelectedCustomView(null);
|
|
786
|
+
}
|
|
787
|
+
})]
|
|
788
|
+
})
|
|
789
|
+
})
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
CustomViewSelector.propTypes = {};
|
|
793
|
+
const CustomViewSelectorOrNothing = props => {
|
|
794
|
+
if (!props.customViewLocatorCode) {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
return jsxRuntime.jsx(CustomViewSelector, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
798
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
799
|
+
}));
|
|
800
|
+
};
|
|
801
|
+
CustomViewSelectorOrNothing.propTypes = {};
|
|
802
|
+
|
|
563
803
|
const messages$2 = reactIntl.defineMessages({
|
|
564
804
|
back: {
|
|
565
805
|
id: 'Components.ModalPage.TopBar.Back',
|
|
@@ -739,7 +979,9 @@ const ModalPage = props => {
|
|
|
739
979
|
zIndex: props.zIndex
|
|
740
980
|
}
|
|
741
981
|
},
|
|
742
|
-
children: [jsxRuntime.jsx(
|
|
982
|
+
children: [jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
983
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
984
|
+
}), jsxRuntime.jsx(ModalPageTopBar, {
|
|
743
985
|
color: props.topBarColor,
|
|
744
986
|
onClose: handleClose,
|
|
745
987
|
currentPathLabel: props.currentPathLabel,
|
|
@@ -764,6 +1006,7 @@ const InfoModalPage = props => jsxRuntime.jsxs(ModalPage, {
|
|
|
764
1006
|
shouldDelayOnClose: props.shouldDelayOnClose,
|
|
765
1007
|
getParentSelector: props.getParentSelector,
|
|
766
1008
|
afterOpenStyles: props.afterOpenStyles,
|
|
1009
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
767
1010
|
children: [jsxRuntime.jsx(PageHeader, {
|
|
768
1011
|
title: props.title,
|
|
769
1012
|
subtitle: props.subtitle
|
|
@@ -841,6 +1084,7 @@ const CustomFormModalPage = props => jsxRuntime.jsxs(ModalPage, {
|
|
|
841
1084
|
getParentSelector: props.getParentSelector,
|
|
842
1085
|
shouldDelayOnClose: props.shouldDelayOnClose,
|
|
843
1086
|
afterOpenStyles: props.afterOpenStyles,
|
|
1087
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
844
1088
|
children: [jsxRuntime.jsx(PageHeader, {
|
|
845
1089
|
title: props.title,
|
|
846
1090
|
subtitle: props.subtitle,
|
|
@@ -892,6 +1136,7 @@ const FormModalPage = props => jsxRuntime.jsx(CustomFormModalPage, {
|
|
|
892
1136
|
dataAttributes: props.dataAttributesPrimaryButton
|
|
893
1137
|
})]
|
|
894
1138
|
}),
|
|
1139
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
895
1140
|
children: props.children
|
|
896
1141
|
});
|
|
897
1142
|
FormModalPage.propTypes = {};
|
|
@@ -942,6 +1187,7 @@ const TabularModalPage = props => {
|
|
|
942
1187
|
getParentSelector: props.getParentSelector,
|
|
943
1188
|
shouldDelayOnClose: props.shouldDelayOnClose,
|
|
944
1189
|
afterOpenStyles: props.afterOpenStyles,
|
|
1190
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
945
1191
|
children: [jsxRuntime.jsxs(TabularPageContainer, {
|
|
946
1192
|
color: "neutral",
|
|
947
1193
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
@@ -1014,7 +1260,9 @@ const defaultProps$6 = {
|
|
|
1014
1260
|
const CustomFormDetailPage = props => {
|
|
1015
1261
|
var _props$title;
|
|
1016
1262
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1017
|
-
children: [jsxRuntime.
|
|
1263
|
+
children: [jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1264
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
1265
|
+
}), jsxRuntime.jsxs(DetailPageContainer, {
|
|
1018
1266
|
children: [jsxRuntime.jsx(PageTopBar, {
|
|
1019
1267
|
color: "neutral",
|
|
1020
1268
|
previousPathLabel: props.previousPathLabel,
|
|
@@ -1056,6 +1304,7 @@ const FormDetailPage = props => jsxRuntime.jsx(CustomFormDetailPage, {
|
|
|
1056
1304
|
title: props.title,
|
|
1057
1305
|
subtitle: props.subtitle,
|
|
1058
1306
|
customTitleRow: props.customTitleRow,
|
|
1307
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
1059
1308
|
previousPathLabel: props.previousPathLabel,
|
|
1060
1309
|
onPreviousPathClick: props.onPreviousPathClick,
|
|
1061
1310
|
hideControls: props.hideControls,
|
|
@@ -1092,6 +1341,7 @@ const InfoDetailPage = props => jsxRuntime.jsx(CustomFormDetailPage, {
|
|
|
1092
1341
|
subtitle: props.subtitle,
|
|
1093
1342
|
customTitleRow: props.customTitleRow,
|
|
1094
1343
|
previousPathLabel: props.previousPathLabel,
|
|
1344
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
1095
1345
|
onPreviousPathClick: props.onPreviousPathClick,
|
|
1096
1346
|
children: props.children
|
|
1097
1347
|
});
|
|
@@ -1107,7 +1357,9 @@ const defaultProps$4 = {
|
|
|
1107
1357
|
const TabularDetailPage = props => {
|
|
1108
1358
|
var _props$title;
|
|
1109
1359
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1110
|
-
children: [jsxRuntime.
|
|
1360
|
+
children: [jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1361
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
1362
|
+
}), jsxRuntime.jsxs(TabularPageContainer, {
|
|
1111
1363
|
color: "neutral",
|
|
1112
1364
|
children: [jsxRuntime.jsx(PageTopBar, {
|
|
1113
1365
|
color: "neutral",
|
|
@@ -1145,7 +1397,7 @@ TabularDetailPage.PageHeaderTitle = PageHeaderTitle;
|
|
|
1145
1397
|
// This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
|
|
1146
1398
|
TabularDetailPage.Intl = i18n.sharedMessages;
|
|
1147
1399
|
|
|
1148
|
-
const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-
|
|
1400
|
+
const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-3653aa0b.cjs.prod.js' /* webpackChunkName: "public-page-layout" */); }));
|
|
1149
1401
|
|
|
1150
1402
|
const MainPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1151
1403
|
target: "ev8m2jf2"
|
|
@@ -1164,7 +1416,9 @@ const defaultProps$3 = {
|
|
|
1164
1416
|
const CustomFormMainPage = props => {
|
|
1165
1417
|
var _props$title;
|
|
1166
1418
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1167
|
-
children: [jsxRuntime.jsx(
|
|
1419
|
+
children: [jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1420
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
1421
|
+
}), jsxRuntime.jsx(MainPageContainer, {
|
|
1168
1422
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
1169
1423
|
scale: "l",
|
|
1170
1424
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
@@ -1207,6 +1461,7 @@ const FormMainPage = props => {
|
|
|
1207
1461
|
title: props.title,
|
|
1208
1462
|
subtitle: props.subtitle,
|
|
1209
1463
|
customTitleRow: props.customTitleRow,
|
|
1464
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
1210
1465
|
hideControls: props.hideControls,
|
|
1211
1466
|
formControls: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1212
1467
|
children: [jsxRuntime.jsx(CustomFormMainPage.FormSecondaryButton, {
|
|
@@ -1242,6 +1497,7 @@ const InfoMainPage = props => {
|
|
|
1242
1497
|
title: props.title,
|
|
1243
1498
|
subtitle: props.subtitle,
|
|
1244
1499
|
customTitleRow: props.customTitleRow,
|
|
1500
|
+
customViewLocatorCode: props.customViewLocatorCode,
|
|
1245
1501
|
hideDivider: true,
|
|
1246
1502
|
children: props.children
|
|
1247
1503
|
});
|
|
@@ -1258,7 +1514,9 @@ const defaultProps$1 = {
|
|
|
1258
1514
|
const TabularMainPage = props => {
|
|
1259
1515
|
var _props$title;
|
|
1260
1516
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1261
|
-
children: [jsxRuntime.
|
|
1517
|
+
children: [jsxRuntime.jsx(CustomViewSelectorOrNothing, {
|
|
1518
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
1519
|
+
}), jsxRuntime.jsxs(TabularPageContainer, {
|
|
1262
1520
|
color: "surface",
|
|
1263
1521
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
1264
1522
|
title: (_props$title = props.title) !== null && _props$title !== void 0 ? _props$title : '',
|
|
@@ -1509,23 +1767,6 @@ function PageContentFull(props) {
|
|
|
1509
1767
|
}
|
|
1510
1768
|
PageContentFull.propTypes = {};
|
|
1511
1769
|
|
|
1512
|
-
const ContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1513
|
-
target: "e1alzj9m0"
|
|
1514
|
-
} )("height:100%;padding:", designSystem.designTokens.spacing40, " 40px;" + ("" ));
|
|
1515
|
-
function CustomPanel(props) {
|
|
1516
|
-
return jsxRuntime.jsx(ModalPage, {
|
|
1517
|
-
hidePathLabel: true,
|
|
1518
|
-
isOpen: true,
|
|
1519
|
-
onClose: props.onClose,
|
|
1520
|
-
size: props.size,
|
|
1521
|
-
title: props.title,
|
|
1522
|
-
children: jsxRuntime.jsx(ContentWrapper, {
|
|
1523
|
-
children: props.children
|
|
1524
|
-
})
|
|
1525
|
-
});
|
|
1526
|
-
}
|
|
1527
|
-
CustomPanel.propTypes = {};
|
|
1528
|
-
|
|
1529
1770
|
// The width of each indentation level.
|
|
1530
1771
|
const indentationSize = '48px';
|
|
1531
1772
|
const useObserverElementDimensions = element => {
|
|
@@ -1645,6 +1886,8 @@ exports.CustomFormDetailPage = CustomFormDetailPage;
|
|
|
1645
1886
|
exports.CustomFormMainPage = CustomFormMainPage;
|
|
1646
1887
|
exports.CustomFormModalPage = CustomFormModalPage;
|
|
1647
1888
|
exports.CustomPanel = CustomPanel;
|
|
1889
|
+
exports.CustomViewLoader = CustomViewLoader;
|
|
1890
|
+
exports.CustomViewsSelector = CustomViewSelectorOrNothing;
|
|
1648
1891
|
exports.FormDetailPage = FormDetailPage;
|
|
1649
1892
|
exports.FormDialog = FormDialog;
|
|
1650
1893
|
exports.FormMainPage = FormMainPage;
|