@commercetools-frontend/application-components 22.38.0 → 22.38.2
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 +431 -635
- package/dist/commercetools-frontend-application-components.cjs.prod.js +396 -562
- package/dist/commercetools-frontend-application-components.esm.js +431 -633
- package/dist/custom-views-selector-04a345e9.cjs.prod.js +247 -0
- package/dist/custom-views-selector-3212ef51.esm.js +256 -0
- package/dist/custom-views-selector-32c60dc1.cjs.dev.js +278 -0
- package/dist/declarations/src/components/custom-views/custom-views-selector/custom-views-selector.d.ts +1 -8
- package/dist/declarations/src/components/custom-views/custom-views-selector/index.d.ts +3 -1
- package/dist/declarations/src/components/custom-views/custom-views-selector/types.d.ts +12 -0
- package/dist/declarations/src/components/detail-pages/tabular-detail-page/tabular-detail-page.d.ts +5 -2
- package/dist/declarations/src/components/main-pages/tabular-main-page/tabular-main-page.d.ts +15 -12
- package/dist/declarations/src/components/modal-pages/tabular-modal-page/tabular-modal-page.d.ts +2 -2
- package/package.json +9 -9
|
@@ -33,23 +33,21 @@ var PrimaryButton = require('@commercetools-uikit/primary-button');
|
|
|
33
33
|
var SecondaryButton = require('@commercetools-uikit/secondary-button');
|
|
34
34
|
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
35
35
|
var omitBy = require('lodash/omitBy');
|
|
36
|
+
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
36
37
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
37
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
38
|
-
var sentry = require('@commercetools-frontend/sentry');
|
|
39
|
-
var AccessibleButton = require('@commercetools-uikit/accessible-button');
|
|
40
|
-
var Constraints = require('@commercetools-uikit/constraints');
|
|
41
|
-
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
42
|
-
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
43
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
44
38
|
var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
|
|
45
39
|
var FlatButton = require('@commercetools-uikit/flat-button');
|
|
46
40
|
var IconButton = require('@commercetools-uikit/icon-button');
|
|
47
|
-
var
|
|
48
|
-
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
41
|
+
var Constraints = require('@commercetools-uikit/constraints');
|
|
49
42
|
var PageNotFoundSVG = require('@commercetools-frontend/assets/images/page-not-found.svg');
|
|
50
43
|
var FailedAuthorizationSVG = require('@commercetools-frontend/assets/images/doors-closed.svg');
|
|
44
|
+
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
45
|
+
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
46
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
47
|
+
var sentry = require('@commercetools-frontend/sentry');
|
|
51
48
|
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
52
49
|
var Stamp = require('@commercetools-uikit/stamp');
|
|
50
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
53
51
|
var useResizeObserver = require('@react-hook/resize-observer');
|
|
54
52
|
var hooks = require('@commercetools-uikit/hooks');
|
|
55
53
|
|
|
@@ -73,22 +71,20 @@ var PrimaryButton__default = /*#__PURE__*/_interopDefault(PrimaryButton);
|
|
|
73
71
|
var SecondaryButton__default = /*#__PURE__*/_interopDefault(SecondaryButton);
|
|
74
72
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
75
73
|
var omitBy__default = /*#__PURE__*/_interopDefault(omitBy);
|
|
76
|
-
var
|
|
77
|
-
var AccessibleButton__default = /*#__PURE__*/_interopDefault(AccessibleButton);
|
|
78
|
-
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
74
|
+
var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
|
|
79
75
|
var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
|
|
80
76
|
var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
|
|
81
77
|
var IconButton__default = /*#__PURE__*/_interopDefault(IconButton);
|
|
82
|
-
var
|
|
83
|
-
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
78
|
+
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
84
79
|
var PageNotFoundSVG__default = /*#__PURE__*/_interopDefault(PageNotFoundSVG);
|
|
85
80
|
var FailedAuthorizationSVG__default = /*#__PURE__*/_interopDefault(FailedAuthorizationSVG);
|
|
86
81
|
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
87
82
|
var Stamp__default = /*#__PURE__*/_interopDefault(Stamp);
|
|
83
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
88
84
|
var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
|
|
89
85
|
|
|
90
86
|
// NOTE: This string will be replaced on build time with the package version.
|
|
91
|
-
var version = "22.38.
|
|
87
|
+
var version = "22.38.2";
|
|
92
88
|
|
|
93
89
|
// We keep these tokens as they are related to page layout components which should have
|
|
94
90
|
// a slightly different layout (margins/paddings) when used within a Custom View panel.
|
|
@@ -117,9 +113,9 @@ var _ref$8 = {
|
|
|
117
113
|
const getLinkStyles = (isActive, isDisabled) => [/*#__PURE__*/react.css("font-size:", designSystem.designTokens.fontSize30, ";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:", designSystem.designTokens.spacing30, ";}", getBottomBorderStyles('transparent'), ";" + ("" ), "" ), isActive && /*#__PURE__*/react.css(getBottomBorderStyles(designSystem.designTokens.colorPrimary), " & h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}" + ("" ), "" ), isDisabled && _ref$8, !isActive && !isDisabled && /*#__PURE__*/react.css(":hover,:focus,:active{& h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}}" + ("" ), "" )];
|
|
118
114
|
|
|
119
115
|
const _excluded$k = ["isDisabled", "exactPathMatch"];
|
|
120
|
-
function ownKeys$
|
|
121
|
-
function _objectSpread$
|
|
122
|
-
const pathWithoutSearch
|
|
116
|
+
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; }
|
|
117
|
+
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; }
|
|
118
|
+
const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
|
|
123
119
|
const warnIfMissingContent = props => {
|
|
124
120
|
Boolean(props.intlMessage) || Boolean(props.label);
|
|
125
121
|
};
|
|
@@ -145,7 +141,7 @@ const TabHeader = _ref2 => {
|
|
|
145
141
|
const location = reactRouterDom.useLocation();
|
|
146
142
|
const isActive = Boolean(reactRouterDom.matchPath(location.pathname, {
|
|
147
143
|
// strip the search, otherwise the path won't match
|
|
148
|
-
path: pathWithoutSearch
|
|
144
|
+
path: pathWithoutSearch(props.to),
|
|
149
145
|
exact: exactPathMatch,
|
|
150
146
|
strict: false
|
|
151
147
|
}));
|
|
@@ -153,11 +149,11 @@ const TabHeader = _ref2 => {
|
|
|
153
149
|
if (props.intlMessage) {
|
|
154
150
|
label = intl.formatMessage(props.intlMessage);
|
|
155
151
|
}
|
|
156
|
-
warnIfMissingContent(_objectSpread$
|
|
152
|
+
warnIfMissingContent(_objectSpread$7({
|
|
157
153
|
exactPathMatch,
|
|
158
154
|
isDisabled
|
|
159
155
|
}, props));
|
|
160
|
-
return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$
|
|
156
|
+
return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$7(_objectSpread$7({
|
|
161
157
|
role: "tab",
|
|
162
158
|
"aria-selected": isActive,
|
|
163
159
|
to: props.to,
|
|
@@ -211,13 +207,13 @@ const getOverlayStyles$1 = props => /*#__PURE__*/react.css("display:flex;positio
|
|
|
211
207
|
`${props.zIndex} !important` : 'auto', ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ), "" );
|
|
212
208
|
|
|
213
209
|
const _excluded$j = ["size", "getParentSelector"];
|
|
214
|
-
function ownKeys$
|
|
215
|
-
function _objectSpread$
|
|
210
|
+
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; }
|
|
211
|
+
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; }
|
|
216
212
|
const getDefaultParentSelector$1 = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
217
213
|
const getOverlayElement$1 = (props, contentElement) =>
|
|
218
214
|
// Assign the `data-role` to the overlay container, which is used as
|
|
219
215
|
// the CSS selector in the `<PortalsContainer>`.
|
|
220
|
-
jsxRuntime.jsx("div", _objectSpread$
|
|
216
|
+
jsxRuntime.jsx("div", _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
221
217
|
"data-role": "dialog-overlay",
|
|
222
218
|
children: contentElement
|
|
223
219
|
}));
|
|
@@ -248,10 +244,10 @@ const DialogContainer = _ref3 => {
|
|
|
248
244
|
shouldCloseOnOverlayClick: Boolean(props.onClose),
|
|
249
245
|
shouldCloseOnEsc: Boolean(props.onClose),
|
|
250
246
|
overlayElement: getOverlayElement$1,
|
|
251
|
-
overlayClassName: makeClassName(getOverlayStyles$1(_objectSpread$
|
|
247
|
+
overlayClassName: makeClassName(getOverlayStyles$1(_objectSpread$6({
|
|
252
248
|
size
|
|
253
249
|
}, props))),
|
|
254
|
-
className: makeClassName(getModalContentStyles(_objectSpread$
|
|
250
|
+
className: makeClassName(getModalContentStyles(_objectSpread$6({
|
|
255
251
|
size
|
|
256
252
|
}, props))),
|
|
257
253
|
contentLabel: typeof props.title === 'string' ? props.title : props['aria-label'],
|
|
@@ -355,8 +351,8 @@ function filterDataAttributes(obj) {
|
|
|
355
351
|
}
|
|
356
352
|
|
|
357
353
|
const _excluded$i = ["isPrimaryButtonDisabled", "dataAttributesPrimaryButton", "dataAttributesSecondaryButton"];
|
|
358
|
-
function ownKeys$
|
|
359
|
-
function _objectSpread$
|
|
354
|
+
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; }
|
|
355
|
+
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; }
|
|
360
356
|
const getFormattedLabel = (label, intl) => typeof label === 'string' ? label : intl.formatMessage(label);
|
|
361
357
|
const DialogFooter = _ref => {
|
|
362
358
|
let _ref$isPrimaryButtonD = _ref.isPrimaryButtonDisabled,
|
|
@@ -378,11 +374,11 @@ const DialogFooter = _ref => {
|
|
|
378
374
|
scale: "m",
|
|
379
375
|
alignItems: "center",
|
|
380
376
|
justifyContent: "flex-end",
|
|
381
|
-
children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$
|
|
377
|
+
children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$5({
|
|
382
378
|
label: getFormattedLabel(props.labelSecondary, intl),
|
|
383
379
|
onClick: props.onCancel,
|
|
384
380
|
iconLeft: props.iconLeftSecondaryButton
|
|
385
|
-
}, filterDataAttributes(dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$
|
|
381
|
+
}, filterDataAttributes(dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$5({
|
|
386
382
|
label: getFormattedLabel(props.labelPrimary, intl),
|
|
387
383
|
onClick: props.onConfirm,
|
|
388
384
|
isDisabled: isPrimaryButtonDisabled
|
|
@@ -476,7 +472,126 @@ FormDialog.Intl = i18n.sharedMessages;
|
|
|
476
472
|
// as the default dialog title.
|
|
477
473
|
FormDialog.TextTitle = TextTitle;
|
|
478
474
|
|
|
479
|
-
const
|
|
475
|
+
const CustomViewSelector = /*#__PURE__*/react$1.lazy(() => {
|
|
476
|
+
if (typeof window !== 'undefined' && typeof window.app !== 'undefined') {
|
|
477
|
+
return Promise.resolve().then(function () { return require('./custom-views-selector-04a345e9.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
|
|
478
|
+
}
|
|
479
|
+
return _Promise__default["default"].resolve({
|
|
480
|
+
default: () => null
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
const _excluded$f = ["truncate"],
|
|
485
|
+
_excluded2$1 = ["titleSize", "truncate"];
|
|
486
|
+
const SubtitleWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
487
|
+
target: "epaiodd0"
|
|
488
|
+
} )("margin-top:", designSystem.designTokens.spacing20, ";" + ("" ));
|
|
489
|
+
const Title = props => {
|
|
490
|
+
switch (props.titleSize) {
|
|
491
|
+
case 'big':
|
|
492
|
+
return jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
493
|
+
as: "h1",
|
|
494
|
+
title: props.title,
|
|
495
|
+
truncate: props.truncate,
|
|
496
|
+
children: props.title
|
|
497
|
+
});
|
|
498
|
+
case 'medium':
|
|
499
|
+
return jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
500
|
+
as: "h2",
|
|
501
|
+
title: props.title,
|
|
502
|
+
truncate: props.truncate,
|
|
503
|
+
children: props.title
|
|
504
|
+
});
|
|
505
|
+
default:
|
|
506
|
+
return jsxRuntime.jsx(Text__default["default"].Subheadline, {
|
|
507
|
+
as: "h4",
|
|
508
|
+
title: props.title,
|
|
509
|
+
truncate: props.truncate,
|
|
510
|
+
children: props.title
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
const Subtitle = _ref2 => {
|
|
515
|
+
let _ref2$truncate = _ref2.truncate,
|
|
516
|
+
truncate = _ref2$truncate === void 0 ? false : _ref2$truncate,
|
|
517
|
+
props = _objectWithoutProperties(_ref2, _excluded$f);
|
|
518
|
+
if (!props.subtitle) {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
if ( /*#__PURE__*/react$1.isValidElement(props.subtitle)) {
|
|
522
|
+
return jsxRuntime.jsx(SubtitleWrapper, {
|
|
523
|
+
children: props.subtitle
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
return jsxRuntime.jsx(SubtitleWrapper, {
|
|
527
|
+
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
528
|
+
title: typeof props.subtitle === 'string' ? props.subtitle : undefined,
|
|
529
|
+
truncate: truncate,
|
|
530
|
+
tone: "secondary",
|
|
531
|
+
children: props.subtitle
|
|
532
|
+
})
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
Subtitle.propTypes = {};
|
|
536
|
+
var _ref$6 = {
|
|
537
|
+
name: "d3v9zr",
|
|
538
|
+
styles: "overflow:hidden"
|
|
539
|
+
} ;
|
|
540
|
+
const PageHeaderTitle = _ref3 => {
|
|
541
|
+
let _ref3$titleSize = _ref3.titleSize,
|
|
542
|
+
titleSize = _ref3$titleSize === void 0 ? 'small' : _ref3$titleSize,
|
|
543
|
+
_ref3$truncate = _ref3.truncate,
|
|
544
|
+
truncate = _ref3$truncate === void 0 ? false : _ref3$truncate,
|
|
545
|
+
props = _objectWithoutProperties(_ref3, _excluded2$1);
|
|
546
|
+
return jsxRuntime.jsxs("div", {
|
|
547
|
+
css: _ref$6,
|
|
548
|
+
children: [jsxRuntime.jsx(Title, {
|
|
549
|
+
title: props.title,
|
|
550
|
+
titleSize: titleSize,
|
|
551
|
+
truncate: truncate
|
|
552
|
+
}), jsxRuntime.jsx(Subtitle, {
|
|
553
|
+
subtitle: props.subtitle,
|
|
554
|
+
truncate: truncate
|
|
555
|
+
})]
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
PageHeaderTitle.propTypes = {};
|
|
559
|
+
PageHeaderTitle.displayName = 'PageHeaderTitle';
|
|
560
|
+
|
|
561
|
+
const PageHeader = props => {
|
|
562
|
+
return jsxRuntime.jsxs("div", {
|
|
563
|
+
css: /*#__PURE__*/react.css("margin:0 ", designSystem.designTokens.spacing55, ";padding:", designSystem.designTokens.spacing40, " 0 ", designSystem.designTokens.spacing40, ";border-bottom:1px solid ", designSystem.designTokens.colorNeutral90, ";" + ("" ), "" ),
|
|
564
|
+
children: [jsxRuntime.jsxs("div", {
|
|
565
|
+
css: /*#__PURE__*/react.css("display:flex;align-items:flex-end;justify-content:space-between;&>*+*{margin-left:", designSystem.designTokens.spacing50, ";}" + ("" ), "" ),
|
|
566
|
+
children: [jsxRuntime.jsx(PageHeaderTitle, {
|
|
567
|
+
title: props.title,
|
|
568
|
+
titleSize: "big",
|
|
569
|
+
subtitle: props.subtitle,
|
|
570
|
+
truncate: true
|
|
571
|
+
}), props.children]
|
|
572
|
+
}), jsxRuntime.jsx(CustomViewSelector, {
|
|
573
|
+
margin: `${designSystem.designTokens.spacing40} 0 0 0`,
|
|
574
|
+
customViewLocatorCode: props.customViewLocatorCode
|
|
575
|
+
})]
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
PageHeader.propTypes = {};
|
|
579
|
+
PageHeader.displayName = 'PageHeader';
|
|
580
|
+
|
|
581
|
+
const ContentWrapper$2 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
582
|
+
target: "e1b7jwn02"
|
|
583
|
+
} )("flex:1;flex-basis:0;overflow:auto;margin:", designTokens.marginForPageContent, ";" + ("" ));
|
|
584
|
+
const ModalContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
585
|
+
target: "e1b7jwn01"
|
|
586
|
+
} )("flex:1;flex-basis:0;overflow:auto;margin:", designSystem.designTokens.spacing50, " ", designSystem.designTokens.spacing55, ";" + ("" ));
|
|
587
|
+
const PageWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
588
|
+
target: "e1b7jwn00"
|
|
589
|
+
} )({
|
|
590
|
+
name: "kdbhus",
|
|
591
|
+
styles: "height:100%;display:flex;flex-direction:column"
|
|
592
|
+
} );
|
|
593
|
+
|
|
594
|
+
const messages$4 = reactIntl.defineMessages({
|
|
480
595
|
back: {
|
|
481
596
|
id: "Components.ModalPage.TopBar.Back",
|
|
482
597
|
defaultMessage: "Go Back"
|
|
@@ -487,7 +602,7 @@ const messages$5 = reactIntl.defineMessages({
|
|
|
487
602
|
}
|
|
488
603
|
});
|
|
489
604
|
|
|
490
|
-
const _excluded$
|
|
605
|
+
const _excluded$e = ["color", "previousPathLabel", "hidePathLabel"];
|
|
491
606
|
// Component to have a larger clickable surface
|
|
492
607
|
var _ref2$2 = {
|
|
493
608
|
name: "1rxhroq",
|
|
@@ -504,22 +619,22 @@ const LargeIconWrapper = props => jsxRuntime.jsx("span", {
|
|
|
504
619
|
// However, we need to explicitly define this otherwise the prop-types babel plugin
|
|
505
620
|
// does not recognize the object shape.
|
|
506
621
|
LargeIconWrapper.propTypes = {};
|
|
507
|
-
var _ref$
|
|
622
|
+
var _ref$5 = {
|
|
508
623
|
name: "uvw8rn",
|
|
509
624
|
styles: "display:flex;overflow:hidden;button:first-of-type svg{height:12px!important;width:12px!important;}"
|
|
510
625
|
} ;
|
|
511
626
|
const ModalPageTopBar = _ref3 => {
|
|
512
627
|
_ref3.color;
|
|
513
628
|
let _ref3$previousPathLab = _ref3.previousPathLabel,
|
|
514
|
-
previousPathLabel = _ref3$previousPathLab === void 0 ? messages$
|
|
629
|
+
previousPathLabel = _ref3$previousPathLab === void 0 ? messages$4.back : _ref3$previousPathLab,
|
|
515
630
|
_ref3$hidePathLabel = _ref3.hidePathLabel,
|
|
516
631
|
hidePathLabel = _ref3$hidePathLabel === void 0 ? false : _ref3$hidePathLabel,
|
|
517
|
-
props = _objectWithoutProperties(_ref3, _excluded$
|
|
632
|
+
props = _objectWithoutProperties(_ref3, _excluded$e);
|
|
518
633
|
const intl = reactIntl.useIntl();
|
|
519
634
|
return jsxRuntime.jsxs("div", {
|
|
520
635
|
css: /*#__PURE__*/react.css("position:relative;display:flex;align-items:center;justify-content:space-between;padding:", designSystem.designTokens.spacing40, " ", designSystem.designTokens.spacing55, " 0;background-color:", designSystem.designTokens.colorSurface, ";border-bottom:1px solid ", designSystem.designTokens.colorSurface, ";& *+*{margin-left:", designSystem.designTokens.spacingS, ";}p{font-size:12px!important;}" + ("" ), "" ),
|
|
521
636
|
children: [jsxRuntime.jsxs("div", {
|
|
522
|
-
css: _ref$
|
|
637
|
+
css: _ref$5,
|
|
523
638
|
children: [!hidePathLabel && jsxRuntime.jsx(FlatButton__default["default"], {
|
|
524
639
|
tone: "primary",
|
|
525
640
|
label: typeof previousPathLabel === 'string' ? previousPathLabel : intl.formatMessage(previousPathLabel),
|
|
@@ -540,7 +655,7 @@ const ModalPageTopBar = _ref3 => {
|
|
|
540
655
|
})]
|
|
541
656
|
})]
|
|
542
657
|
}), props.onClose && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
543
|
-
label: intl.formatMessage(messages$
|
|
658
|
+
label: intl.formatMessage(messages$4.close),
|
|
544
659
|
onClick: props.onClose,
|
|
545
660
|
icon: jsxRuntime.jsx(LargeIconWrapper, {
|
|
546
661
|
children: jsxRuntime.jsx(icons.CloseIcon, {})
|
|
@@ -588,489 +703,114 @@ var _ref2$1 = {
|
|
|
588
703
|
} ;
|
|
589
704
|
const getAfterOpenOverlayAnimation = () => _ref2$1;
|
|
590
705
|
const getBeforeCloseContainerAnimation = props => /*#__PURE__*/react.css("transform:translate3d(\n ", props.size !== 'scale' ? stylesBySize[props.size].width : '30px', ",\n ,\n 0,\n 0\n )!important;" + ("" ), "" );
|
|
591
|
-
var _ref$
|
|
706
|
+
var _ref$4 = {
|
|
592
707
|
name: "728dx5",
|
|
593
708
|
styles: "opacity:0!important"
|
|
594
709
|
} ;
|
|
595
|
-
const getBeforeCloseOverlayAnimation = () => _ref$
|
|
596
|
-
|
|
597
|
-
const _excluded$e = ["size", "getParentSelector", "shouldDelayOnClose"];
|
|
598
|
-
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; }
|
|
599
|
-
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; }
|
|
600
|
-
const getDefaultParentSelector = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
601
|
-
const getOverlayElement = (props, contentElement) =>
|
|
602
|
-
// Assign the `data-role` to the overlay container, which is used as
|
|
603
|
-
// the CSS selector in the `<PortalsContainer>`.
|
|
604
|
-
jsxRuntime.jsx("div", _objectSpread$5(_objectSpread$5({}, props), {}, {
|
|
605
|
-
"data-role": "modal-overlay",
|
|
606
|
-
children: contentElement
|
|
607
|
-
}));
|
|
608
|
-
|
|
609
|
-
// NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
|
|
610
|
-
// However, we need to explicitly define this otherwise the prop-types babel plugin
|
|
611
|
-
// does not recognize the object shape.
|
|
612
|
-
|
|
613
|
-
const ModalPage = _ref => {
|
|
614
|
-
let _ref$size = _ref.size,
|
|
615
|
-
size = _ref$size === void 0 ? 'scale' : _ref$size,
|
|
616
|
-
_ref$getParentSelecto = _ref.getParentSelector,
|
|
617
|
-
getParentSelector = _ref$getParentSelecto === void 0 ? getDefaultParentSelector : _ref$getParentSelecto,
|
|
618
|
-
_ref$shouldDelayOnClo = _ref.shouldDelayOnClose,
|
|
619
|
-
shouldDelayOnClose = _ref$shouldDelayOnClo === void 0 ? true : _ref$shouldDelayOnClo,
|
|
620
|
-
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
621
|
-
const _useState = react$1.useState(false),
|
|
622
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
623
|
-
forceClose = _useState2[0],
|
|
624
|
-
setForceClose = _useState2[1];
|
|
625
|
-
const closingTimer = react$1.useRef();
|
|
626
|
-
react$1.useEffect(() => {
|
|
627
|
-
if (props.isOpen === true) setForceClose(false);
|
|
628
|
-
return () => {
|
|
629
|
-
if (closingTimer.current) {
|
|
630
|
-
clearTimeout(closingTimer.current);
|
|
631
|
-
}
|
|
632
|
-
};
|
|
633
|
-
}, [props.isOpen]);
|
|
634
|
-
const onClose = props.onClose;
|
|
635
|
-
const TRANSITION_DURATION = stylesBySize[size].transitionTime;
|
|
636
|
-
const handleClose = react$1.useCallback(event => {
|
|
637
|
-
if (shouldDelayOnClose) {
|
|
638
|
-
// In this case we want the closing animation to be shown
|
|
639
|
-
// and therefore we need wait for it to be completed
|
|
640
|
-
// before calling `onClose`.
|
|
641
|
-
setForceClose(true);
|
|
642
|
-
closingTimer.current = _setTimeout__default["default"](() => {
|
|
643
|
-
onClose && onClose(event);
|
|
644
|
-
}, TRANSITION_DURATION);
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
onClose && onClose(event);
|
|
648
|
-
}, [onClose, shouldDelayOnClose, TRANSITION_DURATION]);
|
|
649
|
-
return jsxRuntime.jsx(react.ClassNames, {
|
|
650
|
-
children: _ref2 => {
|
|
651
|
-
let makeClassName = _ref2.css;
|
|
652
|
-
return jsxRuntime.jsxs(Modal__default["default"], {
|
|
653
|
-
isOpen: forceClose === true ? false : props.isOpen,
|
|
654
|
-
onRequestClose: handleClose,
|
|
655
|
-
shouldCloseOnOverlayClick: Boolean(props.onClose),
|
|
656
|
-
shouldCloseOnEsc: Boolean(props.onClose),
|
|
657
|
-
overlayElement: getOverlayElement,
|
|
658
|
-
overlayClassName: {
|
|
659
|
-
base: makeClassName(getOverlayStyles(_objectSpread$5({
|
|
660
|
-
size
|
|
661
|
-
}, props))),
|
|
662
|
-
afterOpen: makeClassName(getAfterOpenOverlayAnimation()),
|
|
663
|
-
beforeClose: makeClassName(getBeforeCloseOverlayAnimation())
|
|
664
|
-
},
|
|
665
|
-
className: {
|
|
666
|
-
base: makeClassName(getContainerStyles(_objectSpread$5({
|
|
667
|
-
size
|
|
668
|
-
}, props))),
|
|
669
|
-
afterOpen: typeof props.afterOpenStyles === 'string' ? props.afterOpenStyles : makeClassName(props.afterOpenStyles ?? getAfterOpenContainerAnimation()),
|
|
670
|
-
beforeClose: makeClassName(getBeforeCloseContainerAnimation(_objectSpread$5({
|
|
671
|
-
size
|
|
672
|
-
}, props)))
|
|
673
|
-
},
|
|
674
|
-
contentLabel: props.title,
|
|
675
|
-
parentSelector: getParentSelector,
|
|
676
|
-
ariaHideApp: false
|
|
677
|
-
// Adjust this value if the (beforeClose) animation duration is changed
|
|
678
|
-
,
|
|
679
|
-
closeTimeoutMS: TRANSITION_DURATION,
|
|
680
|
-
style: {
|
|
681
|
-
// stylelint-disable-next-line selector-type-no-unknown
|
|
682
|
-
overlay: {
|
|
683
|
-
zIndex: props.zIndex
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
|
-
children: [!props.hideTopBar && jsxRuntime.jsx(ModalPageTopBar, {
|
|
687
|
-
color: props.topBarColor,
|
|
688
|
-
onClose: handleClose,
|
|
689
|
-
currentPathLabel: props.currentPathLabel,
|
|
690
|
-
previousPathLabel: props.previousPathLabel,
|
|
691
|
-
hidePathLabel: props.hidePathLabel
|
|
692
|
-
}), props.children]
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
};
|
|
697
|
-
ModalPage.propTypes = {};
|
|
698
|
-
ModalPage.displayName = 'ModalPage';
|
|
699
|
-
|
|
700
|
-
const messages$4 = reactIntl.defineMessages({
|
|
701
|
-
loadError: {
|
|
702
|
-
id: "CustomViewLoader.error.load",
|
|
703
|
-
defaultMessage: "We could not load the Custom View. Please contact your administrator to check its configuration."
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
const isIframeReady = iFrameElementRef => {
|
|
708
|
-
try {
|
|
709
|
-
return iFrameElementRef?.contentWindow?.document.readyState === 'complete';
|
|
710
|
-
} catch {
|
|
711
|
-
// Trying to access the contentWindow of a cross-origin iFrame will throw an error.
|
|
712
|
-
// We are not supposed to even get here because the iFrame must use
|
|
713
|
-
// a URL from our very same domain (the custom view is proxied through our http-proxy service).
|
|
714
|
-
return false;
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
const ContentWrapper$2 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
718
|
-
target: "ewwxuwo1"
|
|
719
|
-
} )({
|
|
720
|
-
name: "13udsys",
|
|
721
|
-
styles: "height:100%"
|
|
722
|
-
} );
|
|
723
|
-
const CustomPanelIframe = /*#__PURE__*/_styled__default["default"]("iframe", {
|
|
724
|
-
target: "ewwxuwo0"
|
|
725
|
-
} )({
|
|
726
|
-
name: "174lt7a",
|
|
727
|
-
styles: "height:100%;width:100%;border:none"
|
|
728
|
-
} );
|
|
729
|
-
function CustomViewLoader(props) {
|
|
730
|
-
const iFrameElementRef = react$1.useRef(null);
|
|
731
|
-
const dataLocale = applicationShellConnectors.useApplicationContext(context => context.dataLocale);
|
|
732
|
-
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
733
|
-
const featureFlags = reactBroadcast.useAllFeatureToggles();
|
|
734
|
-
const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
|
|
735
|
-
const showNotification = actionsGlobal.useShowNotification();
|
|
736
|
-
const intl = reactIntl.useIntl();
|
|
737
|
-
const messageFromIFrameHandler = react$1.useCallback(event => {
|
|
738
|
-
if (event.data.origin === window.location.origin) {
|
|
739
|
-
switch (event.data.eventName) {
|
|
740
|
-
case constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_CLOSE:
|
|
741
|
-
props.onClose();
|
|
742
|
-
break;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}, [props]);
|
|
746
|
-
|
|
747
|
-
// onLoad handler is called from the iFrame even where the URL is not valid
|
|
748
|
-
// (blocked by CORS, 404, etc.) so we need to make sure the iFrame is ready
|
|
749
|
-
const onLoadSuccessHandler = react$1.useCallback(() => {
|
|
750
|
-
// Show error and block if the iFrame is not ready
|
|
751
|
-
// (error loading it)
|
|
752
|
-
if (!isIframeReady(iFrameElementRef.current)) {
|
|
753
|
-
showNotification({
|
|
754
|
-
domain: constants.DOMAINS.PAGE,
|
|
755
|
-
kind: constants.NOTIFICATION_KINDS_PAGE.error,
|
|
756
|
-
text: intl.formatMessage(messages$4.loadError)
|
|
757
|
-
});
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
// Listen for messages from the iFrame
|
|
762
|
-
iFrameCommunicationChannel.current.port1.onmessage = messageFromIFrameHandler;
|
|
763
|
-
|
|
764
|
-
// Transfer port2 to the iFrame so it can send messages back privately
|
|
765
|
-
iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
|
|
766
|
-
|
|
767
|
-
// Send the initialization message to the iFrame
|
|
768
|
-
iFrameCommunicationChannel.current.port1.postMessage({
|
|
769
|
-
source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
|
|
770
|
-
destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
|
|
771
|
-
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
|
|
772
|
-
eventData: {
|
|
773
|
-
context: {
|
|
774
|
-
dataLocale,
|
|
775
|
-
projectKey,
|
|
776
|
-
featureFlags,
|
|
777
|
-
customViewConfig: props.customView,
|
|
778
|
-
hostUrl: props.hostUrl || window.location.href
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
});
|
|
782
|
-
|
|
783
|
-
// We want the effect to run only once so we don't need the dependencies array.
|
|
784
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
785
|
-
}, []);
|
|
786
|
-
react$1.useEffect(() => {
|
|
787
|
-
// Close the channel when the component unmounts
|
|
788
|
-
const communicationChannel = iFrameCommunicationChannel.current;
|
|
789
|
-
return () => {
|
|
790
|
-
communicationChannel?.port1.close();
|
|
791
|
-
};
|
|
792
|
-
}, []);
|
|
793
|
-
|
|
794
|
-
// Currently we only support custom panels
|
|
795
|
-
if (props.customView.type !== 'CustomPanel') {
|
|
796
|
-
sentry.reportErrorToSentry(new Error(`CustomViewLoader: Provided Custom View has an unsupported type: ${props.customView.type}. Supported types: ['CustomPanel'].`));
|
|
797
|
-
return null;
|
|
798
|
-
}
|
|
799
|
-
const panelSize = props.customView.typeSettings?.size?.toLocaleLowerCase() || 'large';
|
|
800
|
-
const iFrameUrl = [window.location.origin, 'custom-views', props.customView.id, 'projects', projectKey].join('/');
|
|
801
|
-
return jsxRuntime.jsx(ModalPage, {
|
|
802
|
-
isOpen: true,
|
|
803
|
-
onClose: props.onClose,
|
|
804
|
-
size: panelSize === 'small' ? 10 : 30,
|
|
805
|
-
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
806
|
-
hideTopBar: true,
|
|
807
|
-
children: jsxRuntime.jsx(ContentWrapper$2, {
|
|
808
|
-
children: jsxRuntime.jsx(CustomPanelIframe, {
|
|
809
|
-
id: `custom-view-${props.customView.id}`,
|
|
810
|
-
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
811
|
-
ref: iFrameElementRef,
|
|
812
|
-
src: iFrameUrl,
|
|
813
|
-
onLoad: onLoadSuccessHandler
|
|
814
|
-
}, `custom-view-${props.customView.id}`)
|
|
815
|
-
})
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
CustomViewLoader.propTypes = {};
|
|
819
|
-
|
|
820
|
-
var messages$3 = reactIntl.defineMessages({
|
|
821
|
-
title: {
|
|
822
|
-
id: "CustomViewsSelector.title",
|
|
823
|
-
defaultMessage: "Custom Views:"
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
|
|
827
|
-
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 } } } };
|
|
828
|
-
const useCustomViewsConnector = _ref => {
|
|
829
|
-
let customViewLocatorCode = _ref.customViewLocatorCode;
|
|
830
|
-
const enableCustomViews = reactBroadcast.useFlagVariation(constants.featureFlags.CUSTOM_VIEWS);
|
|
831
|
-
const areCustomViewsEnabled =
|
|
832
|
-
// @ts-ignore In case it's coming from the MC API, it's an object { value: boolean }.
|
|
833
|
-
(enableCustomViews?.value ?? enableCustomViews) && process.env.DISABLE_CUSTOM_VIEWS_FEATURE !== 'true';
|
|
834
|
-
const _useMcQuery = applicationShellConnectors.useMcQuery(FetchCustomViewsQuery, {
|
|
835
|
-
variables: {
|
|
836
|
-
customViewLocatorCode
|
|
837
|
-
},
|
|
838
|
-
context: {
|
|
839
|
-
target: constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
840
|
-
},
|
|
841
|
-
skip: !areCustomViewsEnabled
|
|
842
|
-
}),
|
|
843
|
-
data = _useMcQuery.data,
|
|
844
|
-
error = _useMcQuery.error,
|
|
845
|
-
loading = _useMcQuery.loading;
|
|
846
|
-
return {
|
|
847
|
-
customViews: data?.allCustomViewsInstallationsByLocator?.map(installation => installation.customView) || [],
|
|
848
|
-
error,
|
|
849
|
-
loading
|
|
850
|
-
};
|
|
851
|
-
};
|
|
710
|
+
const getBeforeCloseOverlayAnimation = () => _ref$4;
|
|
852
711
|
|
|
712
|
+
const _excluded$d = ["size", "getParentSelector", "shouldDelayOnClose"];
|
|
853
713
|
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; }
|
|
854
714
|
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; }
|
|
855
|
-
const
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
const CustomViewSelectorItem = props => {
|
|
864
|
-
return jsxRuntime.jsx(AccessibleButton__default["default"], {
|
|
865
|
-
css: /*#__PURE__*/react.css("display:flex;align-items:center;padding:", designSystem.designTokens.spacing20, " ", designSystem.designTokens.spacing25, ";height:30px;border-radius:", designSystem.designTokens.borderRadius6, ";color:", designSystem.designTokens.colorPrimary, ";", props.selected && hoverAndSelectedStateStyles, " :hover{", hoverAndSelectedStateStyles, ";}" + ("" ), "" ),
|
|
866
|
-
onClick: props.onClick,
|
|
867
|
-
label: props.label,
|
|
868
|
-
children: jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
869
|
-
tone: "inherit",
|
|
870
|
-
fontWeight: props.selected ? 'bold' : 'regular',
|
|
871
|
-
children: props.label
|
|
872
|
-
})
|
|
873
|
-
});
|
|
874
|
-
};
|
|
875
|
-
CustomViewSelectorItem.propTypes = {};
|
|
876
|
-
const SelectorLabel = /*#__PURE__*/_styled__default["default"]("div", {
|
|
877
|
-
target: "e16cb3zv1"
|
|
878
|
-
} )({
|
|
879
|
-
name: "1i68o0s",
|
|
880
|
-
styles: "display:flex;align-items:center;gap:6px;div{font-weight:300;}"
|
|
881
|
-
} );
|
|
882
|
-
const Separator = /*#__PURE__*/_styled__default["default"]("span", {
|
|
883
|
-
target: "e16cb3zv0"
|
|
884
|
-
} )({
|
|
885
|
-
name: "1lsblg0",
|
|
886
|
-
styles: "width:1px;height:18px;background-color:#cccccc"
|
|
887
|
-
} );
|
|
888
|
-
function CustomViewSelector(props) {
|
|
889
|
-
const _useState = react$1.useState(null),
|
|
890
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
891
|
-
selectedCustomView = _useState2[0],
|
|
892
|
-
setSelectedCustomView = _useState2[1];
|
|
893
|
-
const _useCustomViewsConnec = useCustomViewsConnector({
|
|
894
|
-
customViewLocatorCode: props.customViewLocatorCode
|
|
895
|
-
}),
|
|
896
|
-
customViews = _useCustomViewsConnec.customViews,
|
|
897
|
-
error = _useCustomViewsConnec.error,
|
|
898
|
-
loading = _useCustomViewsConnec.loading;
|
|
899
|
-
const onCustomViewsResolved = props.onCustomViewsResolved;
|
|
900
|
-
react$1.useEffect(() => {
|
|
901
|
-
if (!loading && !error && onCustomViewsResolved) {
|
|
902
|
-
onCustomViewsResolved(customViews);
|
|
903
|
-
}
|
|
904
|
-
}, [customViews, error, loading, onCustomViewsResolved]);
|
|
905
|
-
if (error) {
|
|
906
|
-
sentry.reportErrorToSentry(error, {
|
|
907
|
-
extra: {
|
|
908
|
-
customViewLocatorCode: props.customViewLocatorCode
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
|
-
return jsxRuntime.jsx(Wrapper, {
|
|
914
|
-
shouldRender: customViews.length > 0,
|
|
915
|
-
margin: props.margin || '0',
|
|
916
|
-
children: jsxRuntime.jsx(Container$2, {
|
|
917
|
-
children: jsxRuntime.jsxs(Constraints__default["default"].Horizontal, {
|
|
918
|
-
max: "scale",
|
|
919
|
-
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
920
|
-
scale: "s",
|
|
921
|
-
justifyContent: "flex-start",
|
|
922
|
-
alignItems: "center",
|
|
923
|
-
children: [jsxRuntime.jsxs(SelectorLabel, {
|
|
924
|
-
children: [jsxRuntime.jsx(icons.WindowEyeIcon, {
|
|
925
|
-
size: "medium",
|
|
926
|
-
color: "neutral60"
|
|
927
|
-
}), jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
928
|
-
tone: "secondary",
|
|
929
|
-
intlMessage: messages$3.title
|
|
930
|
-
})]
|
|
931
|
-
}), _mapInstanceProperty__default["default"](customViews).call(customViews, (customView, index) => {
|
|
932
|
-
const isNotLastItem = index !== customViews.length - 1;
|
|
933
|
-
return jsxRuntime.jsxs(react$1.Fragment, {
|
|
934
|
-
children: [jsxRuntime.jsx(CustomViewSelectorItem, {
|
|
935
|
-
selected: selectedCustomView?.id === customView.id,
|
|
936
|
-
onClick: () => {
|
|
937
|
-
setSelectedCustomView(customView);
|
|
938
|
-
},
|
|
939
|
-
label: customView.defaultLabel
|
|
940
|
-
}), isNotLastItem && jsxRuntime.jsx(Separator, {})]
|
|
941
|
-
}, customView.id);
|
|
942
|
-
})]
|
|
943
|
-
}), selectedCustomView && jsxRuntime.jsx(CustomViewLoader, {
|
|
944
|
-
customView: selectedCustomView,
|
|
945
|
-
onClose: () => {
|
|
946
|
-
setSelectedCustomView(null);
|
|
947
|
-
}
|
|
948
|
-
})]
|
|
949
|
-
})
|
|
950
|
-
})
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
CustomViewSelector.propTypes = {};
|
|
954
|
-
CustomViewSelector.displayName = 'CustomViewSelector';
|
|
955
|
-
const CustomViewSelectorOrNothing = props => {
|
|
956
|
-
if (!props.customViewLocatorCode) {
|
|
957
|
-
return null;
|
|
958
|
-
}
|
|
959
|
-
return jsxRuntime.jsx(CustomViewSelector, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
960
|
-
customViewLocatorCode: props.customViewLocatorCode
|
|
961
|
-
}));
|
|
962
|
-
};
|
|
963
|
-
CustomViewSelectorOrNothing.propTypes = {};
|
|
964
|
-
|
|
965
|
-
const _excluded$d = ["truncate"],
|
|
966
|
-
_excluded2$1 = ["titleSize", "truncate"];
|
|
967
|
-
const SubtitleWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
968
|
-
target: "epaiodd0"
|
|
969
|
-
} )("margin-top:", designSystem.designTokens.spacing20, ";" + ("" ));
|
|
970
|
-
const Title = props => {
|
|
971
|
-
switch (props.titleSize) {
|
|
972
|
-
case 'big':
|
|
973
|
-
return jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
974
|
-
as: "h1",
|
|
975
|
-
title: props.title,
|
|
976
|
-
truncate: props.truncate,
|
|
977
|
-
children: props.title
|
|
978
|
-
});
|
|
979
|
-
case 'medium':
|
|
980
|
-
return jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
981
|
-
as: "h2",
|
|
982
|
-
title: props.title,
|
|
983
|
-
truncate: props.truncate,
|
|
984
|
-
children: props.title
|
|
985
|
-
});
|
|
986
|
-
default:
|
|
987
|
-
return jsxRuntime.jsx(Text__default["default"].Subheadline, {
|
|
988
|
-
as: "h4",
|
|
989
|
-
title: props.title,
|
|
990
|
-
truncate: props.truncate,
|
|
991
|
-
children: props.title
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
const Subtitle = _ref2 => {
|
|
996
|
-
let _ref2$truncate = _ref2.truncate,
|
|
997
|
-
truncate = _ref2$truncate === void 0 ? false : _ref2$truncate,
|
|
998
|
-
props = _objectWithoutProperties(_ref2, _excluded$d);
|
|
999
|
-
if (!props.subtitle) {
|
|
1000
|
-
return null;
|
|
1001
|
-
}
|
|
1002
|
-
if ( /*#__PURE__*/react$1.isValidElement(props.subtitle)) {
|
|
1003
|
-
return jsxRuntime.jsx(SubtitleWrapper, {
|
|
1004
|
-
children: props.subtitle
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
|
-
return jsxRuntime.jsx(SubtitleWrapper, {
|
|
1008
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1009
|
-
title: typeof props.subtitle === 'string' ? props.subtitle : undefined,
|
|
1010
|
-
truncate: truncate,
|
|
1011
|
-
tone: "secondary",
|
|
1012
|
-
children: props.subtitle
|
|
1013
|
-
})
|
|
1014
|
-
});
|
|
1015
|
-
};
|
|
1016
|
-
Subtitle.propTypes = {};
|
|
1017
|
-
var _ref$4 = {
|
|
1018
|
-
name: "d3v9zr",
|
|
1019
|
-
styles: "overflow:hidden"
|
|
1020
|
-
} ;
|
|
1021
|
-
const PageHeaderTitle = _ref3 => {
|
|
1022
|
-
let _ref3$titleSize = _ref3.titleSize,
|
|
1023
|
-
titleSize = _ref3$titleSize === void 0 ? 'small' : _ref3$titleSize,
|
|
1024
|
-
_ref3$truncate = _ref3.truncate,
|
|
1025
|
-
truncate = _ref3$truncate === void 0 ? false : _ref3$truncate,
|
|
1026
|
-
props = _objectWithoutProperties(_ref3, _excluded2$1);
|
|
1027
|
-
return jsxRuntime.jsxs("div", {
|
|
1028
|
-
css: _ref$4,
|
|
1029
|
-
children: [jsxRuntime.jsx(Title, {
|
|
1030
|
-
title: props.title,
|
|
1031
|
-
titleSize: titleSize,
|
|
1032
|
-
truncate: truncate
|
|
1033
|
-
}), jsxRuntime.jsx(Subtitle, {
|
|
1034
|
-
subtitle: props.subtitle,
|
|
1035
|
-
truncate: truncate
|
|
1036
|
-
})]
|
|
1037
|
-
});
|
|
1038
|
-
};
|
|
1039
|
-
PageHeaderTitle.propTypes = {};
|
|
1040
|
-
PageHeaderTitle.displayName = 'PageHeaderTitle';
|
|
715
|
+
const getDefaultParentSelector = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
|
|
716
|
+
const getOverlayElement = (props, contentElement) =>
|
|
717
|
+
// Assign the `data-role` to the overlay container, which is used as
|
|
718
|
+
// the CSS selector in the `<PortalsContainer>`.
|
|
719
|
+
jsxRuntime.jsx("div", _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
720
|
+
"data-role": "modal-overlay",
|
|
721
|
+
children: contentElement
|
|
722
|
+
}));
|
|
1041
723
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
724
|
+
// NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
|
|
725
|
+
// However, we need to explicitly define this otherwise the prop-types babel plugin
|
|
726
|
+
// does not recognize the object shape.
|
|
727
|
+
|
|
728
|
+
const ModalPage = _ref => {
|
|
729
|
+
let _ref$size = _ref.size,
|
|
730
|
+
size = _ref$size === void 0 ? 'scale' : _ref$size,
|
|
731
|
+
_ref$getParentSelecto = _ref.getParentSelector,
|
|
732
|
+
getParentSelector = _ref$getParentSelecto === void 0 ? getDefaultParentSelector : _ref$getParentSelecto,
|
|
733
|
+
_ref$shouldDelayOnClo = _ref.shouldDelayOnClose,
|
|
734
|
+
shouldDelayOnClose = _ref$shouldDelayOnClo === void 0 ? true : _ref$shouldDelayOnClo,
|
|
735
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
736
|
+
const _useState = react$1.useState(false),
|
|
737
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
738
|
+
forceClose = _useState2[0],
|
|
739
|
+
setForceClose = _useState2[1];
|
|
740
|
+
const closingTimer = react$1.useRef();
|
|
741
|
+
react$1.useEffect(() => {
|
|
742
|
+
if (props.isOpen === true) setForceClose(false);
|
|
743
|
+
return () => {
|
|
744
|
+
if (closingTimer.current) {
|
|
745
|
+
clearTimeout(closingTimer.current);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
}, [props.isOpen]);
|
|
749
|
+
const onClose = props.onClose;
|
|
750
|
+
const TRANSITION_DURATION = stylesBySize[size].transitionTime;
|
|
751
|
+
const handleClose = react$1.useCallback(event => {
|
|
752
|
+
if (shouldDelayOnClose) {
|
|
753
|
+
// In this case we want the closing animation to be shown
|
|
754
|
+
// and therefore we need wait for it to be completed
|
|
755
|
+
// before calling `onClose`.
|
|
756
|
+
setForceClose(true);
|
|
757
|
+
closingTimer.current = _setTimeout__default["default"](() => {
|
|
758
|
+
onClose && onClose(event);
|
|
759
|
+
}, TRANSITION_DURATION);
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
onClose && onClose(event);
|
|
763
|
+
}, [onClose, shouldDelayOnClose, TRANSITION_DURATION]);
|
|
764
|
+
return jsxRuntime.jsx(react.ClassNames, {
|
|
765
|
+
children: _ref2 => {
|
|
766
|
+
let makeClassName = _ref2.css;
|
|
767
|
+
return jsxRuntime.jsxs(Modal__default["default"], {
|
|
768
|
+
isOpen: forceClose === true ? false : props.isOpen,
|
|
769
|
+
onRequestClose: handleClose,
|
|
770
|
+
shouldCloseOnOverlayClick: Boolean(props.onClose),
|
|
771
|
+
shouldCloseOnEsc: Boolean(props.onClose),
|
|
772
|
+
overlayElement: getOverlayElement,
|
|
773
|
+
overlayClassName: {
|
|
774
|
+
base: makeClassName(getOverlayStyles(_objectSpread$4({
|
|
775
|
+
size
|
|
776
|
+
}, props))),
|
|
777
|
+
afterOpen: makeClassName(getAfterOpenOverlayAnimation()),
|
|
778
|
+
beforeClose: makeClassName(getBeforeCloseOverlayAnimation())
|
|
779
|
+
},
|
|
780
|
+
className: {
|
|
781
|
+
base: makeClassName(getContainerStyles(_objectSpread$4({
|
|
782
|
+
size
|
|
783
|
+
}, props))),
|
|
784
|
+
afterOpen: typeof props.afterOpenStyles === 'string' ? props.afterOpenStyles : makeClassName(props.afterOpenStyles ?? getAfterOpenContainerAnimation()),
|
|
785
|
+
beforeClose: makeClassName(getBeforeCloseContainerAnimation(_objectSpread$4({
|
|
786
|
+
size
|
|
787
|
+
}, props)))
|
|
788
|
+
},
|
|
789
|
+
contentLabel: props.title,
|
|
790
|
+
parentSelector: getParentSelector,
|
|
791
|
+
ariaHideApp: false
|
|
792
|
+
// Adjust this value if the (beforeClose) animation duration is changed
|
|
793
|
+
,
|
|
794
|
+
closeTimeoutMS: TRANSITION_DURATION,
|
|
795
|
+
style: {
|
|
796
|
+
// stylelint-disable-next-line selector-type-no-unknown
|
|
797
|
+
overlay: {
|
|
798
|
+
zIndex: props.zIndex
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
children: [!props.hideTopBar && jsxRuntime.jsx(ModalPageTopBar, {
|
|
802
|
+
color: props.topBarColor,
|
|
803
|
+
onClose: handleClose,
|
|
804
|
+
currentPathLabel: props.currentPathLabel,
|
|
805
|
+
previousPathLabel: props.previousPathLabel,
|
|
806
|
+
hidePathLabel: props.hidePathLabel
|
|
807
|
+
}), props.children]
|
|
808
|
+
});
|
|
809
|
+
}
|
|
1057
810
|
});
|
|
1058
811
|
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
const ContentWrapper$1 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1063
|
-
target: "e1b7jwn02"
|
|
1064
|
-
} )("flex:1;flex-basis:0;overflow:auto;margin:", designTokens.marginForPageContent, ";" + ("" ));
|
|
1065
|
-
const ModalContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1066
|
-
target: "e1b7jwn01"
|
|
1067
|
-
} )("flex:1;flex-basis:0;overflow:auto;margin:", designSystem.designTokens.spacing50, " ", designSystem.designTokens.spacing55, ";" + ("" ));
|
|
1068
|
-
const PageWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1069
|
-
target: "e1b7jwn00"
|
|
1070
|
-
} )({
|
|
1071
|
-
name: "kdbhus",
|
|
1072
|
-
styles: "height:100%;display:flex;flex-direction:column"
|
|
1073
|
-
} );
|
|
812
|
+
ModalPage.propTypes = {};
|
|
813
|
+
ModalPage.displayName = 'ModalPage';
|
|
1074
814
|
|
|
1075
815
|
const InfoModalPage = props => jsxRuntime.jsxs(ModalPage, {
|
|
1076
816
|
title: props.title,
|
|
@@ -1231,26 +971,6 @@ FormModalPage.displayName = 'FormModalPage';
|
|
|
1231
971
|
// The Intl messages can be used for button labels.
|
|
1232
972
|
FormModalPage.Intl = i18n.sharedMessages;
|
|
1233
973
|
|
|
1234
|
-
const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
|
|
1235
|
-
const useCustomViewLocatorSelector = function () {
|
|
1236
|
-
var _context;
|
|
1237
|
-
let customViewLocatorCodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1238
|
-
const location = reactRouterDom.useLocation();
|
|
1239
|
-
const customViewLocator = _findInstanceProperty__default["default"](_context = _Object$entries__default["default"](customViewLocatorCodes)).call(_context, _ref => {
|
|
1240
|
-
let _ref2 = _slicedToArray(_ref, 2),
|
|
1241
|
-
locator = _ref2[1];
|
|
1242
|
-
return reactRouterDom.matchPath(location.pathname, {
|
|
1243
|
-
// strip the search, otherwise the path won't match
|
|
1244
|
-
path: pathWithoutSearch(locator),
|
|
1245
|
-
exact: true,
|
|
1246
|
-
strict: false
|
|
1247
|
-
});
|
|
1248
|
-
});
|
|
1249
|
-
return {
|
|
1250
|
-
currentCustomViewLocatorCode: customViewLocator?.[0]
|
|
1251
|
-
};
|
|
1252
|
-
};
|
|
1253
|
-
|
|
1254
974
|
const TabControls = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1255
975
|
target: "elpldre4"
|
|
1256
976
|
} )("margin-top:", designSystem.designTokens.spacingS, ";" + ("" ));
|
|
@@ -1281,8 +1001,6 @@ const TabularModalPage = _ref => {
|
|
|
1281
1001
|
let _ref$hideControls = _ref.hideControls,
|
|
1282
1002
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1283
1003
|
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
1284
|
-
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
1285
|
-
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
1286
1004
|
return jsxRuntime.jsxs(ModalPage, {
|
|
1287
1005
|
title: props.title,
|
|
1288
1006
|
isOpen: props.isOpen,
|
|
@@ -1312,9 +1030,9 @@ const TabularModalPage = _ref => {
|
|
|
1312
1030
|
})]
|
|
1313
1031
|
})
|
|
1314
1032
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1315
|
-
children: jsxRuntime.jsx(
|
|
1033
|
+
children: jsxRuntime.jsx(CustomViewSelector, {
|
|
1316
1034
|
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1317
|
-
|
|
1035
|
+
customViewLocatorCodes: props.customViewLocatorCodes
|
|
1318
1036
|
})
|
|
1319
1037
|
}), jsxRuntime.jsx(ModalContentWrapper, {
|
|
1320
1038
|
children: props.children
|
|
@@ -1336,7 +1054,7 @@ const _excluded$9 = ["color", "previousPathLabel"];
|
|
|
1336
1054
|
const PageTopBar = _ref => {
|
|
1337
1055
|
_ref.color;
|
|
1338
1056
|
let _ref$previousPathLabe = _ref.previousPathLabel,
|
|
1339
|
-
previousPathLabel = _ref$previousPathLabe === void 0 ? messages$
|
|
1057
|
+
previousPathLabel = _ref$previousPathLabe === void 0 ? messages$4.back : _ref$previousPathLabe,
|
|
1340
1058
|
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
1341
1059
|
const intl = reactIntl.useIntl();
|
|
1342
1060
|
return jsxRuntime.jsx("div", {
|
|
@@ -1382,7 +1100,7 @@ const CustomFormDetailPage = _ref => {
|
|
|
1382
1100
|
title: props.title ?? '',
|
|
1383
1101
|
subtitle: props.subtitle,
|
|
1384
1102
|
titleSize: "big"
|
|
1385
|
-
}), jsxRuntime.jsx(
|
|
1103
|
+
}), jsxRuntime.jsx(CustomViewSelector, {
|
|
1386
1104
|
margin: getCustomViewsSelectorMargin(!hideControls && !!props.formControls),
|
|
1387
1105
|
customViewLocatorCode: props.customViewLocatorCode
|
|
1388
1106
|
}), !hideControls && props.formControls && jsxRuntime.jsx(HeaderControlsWrapper, {
|
|
@@ -1391,7 +1109,7 @@ const CustomFormDetailPage = _ref => {
|
|
|
1391
1109
|
children: props.formControls
|
|
1392
1110
|
})
|
|
1393
1111
|
})]
|
|
1394
|
-
}), jsxRuntime.jsx(ContentWrapper$
|
|
1112
|
+
}), jsxRuntime.jsx(ContentWrapper$2, {
|
|
1395
1113
|
children: props.children
|
|
1396
1114
|
})]
|
|
1397
1115
|
});
|
|
@@ -1471,8 +1189,6 @@ const TabularDetailPage = _ref => {
|
|
|
1471
1189
|
let _ref$hideControls = _ref.hideControls,
|
|
1472
1190
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1473
1191
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1474
|
-
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
1475
|
-
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
1476
1192
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1477
1193
|
children: [jsxRuntime.jsxs(TabularPageContainer, {
|
|
1478
1194
|
children: [jsxRuntime.jsx(PageTopBar, {
|
|
@@ -1493,11 +1209,11 @@ const TabularDetailPage = _ref => {
|
|
|
1493
1209
|
})
|
|
1494
1210
|
})]
|
|
1495
1211
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1496
|
-
children: jsxRuntime.jsx(
|
|
1212
|
+
children: jsxRuntime.jsx(CustomViewSelector, {
|
|
1497
1213
|
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1498
|
-
|
|
1214
|
+
customViewLocatorCodes: props.customViewLocatorCodes
|
|
1499
1215
|
})
|
|
1500
|
-
}), jsxRuntime.jsx(ContentWrapper$
|
|
1216
|
+
}), jsxRuntime.jsx(ContentWrapper$2, {
|
|
1501
1217
|
children: props.children
|
|
1502
1218
|
})]
|
|
1503
1219
|
});
|
|
@@ -1543,7 +1259,7 @@ const CustomFormMainPage = _ref => {
|
|
|
1543
1259
|
title: props.title ?? '',
|
|
1544
1260
|
subtitle: props.subtitle,
|
|
1545
1261
|
titleSize: "big"
|
|
1546
|
-
}), jsxRuntime.jsx(
|
|
1262
|
+
}), jsxRuntime.jsx(CustomViewSelector, {
|
|
1547
1263
|
margin: headerRowMargin,
|
|
1548
1264
|
customViewLocatorCode: props.customViewLocatorCode
|
|
1549
1265
|
}), !hideControls && props.formControls && jsxRuntime.jsx("div", {
|
|
@@ -1638,8 +1354,6 @@ const TabularMainPage = _ref => {
|
|
|
1638
1354
|
let _ref$hideControls = _ref.hideControls,
|
|
1639
1355
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
1640
1356
|
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1641
|
-
const _useCustomViewLocator = useCustomViewLocatorSelector(props.customViewLocatorCodes),
|
|
1642
|
-
currentCustomViewLocatorCode = _useCustomViewLocator.currentCustomViewLocatorCode;
|
|
1643
1357
|
return jsxRuntime.jsxs(PageWrapper, {
|
|
1644
1358
|
children: [jsxRuntime.jsxs(TabularPageContainer, {
|
|
1645
1359
|
children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
|
|
@@ -1656,11 +1370,11 @@ const TabularMainPage = _ref => {
|
|
|
1656
1370
|
})
|
|
1657
1371
|
})]
|
|
1658
1372
|
}), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
|
|
1659
|
-
children: jsxRuntime.jsx(
|
|
1373
|
+
children: jsxRuntime.jsx(CustomViewSelector, {
|
|
1660
1374
|
margin: `${designSystem.designTokens.spacing30} 0 0 0`,
|
|
1661
|
-
|
|
1375
|
+
customViewLocatorCodes: props.customViewLocatorCodes
|
|
1662
1376
|
})
|
|
1663
|
-
}), jsxRuntime.jsx(ContentWrapper$
|
|
1377
|
+
}), jsxRuntime.jsx(ContentWrapper$2, {
|
|
1664
1378
|
css: /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ),
|
|
1665
1379
|
children: props.children
|
|
1666
1380
|
})]
|
|
@@ -1718,7 +1432,7 @@ const MaintenancePageLayout = props => jsxRuntime.jsx("div", {
|
|
|
1718
1432
|
MaintenancePageLayout.propTypes = {};
|
|
1719
1433
|
MaintenancePageLayout.displayName = 'MaintenancePageLayout';
|
|
1720
1434
|
|
|
1721
|
-
var messages$
|
|
1435
|
+
var messages$3 = reactIntl.defineMessages({
|
|
1722
1436
|
title: {
|
|
1723
1437
|
id: "PageNotFound.title",
|
|
1724
1438
|
defaultMessage: "We could not find what you are looking for"
|
|
@@ -1741,9 +1455,9 @@ const PageNotFound = () => {
|
|
|
1741
1455
|
const intl = reactIntl.useIntl();
|
|
1742
1456
|
return jsxRuntime.jsx(MaintenancePageLayout, {
|
|
1743
1457
|
imageSrc: PageNotFoundSVG__default["default"],
|
|
1744
|
-
title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, messages$
|
|
1745
|
-
label: intl.formatMessage(messages$
|
|
1746
|
-
paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2(_objectSpread$2({}, messages$
|
|
1458
|
+
title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, messages$3.title)),
|
|
1459
|
+
label: intl.formatMessage(messages$3.title),
|
|
1460
|
+
paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2(_objectSpread$2({}, messages$3.paragraph1), {}, {
|
|
1747
1461
|
values: {
|
|
1748
1462
|
a: getLink
|
|
1749
1463
|
}
|
|
@@ -1752,7 +1466,7 @@ const PageNotFound = () => {
|
|
|
1752
1466
|
};
|
|
1753
1467
|
PageNotFound.displayName = 'PageNotFound';
|
|
1754
1468
|
|
|
1755
|
-
var messages$
|
|
1469
|
+
var messages$2 = reactIntl.defineMessages({
|
|
1756
1470
|
title: {
|
|
1757
1471
|
id: "PageUnauthorized.title",
|
|
1758
1472
|
defaultMessage: "We could not find what you are looking for"
|
|
@@ -1779,10 +1493,10 @@ const PageUnauthorized = () => {
|
|
|
1779
1493
|
const intl = reactIntl.useIntl();
|
|
1780
1494
|
return jsxRuntime.jsx(MaintenancePageLayout, {
|
|
1781
1495
|
imageSrc: FailedAuthorizationSVG__default["default"],
|
|
1782
|
-
title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages$
|
|
1783
|
-
label: intl.formatMessage(messages$
|
|
1784
|
-
paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages$
|
|
1785
|
-
paragraph2: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1(_objectSpread$1({}, messages$
|
|
1496
|
+
title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages$2.title)),
|
|
1497
|
+
label: intl.formatMessage(messages$2.title),
|
|
1498
|
+
paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages$2.paragraph1)),
|
|
1499
|
+
paragraph2: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1(_objectSpread$1({}, messages$2.paragraph2), {}, {
|
|
1786
1500
|
values: {
|
|
1787
1501
|
a: getSupportUrlLink
|
|
1788
1502
|
}
|
|
@@ -1907,7 +1621,7 @@ function PageContentFull(props) {
|
|
|
1907
1621
|
PageContentFull.propTypes = {};
|
|
1908
1622
|
|
|
1909
1623
|
const _excluded$1 = ["size", "hideControls", "onPrimaryButtonClick", "onSecondaryButtonClick"];
|
|
1910
|
-
const ContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1624
|
+
const ContentWrapper$1 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1911
1625
|
target: "e18jo6y41"
|
|
1912
1626
|
} )("flex:1;flex-basis:0;margin:", designTokens.marginForPageContent, ";overflow:auto;" + ("" ));
|
|
1913
1627
|
const HeaderWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
@@ -1947,7 +1661,7 @@ function Drawer(_ref) {
|
|
|
1947
1661
|
children: props.subtitle
|
|
1948
1662
|
})
|
|
1949
1663
|
}), props.onClose && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
1950
|
-
label: intl.formatMessage(messages$
|
|
1664
|
+
label: intl.formatMessage(messages$4.close),
|
|
1951
1665
|
onClick: props.onClose,
|
|
1952
1666
|
icon: jsxRuntime.jsx(LargeIconWrapper, {
|
|
1953
1667
|
children: jsxRuntime.jsx(icons.CloseIcon, {})
|
|
@@ -1972,7 +1686,7 @@ function Drawer(_ref) {
|
|
|
1972
1686
|
})]
|
|
1973
1687
|
})]
|
|
1974
1688
|
})
|
|
1975
|
-
}), jsxRuntime.jsx(ContentWrapper, {
|
|
1689
|
+
}), jsxRuntime.jsx(ContentWrapper$1, {
|
|
1976
1690
|
children: props.children
|
|
1977
1691
|
})]
|
|
1978
1692
|
});
|
|
@@ -1987,6 +1701,126 @@ Drawer.FormSecondaryButton = FormSecondaryButton;
|
|
|
1987
1701
|
// The Intl messages can be used for button labels.
|
|
1988
1702
|
Drawer.Intl = i18n.sharedMessages;
|
|
1989
1703
|
|
|
1704
|
+
const messages$1 = reactIntl.defineMessages({
|
|
1705
|
+
loadError: {
|
|
1706
|
+
id: "CustomViewLoader.error.load",
|
|
1707
|
+
defaultMessage: "We could not load the Custom View. Please contact your administrator to check its configuration."
|
|
1708
|
+
}
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
const isIframeReady = iFrameElementRef => {
|
|
1712
|
+
try {
|
|
1713
|
+
return iFrameElementRef?.contentWindow?.document.readyState === 'complete';
|
|
1714
|
+
} catch {
|
|
1715
|
+
// Trying to access the contentWindow of a cross-origin iFrame will throw an error.
|
|
1716
|
+
// We are not supposed to even get here because the iFrame must use
|
|
1717
|
+
// a URL from our very same domain (the custom view is proxied through our http-proxy service).
|
|
1718
|
+
return false;
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
const ContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1722
|
+
target: "ewwxuwo1"
|
|
1723
|
+
} )({
|
|
1724
|
+
name: "13udsys",
|
|
1725
|
+
styles: "height:100%"
|
|
1726
|
+
} );
|
|
1727
|
+
const CustomPanelIframe = /*#__PURE__*/_styled__default["default"]("iframe", {
|
|
1728
|
+
target: "ewwxuwo0"
|
|
1729
|
+
} )({
|
|
1730
|
+
name: "174lt7a",
|
|
1731
|
+
styles: "height:100%;width:100%;border:none"
|
|
1732
|
+
} );
|
|
1733
|
+
function CustomViewLoader(props) {
|
|
1734
|
+
const iFrameElementRef = react$1.useRef(null);
|
|
1735
|
+
const dataLocale = applicationShellConnectors.useApplicationContext(context => context.dataLocale);
|
|
1736
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
1737
|
+
const featureFlags = reactBroadcast.useAllFeatureToggles();
|
|
1738
|
+
const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
|
|
1739
|
+
const showNotification = actionsGlobal.useShowNotification();
|
|
1740
|
+
const intl = reactIntl.useIntl();
|
|
1741
|
+
const messageFromIFrameHandler = react$1.useCallback(event => {
|
|
1742
|
+
if (event.data.origin === window.location.origin) {
|
|
1743
|
+
switch (event.data.eventName) {
|
|
1744
|
+
case constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_CLOSE:
|
|
1745
|
+
props.onClose();
|
|
1746
|
+
break;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
}, [props]);
|
|
1750
|
+
|
|
1751
|
+
// onLoad handler is called from the iFrame even where the URL is not valid
|
|
1752
|
+
// (blocked by CORS, 404, etc.) so we need to make sure the iFrame is ready
|
|
1753
|
+
const onLoadSuccessHandler = react$1.useCallback(() => {
|
|
1754
|
+
// Show error and block if the iFrame is not ready
|
|
1755
|
+
// (error loading it)
|
|
1756
|
+
if (!isIframeReady(iFrameElementRef.current)) {
|
|
1757
|
+
showNotification({
|
|
1758
|
+
domain: constants.DOMAINS.PAGE,
|
|
1759
|
+
kind: constants.NOTIFICATION_KINDS_PAGE.error,
|
|
1760
|
+
text: intl.formatMessage(messages$1.loadError)
|
|
1761
|
+
});
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
// Listen for messages from the iFrame
|
|
1766
|
+
iFrameCommunicationChannel.current.port1.onmessage = messageFromIFrameHandler;
|
|
1767
|
+
|
|
1768
|
+
// Transfer port2 to the iFrame so it can send messages back privately
|
|
1769
|
+
iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
|
|
1770
|
+
|
|
1771
|
+
// Send the initialization message to the iFrame
|
|
1772
|
+
iFrameCommunicationChannel.current.port1.postMessage({
|
|
1773
|
+
source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
|
|
1774
|
+
destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
|
|
1775
|
+
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
|
|
1776
|
+
eventData: {
|
|
1777
|
+
context: {
|
|
1778
|
+
dataLocale,
|
|
1779
|
+
projectKey,
|
|
1780
|
+
featureFlags,
|
|
1781
|
+
customViewConfig: props.customView,
|
|
1782
|
+
hostUrl: props.hostUrl || window.location.href
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
|
|
1787
|
+
// We want the effect to run only once so we don't need the dependencies array.
|
|
1788
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1789
|
+
}, []);
|
|
1790
|
+
react$1.useEffect(() => {
|
|
1791
|
+
// Close the channel when the component unmounts
|
|
1792
|
+
const communicationChannel = iFrameCommunicationChannel.current;
|
|
1793
|
+
return () => {
|
|
1794
|
+
communicationChannel?.port1.close();
|
|
1795
|
+
};
|
|
1796
|
+
}, []);
|
|
1797
|
+
|
|
1798
|
+
// Currently we only support custom panels
|
|
1799
|
+
if (props.customView.type !== 'CustomPanel') {
|
|
1800
|
+
sentry.reportErrorToSentry(new Error(`CustomViewLoader: Provided Custom View has an unsupported type: ${props.customView.type}. Supported types: ['CustomPanel'].`));
|
|
1801
|
+
return null;
|
|
1802
|
+
}
|
|
1803
|
+
const panelSize = props.customView.typeSettings?.size?.toLocaleLowerCase() || 'large';
|
|
1804
|
+
const iFrameUrl = [window.location.origin, 'custom-views', props.customView.id, 'projects', projectKey].join('/');
|
|
1805
|
+
return jsxRuntime.jsx(ModalPage, {
|
|
1806
|
+
isOpen: true,
|
|
1807
|
+
onClose: props.onClose,
|
|
1808
|
+
size: panelSize === 'small' ? 10 : 30,
|
|
1809
|
+
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
1810
|
+
hideTopBar: true,
|
|
1811
|
+
children: jsxRuntime.jsx(ContentWrapper, {
|
|
1812
|
+
children: jsxRuntime.jsx(CustomPanelIframe, {
|
|
1813
|
+
id: `custom-view-${props.customView.id}`,
|
|
1814
|
+
title: `Custom View: ${props.customView.defaultLabel}`,
|
|
1815
|
+
ref: iFrameElementRef,
|
|
1816
|
+
src: iFrameUrl,
|
|
1817
|
+
onLoad: onLoadSuccessHandler
|
|
1818
|
+
}, `custom-view-${props.customView.id}`)
|
|
1819
|
+
})
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
CustomViewLoader.propTypes = {};
|
|
1823
|
+
|
|
1990
1824
|
var messages = reactIntl.defineMessages({
|
|
1991
1825
|
ProjectProduction: {
|
|
1992
1826
|
id: "ProjectStamp.production",
|
|
@@ -2178,7 +2012,7 @@ exports.CustomFormDetailPage = CustomFormDetailPage;
|
|
|
2178
2012
|
exports.CustomFormMainPage = CustomFormMainPage;
|
|
2179
2013
|
exports.CustomFormModalPage = CustomFormModalPage;
|
|
2180
2014
|
exports.CustomViewLoader = CustomViewLoader;
|
|
2181
|
-
exports.CustomViewsSelector =
|
|
2015
|
+
exports.CustomViewsSelector = CustomViewSelector;
|
|
2182
2016
|
exports.Drawer = Drawer;
|
|
2183
2017
|
exports.FormDetailPage = FormDetailPage;
|
|
2184
2018
|
exports.FormDialog = FormDialog;
|