@commercetools-frontend/application-components 0.0.0-CRAFT-1791-20251006162610

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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/dist/commercetools-frontend-application-components.cjs.d.ts +2 -0
  4. package/dist/commercetools-frontend-application-components.cjs.dev.js +2303 -0
  5. package/dist/commercetools-frontend-application-components.cjs.js +7 -0
  6. package/dist/commercetools-frontend-application-components.cjs.prod.js +2108 -0
  7. package/dist/commercetools-frontend-application-components.esm.js +2236 -0
  8. package/dist/custom-views-selector-03d0524e.cjs.prod.js +245 -0
  9. package/dist/custom-views-selector-9f964e68.esm.js +245 -0
  10. package/dist/custom-views-selector-d167f024.cjs.dev.js +266 -0
  11. package/dist/declarations/src/components/custom-views/custom-view-loader/custom-view-loader.d.ts +9 -0
  12. package/dist/declarations/src/components/custom-views/custom-view-loader/index.d.ts +1 -0
  13. package/dist/declarations/src/components/custom-views/custom-views-selector/index.d.ts +2 -0
  14. package/dist/declarations/src/components/custom-views/custom-views-selector/types.d.ts +12 -0
  15. package/dist/declarations/src/components/detail-pages/custom-form-detail-page/custom-form-detail-page.d.ts +186 -0
  16. package/dist/declarations/src/components/detail-pages/custom-form-detail-page/index.d.ts +1 -0
  17. package/dist/declarations/src/components/detail-pages/form-detail-page/form-detail-page.d.ts +171 -0
  18. package/dist/declarations/src/components/detail-pages/form-detail-page/index.d.ts +1 -0
  19. package/dist/declarations/src/components/detail-pages/info-detail-page/index.d.ts +1 -0
  20. package/dist/declarations/src/components/detail-pages/info-detail-page/info-detail-page.d.ts +52 -0
  21. package/dist/declarations/src/components/detail-pages/tabular-detail-page/index.d.ts +1 -0
  22. package/dist/declarations/src/components/detail-pages/tabular-detail-page/tabular-detail-page.d.ts +191 -0
  23. package/dist/declarations/src/components/dialogs/confirmation-dialog/confirmation-dialog.d.ts +110 -0
  24. package/dist/declarations/src/components/dialogs/confirmation-dialog/index.d.ts +1 -0
  25. package/dist/declarations/src/components/dialogs/form-dialog/form-dialog.d.ts +114 -0
  26. package/dist/declarations/src/components/dialogs/form-dialog/index.d.ts +1 -0
  27. package/dist/declarations/src/components/dialogs/info-dialog/index.d.ts +1 -0
  28. package/dist/declarations/src/components/dialogs/info-dialog/info-dialog.d.ts +19 -0
  29. package/dist/declarations/src/components/drawer/drawer.d.ts +153 -0
  30. package/dist/declarations/src/components/drawer/index.d.ts +1 -0
  31. package/dist/declarations/src/components/main-pages/custom-form-main-page/custom-form-main-page.d.ts +177 -0
  32. package/dist/declarations/src/components/main-pages/custom-form-main-page/index.d.ts +1 -0
  33. package/dist/declarations/src/components/main-pages/form-main-page/form-main-page.d.ts +163 -0
  34. package/dist/declarations/src/components/main-pages/form-main-page/index.d.ts +1 -0
  35. package/dist/declarations/src/components/main-pages/info-main-page/index.d.ts +1 -0
  36. package/dist/declarations/src/components/main-pages/info-main-page/info-main-page.d.ts +38 -0
  37. package/dist/declarations/src/components/main-pages/tabular-main-page/index.d.ts +1 -0
  38. package/dist/declarations/src/components/main-pages/tabular-main-page/tabular-main-page.d.ts +177 -0
  39. package/dist/declarations/src/components/maintenance-page-layout/index.d.ts +1 -0
  40. package/dist/declarations/src/components/maintenance-page-layout/maintenance-page-layout.d.ts +15 -0
  41. package/dist/declarations/src/components/modal-pages/custom-form-modal-page/custom-form-modal-page.d.ts +166 -0
  42. package/dist/declarations/src/components/modal-pages/custom-form-modal-page/index.d.ts +1 -0
  43. package/dist/declarations/src/components/modal-pages/form-modal-page/form-modal-page.d.ts +127 -0
  44. package/dist/declarations/src/components/modal-pages/form-modal-page/index.d.ts +1 -0
  45. package/dist/declarations/src/components/modal-pages/info-modal-page/index.d.ts +1 -0
  46. package/dist/declarations/src/components/modal-pages/info-modal-page/info-modal-page.d.ts +42 -0
  47. package/dist/declarations/src/components/modal-pages/tabular-modal-page/index.d.ts +1 -0
  48. package/dist/declarations/src/components/modal-pages/tabular-modal-page/tabular-modal-page.d.ts +169 -0
  49. package/dist/declarations/src/components/modal-pages/utils/index.d.ts +1 -0
  50. package/dist/declarations/src/components/modal-pages/utils/modal-page-top-bar.d.ts +26 -0
  51. package/dist/declarations/src/components/page-content-containers/page-content-full/index.d.ts +2 -0
  52. package/dist/declarations/src/components/page-content-containers/page-content-full/page-content-full.d.ts +6 -0
  53. package/dist/declarations/src/components/page-content-containers/page-content-narrow/index.d.ts +2 -0
  54. package/dist/declarations/src/components/page-content-containers/page-content-narrow/page-content-narrow.d.ts +6 -0
  55. package/dist/declarations/src/components/page-content-containers/page-content-wide/index.d.ts +2 -0
  56. package/dist/declarations/src/components/page-content-containers/page-content-wide/page-content-wide.d.ts +9 -0
  57. package/dist/declarations/src/components/page-not-found/index.d.ts +1 -0
  58. package/dist/declarations/src/components/page-not-found/page-not-found.d.ts +5 -0
  59. package/dist/declarations/src/components/page-unauthorized/index.d.ts +1 -0
  60. package/dist/declarations/src/components/page-unauthorized/page-unauthorized.d.ts +5 -0
  61. package/dist/declarations/src/components/portals-container/index.d.ts +1 -0
  62. package/dist/declarations/src/components/portals-container/portals-container.d.ts +44 -0
  63. package/dist/declarations/src/components/project-stamp/project-stamp.d.ts +9 -0
  64. package/dist/declarations/src/components/public-page-layout/index.d.ts +7 -0
  65. package/dist/declarations/src/components/tab-header/index.d.ts +1 -0
  66. package/dist/declarations/src/components/tab-header/tab-header.d.ts +36 -0
  67. package/dist/declarations/src/hooks/use-modal-state/index.d.ts +1 -0
  68. package/dist/declarations/src/hooks/use-modal-state/use-modal-state.d.ts +6 -0
  69. package/dist/declarations/src/index.d.ts +35 -0
  70. package/dist/declarations/src/theming.d.ts +15 -0
  71. package/dist/declarations/src/version.d.ts +2 -0
  72. package/dist/public-page-layout-7d1cb99f.esm.js +94 -0
  73. package/dist/public-page-layout-b182d2dd.cjs.prod.js +94 -0
  74. package/dist/public-page-layout-b92fb7e4.cjs.dev.js +103 -0
  75. package/materials/media-queries.css +15 -0
  76. package/package.json +101 -0
@@ -0,0 +1,2108 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
15
+ var reactIntl = require('react-intl');
16
+ var reactRouterDom = require('react-router-dom');
17
+ var Text = require('@commercetools-uikit/text');
18
+ var utils = require('@commercetools-uikit/utils');
19
+ var react = require('@emotion/react');
20
+ var designSystem = require('@commercetools-uikit/design-system');
21
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
22
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
23
+ var _styled = require('@emotion/styled/base');
24
+ var react$1 = require('react');
25
+ var reactDialog = require('@radix-ui/react-dialog');
26
+ var constants = require('@commercetools-frontend/constants');
27
+ var Card = require('@commercetools-uikit/card');
28
+ var icons = require('@commercetools-uikit/icons');
29
+ var SecondaryIconButton = require('@commercetools-uikit/secondary-icon-button');
30
+ var Spacings = require('@commercetools-uikit/spacings');
31
+ var i18n = require('@commercetools-frontend/i18n');
32
+ var PrimaryButton = require('@commercetools-uikit/primary-button');
33
+ var SecondaryButton = require('@commercetools-uikit/secondary-button');
34
+ var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
35
+ var omitBy = require('lodash/omitBy');
36
+ var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
37
+ var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
38
+ var FlatButton = require('@commercetools-uikit/flat-button');
39
+ var IconButton = require('@commercetools-uikit/icon-button');
40
+ var Constraints = require('@commercetools-uikit/constraints');
41
+ var PageNotFoundSVG = require('@commercetools-frontend/assets/images/page-not-found.svg');
42
+ var FailedAuthorizationSVG = require('@commercetools-frontend/assets/images/doors-closed.svg');
43
+ var reactBroadcast = require('@flopflip/react-broadcast');
44
+ var actionsGlobal = require('@commercetools-frontend/actions-global');
45
+ var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
46
+ var sentry = require('@commercetools-frontend/sentry');
47
+ var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
48
+ var Stamp = require('@commercetools-uikit/stamp');
49
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
50
+ var useResizeObserver = require('@react-hook/resize-observer');
51
+ var hooks = require('@commercetools-uikit/hooks');
52
+
53
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
54
+
55
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
56
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
57
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
58
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
59
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
60
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
61
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
62
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
63
+ var Text__default = /*#__PURE__*/_interopDefault(Text);
64
+ var _styled__default = /*#__PURE__*/_interopDefault(_styled);
65
+ var Card__default = /*#__PURE__*/_interopDefault(Card);
66
+ var SecondaryIconButton__default = /*#__PURE__*/_interopDefault(SecondaryIconButton);
67
+ var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
68
+ var PrimaryButton__default = /*#__PURE__*/_interopDefault(PrimaryButton);
69
+ var SecondaryButton__default = /*#__PURE__*/_interopDefault(SecondaryButton);
70
+ var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
71
+ var omitBy__default = /*#__PURE__*/_interopDefault(omitBy);
72
+ var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
73
+ var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
74
+ var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
75
+ var IconButton__default = /*#__PURE__*/_interopDefault(IconButton);
76
+ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
77
+ var PageNotFoundSVG__default = /*#__PURE__*/_interopDefault(PageNotFoundSVG);
78
+ var FailedAuthorizationSVG__default = /*#__PURE__*/_interopDefault(FailedAuthorizationSVG);
79
+ var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
80
+ var Stamp__default = /*#__PURE__*/_interopDefault(Stamp);
81
+ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
82
+ var useResizeObserver__default = /*#__PURE__*/_interopDefault(useResizeObserver);
83
+
84
+ // NOTE: This string will be replaced on build time with the package version.
85
+ var version = "24.7.2";
86
+
87
+ // We keep these tokens as they are related to page layout components which should have
88
+ // a slightly different layout (margins/paddings) when used within a Custom View panel.
89
+ // https://github.com/commercetools/merchant-center-application-kit/pull/3353
90
+ const themesOverrides = {
91
+ default: {
92
+ marginForCustomViewsSelectorAsTabular: `0 ${designSystem.designTokens.spacing55}`,
93
+ marginForPageContent: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55}`,
94
+ paddingForDetailPageHeader: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55} ${designSystem.designTokens.spacing40}`,
95
+ paddingForMainPageHeader: `${designSystem.designTokens.spacing50} ${designSystem.designTokens.spacing55} 0`,
96
+ paddingForTabularPageHeader: `${designSystem.designTokens.spacing40} ${designSystem.designTokens.spacing55} 0`,
97
+ backgroundColorForNavbar: designSystem.designTokens.colorPrimary10,
98
+ backgroundColorForNavbarHeader: designSystem.designTokens.colorPrimary10,
99
+ fontColorForTabLabelWhenActive: designSystem.designTokens.colorPrimary
100
+ }
101
+ };
102
+ const designTokens = designSystem.transformTokensToCssVarsReferences(themesOverrides.default, {
103
+ includeDefaultValue: false
104
+ });
105
+
106
+ const getBottomBorderStyles = background => /*#__PURE__*/react.css(":after{content:'';position:absolute;bottom:0;left:0;right:0;height:2px;border-radius:", designSystem.designTokens.borderRadius2, ";background-color:", background, ";transition:background-color ", designSystem.designTokens.transitionEaseinout150Ms, ";}" + ("" ), "" );
107
+ var _ref$7 = {
108
+ name: "1u0tiat",
109
+ styles: "&[aria-disabled='true']{cursor:not-allowed;opacity:0.5;&:active{pointer-events:none;}}"
110
+ } ;
111
+ 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$7, !isActive && !isDisabled && /*#__PURE__*/react.css(":hover,:focus,:active{& h3{color:", designTokens.fontColorForTabLabelWhenActive, "!important;}}" + ("" ), "" )];
112
+
113
+ const _excluded$k = ["isDisabled", "exactPathMatch"];
114
+ 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; }
115
+ 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; }
116
+ const pathWithoutSearch = path => typeof path === 'string' ? path.split('?')[0] : path.pathname;
117
+ const warnIfMissingContent = props => {
118
+ Boolean(props.intlMessage) || Boolean(props.label);
119
+ };
120
+ const getDisabledLinkAtributes = isDisabled => isDisabled ? {
121
+ tabIndex: -1,
122
+ 'aria-disabled': true
123
+ } : {};
124
+ const TabLabel = _ref => {
125
+ let children = _ref.children;
126
+ return jsxRuntime.jsx(Text__default["default"].Headline, {
127
+ as: "h3",
128
+ truncate: true,
129
+ children: children
130
+ });
131
+ };
132
+ const TabHeader = _ref2 => {
133
+ let _ref2$isDisabled = _ref2.isDisabled,
134
+ isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
135
+ _ref2$exactPathMatch = _ref2.exactPathMatch,
136
+ exactPathMatch = _ref2$exactPathMatch === void 0 ? false : _ref2$exactPathMatch,
137
+ props = _objectWithoutProperties(_ref2, _excluded$k);
138
+ const intl = reactIntl.useIntl();
139
+ const location = reactRouterDom.useLocation();
140
+ const isActive = Boolean(reactRouterDom.matchPath(location.pathname, {
141
+ // strip the search, otherwise the path won't match
142
+ path: pathWithoutSearch(props.to),
143
+ exact: exactPathMatch,
144
+ strict: false
145
+ }));
146
+ let label = props.label;
147
+ if (props.intlMessage) {
148
+ label = intl.formatMessage(props.intlMessage);
149
+ }
150
+ warnIfMissingContent(_objectSpread$5({
151
+ exactPathMatch,
152
+ isDisabled
153
+ }, props));
154
+ return jsxRuntime.jsx(reactRouterDom.Link, _objectSpread$5(_objectSpread$5({
155
+ role: "tab",
156
+ "aria-selected": isActive,
157
+ to: props.to,
158
+ css: getLinkStyles(isActive, isDisabled)
159
+ }, getDisabledLinkAtributes(isDisabled)), {}, {
160
+ children: jsxRuntime.jsx(TabLabel, {
161
+ children: label
162
+ })
163
+ }));
164
+ };
165
+ TabHeader.displayName = 'TabHeader';
166
+
167
+ const getConstraintForGridStyle = size => {
168
+ switch (size) {
169
+ case 7:
170
+ return designSystem.designTokens.constraint7;
171
+ case 8:
172
+ return designSystem.designTokens.constraint8;
173
+ case 9:
174
+ case 'm':
175
+ return designSystem.designTokens.constraint9;
176
+ case 10:
177
+ return designSystem.designTokens.constraint10;
178
+ case 11:
179
+ return designSystem.designTokens.constraint11;
180
+ case 12:
181
+ return designSystem.designTokens.constraint12;
182
+ case 13:
183
+ case 'l':
184
+ return designSystem.designTokens.constraint13;
185
+ case 16:
186
+ return designSystem.designTokens.constraint16;
187
+ case 'scale':
188
+ return designSystem.designTokens.constraintScale;
189
+ default:
190
+ return designSystem.designTokens.constraintScale;
191
+ }
192
+ };
193
+ const getModalContentStyles = props => {
194
+ const sizeConstraint = getConstraintForGridStyle(props.size);
195
+ const gridStyle = props.size === 'scale' ? /*#__PURE__*/react.css("grid:[row1-start] 'top top top' minmax(\n ", designSystem.designTokens.spacingXl, ",\n 1fr\n ) [row1-end] [row2-start] 'left main right' minmax(0, 100%) [row2-end] [row3-start] 'bottom bottom bottom' minmax(\n ", designSystem.designTokens.spacingXl, ",\n 1fr\n ) [row3-end]/", designSystem.designTokens.spacingXl, " 1fr ", designSystem.designTokens.spacingXl, ";" + ("" ), "" ) : /*#__PURE__*/react.css("grid:[row1-start] 'top top top' minmax(\n ", designSystem.designTokens.spacingXl, ",\n 1fr\n ) [row1-end] [row2-start] 'left main right' minmax(0, 100%) [row2-end] [row3-start] 'bottom bottom bottom' minmax(\n ", designSystem.designTokens.spacingXl, ",\n 1fr\n ) [row3-end]/minmax(", designSystem.designTokens.spacingXl, ", 1fr) ", sizeConstraint, " minmax(", designSystem.designTokens.spacingXl, ", 1fr);" + ("" ), "" );
196
+
197
+ // To ensure that the mouse click on the overlay surface goes "through"
198
+ // and triggers the modal to close, we need to turn off the pointer events.
199
+ const baseStyles = /*#__PURE__*/react.css("display:grid;height:100%;width:100%;outline:none;position:relative;pointer-events:none;z-index:", typeof props.zIndex === 'number' ?
200
+ // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
201
+ // We're assigning value 1 unit higher than the overlay to ensure the content is on top.
202
+ // It's safe to do that since the modal is topmost in the stacking layer.
203
+ `${props.zIndex + 1} !important` : 'auto', ";", gridStyle, ";" + ("" ), "" );
204
+ return baseStyles;
205
+ };
206
+ const ClickableDialogContent = /*#__PURE__*/_styled__default["default"](reactDialog.Content, {
207
+ target: "e1nocpaa2"
208
+ } )(props => getModalContentStyles(props), ";" + ("" ));
209
+ const DialogOverlay = /*#__PURE__*/_styled__default["default"]("div", {
210
+ target: "e1nocpaa1"
211
+ } )("display:flex;position:absolute;z-index:", _ref => {
212
+ let zIndex = _ref.zIndex;
213
+ return (
214
+ // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
215
+ typeof zIndex === 'number' ? `${zIndex} !important` : 'auto'
216
+ );
217
+ }, ";top:0;width:100%;height:100%;background-color:rgba(32, 62, 72, 0.5);opacity:1;" + ("" ));
218
+ const DialogContent$1 = /*#__PURE__*/_styled__default["default"]("div", {
219
+ target: "e1nocpaa0"
220
+ } )({
221
+ name: "vyh6ik",
222
+ styles: "position:absolute;width:100%;height:100%;top:0"
223
+ } );
224
+
225
+ const _excluded$j = ["size", "getParentSelector"];
226
+ const getDefaultParentSelector$1 = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
227
+ const GridArea = /*#__PURE__*/_styled__default["default"]("div", {
228
+ target: "elx55gk0"
229
+ } )("grid-area:", props => props.name, ";" + ("" ));
230
+ var _ref$6 = {
231
+ name: "1daj17f",
232
+ styles: "display:flex;flex-direction:column;align-items:stretch;height:100%;min-height:0"
233
+ } ;
234
+ var _ref2$2 = {
235
+ name: "1187q51",
236
+ styles: "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden"
237
+ } ;
238
+ const DialogContainer = _ref3 => {
239
+ let _ref3$size = _ref3.size,
240
+ size = _ref3$size === void 0 ? 13 : _ref3$size,
241
+ _ref3$getParentSelect = _ref3.getParentSelector,
242
+ getParentSelector = _ref3$getParentSelect === void 0 ? getDefaultParentSelector$1 : _ref3$getParentSelect,
243
+ props = _objectWithoutProperties(_ref3, _excluded$j);
244
+ utils.useWarning(typeof props.title === 'string' || typeof props.title !== 'string' && Boolean(props['aria-label']), 'app-kit/DialogHeader: "aria-label" prop is required when the "title" prop is not a string.');
245
+ const _useState = react$1.useState(null),
246
+ _useState2 = _slicedToArray(_useState, 2),
247
+ portalContainer = _useState2[0],
248
+ setPortalContainer = _useState2[1];
249
+ react$1.useEffect(() => {
250
+ const container = getParentSelector();
251
+ if (container) {
252
+ setPortalContainer(container);
253
+ }
254
+ }, []);
255
+ const dialogAccessibleLabel = typeof props.title === 'string' ? props.title : props['aria-label'];
256
+ return jsxRuntime.jsx(reactDialog.Root, {
257
+ open: props.isOpen,
258
+ modal: false,
259
+ children: jsxRuntime.jsx(reactDialog.Portal, {
260
+ container: portalContainer,
261
+ children: jsxRuntime.jsx(DialogOverlay, {
262
+ "data-role": "dialog-overlay",
263
+ zIndex: props.zIndex,
264
+ children: jsxRuntime.jsx(DialogContent$1, {
265
+ children: jsxRuntime.jsxs(ClickableDialogContent, {
266
+ size: size,
267
+ onEscapeKeyDown: props.onClose,
268
+ onPointerDownOutside: props.onClose,
269
+ "aria-describedby": undefined,
270
+ "aria-labelledby": undefined,
271
+ "aria-label": dialogAccessibleLabel,
272
+ id: undefined,
273
+ children: [jsxRuntime.jsx(GridArea, {
274
+ name: "top"
275
+ }), jsxRuntime.jsx(GridArea, {
276
+ name: "left"
277
+ }), jsxRuntime.jsx(GridArea, {
278
+ name: "right"
279
+ }), jsxRuntime.jsx(GridArea, {
280
+ name: "bottom"
281
+ }), jsxRuntime.jsx(GridArea, {
282
+ name: "main",
283
+ css: _ref2$2,
284
+ children: jsxRuntime.jsx(Card__default["default"]
285
+ // 1. For the min-height: https://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox/28639686#28639686
286
+ // 2. For the actual "> div" container with the content, we need to use normal pointer events so that clicking on it does not close the dialog.
287
+ , {
288
+ css: /*#__PURE__*/react.css("min-height:0;padding:", designSystem.designTokens.spacing20, " ", designSystem.designTokens.spacing30, ";>div{display:flex;flex-direction:column;height:100%;pointer-events:auto;min-height:0;}" + ("" ), "" ),
289
+ children: jsxRuntime.jsx("div", {
290
+ css: _ref$6,
291
+ children: props.children
292
+ })
293
+ })
294
+ })]
295
+ })
296
+ })
297
+ })
298
+ })
299
+ });
300
+ };
301
+ DialogContainer.displayName = 'DialogContainer';
302
+
303
+ // The overflow should be "auto", to make the container scrollable
304
+ const DialogContent = /*#__PURE__*/_styled__default["default"]("div", {
305
+ target: "eo6zkz80"
306
+ } )("border-top:1px solid ", designSystem.designTokens.colorNeutral90, ";padding:", designSystem.designTokens.spacing40, " 0 0;flex:1;overflow:auto;" + ("" ));
307
+
308
+ const TextTitle = props => jsxRuntime.jsx(Text__default["default"].Headline, {
309
+ as: "h3",
310
+ title: props.title,
311
+ truncate: true,
312
+ children: props.title
313
+ });
314
+ const HiddenEmptyDialogTitle$1 = () => jsxRuntime.jsx("div", {
315
+ "aria-hidden": true,
316
+ style: {
317
+ display: 'none'
318
+ },
319
+ children: jsxRuntime.jsx(reactDialog.Title, {})
320
+ });
321
+ const Title$1 = props => {
322
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
323
+ children: [typeof props.title === 'string' ? jsxRuntime.jsx(TextTitle, {
324
+ title: props.title
325
+ }) : props.title, jsxRuntime.jsx(HiddenEmptyDialogTitle$1, {})]
326
+ });
327
+ };
328
+ const DialogHeader = props => jsxRuntime.jsx("div", {
329
+ css: /*#__PURE__*/react.css("flex:0 1 auto;display:flex;flex-direction:column;margin-bottom:", designSystem.designTokens.spacing30, ";" + ("" ), "" ),
330
+ children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
331
+ scale: "m",
332
+ alignItems: "center",
333
+ justifyContent: "space-between",
334
+ children: [jsxRuntime.jsx(Title$1, {
335
+ title: props.title
336
+ }), props.onClose && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
337
+ label: "Close dialog",
338
+ onClick: props.onClose,
339
+ icon: jsxRuntime.jsx(icons.CloseIcon, {}),
340
+ size: "30"
341
+ })]
342
+ })
343
+ });
344
+ DialogHeader.displayName = 'DialogHeader';
345
+
346
+ const InfoDialog = props => jsxRuntime.jsxs(DialogContainer, {
347
+ isOpen: props.isOpen,
348
+ onClose: props.onClose,
349
+ size: props.size,
350
+ zIndex: props.zIndex,
351
+ title: props.title,
352
+ "aria-label": props['aria-label'],
353
+ getParentSelector: props.getParentSelector,
354
+ children: [jsxRuntime.jsx(DialogHeader, {
355
+ title: props.title,
356
+ onClose: props.onClose
357
+ }), jsxRuntime.jsx(DialogContent, {
358
+ children: props.children
359
+ })]
360
+ });
361
+ InfoDialog.displayName = 'InfoDialog';
362
+
363
+ // Allow consumers who want to use a custom title to reuse the same title styles
364
+ // as the default dialog title.
365
+ InfoDialog.TextTitle = TextTitle;
366
+
367
+ function filterDataAttributes(obj) {
368
+ return omitBy__default["default"](obj, (_value, key) => !_startsWithInstanceProperty__default["default"](key).call(key, 'data-'));
369
+ }
370
+
371
+ const _excluded$i = ["isPrimaryButtonDisabled", "dataAttributesPrimaryButton", "dataAttributesSecondaryButton"];
372
+ 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; }
373
+ 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; }
374
+ const getFormattedLabel = (label, intl) => typeof label === 'string' ? label : intl.formatMessage(label);
375
+ const DialogFooter = _ref => {
376
+ let _ref$isPrimaryButtonD = _ref.isPrimaryButtonDisabled,
377
+ isPrimaryButtonDisabled = _ref$isPrimaryButtonD === void 0 ? false : _ref$isPrimaryButtonD,
378
+ _ref$dataAttributesPr = _ref.dataAttributesPrimaryButton,
379
+ dataAttributesPrimaryButton = _ref$dataAttributesPr === void 0 ? {} : _ref$dataAttributesPr,
380
+ _ref$dataAttributesSe = _ref.dataAttributesSecondaryButton,
381
+ dataAttributesSecondaryButton = _ref$dataAttributesSe === void 0 ? {} : _ref$dataAttributesSe,
382
+ props = _objectWithoutProperties(_ref, _excluded$i);
383
+ const intl = reactIntl.useIntl();
384
+ return jsxRuntime.jsx("div", {
385
+ css: /*#__PURE__*/react.css("margin-top:", designSystem.designTokens.spacing50, ";" + ("" ), "" ),
386
+ children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
387
+ alignItems: "center",
388
+ justifyContent: "space-between",
389
+ children: [jsxRuntime.jsx("div", {
390
+ children: props.footerContent
391
+ }), jsxRuntime.jsxs(Spacings__default["default"].Inline, {
392
+ scale: "m",
393
+ alignItems: "center",
394
+ justifyContent: "flex-end",
395
+ children: [jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$4({
396
+ label: getFormattedLabel(props.labelSecondary, intl),
397
+ onClick: props.onCancel,
398
+ iconLeft: props.iconLeftSecondaryButton
399
+ }, filterDataAttributes(dataAttributesSecondaryButton))), jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$4({
400
+ label: getFormattedLabel(props.labelPrimary, intl),
401
+ iconLeft: props.iconLeftPrimaryButton,
402
+ onClick: props.onConfirm,
403
+ isDisabled: isPrimaryButtonDisabled
404
+ }, filterDataAttributes(dataAttributesPrimaryButton)))]
405
+ })]
406
+ })
407
+ });
408
+ };
409
+ DialogFooter.displayName = 'DialogFooter';
410
+
411
+ const _excluded$h = ["labelSecondary", "labelPrimary"];
412
+ const ConfirmationDialog = _ref => {
413
+ let _ref$labelSecondary = _ref.labelSecondary,
414
+ labelSecondary = _ref$labelSecondary === void 0 ? i18n.sharedMessages.cancel : _ref$labelSecondary,
415
+ _ref$labelPrimary = _ref.labelPrimary,
416
+ labelPrimary = _ref$labelPrimary === void 0 ? i18n.sharedMessages.confirm : _ref$labelPrimary,
417
+ props = _objectWithoutProperties(_ref, _excluded$h);
418
+ return jsxRuntime.jsxs(DialogContainer, {
419
+ isOpen: props.isOpen,
420
+ onClose: props.onClose,
421
+ size: props.size,
422
+ zIndex: props.zIndex,
423
+ title: props.title,
424
+ "aria-label": props['aria-label'],
425
+ getParentSelector: props.getParentSelector,
426
+ children: [jsxRuntime.jsx(DialogHeader, {
427
+ title: props.title,
428
+ onClose: props.onClose
429
+ }), jsxRuntime.jsx(DialogContent, {
430
+ children: props.children
431
+ }), jsxRuntime.jsx(DialogFooter, {
432
+ labelSecondary: labelSecondary,
433
+ labelPrimary: labelPrimary,
434
+ isPrimaryButtonDisabled: props.isPrimaryButtonDisabled,
435
+ onCancel: props.onCancel,
436
+ onConfirm: props.onConfirm,
437
+ dataAttributesSecondaryButton: props.dataAttributesSecondaryButton,
438
+ dataAttributesPrimaryButton: props.dataAttributesPrimaryButton
439
+ })]
440
+ });
441
+ };
442
+ ConfirmationDialog.displayName = 'ConfirmationDialog';
443
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
444
+ // The Intl messages can be used for button labels.
445
+ ConfirmationDialog.Intl = i18n.sharedMessages;
446
+ // Allow consumers who want to use a custom title to reuse the same title styles
447
+ // as the default dialog title.
448
+ ConfirmationDialog.TextTitle = TextTitle;
449
+
450
+ const _excluded$g = ["labelSecondary", "labelPrimary"];
451
+ const FormDialog = _ref => {
452
+ let _ref$labelSecondary = _ref.labelSecondary,
453
+ labelSecondary = _ref$labelSecondary === void 0 ? i18n.sharedMessages.cancel : _ref$labelSecondary,
454
+ _ref$labelPrimary = _ref.labelPrimary,
455
+ labelPrimary = _ref$labelPrimary === void 0 ? i18n.sharedMessages.save : _ref$labelPrimary,
456
+ props = _objectWithoutProperties(_ref, _excluded$g);
457
+ return jsxRuntime.jsxs(DialogContainer, {
458
+ isOpen: props.isOpen,
459
+ onClose: props.onClose,
460
+ size: props.size,
461
+ zIndex: props.zIndex,
462
+ title: props.title,
463
+ "aria-label": props['aria-label'],
464
+ getParentSelector: props.getParentSelector,
465
+ children: [jsxRuntime.jsx(DialogHeader, {
466
+ title: props.title,
467
+ onClose: props.onClose
468
+ }), jsxRuntime.jsx(DialogContent, {
469
+ children: props.children
470
+ }), jsxRuntime.jsx(DialogFooter, {
471
+ labelSecondary: labelSecondary,
472
+ labelPrimary: labelPrimary,
473
+ isPrimaryButtonDisabled: props.isPrimaryButtonDisabled,
474
+ onCancel: props.onSecondaryButtonClick,
475
+ onConfirm: props.onPrimaryButtonClick,
476
+ dataAttributesSecondaryButton: props.dataAttributesSecondaryButton,
477
+ dataAttributesPrimaryButton: props.dataAttributesPrimaryButton,
478
+ iconLeftSecondaryButton: props.iconLeftSecondaryButton,
479
+ iconLeftPrimaryButton: props.iconLeftPrimaryButton,
480
+ footerContent: props.footerContent
481
+ })]
482
+ });
483
+ };
484
+ FormDialog.displayName = 'FormDialog';
485
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
486
+ // The Intl messages can be used for button labels.
487
+ FormDialog.Intl = i18n.sharedMessages;
488
+ // Allow consumers who want to use a custom title to reuse the same title styles
489
+ // as the default dialog title.
490
+ FormDialog.TextTitle = TextTitle;
491
+
492
+ const CustomViewSelector = /*#__PURE__*/react$1.lazy(() => {
493
+ if (typeof window !== 'undefined' && typeof window.app !== 'undefined') {
494
+ return Promise.resolve().then(function () { return require('./custom-views-selector-03d0524e.cjs.prod.js' /* webpackChunkName: "custom-views-selector" */); });
495
+ }
496
+ return _Promise__default["default"].resolve({
497
+ default: () => null
498
+ });
499
+ });
500
+
501
+ const _excluded$f = ["truncate"],
502
+ _excluded2$1 = ["titleSize", "truncate"];
503
+ const SubtitleWrapper = /*#__PURE__*/_styled__default["default"]("div", {
504
+ target: "epaiodd0"
505
+ } )("margin-top:", designSystem.designTokens.spacing20, ";" + ("" ));
506
+ const Title = props => {
507
+ switch (props.titleSize) {
508
+ case 'big':
509
+ return jsxRuntime.jsx(Text__default["default"].Headline, {
510
+ as: "h1",
511
+ title: props.title,
512
+ truncate: props.truncate,
513
+ children: props.title
514
+ });
515
+ case 'medium':
516
+ return jsxRuntime.jsx(Text__default["default"].Headline, {
517
+ as: "h2",
518
+ title: props.title,
519
+ truncate: props.truncate,
520
+ children: props.title
521
+ });
522
+ default:
523
+ return jsxRuntime.jsx(Text__default["default"].Subheadline, {
524
+ as: "h4",
525
+ title: props.title,
526
+ truncate: props.truncate,
527
+ children: props.title
528
+ });
529
+ }
530
+ };
531
+ const Subtitle = _ref2 => {
532
+ let _ref2$truncate = _ref2.truncate,
533
+ truncate = _ref2$truncate === void 0 ? false : _ref2$truncate,
534
+ props = _objectWithoutProperties(_ref2, _excluded$f);
535
+ if (!props.subtitle) {
536
+ return null;
537
+ }
538
+ if (/*#__PURE__*/react$1.isValidElement(props.subtitle)) {
539
+ return jsxRuntime.jsx(SubtitleWrapper, {
540
+ children: props.subtitle
541
+ });
542
+ }
543
+ return jsxRuntime.jsx(SubtitleWrapper, {
544
+ children: jsxRuntime.jsx(Text__default["default"].Body, {
545
+ title: typeof props.subtitle === 'string' ? props.subtitle : undefined,
546
+ truncate: truncate,
547
+ tone: "secondary",
548
+ children: props.subtitle
549
+ })
550
+ });
551
+ };
552
+ var _ref$5 = {
553
+ name: "d3v9zr",
554
+ styles: "overflow:hidden"
555
+ } ;
556
+ const PageHeaderTitle = _ref3 => {
557
+ let _ref3$titleSize = _ref3.titleSize,
558
+ titleSize = _ref3$titleSize === void 0 ? 'small' : _ref3$titleSize,
559
+ _ref3$truncate = _ref3.truncate,
560
+ truncate = _ref3$truncate === void 0 ? false : _ref3$truncate,
561
+ props = _objectWithoutProperties(_ref3, _excluded2$1);
562
+ return jsxRuntime.jsxs("div", {
563
+ css: _ref$5,
564
+ children: [jsxRuntime.jsx(Title, {
565
+ title: props.title,
566
+ titleSize: titleSize,
567
+ truncate: truncate
568
+ }), jsxRuntime.jsx(Subtitle, {
569
+ subtitle: props.subtitle,
570
+ truncate: truncate
571
+ })]
572
+ });
573
+ };
574
+ PageHeaderTitle.displayName = 'PageHeaderTitle';
575
+
576
+ const PageHeader = props => {
577
+ return jsxRuntime.jsxs("div", {
578
+ css: /*#__PURE__*/react.css("margin:0 ", designSystem.designTokens.spacing55, ";padding:", designSystem.designTokens.spacing40, " 0 ", designSystem.designTokens.spacing40, ";border-bottom:1px solid ", designSystem.designTokens.colorNeutral90, ";" + ("" ), "" ),
579
+ children: [jsxRuntime.jsxs("div", {
580
+ css: /*#__PURE__*/react.css("display:flex;align-items:flex-end;justify-content:space-between;&>*+*{margin-left:", designSystem.designTokens.spacing50, ";}" + ("" ), "" ),
581
+ children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
582
+ title: props.title,
583
+ titleSize: "big",
584
+ subtitle: props.subtitle,
585
+ truncate: true
586
+ }), props.children]
587
+ }), jsxRuntime.jsx(CustomViewSelector, {
588
+ margin: `${designSystem.designTokens.spacing40} 0 0 0`,
589
+ customViewLocatorCode: props.customViewLocatorCode
590
+ })]
591
+ });
592
+ };
593
+ PageHeader.displayName = 'PageHeader';
594
+
595
+ const ContentWrapper$2 = /*#__PURE__*/_styled__default["default"]("div", {
596
+ target: "e1b7jwn02"
597
+ } )("flex:1;flex-basis:0;overflow:auto;margin:", designTokens.marginForPageContent, ";" + ("" ));
598
+ const ModalContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
599
+ target: "e1b7jwn01"
600
+ } )("flex:1;flex-basis:0;overflow:auto;margin:", designSystem.designTokens.spacing50, " ", designSystem.designTokens.spacing55, ";" + ("" ));
601
+ const PageWrapper = /*#__PURE__*/_styled__default["default"]("div", {
602
+ target: "e1b7jwn00"
603
+ } )({
604
+ name: "kdbhus",
605
+ styles: "height:100%;display:flex;flex-direction:column"
606
+ } );
607
+
608
+ const messages$4 = reactIntl.defineMessages({
609
+ back: {
610
+ id: 'Components.ModalPage.TopBar.Back',
611
+ defaultMessage: 'Go Back'
612
+ },
613
+ close: {
614
+ id: 'Components.ModalPage.TopBar.Close',
615
+ defaultMessage: 'Close Modal Page'
616
+ }
617
+ });
618
+
619
+ const _excluded$e = ["color", "previousPathLabel", "hidePathLabel"];
620
+ // Component to have a larger clickable surface
621
+ var _ref2$1 = {
622
+ name: "1rxhroq",
623
+ styles: "display:flex;align-items:center;justify-content:center;&::after{content:'';position:absolute;height:35px;width:48px;top:0;right:0;}"
624
+ } ;
625
+ const LargeIconWrapper = props => jsxRuntime.jsx("span", {
626
+ css: _ref2$1,
627
+ children: /*#__PURE__*/react$1.cloneElement(props.children, {
628
+ size: props.size
629
+ })
630
+ });
631
+
632
+ // NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
633
+ // However, we need to explicitly define this otherwise the prop-types babel plugin
634
+ // does not recognize the object shape.
635
+ var _ref$4 = {
636
+ name: "uvw8rn",
637
+ styles: "display:flex;overflow:hidden;button:first-of-type svg{height:12px!important;width:12px!important;}"
638
+ } ;
639
+ const ModalPageTopBar = _ref3 => {
640
+ _ref3.color;
641
+ let _ref3$previousPathLab = _ref3.previousPathLabel,
642
+ previousPathLabel = _ref3$previousPathLab === void 0 ? messages$4.back : _ref3$previousPathLab,
643
+ _ref3$hidePathLabel = _ref3.hidePathLabel,
644
+ hidePathLabel = _ref3$hidePathLabel === void 0 ? false : _ref3$hidePathLabel,
645
+ props = _objectWithoutProperties(_ref3, _excluded$e);
646
+ const intl = reactIntl.useIntl();
647
+ return jsxRuntime.jsxs("div", {
648
+ 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;}" + ("" ), "" ),
649
+ children: [jsxRuntime.jsxs("div", {
650
+ css: _ref$4,
651
+ children: [!hidePathLabel && jsxRuntime.jsx(FlatButton__default["default"], {
652
+ tone: "primary",
653
+ label: typeof previousPathLabel === 'string' ? previousPathLabel : intl.formatMessage(previousPathLabel),
654
+ icon: jsxRuntime.jsx(icons.AngleLeftIcon, {
655
+ size: "medium",
656
+ color: "primary"
657
+ }),
658
+ onClick: props.onClose
659
+ }), props.currentPathLabel && jsxRuntime.jsxs(jsxRuntime.Fragment, {
660
+ children: [jsxRuntime.jsx(Text__default["default"].Detail, {
661
+ as: "span",
662
+ children: "/"
663
+ }), jsxRuntime.jsx(Text__default["default"].Detail, {
664
+ as: "span",
665
+ title: props.currentPathLabel,
666
+ truncate: true,
667
+ children: props.currentPathLabel
668
+ })]
669
+ })]
670
+ }), props.onClose && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
671
+ label: intl.formatMessage(messages$4.close),
672
+ onClick: props.onClose,
673
+ icon: jsxRuntime.jsx(LargeIconWrapper, {
674
+ children: jsxRuntime.jsx(icons.CloseIcon, {})
675
+ }),
676
+ size: "40"
677
+ })]
678
+ });
679
+ };
680
+ ModalPageTopBar.displayName = 'ModalPageTopBar';
681
+
682
+ const stylesBySize = {
683
+ '10': {
684
+ width: '600px',
685
+ transitionTime: 200
686
+ },
687
+ '20': {
688
+ width: '900px',
689
+ transitionTime: 200
690
+ },
691
+ '30': {
692
+ width: '1200px',
693
+ transitionTime: 200
694
+ },
695
+ scale: {
696
+ width: '100%',
697
+ transitionTime: 300
698
+ }
699
+ };
700
+ const overlayShow = react.keyframes`
701
+ 0% {
702
+ opacity: 0;
703
+ }
704
+ 100% {
705
+ opacity: 1;
706
+ }
707
+ `;
708
+
709
+ // we can't use Overlay from Radix-ui because it doesn't appear in DOM when Dialog.Root is rendered with `modal={false}`
710
+ const ModalOverlay = /*#__PURE__*/_styled__default["default"]("div", {
711
+ target: "e1jbmsa1"
712
+ } )("position:absolute;top:0;left:0;width:100%;height:100%;background-color:hsla(195, 35%, 20%, 0.05);z-index:", _ref => {
713
+ let zIndex = _ref.zIndex;
714
+ return (
715
+ // Use `!important` to overwrite the default value assigned by the Stacking Layer System.
716
+ typeof zIndex === 'number' ? `${zIndex} !important` : 'inherit'
717
+ );
718
+ }, ";opacity:0;", _ref2 => {
719
+ let size = _ref2.size;
720
+ const transitionDuration = stylesBySize[size].transitionTime;
721
+ return /*#__PURE__*/react.css("animation:", overlayShow, " ", transitionDuration, "ms ease-out forwards;" + ("" ), "" );
722
+ }, ";" + ("" ));
723
+ const getContentShowAnimation = size => react.keyframes({
724
+ '0%': {
725
+ opacity: 0,
726
+ transform: `translate3d(${size !== 'scale' ? stylesBySize[size].width : '30px'}, 0, 0)`
727
+ },
728
+ '100%': {
729
+ opacity: 1,
730
+ transform: `translate3d(0, 0, 0)`
731
+ }
732
+ });
733
+ const getContentHideAnimation = size => react.keyframes({
734
+ '0%': {
735
+ opacity: 1,
736
+ transform: `translate3d(0, 0, 0)`
737
+ },
738
+ '100%': {
739
+ opacity: 0,
740
+ transform: `translate3d(${size !== 'scale' ? stylesBySize[size].width : '30px'}, 0, 0)`
741
+ }
742
+ });
743
+ const ModalContent = /*#__PURE__*/_styled__default["default"](reactDialog.Content, {
744
+ shouldForwardProp: prop => prop !== 'size',
745
+ target: "e1jbmsa0"
746
+ } )("position:absolute;top:0;right:0;height:100%;width:", _ref3 => {
747
+ let size = _ref3.size;
748
+ return size !== 'scale' ?
749
+ // In case we're using a specific size, we want it to be used until there's no space left.
750
+ // In such scenario, we want the modal to be as wide as possible, but using the shared indentation width size.
751
+ `min(${stylesBySize[size].width}, calc(100% - ${constants.PORTALS_CONTAINER_INDENTATION_SIZE})) !important` : stylesBySize.scale.width;
752
+ }, ";display:flex;flex-direction:column;background-color:", designSystem.designTokens.colorSurface, ";box-shadow:0px 0px 40px 0px rgba(0, 0, 0, 0.1);outline:0;z-index:inherit;&[data-state='open']{animation:", _ref4 => {
753
+ let size = _ref4.size;
754
+ return getContentShowAnimation(size);
755
+ }, " 300ms ease forwards;}&[data-state='closed']{animation:", _ref5 => {
756
+ let size = _ref5.size;
757
+ return getContentHideAnimation(size);
758
+ }, " 300ms ease forwards;}" + ("" ));
759
+
760
+ const _excluded$d = ["size", "getParentSelector", "shouldDelayOnClose"];
761
+ const HiddenEmptyDialogTitle = () => jsxRuntime.jsx("div", {
762
+ "aria-hidden": true,
763
+ style: {
764
+ display: 'none'
765
+ },
766
+ children: jsxRuntime.jsx(reactDialog.Title, {})
767
+ });
768
+
769
+ // When running tests, we don't render the AppShell. Instead we mock the
770
+ // application context to make the data available to the application under
771
+ // test. However, this also means that the AppShell tree is not rendered,
772
+ // which contains among other things the <div id="portals-container" />
773
+ // element, used to render the modal content.
774
+ // Apparently though, when the <Modal> component unmounts between tests, it
775
+ // tries to remove the child elements within the parent selector
776
+ // ("portals-container") which may have been cleaned up by another test,
777
+ // resulting in the <Modal> to throw an NotFoundError.
778
+ // To solve this, we can simply use "document.body" as the parent selector
779
+ // instead of a specific element that will be cleaned up, resulting in
780
+ // console errors (even though the test passes). We only need to to this in
781
+ // test environment.
782
+ const getDefaultParentSelector = () => document.querySelector(`#${constants.PORTALS_CONTAINER_ID}`);
783
+
784
+ // NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
785
+ // However, we need to explicitly define this otherwise the prop-types babel plugin
786
+ // does not recognize the object shape.
787
+
788
+ const ModalPage = _ref => {
789
+ let _ref$size = _ref.size,
790
+ size = _ref$size === void 0 ? 'scale' : _ref$size,
791
+ _ref$getParentSelecto = _ref.getParentSelector,
792
+ getParentSelector = _ref$getParentSelecto === void 0 ? getDefaultParentSelector : _ref$getParentSelecto,
793
+ _ref$shouldDelayOnClo = _ref.shouldDelayOnClose,
794
+ shouldDelayOnClose = _ref$shouldDelayOnClo === void 0 ? true : _ref$shouldDelayOnClo,
795
+ props = _objectWithoutProperties(_ref, _excluded$d);
796
+ const _useState = react$1.useState(false),
797
+ _useState2 = _slicedToArray(_useState, 2),
798
+ forceClose = _useState2[0],
799
+ setForceClose = _useState2[1];
800
+ const closingTimer = react$1.useRef(undefined);
801
+ const TRANSITION_DURATION = stylesBySize[size].transitionTime;
802
+ react$1.useEffect(() => {
803
+ if (props.isOpen === true) setForceClose(false);
804
+ return () => {
805
+ if (closingTimer.current) {
806
+ clearTimeout(closingTimer.current);
807
+ }
808
+ };
809
+ }, [props.isOpen]);
810
+ const onClose = props.onClose;
811
+ const handleClose = react$1.useCallback(event => {
812
+ if (shouldDelayOnClose) {
813
+ // In this case we want the closing animation to be shown
814
+ // and therefore we need wait for it to be completed
815
+ // before calling `onClose`.
816
+ setForceClose(true);
817
+ closingTimer.current = _setTimeout__default["default"](() => {
818
+ onClose && onClose(event);
819
+ }, TRANSITION_DURATION);
820
+ return;
821
+ }
822
+ onClose && onClose(event);
823
+ }, [onClose, shouldDelayOnClose, TRANSITION_DURATION]);
824
+ const _useState3 = react$1.useState(null),
825
+ _useState4 = _slicedToArray(_useState3, 2),
826
+ portalContainer = _useState4[0],
827
+ setPortalContainer = _useState4[1];
828
+ react$1.useEffect(() => {
829
+ const container = getParentSelector();
830
+ if (container) {
831
+ setPortalContainer(container);
832
+ }
833
+ }, []);
834
+ return jsxRuntime.jsx(reactDialog.Root, {
835
+ open: props.isOpen && !forceClose,
836
+ onOpenChange: handleClose,
837
+ modal: false // `true` would apply aria-hidden to all other elements when the modal is open
838
+ ,
839
+ children: jsxRuntime.jsx(reactDialog.Portal, {
840
+ container: portalContainer,
841
+ children: jsxRuntime.jsxs("div", {
842
+ // Assign the `data-role` to the overlay container, which is used as
843
+ // the CSS selector in the `<PortalsContainer>`.
844
+ "data-role": "modal-overlay",
845
+ children: [jsxRuntime.jsx(ModalOverlay, {
846
+ size: size,
847
+ "data-role": "modal-overlay-clickable",
848
+ onClick: handleClose
849
+ }), jsxRuntime.jsxs(ModalContent, {
850
+ size: size,
851
+ "aria-describedby": undefined,
852
+ onInteractOutside: e => {
853
+ // Prevent only the modal from closing, handle all other events
854
+ const overlay = document.querySelector('[data-role="modal-overlay-clickable"]');
855
+ if (!overlay?.contains(e.target)) {
856
+ e.preventDefault();
857
+ }
858
+ },
859
+ "aria-labelledby": undefined,
860
+ "aria-label": props.title,
861
+ id: undefined,
862
+ children: [jsxRuntime.jsx(HiddenEmptyDialogTitle, {}), !props.hideTopBar && jsxRuntime.jsx(ModalPageTopBar, {
863
+ color: props.topBarColor,
864
+ onClose: handleClose,
865
+ currentPathLabel: props.currentPathLabel,
866
+ previousPathLabel: props.previousPathLabel,
867
+ hidePathLabel: props.hidePathLabel
868
+ }), props.children]
869
+ })]
870
+ })
871
+ })
872
+ });
873
+ };
874
+ ModalPage.displayName = 'ModalPage';
875
+
876
+ const InfoModalPage = props => jsxRuntime.jsxs(ModalPage, {
877
+ title: props.title,
878
+ isOpen: props.isOpen,
879
+ zIndex: props.zIndex,
880
+ onClose: props.onClose,
881
+ currentPathLabel: props.topBarCurrentPathLabel || props.title,
882
+ previousPathLabel: props.topBarPreviousPathLabel,
883
+ shouldDelayOnClose: props.shouldDelayOnClose,
884
+ getParentSelector: props.getParentSelector,
885
+ afterOpenStyles: props.afterOpenStyles,
886
+ children: [jsxRuntime.jsx(PageHeader, {
887
+ title: props.title,
888
+ subtitle: props.subtitle,
889
+ customTitleRow: props.customTitleRow,
890
+ customViewLocatorCode: props.customViewLocatorCode
891
+ }), jsxRuntime.jsx(ModalContentWrapper, {
892
+ children: props.children
893
+ })]
894
+ });
895
+ InfoModalPage.displayName = 'InfoModalPage';
896
+
897
+ const _excluded$c = ["label", "isDisabled", "dataAttributes"],
898
+ _excluded2 = ["label", "isDisabled", "dataAttributes"],
899
+ _excluded3 = ["label", "isDisabled", "dataAttributes"];
900
+ function ownKeys$3(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; }
901
+ function _objectSpread$3(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$3(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$3(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
902
+ const useFormattedLabel = label => {
903
+ const intl = reactIntl.useIntl();
904
+ return typeof label === 'string' ? label : intl.formatMessage(label);
905
+ };
906
+ const FormPrimaryButton = _ref => {
907
+ let _ref$label = _ref.label,
908
+ label = _ref$label === void 0 ? i18n.sharedMessages.confirm : _ref$label,
909
+ _ref$isDisabled = _ref.isDisabled,
910
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
911
+ _ref$dataAttributes = _ref.dataAttributes,
912
+ dataAttributes = _ref$dataAttributes === void 0 ? {} : _ref$dataAttributes,
913
+ props = _objectWithoutProperties(_ref, _excluded$c);
914
+ const _label = useFormattedLabel(label);
915
+ return jsxRuntime.jsx(PrimaryButton__default["default"], _objectSpread$3({
916
+ label: _label,
917
+ onClick: props.onClick,
918
+ isDisabled: isDisabled,
919
+ iconLeft: props.iconLeft
920
+ }, filterDataAttributes(dataAttributes)));
921
+ };
922
+ FormPrimaryButton.displayName = 'FormPrimaryButton';
923
+ const FormSecondaryButton = _ref2 => {
924
+ let _ref2$label = _ref2.label,
925
+ label = _ref2$label === void 0 ? i18n.sharedMessages.cancel : _ref2$label,
926
+ _ref2$isDisabled = _ref2.isDisabled,
927
+ isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
928
+ _ref2$dataAttributes = _ref2.dataAttributes,
929
+ dataAttributes = _ref2$dataAttributes === void 0 ? {} : _ref2$dataAttributes,
930
+ props = _objectWithoutProperties(_ref2, _excluded2);
931
+ const _label = useFormattedLabel(label);
932
+ return jsxRuntime.jsx(SecondaryButton__default["default"], _objectSpread$3({
933
+ label: _label,
934
+ onClick: props.onClick,
935
+ isDisabled: isDisabled,
936
+ iconLeft: props.iconLeft
937
+ }, filterDataAttributes(dataAttributes)));
938
+ };
939
+ FormSecondaryButton.displayName = 'FormSecondaryButton';
940
+ const FormDeleteButton = _ref3 => {
941
+ let _ref3$label = _ref3.label,
942
+ label = _ref3$label === void 0 ? i18n.sharedMessages.delete : _ref3$label,
943
+ _ref3$isDisabled = _ref3.isDisabled,
944
+ isDisabled = _ref3$isDisabled === void 0 ? false : _ref3$isDisabled,
945
+ _ref3$dataAttributes = _ref3.dataAttributes,
946
+ dataAttributes = _ref3$dataAttributes === void 0 ? {} : _ref3$dataAttributes,
947
+ props = _objectWithoutProperties(_ref3, _excluded3);
948
+ const _label = useFormattedLabel(label);
949
+ return jsxRuntime.jsx(IconButton__default["default"], _objectSpread$3({
950
+ icon: jsxRuntime.jsx(icons.BinLinearIcon, {}),
951
+ label: _label,
952
+ onClick: props.onClick,
953
+ isDisabled: isDisabled
954
+ }, filterDataAttributes(dataAttributes)));
955
+ };
956
+ FormDeleteButton.displayName = 'FormDeleteButton';
957
+
958
+ const CustomFormModalPage = props => jsxRuntime.jsxs(ModalPage, {
959
+ title: props.title,
960
+ isOpen: props.isOpen,
961
+ zIndex: props.zIndex,
962
+ onClose: props.onClose,
963
+ currentPathLabel: props.topBarCurrentPathLabel || props.title,
964
+ previousPathLabel: props.topBarPreviousPathLabel,
965
+ getParentSelector: props.getParentSelector,
966
+ shouldDelayOnClose: props.shouldDelayOnClose,
967
+ afterOpenStyles: props.afterOpenStyles,
968
+ children: [jsxRuntime.jsx(PageHeader, {
969
+ title: props.title,
970
+ subtitle: props.subtitle,
971
+ customViewLocatorCode: props.customViewLocatorCode,
972
+ children: !props.hideControls && props.formControls && jsxRuntime.jsx(Spacings__default["default"].Inline, {
973
+ alignItems: "flex-end",
974
+ children: props.formControls
975
+ })
976
+ }), jsxRuntime.jsx(ModalContentWrapper, {
977
+ children: props.children
978
+ })]
979
+ });
980
+ CustomFormModalPage.displayName = 'CustomFormModalPage';
981
+ // Static export of pre-configured form control buttons to easily re-use
982
+ // them in the custom controls.
983
+ CustomFormModalPage.FormPrimaryButton = FormPrimaryButton;
984
+ CustomFormModalPage.FormSecondaryButton = FormSecondaryButton;
985
+ CustomFormModalPage.FormDeleteButton = FormDeleteButton;
986
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
987
+ // The Intl messages can be used for button labels.
988
+ CustomFormModalPage.Intl = i18n.sharedMessages;
989
+
990
+ const _excluded$b = ["hideControls"];
991
+ const FormModalPage = _ref => {
992
+ let _ref$hideControls = _ref.hideControls,
993
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
994
+ props = _objectWithoutProperties(_ref, _excluded$b);
995
+ return jsxRuntime.jsx(CustomFormModalPage, {
996
+ title: props.title,
997
+ subtitle: props.subtitle,
998
+ isOpen: props.isOpen,
999
+ zIndex: props.zIndex,
1000
+ onClose: props.onClose,
1001
+ topBarCurrentPathLabel: props.topBarCurrentPathLabel,
1002
+ topBarPreviousPathLabel: props.topBarPreviousPathLabel,
1003
+ getParentSelector: props.getParentSelector,
1004
+ shouldDelayOnClose: props.shouldDelayOnClose,
1005
+ hideControls: hideControls,
1006
+ afterOpenStyles: props.afterOpenStyles,
1007
+ formControls: jsxRuntime.jsxs(jsxRuntime.Fragment, {
1008
+ children: [jsxRuntime.jsx(CustomFormModalPage.FormSecondaryButton, {
1009
+ label: props.labelSecondaryButton,
1010
+ onClick: props.onSecondaryButtonClick,
1011
+ isDisabled: props.isSecondaryButtonDisabled,
1012
+ dataAttributes: props.dataAttributesSecondaryButton,
1013
+ iconLeft: props.iconLeftSecondaryButton
1014
+ }), jsxRuntime.jsx(CustomFormModalPage.FormPrimaryButton, {
1015
+ label: props.labelPrimaryButton,
1016
+ onClick: props.onPrimaryButtonClick,
1017
+ isDisabled: props.isPrimaryButtonDisabled,
1018
+ dataAttributes: props.dataAttributesPrimaryButton
1019
+ })]
1020
+ }),
1021
+ customViewLocatorCode: props.customViewLocatorCode,
1022
+ children: props.children
1023
+ });
1024
+ };
1025
+ FormModalPage.displayName = 'FormModalPage';
1026
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1027
+ // The Intl messages can be used for button labels.
1028
+ FormModalPage.Intl = i18n.sharedMessages;
1029
+
1030
+ const TabControls = /*#__PURE__*/_styled__default["default"]("div", {
1031
+ target: "elpldre4"
1032
+ } )("margin-top:", designSystem.designTokens.spacingS, ";" + ("" ));
1033
+ const ControlsContainter = props => jsxRuntime.jsxs("div", {
1034
+ css: /*#__PURE__*/react.css("display:flex;align-items:flex-end;justify-content:space-between;margin-top:", designSystem.designTokens.spacing40, ";" + ("" ), "" ),
1035
+ children: [jsxRuntime.jsx(TabControls, {
1036
+ role: "tablist",
1037
+ children: props.tabControls
1038
+ }), props.formControls]
1039
+ });
1040
+ ControlsContainter.displayName = 'ControlsContainter';
1041
+ const TabularPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
1042
+ target: "elpldre3"
1043
+ } )("background-color:", designSystem.designTokens.colorSurface, ";padding:", designTokens.paddingForTabularPageHeader, ";border-bottom:1px solid ", designSystem.designTokens.colorNeutral90, ";" + ("" ));
1044
+ const FormControlsContainer = /*#__PURE__*/_styled__default["default"]("div", {
1045
+ target: "elpldre2"
1046
+ } )("margin-bottom:", designSystem.designTokens.spacingM, ";" + ("" ));
1047
+ const CustomViewsSelectorWrapper = /*#__PURE__*/_styled__default["default"]("div", {
1048
+ target: "elpldre1"
1049
+ } )("margin:", designTokens.marginForCustomViewsSelectorAsTabular, ";" + ("" ));
1050
+ const TabularModalPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
1051
+ target: "elpldre0"
1052
+ } )(TabularPageContainer, "{padding:", designSystem.designTokens.spacing40, " ", designSystem.designTokens.spacing55, " 0;}" + ("" ));
1053
+
1054
+ const _excluded$a = ["hideControls"];
1055
+ const TabularModalPage = _ref => {
1056
+ let _ref$hideControls = _ref.hideControls,
1057
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1058
+ props = _objectWithoutProperties(_ref, _excluded$a);
1059
+ return jsxRuntime.jsxs(ModalPage, {
1060
+ title: props.title,
1061
+ isOpen: props.isOpen,
1062
+ zIndex: props.zIndex,
1063
+ onClose: props.onClose,
1064
+ topBarColor: "neutral",
1065
+ currentPathLabel: props.topBarCurrentPathLabel || props.title,
1066
+ previousPathLabel: props.topBarPreviousPathLabel,
1067
+ getParentSelector: props.getParentSelector,
1068
+ shouldDelayOnClose: props.shouldDelayOnClose,
1069
+ afterOpenStyles: props.afterOpenStyles,
1070
+ children: [jsxRuntime.jsx(TabularModalPageContainer, {
1071
+ children: jsxRuntime.jsxs(TabularPageContainer, {
1072
+ children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
1073
+ title: props.title,
1074
+ titleSize: "big",
1075
+ subtitle: props.subtitle,
1076
+ truncate: true
1077
+ }), jsxRuntime.jsx(ControlsContainter, {
1078
+ tabControls: props.tabControls,
1079
+ formControls: jsxRuntime.jsx(FormControlsContainer, {
1080
+ children: !hideControls && props.formControls && jsxRuntime.jsx(Spacings__default["default"].Inline, {
1081
+ alignItems: "flex-end",
1082
+ children: props.formControls
1083
+ })
1084
+ })
1085
+ })]
1086
+ })
1087
+ }), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
1088
+ children: jsxRuntime.jsx(CustomViewSelector, {
1089
+ margin: `${designSystem.designTokens.spacing30} 0 0 0`,
1090
+ customViewLocatorCodes: props.customViewLocatorCodes
1091
+ })
1092
+ }), jsxRuntime.jsx(ModalContentWrapper, {
1093
+ children: props.children
1094
+ })]
1095
+ });
1096
+ };
1097
+ TabularModalPage.displayName = 'TabularModalPage';
1098
+ // Static export of pre-configured form control buttons to easily re-use
1099
+ // them in the custom controls.
1100
+ TabularModalPage.FormPrimaryButton = FormPrimaryButton;
1101
+ TabularModalPage.FormSecondaryButton = FormSecondaryButton;
1102
+ TabularModalPage.FormDeleteButton = FormDeleteButton;
1103
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1104
+ // The Intl messages can be used for button labels.
1105
+ TabularModalPage.Intl = i18n.sharedMessages;
1106
+
1107
+ const _excluded$9 = ["color", "previousPathLabel"];
1108
+ const PageTopBar = _ref => {
1109
+ _ref.color;
1110
+ let _ref$previousPathLabe = _ref.previousPathLabel,
1111
+ previousPathLabel = _ref$previousPathLabe === void 0 ? messages$4.back : _ref$previousPathLabe,
1112
+ props = _objectWithoutProperties(_ref, _excluded$9);
1113
+ const intl = reactIntl.useIntl();
1114
+ return jsxRuntime.jsx("div", {
1115
+ css: /*#__PURE__*/react.css("position:relative;display:flex;align-items:center;justify-content:space-between;margin-bottom:", designSystem.designTokens.spacing40, ";background-color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ),
1116
+ children: jsxRuntime.jsx(FlatButton__default["default"], {
1117
+ tone: "primary",
1118
+ label: typeof previousPathLabel === 'string' ? previousPathLabel : intl.formatMessage(previousPathLabel),
1119
+ icon: jsxRuntime.jsx(icons.ListIcon, {
1120
+ size: "medium",
1121
+ color: "primary"
1122
+ }),
1123
+ onClick: props.onClick
1124
+ })
1125
+ });
1126
+ };
1127
+ PageTopBar.displayName = 'PageTopBar';
1128
+
1129
+ const _excluded$8 = ["hideControls"];
1130
+ const DetailPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
1131
+ target: "etkdonc1"
1132
+ } )("background-color:", designSystem.designTokens.colorSurface, ";padding:", designTokens.paddingForDetailPageHeader, ";border-bottom:1px ", designSystem.designTokens.colorNeutral90, " solid;" + ("" ));
1133
+ const HeaderControlsWrapper = /*#__PURE__*/_styled__default["default"]("div", {
1134
+ target: "etkdonc0"
1135
+ } )("margin-top:", designSystem.designTokens.spacingS, ";" + ("" ));
1136
+ const getCustomViewsSelectorMargin = hasContentBelow => `${designSystem.designTokens.spacing40} 0 ${hasContentBelow ? designSystem.designTokens.spacing40 : '0'} 0`;
1137
+
1138
+ // NOTE: the `MessageDescriptor` type is exposed by `react-intl`.
1139
+ // However, we need to explicitly define this otherwise the prop-types babel plugin
1140
+ // does not recognize the object shape.
1141
+
1142
+ const CustomFormDetailPage = _ref => {
1143
+ let _ref$hideControls = _ref.hideControls,
1144
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1145
+ props = _objectWithoutProperties(_ref, _excluded$8);
1146
+ return jsxRuntime.jsxs(PageWrapper, {
1147
+ children: [jsxRuntime.jsxs(DetailPageContainer, {
1148
+ children: [jsxRuntime.jsx(PageTopBar, {
1149
+ color: "neutral",
1150
+ previousPathLabel: props.previousPathLabel,
1151
+ onClick: props.onPreviousPathClick
1152
+ }), props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
1153
+ title: props.title ?? '',
1154
+ subtitle: props.subtitle,
1155
+ titleSize: "big"
1156
+ }), jsxRuntime.jsx(CustomViewSelector, {
1157
+ margin: getCustomViewsSelectorMargin(!hideControls && !!props.formControls),
1158
+ customViewLocatorCode: props.customViewLocatorCode
1159
+ }), !hideControls && props.formControls && jsxRuntime.jsx(HeaderControlsWrapper, {
1160
+ children: jsxRuntime.jsx(Spacings__default["default"].Inline, {
1161
+ justifyContent: "flex-end",
1162
+ children: props.formControls
1163
+ })
1164
+ })]
1165
+ }), jsxRuntime.jsx(ContentWrapper$2, {
1166
+ children: props.children
1167
+ })]
1168
+ });
1169
+ };
1170
+ CustomFormDetailPage.displayName = 'CustomFormDetailPage';
1171
+ // Static export of pre-configured page header title component to easily
1172
+ // use as part of a custom title row
1173
+ CustomFormDetailPage.PageHeaderTitle = PageHeaderTitle;
1174
+ // Static export of pre-configured form control buttons to easily re-use
1175
+ // them in the custom controls.
1176
+ CustomFormDetailPage.FormPrimaryButton = FormPrimaryButton;
1177
+ CustomFormDetailPage.FormSecondaryButton = FormSecondaryButton;
1178
+ CustomFormDetailPage.FormDeleteButton = FormDeleteButton;
1179
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1180
+ // The Intl messages can be used for button labels.
1181
+ CustomFormDetailPage.Intl = i18n.sharedMessages;
1182
+
1183
+ const _excluded$7 = ["hideControls"];
1184
+ const FormDetailPage = _ref => {
1185
+ let _ref$hideControls = _ref.hideControls,
1186
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1187
+ props = _objectWithoutProperties(_ref, _excluded$7);
1188
+ return jsxRuntime.jsx(CustomFormDetailPage, {
1189
+ title: props.title,
1190
+ subtitle: props.subtitle,
1191
+ customTitleRow: props.customTitleRow,
1192
+ customViewLocatorCode: props.customViewLocatorCode,
1193
+ previousPathLabel: props.previousPathLabel,
1194
+ onPreviousPathClick: props.onPreviousPathClick,
1195
+ hideControls: hideControls,
1196
+ formControls: jsxRuntime.jsxs(jsxRuntime.Fragment, {
1197
+ children: [jsxRuntime.jsx(CustomFormDetailPage.FormSecondaryButton, {
1198
+ label: props.labelSecondaryButton,
1199
+ onClick: props.onSecondaryButtonClick,
1200
+ isDisabled: props.isSecondaryButtonDisabled,
1201
+ dataAttributes: props.dataAttributesSecondaryButton,
1202
+ iconLeft: props.iconLeftSecondaryButton
1203
+ }), jsxRuntime.jsx(CustomFormDetailPage.FormPrimaryButton, {
1204
+ label: props.labelPrimaryButton,
1205
+ onClick: props.onPrimaryButtonClick,
1206
+ isDisabled: props.isPrimaryButtonDisabled,
1207
+ dataAttributes: props.dataAttributesPrimaryButton
1208
+ })]
1209
+ }),
1210
+ children: props.children
1211
+ });
1212
+ };
1213
+ FormDetailPage.displayName = 'FormDetailPage';
1214
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1215
+ // The Intl messages can be used for button labels.
1216
+ // Static export of pre-configured page header title component to easily
1217
+ // use as part of a custom title row
1218
+ FormDetailPage.PageHeaderTitle = PageHeaderTitle;
1219
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1220
+ // The Intl messages can be used for button labels.
1221
+ FormDetailPage.Intl = i18n.sharedMessages;
1222
+
1223
+ const InfoDetailPage = props => jsxRuntime.jsx(CustomFormDetailPage, {
1224
+ title: props.title,
1225
+ subtitle: props.subtitle,
1226
+ customTitleRow: props.customTitleRow,
1227
+ previousPathLabel: props.previousPathLabel,
1228
+ customViewLocatorCode: props.customViewLocatorCode,
1229
+ onPreviousPathClick: props.onPreviousPathClick,
1230
+ children: props.children
1231
+ });
1232
+ InfoDetailPage.displayName = 'InfoDetailPage';
1233
+ // Static export of pre-configured page header title component to easily
1234
+ // use as part of a custom title row
1235
+ InfoDetailPage.PageHeaderTitle = PageHeaderTitle;
1236
+
1237
+ const _excluded$6 = ["hideControls"];
1238
+ const TabularDetailPage = _ref => {
1239
+ let _ref$hideControls = _ref.hideControls,
1240
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1241
+ props = _objectWithoutProperties(_ref, _excluded$6);
1242
+ return jsxRuntime.jsxs(PageWrapper, {
1243
+ children: [jsxRuntime.jsxs(TabularPageContainer, {
1244
+ children: [jsxRuntime.jsx(PageTopBar, {
1245
+ color: "neutral",
1246
+ previousPathLabel: props.previousPathLabel,
1247
+ onClick: props.onPreviousPathClick
1248
+ }), props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
1249
+ title: props.title ?? '',
1250
+ subtitle: props.subtitle,
1251
+ titleSize: "big"
1252
+ }), jsxRuntime.jsx(ControlsContainter, {
1253
+ tabControls: props.tabControls,
1254
+ formControls: jsxRuntime.jsx(FormControlsContainer, {
1255
+ children: !hideControls && props.formControls && jsxRuntime.jsx(Spacings__default["default"].Inline, {
1256
+ alignItems: "flex-end",
1257
+ children: props.formControls
1258
+ })
1259
+ })
1260
+ })]
1261
+ }), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
1262
+ children: jsxRuntime.jsx(CustomViewSelector, {
1263
+ margin: `${designSystem.designTokens.spacing30} 0 0 0`,
1264
+ customViewLocatorCodes: props.customViewLocatorCodes
1265
+ })
1266
+ }), jsxRuntime.jsx(ContentWrapper$2, {
1267
+ children: props.children
1268
+ })]
1269
+ });
1270
+ };
1271
+ TabularDetailPage.displayName = 'TabularDetailPage';
1272
+ // Static export of pre-configured form control buttons to easily re-use
1273
+ // them in the custom controls.
1274
+ TabularDetailPage.FormPrimaryButton = FormPrimaryButton;
1275
+ TabularDetailPage.FormSecondaryButton = FormSecondaryButton;
1276
+ TabularDetailPage.FormDeleteButton = FormDeleteButton;
1277
+ // Static export of pre-configured page header title component to easily
1278
+ // use as part of a custom title row
1279
+ TabularDetailPage.PageHeaderTitle = PageHeaderTitle;
1280
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1281
+ TabularDetailPage.Intl = i18n.sharedMessages;
1282
+
1283
+ const PublicPageLayout = /*#__PURE__*/react$1.lazy(() => Promise.resolve().then(function () { return require('./public-page-layout-b182d2dd.cjs.prod.js' /* webpackChunkName: "public-page-layout" */); }));
1284
+
1285
+ const MainPageContainer = /*#__PURE__*/_styled__default["default"]("div", {
1286
+ target: "ev8m2jf2"
1287
+ } )("padding:", designTokens.paddingForMainPageHeader, ";" + ("" ));
1288
+ const Divider = /*#__PURE__*/_styled__default["default"]("hr", {
1289
+ target: "ev8m2jf1"
1290
+ } )("background-color:", designSystem.designTokens.colorNeutral90, ";height:1px;border:0;" + ("" ));
1291
+
1292
+ // NOTE: do not change "margin" to "padding" as this breaks sticky DataTable styles
1293
+ const MainPageContent = /*#__PURE__*/_styled__default["default"]("div", {
1294
+ target: "ev8m2jf0"
1295
+ } )("flex:1;flex-basis:0;overflow:auto;margin:", designTokens.marginForPageContent, ";" + ("" ));
1296
+
1297
+ const _excluded$5 = ["hideControls", "hideDivider"];
1298
+ const headerRowMargin = `${designSystem.designTokens.spacing40} 0 0 0`;
1299
+ const CustomFormMainPage = _ref => {
1300
+ let _ref$hideControls = _ref.hideControls,
1301
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1302
+ _ref$hideDivider = _ref.hideDivider,
1303
+ hideDivider = _ref$hideDivider === void 0 ? false : _ref$hideDivider,
1304
+ props = _objectWithoutProperties(_ref, _excluded$5);
1305
+ return jsxRuntime.jsxs(PageWrapper, {
1306
+ children: [jsxRuntime.jsxs(MainPageContainer, {
1307
+ children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
1308
+ title: props.title ?? '',
1309
+ subtitle: props.subtitle,
1310
+ titleSize: "big"
1311
+ }), jsxRuntime.jsx(CustomViewSelector, {
1312
+ margin: headerRowMargin,
1313
+ customViewLocatorCode: props.customViewLocatorCode
1314
+ }), !hideControls && props.formControls && jsxRuntime.jsx("div", {
1315
+ css: /*#__PURE__*/react.css("margin:", headerRowMargin, ";" + ("" ), "" ),
1316
+ children: jsxRuntime.jsx(Spacings__default["default"].Inline, {
1317
+ justifyContent: "flex-end",
1318
+ children: props.formControls
1319
+ })
1320
+ }), !hideDivider && jsxRuntime.jsx("div", {
1321
+ css: /*#__PURE__*/react.css("&>", Divider, "{margin:", headerRowMargin, ";}" + ("" ), "" ),
1322
+ children: jsxRuntime.jsx(Divider, {})
1323
+ })]
1324
+ }), jsxRuntime.jsx(MainPageContent, {
1325
+ children: props.children
1326
+ })]
1327
+ });
1328
+ };
1329
+ CustomFormMainPage.displayName = 'CustomFormMainPage';
1330
+
1331
+ // Static export of pre-configured page header title component to easily
1332
+ // use as part of a custom title row
1333
+ CustomFormMainPage.PageHeaderTitle = PageHeaderTitle;
1334
+
1335
+ // Static export of pre-configured form control buttons to easily re-use
1336
+ // them in the custom controls.
1337
+ CustomFormMainPage.FormPrimaryButton = FormPrimaryButton;
1338
+ CustomFormMainPage.FormSecondaryButton = FormSecondaryButton;
1339
+ CustomFormMainPage.FormDeleteButton = FormDeleteButton;
1340
+
1341
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1342
+ // The Intl messages can be used for button labels.
1343
+ CustomFormMainPage.Intl = i18n.sharedMessages;
1344
+
1345
+ const _excluded$4 = ["hideControls"];
1346
+ const FormMainPage = _ref => {
1347
+ let _ref$hideControls = _ref.hideControls,
1348
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1349
+ props = _objectWithoutProperties(_ref, _excluded$4);
1350
+ return jsxRuntime.jsx(CustomFormMainPage, {
1351
+ title: props.title,
1352
+ subtitle: props.subtitle,
1353
+ customTitleRow: props.customTitleRow,
1354
+ customViewLocatorCode: props.customViewLocatorCode,
1355
+ hideControls: hideControls,
1356
+ formControls: jsxRuntime.jsxs(jsxRuntime.Fragment, {
1357
+ children: [jsxRuntime.jsx(CustomFormMainPage.FormSecondaryButton, {
1358
+ label: props.labelSecondaryButton,
1359
+ onClick: props.onSecondaryButtonClick,
1360
+ isDisabled: props.isSecondaryButtonDisabled,
1361
+ dataAttributes: props.dataAttributesSecondaryButton,
1362
+ iconLeft: props.iconLeftSecondaryButton
1363
+ }), jsxRuntime.jsx(CustomFormMainPage.FormPrimaryButton, {
1364
+ label: props.labelPrimaryButton,
1365
+ onClick: props.onPrimaryButtonClick,
1366
+ isDisabled: props.isPrimaryButtonDisabled,
1367
+ dataAttributes: props.dataAttributesPrimaryButton
1368
+ })]
1369
+ }),
1370
+ children: props.children
1371
+ });
1372
+ };
1373
+ FormMainPage.displayName = 'FormMainPage';
1374
+
1375
+ // Static export of pre-configured page header title component to easily
1376
+ // use as part of a custom title row
1377
+ FormMainPage.PageHeaderTitle = PageHeaderTitle;
1378
+
1379
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1380
+ // The Intl messages can be used for button labels.
1381
+ FormMainPage.Intl = i18n.sharedMessages;
1382
+
1383
+ const InfoMainPage = props => {
1384
+ return jsxRuntime.jsx(CustomFormMainPage, {
1385
+ title: props.title,
1386
+ subtitle: props.subtitle,
1387
+ customTitleRow: props.customTitleRow,
1388
+ customViewLocatorCode: props.customViewLocatorCode,
1389
+ hideDivider: true,
1390
+ children: props.children
1391
+ });
1392
+ };
1393
+ InfoMainPage.displayName = 'InfoMainPage';
1394
+ // Static export of pre-configured page header title component to easily
1395
+ // use as part of a custom title row
1396
+ InfoMainPage.PageHeaderTitle = PageHeaderTitle;
1397
+
1398
+ const _excluded$3 = ["hideControls"];
1399
+ const TabularMainPage = _ref => {
1400
+ let _ref$hideControls = _ref.hideControls,
1401
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1402
+ props = _objectWithoutProperties(_ref, _excluded$3);
1403
+ return jsxRuntime.jsxs(PageWrapper, {
1404
+ children: [jsxRuntime.jsxs(TabularPageContainer, {
1405
+ children: [props.customTitleRow || jsxRuntime.jsx(PageHeaderTitle, {
1406
+ title: props.title ?? '',
1407
+ subtitle: props.subtitle,
1408
+ titleSize: "big"
1409
+ }), jsxRuntime.jsx(ControlsContainter, {
1410
+ tabControls: props.tabControls,
1411
+ formControls: jsxRuntime.jsx(FormControlsContainer, {
1412
+ children: !hideControls && props.formControls && jsxRuntime.jsx(Spacings__default["default"].Inline, {
1413
+ alignItems: "flex-end",
1414
+ children: props.formControls
1415
+ })
1416
+ })
1417
+ })]
1418
+ }), jsxRuntime.jsx(CustomViewsSelectorWrapper, {
1419
+ children: jsxRuntime.jsx(CustomViewSelector, {
1420
+ margin: `${designSystem.designTokens.spacing30} 0 0 0`,
1421
+ customViewLocatorCodes: props.customViewLocatorCodes
1422
+ })
1423
+ }), jsxRuntime.jsx(ContentWrapper$2, {
1424
+ css: /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ),
1425
+ children: props.children
1426
+ })]
1427
+ });
1428
+ };
1429
+ TabularMainPage.displayName = 'TabularMainPage';
1430
+ // Static export of pre-configured form control buttons to easily re-use
1431
+ // them in the custom controls.
1432
+ TabularMainPage.FormPrimaryButton = FormPrimaryButton;
1433
+ TabularMainPage.FormSecondaryButton = FormSecondaryButton;
1434
+ TabularMainPage.FormDeleteButton = FormDeleteButton;
1435
+ // Static export of pre-configured page header title component to easily
1436
+ // use as part of a custom title row
1437
+ TabularMainPage.PageHeaderTitle = PageHeaderTitle;
1438
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1439
+ TabularMainPage.Intl = i18n.sharedMessages;
1440
+
1441
+ var _ref$3 = {
1442
+ name: "zl1inp",
1443
+ styles: "display:flex;justify-content:center"
1444
+ } ;
1445
+ var _ref2 = {
1446
+ name: "10lgefo",
1447
+ styles: "display:grid;align-items:center;justify-content:center;height:100%;white-space:pre-wrap;text-align:center"
1448
+ } ;
1449
+ const MaintenancePageLayout = props => jsxRuntime.jsx("div", {
1450
+ css: _ref2,
1451
+ children: jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
1452
+ max: 10,
1453
+ children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
1454
+ scale: "m",
1455
+ children: [jsxRuntime.jsx("div", {
1456
+ children: jsxRuntime.jsx("img", {
1457
+ style: {
1458
+ height: designSystem.designTokens.constraint7
1459
+ },
1460
+ src: props.imageSrc,
1461
+ alt: props.label
1462
+ })
1463
+ }), jsxRuntime.jsx(Text__default["default"].Headline, {
1464
+ as: "h2",
1465
+ children: props.title
1466
+ }), jsxRuntime.jsx(Text__default["default"].Body, {
1467
+ children: props.paragraph1
1468
+ }), props.bodyContent && jsxRuntime.jsx("div", {
1469
+ css: _ref$3,
1470
+ children: props.bodyContent
1471
+ }), props.paragraph2 && jsxRuntime.jsx(Text__default["default"].Body, {
1472
+ children: props.paragraph2
1473
+ })]
1474
+ })
1475
+ })
1476
+ });
1477
+ MaintenancePageLayout.displayName = 'MaintenancePageLayout';
1478
+
1479
+ var messages$3 = reactIntl.defineMessages({
1480
+ title: {
1481
+ id: 'PageNotFound.title',
1482
+ defaultMessage: 'We could not find what you are looking for'
1483
+ },
1484
+ paragraph1: {
1485
+ id: 'PageNotFound.paragraph1',
1486
+ defaultMessage: 'The item you are looking for may have been deleted, does not exist, or the URL was entered incorrectly. Check the URL and try again.\n\nPlease contact your system administrator or the commercetools <a>Help Desk</a> if you have any further questions.'
1487
+ }
1488
+ });
1489
+
1490
+ function ownKeys$2(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; }
1491
+ function _objectSpread$2(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$2(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$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1492
+ const getLink = msg => jsxRuntime.jsx("a", {
1493
+ href: constants.SUPPORT_PORTAL_URL,
1494
+ target: "_blank",
1495
+ rel: "noopener noreferrer",
1496
+ children: msg
1497
+ }, "support-portal-url");
1498
+ const PageNotFound = () => {
1499
+ const intl = reactIntl.useIntl();
1500
+ return jsxRuntime.jsx(MaintenancePageLayout, {
1501
+ imageSrc: PageNotFoundSVG__default["default"],
1502
+ title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, messages$3.title)),
1503
+ label: intl.formatMessage(messages$3.title),
1504
+ paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2(_objectSpread$2({}, messages$3.paragraph1), {}, {
1505
+ values: {
1506
+ a: getLink
1507
+ }
1508
+ }))
1509
+ });
1510
+ };
1511
+ PageNotFound.displayName = 'PageNotFound';
1512
+
1513
+ var messages$2 = reactIntl.defineMessages({
1514
+ title: {
1515
+ id: 'PageUnauthorized.title',
1516
+ defaultMessage: 'We could not find what you are looking for'
1517
+ },
1518
+ paragraph1: {
1519
+ id: 'PageUnauthorized.paragraph1',
1520
+ defaultMessage: 'The Module you are looking for either does not exist for this Project or you are not authorized to view it.'
1521
+ },
1522
+ paragraph2: {
1523
+ id: 'PageUnauthorized.paragraph2',
1524
+ defaultMessage: 'Please contact your system administrator or the commercetools <a>Help Desk</a> if you have any further questions.'
1525
+ }
1526
+ });
1527
+
1528
+ function ownKeys$1(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; }
1529
+ function _objectSpread$1(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$1(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$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1530
+ const getSupportUrlLink = msg => jsxRuntime.jsx("a", {
1531
+ href: constants.SUPPORT_PORTAL_URL,
1532
+ target: "_blank",
1533
+ rel: "noopener noreferrer",
1534
+ children: msg
1535
+ }, "support-portal-url");
1536
+ const PageUnauthorized = () => {
1537
+ const intl = reactIntl.useIntl();
1538
+ return jsxRuntime.jsx(MaintenancePageLayout, {
1539
+ imageSrc: FailedAuthorizationSVG__default["default"],
1540
+ title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages$2.title)),
1541
+ label: intl.formatMessage(messages$2.title),
1542
+ paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages$2.paragraph1)),
1543
+ paragraph2: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1(_objectSpread$1({}, messages$2.paragraph2), {}, {
1544
+ values: {
1545
+ a: getSupportUrlLink
1546
+ }
1547
+ }))
1548
+ });
1549
+ };
1550
+ PageUnauthorized.displayName = 'PageUnauthorized';
1551
+
1552
+ const Content$1 = /*#__PURE__*/_styled__default["default"]("section", {
1553
+ target: "e1jvhtw81"
1554
+ } )({
1555
+ name: "1sxg93g",
1556
+ styles: "grid-area:content"
1557
+ } );
1558
+ const Container$1 = /*#__PURE__*/_styled__default["default"]("div", {
1559
+ target: "e1jvhtw80"
1560
+ } )({
1561
+ name: "1vpm32e",
1562
+ styles: "display:grid;grid-template-areas:'. content .';grid-template-columns:1fr minmax(400px, 742px) 1fr;width:100%"
1563
+ } );
1564
+ function PageContentNarrow(props) {
1565
+ return jsxRuntime.jsx(Container$1, {
1566
+ children: jsxRuntime.jsx(Content$1, {
1567
+ children: props.children
1568
+ })
1569
+ });
1570
+ }
1571
+
1572
+ const _excluded$2 = ["columns", "gapSize"];
1573
+ const Content = /*#__PURE__*/_styled__default["default"]("section", {
1574
+ target: "e1dg479f4"
1575
+ } )("grid-area:content;display:grid;grid-template-areas:", props => props.columns === '1' ? 'none' : '"left-column right-column"', ";grid-template-columns:", props => {
1576
+ // NOTE: using only `?fr` can cause the layout the "break" as `fr`
1577
+ // is all about distribution of the available space.
1578
+ // If the content of a column becomes "bigger", the system tries
1579
+ // to compensate for the lack of space by reducing the width of the
1580
+ // other column (it does not overflow).
1581
+ // To fix that, we can use `minmax` to instruct the system that
1582
+ // the column size has to be maintained. However, this will cause
1583
+ // some overflow if the content is bigger.
1584
+ // For us, it's important to ensure that the columns layout maintains
1585
+ // the correct dimensions and sizes, thus using `minmax`.
1586
+ switch (props.columns) {
1587
+ case '1/1':
1588
+ return 'repeat(2, minmax(0, 1fr))';
1589
+ case '2/1':
1590
+ return 'minmax(0, 2fr) minmax(0, 1fr)';
1591
+ default:
1592
+ return 'minmax(0, 1fr)';
1593
+ }
1594
+ }, ";gap:", props => props.gapSize === '10' ? designSystem.designTokens.spacing50 : designSystem.designTokens.spacing70, ";width:100%;" + ("" ));
1595
+ const LeftContentColumn = /*#__PURE__*/_styled__default["default"]("div", {
1596
+ target: "e1dg479f3"
1597
+ } )({
1598
+ name: "1ibwnup",
1599
+ styles: "grid-area:left-column"
1600
+ } );
1601
+ const RightContentColumn = /*#__PURE__*/_styled__default["default"]("div", {
1602
+ target: "e1dg479f2"
1603
+ } )({
1604
+ name: "hjfyry",
1605
+ styles: "grid-area:right-column"
1606
+ } );
1607
+ const RightColumnContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
1608
+ target: "e1dg479f1"
1609
+ } )("top:0;position:", props => props.columns === '2/1' ? 'sticky' : 'static', ";" + ("" ));
1610
+ const Container = /*#__PURE__*/_styled__default["default"]("div", {
1611
+ target: "e1dg479f0"
1612
+ } )({
1613
+ name: "5phl7w",
1614
+ styles: "display:grid;grid-template-areas:'. content .';grid-template-columns:1fr minmax(800px, 1200px) 1fr;width:100%"
1615
+ } );
1616
+ function PageContentWide(_ref) {
1617
+ let _ref$columns = _ref.columns,
1618
+ columns = _ref$columns === void 0 ? '1' : _ref$columns,
1619
+ _ref$gapSize = _ref.gapSize,
1620
+ gapSize = _ref$gapSize === void 0 ? '20' : _ref$gapSize,
1621
+ props = _objectWithoutProperties(_ref, _excluded$2);
1622
+ const _Children$toArray = react$1.Children.toArray(props.children),
1623
+ _Children$toArray2 = _slicedToArray(_Children$toArray, 2),
1624
+ leftChild = _Children$toArray2[0],
1625
+ rightChild = _Children$toArray2[1];
1626
+ const childrenCount = react$1.Children.count(props.children);
1627
+ const isOneColumnAndMoreThanOneChild = columns === '1' && childrenCount > 1;
1628
+ const isTwoColumnsAndMoreThanTwoChildren = columns !== '1' && childrenCount > 2;
1629
+ utils.useWarning(!isOneColumnAndMoreThanOneChild, 'PageContentWide: This component only renders its first children when using a single column but you provided more than one.');
1630
+ utils.useWarning(!isTwoColumnsAndMoreThanTwoChildren, 'PageContentWide: This component only renders its first two children when using a two columns layout but you provided more than two.');
1631
+ return jsxRuntime.jsx(Container, {
1632
+ children: jsxRuntime.jsx(Content, {
1633
+ columns: columns,
1634
+ gapSize: gapSize,
1635
+ children: columns === '1' ? jsxRuntime.jsx(jsxRuntime.Fragment, {
1636
+ children: leftChild
1637
+ }) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
1638
+ children: [jsxRuntime.jsx(LeftContentColumn, {
1639
+ children: leftChild
1640
+ }), jsxRuntime.jsx(RightContentColumn, {
1641
+ children: jsxRuntime.jsx(RightColumnContentWrapper, {
1642
+ columns: columns,
1643
+ children: rightChild
1644
+ })
1645
+ })]
1646
+ })
1647
+ })
1648
+ });
1649
+ }
1650
+
1651
+ var _ref$2 = {
1652
+ name: "1d3w5wq",
1653
+ styles: "width:100%"
1654
+ } ;
1655
+ function PageContentFull(props) {
1656
+ return jsxRuntime.jsx("div", {
1657
+ css: _ref$2,
1658
+ children: jsxRuntime.jsx("section", {
1659
+ children: props.children
1660
+ })
1661
+ });
1662
+ }
1663
+
1664
+ const _excluded$1 = ["size", "hideControls", "onPrimaryButtonClick", "onSecondaryButtonClick"];
1665
+ const ContentWrapper$1 = /*#__PURE__*/_styled__default["default"]("div", {
1666
+ target: "e18jo6y41"
1667
+ } )("flex:1;flex-basis:0;margin:", designTokens.marginForPageContent, ";overflow:auto;" + ("" ));
1668
+ const HeaderWrapper = /*#__PURE__*/_styled__default["default"]("div", {
1669
+ target: "e18jo6y40"
1670
+ } )("padding:", designSystem.designTokens.spacing40, " 40px;border-bottom:1px solid ", designSystem.designTokens.colorNeutral90, ";" + ("" ));
1671
+ function Drawer(_ref) {
1672
+ let _ref$size = _ref.size,
1673
+ size = _ref$size === void 0 ? 10 : _ref$size,
1674
+ _ref$hideControls = _ref.hideControls,
1675
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
1676
+ _ref$onPrimaryButtonC = _ref.onPrimaryButtonClick,
1677
+ onPrimaryButtonClick = _ref$onPrimaryButtonC === void 0 ? () => {} : _ref$onPrimaryButtonC,
1678
+ _ref$onSecondaryButto = _ref.onSecondaryButtonClick,
1679
+ onSecondaryButtonClick = _ref$onSecondaryButto === void 0 ? () => {} : _ref$onSecondaryButto,
1680
+ props = _objectWithoutProperties(_ref, _excluded$1);
1681
+ const intl = reactIntl.useIntl();
1682
+ return jsxRuntime.jsxs(ModalPage, {
1683
+ isOpen: props.isOpen,
1684
+ hidePathLabel: true,
1685
+ hideTopBar: true,
1686
+ onClose: props.onClose,
1687
+ size: size,
1688
+ title: props.title,
1689
+ afterOpenStyles: props.afterOpenStyles,
1690
+ getParentSelector: props.getParentSelector,
1691
+ shouldDelayOnClose: props.shouldDelayOnClose,
1692
+ topBarColor: props.topBarColor,
1693
+ zIndex: props.zIndex,
1694
+ children: [jsxRuntime.jsx(HeaderWrapper, {
1695
+ children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
1696
+ children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
1697
+ justifyContent: "space-between",
1698
+ children: [jsxRuntime.jsx(PageHeaderTitle, {
1699
+ title: props.title,
1700
+ titleSize: "medium",
1701
+ subtitle: props.subtitle && jsxRuntime.jsx(Text__default["default"].Detail, {
1702
+ children: props.subtitle
1703
+ })
1704
+ }), props.onClose && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
1705
+ label: intl.formatMessage(messages$4.close),
1706
+ onClick: props.onClose,
1707
+ icon: jsxRuntime.jsx(LargeIconWrapper, {
1708
+ children: jsxRuntime.jsx(icons.CloseIcon, {})
1709
+ }),
1710
+ size: "40"
1711
+ })]
1712
+ }), jsxRuntime.jsxs(Spacings__default["default"].Inline, {
1713
+ justifyContent: "flex-end",
1714
+ children: [!hideControls && props.formControls && props.formControls, !hideControls && !props.formControls && jsxRuntime.jsxs(jsxRuntime.Fragment, {
1715
+ children: [jsxRuntime.jsx(FormSecondaryButton, {
1716
+ label: props.labelSecondaryButton,
1717
+ onClick: onSecondaryButtonClick,
1718
+ isDisabled: props.isSecondaryButtonDisabled,
1719
+ dataAttributes: props.dataAttributesSecondaryButton,
1720
+ iconLeft: props.iconLeftSecondaryButton
1721
+ }), jsxRuntime.jsx(FormPrimaryButton, {
1722
+ label: props.labelPrimaryButton,
1723
+ onClick: onPrimaryButtonClick,
1724
+ isDisabled: props.isPrimaryButtonDisabled,
1725
+ dataAttributes: props.dataAttributesPrimaryButton
1726
+ })]
1727
+ })]
1728
+ })]
1729
+ })
1730
+ }), jsxRuntime.jsx(ContentWrapper$1, {
1731
+ children: props.children
1732
+ })]
1733
+ });
1734
+ }
1735
+ Drawer.displayName = 'Drawer';
1736
+ // Static export of pre-configured form control buttons to easily re-use
1737
+ // them in the custom controls.
1738
+ Drawer.FormPrimaryButton = FormPrimaryButton;
1739
+ Drawer.FormSecondaryButton = FormSecondaryButton;
1740
+ // This is a convenience proxy export to expose pre-defined Intl messages defined in the `@commercetools-frontend/i18n` package.
1741
+ // The Intl messages can be used for button labels.
1742
+ Drawer.Intl = i18n.sharedMessages;
1743
+
1744
+ const messages$1 = reactIntl.defineMessages({
1745
+ loadError: {
1746
+ id: 'CustomViewLoader.error.load',
1747
+ defaultMessage: 'We could not load the Custom View. Please contact your administrator to check its configuration.'
1748
+ }
1749
+ });
1750
+
1751
+ const isIframeReady = iFrameElementRef => {
1752
+ try {
1753
+ return iFrameElementRef?.contentWindow?.document.readyState === 'complete';
1754
+ } catch {
1755
+ // Trying to access the contentWindow of a cross-origin iFrame will throw an error.
1756
+ // We are not supposed to even get here because the iFrame must use
1757
+ // a URL from our very same domain (the custom view is proxied through our http-proxy service).
1758
+ return false;
1759
+ }
1760
+ };
1761
+ const ContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
1762
+ target: "ewwxuwo1"
1763
+ } )({
1764
+ name: "13udsys",
1765
+ styles: "height:100%"
1766
+ } );
1767
+ const CustomPanelIframe = /*#__PURE__*/_styled__default["default"]("iframe", {
1768
+ target: "ewwxuwo0"
1769
+ } )({
1770
+ name: "174lt7a",
1771
+ styles: "height:100%;width:100%;border:none"
1772
+ } );
1773
+ function CustomViewLoader(props) {
1774
+ const iFrameElementRef = react$1.useRef(null);
1775
+ const dataLocale = applicationShellConnectors.useApplicationContext(context => context.dataLocale);
1776
+ const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
1777
+ const featureFlags = reactBroadcast.useAllFeatureToggles();
1778
+ const iFrameCommunicationChannel = react$1.useRef(new MessageChannel());
1779
+ const showNotification = actionsGlobal.useShowNotification();
1780
+ const intl = reactIntl.useIntl();
1781
+ const hasSentInitializationMessages = react$1.useRef(false);
1782
+ const sendInitializationMessages = react$1.useCallback(() => {
1783
+ // If we have already sent the initialization messages, do not send them again.
1784
+ // The message can be sent either as a response to the CUSTOM_VIEW_READY message
1785
+ // or as a result of a setTimeout after 500ms. In any case, this message should be sent only once.
1786
+ if (hasSentInitializationMessages.current) {
1787
+ return;
1788
+ }
1789
+
1790
+ // Transfer port2 to the iFrame so it can send messages back privately
1791
+ iFrameElementRef.current?.contentWindow?.postMessage(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP, window.location.href, [iFrameCommunicationChannel.current.port2]);
1792
+
1793
+ // Send the initialization message to the iFrame
1794
+ iFrameCommunicationChannel.current.port1.postMessage({
1795
+ source: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
1796
+ destination: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${props.customView.id}`,
1797
+ eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION,
1798
+ eventData: {
1799
+ context: {
1800
+ dataLocale,
1801
+ projectKey,
1802
+ featureFlags,
1803
+ customViewConfig: props.customView,
1804
+ hostUrl: props.hostUrl || window.location.href
1805
+ }
1806
+ }
1807
+ });
1808
+ hasSentInitializationMessages.current = true;
1809
+ }, [dataLocale, featureFlags, props.customView, props.hostUrl, projectKey]);
1810
+ const messageFromIFrameHandler = react$1.useCallback(event => {
1811
+ if (event.data.origin === window.location.origin) {
1812
+ switch (event.data.eventName) {
1813
+ case constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_CLOSE:
1814
+ props.onClose();
1815
+ if (props.locatorCode) {
1816
+ window.dispatchEvent(new CustomEvent(constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_ON_CLOSE_AFTER, {
1817
+ detail: {
1818
+ originLocatorCode: props.locatorCode
1819
+ }
1820
+ }));
1821
+ }
1822
+ break;
1823
+ // This message will only be sent by custom view shell older than v24.x
1824
+ // For backwards compatibility we will send the initialization messages
1825
+ // after 500ms if this message was not received by then.
1826
+ case constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_READY:
1827
+ {
1828
+ sendInitializationMessages();
1829
+ }
1830
+ }
1831
+ }
1832
+ }, [props, sendInitializationMessages]);
1833
+
1834
+ // onLoad handler is called from the iFrame even where the URL is not valid
1835
+ // (blocked by CORS, 404, etc.) so we need to make sure the iFrame is ready
1836
+ const onLoadSuccessHandler = react$1.useCallback(() => {
1837
+ // Show error and block if the iFrame is not ready
1838
+ // (error loading it)
1839
+ if (!isIframeReady(iFrameElementRef.current)) {
1840
+ showNotification({
1841
+ domain: constants.DOMAINS.PAGE,
1842
+ kind: constants.NOTIFICATION_KINDS_PAGE.error,
1843
+ text: intl.formatMessage(messages$1.loadError)
1844
+ });
1845
+ return;
1846
+ }
1847
+
1848
+ // This is for backwards compatibility with custom view shell older than v24.0.0
1849
+ // where the custom-view-shell does not send the CUSTOM_VIEW_READY message yet.
1850
+ _setTimeout__default["default"](() => {
1851
+ sendInitializationMessages();
1852
+ }, 500);
1853
+
1854
+ // We want the effect to run only once so we don't need the dependencies array.
1855
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1856
+ }, []);
1857
+ react$1.useEffect(() => {
1858
+ // Close the channel when the component unmounts
1859
+ const communicationChannel = iFrameCommunicationChannel.current;
1860
+
1861
+ // Listen for messages from the iFrame
1862
+ iFrameCommunicationChannel.current.port1.onmessage = messageFromIFrameHandler;
1863
+ window.addEventListener('message', messageFromIFrameHandler);
1864
+ return () => {
1865
+ window.removeEventListener('message', messageFromIFrameHandler);
1866
+ communicationChannel?.port1.close();
1867
+ };
1868
+ }, []);
1869
+
1870
+ // Currently we only support custom panels
1871
+ if (props.customView.type !== 'CustomPanel') {
1872
+ sentry.reportErrorToSentry(new Error(`CustomViewLoader: Provided Custom View has an unsupported type: ${props.customView.type}. Supported types: ['CustomPanel'].`));
1873
+ return null;
1874
+ }
1875
+ const panelSize = props.customView.typeSettings?.size?.toLocaleLowerCase() || 'large';
1876
+ const iFrameUrl = [window.location.origin, 'custom-views', props.customView.id, 'projects', projectKey].join('/');
1877
+ return jsxRuntime.jsx(ModalPage, {
1878
+ isOpen: true,
1879
+ onClose: props.onClose,
1880
+ size: panelSize === 'small' ? 10 : 30,
1881
+ title: `Custom View: ${props.customView.defaultLabel}`,
1882
+ hideTopBar: true,
1883
+ children: jsxRuntime.jsx(ContentWrapper, {
1884
+ children: jsxRuntime.jsx(CustomPanelIframe, {
1885
+ id: `custom-view-${props.customView.id}`,
1886
+ title: `Custom View: ${props.customView.defaultLabel}`,
1887
+ ref: iFrameElementRef,
1888
+ src: iFrameUrl,
1889
+ onLoad: onLoadSuccessHandler
1890
+ }, `custom-view-${props.customView.id}`)
1891
+ })
1892
+ });
1893
+ }
1894
+
1895
+ var messages = reactIntl.defineMessages({
1896
+ ProjectProduction: {
1897
+ id: 'ProjectStamp.production',
1898
+ defaultMessage: 'Production'
1899
+ },
1900
+ ProjectSuspended: {
1901
+ id: 'ProjectStamp.suspended',
1902
+ defaultMessage: 'Suspended'
1903
+ },
1904
+ ProjectExpired: {
1905
+ id: 'ProjectStamp.expired',
1906
+ defaultMessage: 'Trial expired'
1907
+ },
1908
+ ProjectWillExpire: {
1909
+ id: 'ProjectStamp.willExpire',
1910
+ defaultMessage: '{daysLeft, select, 0 {Trial ends today} 1 {Trial ends in 1 day} other {Trial ends in {daysLeft} days}}'
1911
+ }
1912
+ });
1913
+
1914
+ const _excluded = ["values"];
1915
+ function ownKeys(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; }
1916
+ function _objectSpread(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(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(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1917
+ function CustomStamp(props) {
1918
+ const intl = reactIntl.useIntl();
1919
+ const _props$label = props.label,
1920
+ values = _valuesInstanceProperty__default["default"](_props$label),
1921
+ message = _objectWithoutProperties(_props$label, _excluded);
1922
+ return jsxRuntime.jsx(Stamp__default["default"], {
1923
+ tone: props.tone,
1924
+ isCondensed: true,
1925
+ label: intl.formatMessage(message, values || {}),
1926
+ icon: props.icon
1927
+ });
1928
+ }
1929
+ var _ref$1 = {
1930
+ name: "ph6b5m",
1931
+ styles: "height:18px;svg{height:18px;width:12px;}"
1932
+ } ;
1933
+ const IsProduction = () => {
1934
+ return jsxRuntime.jsx(CustomStamp, {
1935
+ tone: "positive",
1936
+ label: messages.ProjectProduction,
1937
+ icon: jsxRuntime.jsx("div", {
1938
+ css: _ref$1,
1939
+ children: jsxRuntime.jsx(icons.DotIcon, {
1940
+ color: "success"
1941
+ })
1942
+ })
1943
+ });
1944
+ };
1945
+ const IsSuspended = () => jsxRuntime.jsx(CustomStamp, {
1946
+ tone: "critical",
1947
+ label: messages.ProjectSuspended
1948
+ });
1949
+ const IsExpired = () => jsxRuntime.jsx(CustomStamp, {
1950
+ tone: "critical",
1951
+ label: messages.ProjectExpired
1952
+ });
1953
+ const WillExpire = props => jsxRuntime.jsx(CustomStamp, {
1954
+ tone: "information",
1955
+ label: _objectSpread(_objectSpread({}, messages.ProjectWillExpire), {}, {
1956
+ values: {
1957
+ daysLeft: props.daysLeft
1958
+ }
1959
+ })
1960
+ });
1961
+ const ProjectStamp = {
1962
+ IsProduction,
1963
+ IsSuspended,
1964
+ IsExpired,
1965
+ WillExpire
1966
+ };
1967
+
1968
+ const useObserverElementDimensions = element => {
1969
+ const _useState = react$1.useState({
1970
+ height: 0,
1971
+ width: 0
1972
+ }),
1973
+ _useState2 = _slicedToArray(_useState, 2),
1974
+ dimensions = _useState2[0],
1975
+ setDimensions = _useState2[1];
1976
+ useResizeObserver__default["default"](element, entry => {
1977
+ setDimensions({
1978
+ height: entry.contentRect.height,
1979
+ width: entry.contentRect.width
1980
+ });
1981
+ });
1982
+ return dimensions;
1983
+ };
1984
+
1985
+ // All modal components expect to be rendered inside this container.
1986
+ var _ref = {
1987
+ name: "qk9kof",
1988
+ styles: "display:flex;height:1px;margin-top:-1px"
1989
+ } ;
1990
+ const PortalsContainer = /*#__PURE__*/react$1.forwardRef((props, ref) => {
1991
+ // Initialize props with default values.
1992
+ // NOTE: using `defaultProps` with `forwardRef` results in the type declarations
1993
+ // to ignore the `defaultProps`. Therefore, the default props are typed
1994
+ // as optional and we initialize the value here with the default values.
1995
+ const offsetTop = props.offsetTop ?? '0px';
1996
+ const offsetLeft = props.offsetLeft ?? '0px';
1997
+ const offsetLeftOnExpandedMenu = props.offsetLeftOnExpandedMenu ?? '0px';
1998
+ const containerSelectorToPreventScrollingOnOpen = props.containerSelectorToPreventScrollingOnOpen ?? 'main';
1999
+ const zIndex = props.zIndex ?? 10000;
2000
+ const baseModalZIndex = props.baseModalZIndex ?? 1000;
2001
+ const modalWidthTransition = 'width 150ms cubic-bezier(1, 0, 0.58, 1)';
2002
+ const portalsContainerRef = react$1.useRef(null);
2003
+ const globalNotificationsElementDimensions = useObserverElementDimensions(ref?.current?.notificationsGlobalRef);
2004
+ const pageNotificationsElementDimensions = useObserverElementDimensions(ref?.current?.notificationsPageRef);
2005
+ const _useState3 = react$1.useState([]),
2006
+ _useState4 = _slicedToArray(_useState3, 2),
2007
+ stackingLayers = _useState4[0],
2008
+ setStackingLayers = _useState4[1];
2009
+ // The mutation observer gets triggered every time a child node gets added or
2010
+ // removed from the portals container.
2011
+ // The stacking layers are then re-calculated.
2012
+ hooks.useMutationObserver(portalsContainerRef, mutationList => {
2013
+ var _context;
2014
+ // We expect only a single element in the mutation list as we configured the
2015
+ // observer to only listen to `childList` changes.
2016
+ const _mutationList = _slicedToArray(mutationList, 1),
2017
+ mutationEvent = _mutationList[0];
2018
+ let indentationLevel = 0;
2019
+ const nextStackingLevels = [];
2020
+ _forEachInstanceProperty__default["default"](_context = mutationEvent.target.childNodes).call(_context, (node, index) => {
2021
+ if (node instanceof HTMLElement) {
2022
+ const stackingLevel = index + 1;
2023
+ node.dataset.level = String(stackingLevel);
2024
+ if (node.dataset.role === 'modal-overlay') {
2025
+ indentationLevel += 1;
2026
+ }
2027
+ nextStackingLevels.push({
2028
+ stackingLevel,
2029
+ indentationLevel
2030
+ });
2031
+ }
2032
+ });
2033
+ setStackingLayers(nextStackingLevels);
2034
+ }, {
2035
+ // Only subscribe to changes to the child nodes of the portals container.
2036
+ childList: true
2037
+ });
2038
+ const isModalOpen = stackingLayers.length > 0;
2039
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2040
+ children: [jsxRuntime.jsx(react.Global, {
2041
+ styles: [isModalOpen && /*#__PURE__*/react.css(containerSelectorToPreventScrollingOnOpen, "{overflow:hidden!important;}#", constants.PORTALS_CONTAINER_ID, "{position:fixed;height:calc(\n 100% - ", offsetTop, " -\n ", globalNotificationsElementDimensions.height, "px -\n ", pageNotificationsElementDimensions.height, "px\n );width:calc(100% - ", offsetLeft, ");top:calc(\n ", offsetTop, " +\n ", globalNotificationsElementDimensions.height, "px +\n ", pageNotificationsElementDimensions.height, "px\n );right:0;bottom:0;z-index:", zIndex, ";transition:", modalWidthTransition, ";}.body__menu-open #", constants.PORTALS_CONTAINER_ID, "{width:calc(100% - ", offsetLeftOnExpandedMenu, ");transition:", modalWidthTransition, ";}" + ("" ), "" ),
2042
+ // Apply styles for stacking layers.
2043
+ ..._mapInstanceProperty__default["default"](stackingLayers).call(stackingLayers,
2044
+ /**
2045
+ * Every "overlay" container gets assigned a sequential `z-index` level.
2046
+ * Furthermore, the "modal overlay" containers (not "dialog") get assigned
2047
+ * the correct indentation level width.
2048
+ */
2049
+ stackingLayer => /*#__PURE__*/react.css("#", constants.PORTALS_CONTAINER_ID, " [data-level='", stackingLayer.stackingLevel, "'][data-role$='overlay']{z-index:calc(\n ", baseModalZIndex, " + ", stackingLayer.stackingLevel, "\n );}#", constants.PORTALS_CONTAINER_ID, " [data-level='", stackingLayer.stackingLevel, "'][data-role='modal-overlay'] [role='dialog']{width:calc(\n 100% -\n (\n ", constants.PORTALS_CONTAINER_INDENTATION_SIZE, " *\n ", stackingLayer.indentationLevel, "\n )\n );}" + ("" ), "" )), "" ]
2050
+ }), jsxRuntime.jsx("div", {
2051
+ id: constants.PORTALS_CONTAINER_ID,
2052
+ ref: portalsContainerRef
2053
+ // The container needs a height in order to be tabbable: https://reactjs/react-modal#774
2054
+ ,
2055
+ css: _ref
2056
+ })]
2057
+ });
2058
+ });
2059
+ PortalsContainer.displayName = 'PortalsContainer';
2060
+
2061
+ const useModalState = function () {
2062
+ let isInitiallyOpen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2063
+ const _useState = react$1.useState(isInitiallyOpen),
2064
+ _useState2 = _slicedToArray(_useState, 2),
2065
+ isModalOpen = _useState2[0],
2066
+ setIsModalOpen = _useState2[1];
2067
+ const openModal = react$1.useCallback(() => setIsModalOpen(true), []);
2068
+ const closeModal = react$1.useCallback(() => setIsModalOpen(false), []);
2069
+ return {
2070
+ isModalOpen,
2071
+ openModal,
2072
+ closeModal
2073
+ };
2074
+ };
2075
+
2076
+ exports.ConfirmationDialog = ConfirmationDialog;
2077
+ exports.CustomFormDetailPage = CustomFormDetailPage;
2078
+ exports.CustomFormMainPage = CustomFormMainPage;
2079
+ exports.CustomFormModalPage = CustomFormModalPage;
2080
+ exports.CustomViewLoader = CustomViewLoader;
2081
+ exports.CustomViewsSelector = CustomViewSelector;
2082
+ exports.Drawer = Drawer;
2083
+ exports.FormDetailPage = FormDetailPage;
2084
+ exports.FormDialog = FormDialog;
2085
+ exports.FormMainPage = FormMainPage;
2086
+ exports.FormModalPage = FormModalPage;
2087
+ exports.InfoDetailPage = InfoDetailPage;
2088
+ exports.InfoDialog = InfoDialog;
2089
+ exports.InfoMainPage = InfoMainPage;
2090
+ exports.InfoModalPage = InfoModalPage;
2091
+ exports.MaintenancePageLayout = MaintenancePageLayout;
2092
+ exports.ModalPageTopBar = ModalPageTopBar;
2093
+ exports.PageContentFull = PageContentFull;
2094
+ exports.PageContentNarrow = PageContentNarrow;
2095
+ exports.PageContentWide = PageContentWide;
2096
+ exports.PageNotFound = PageNotFound;
2097
+ exports.PageUnauthorized = PageUnauthorized;
2098
+ exports.PortalsContainer = PortalsContainer;
2099
+ exports.ProjectStamp = ProjectStamp;
2100
+ exports.PublicPageLayout = PublicPageLayout;
2101
+ exports.TabHeader = TabHeader;
2102
+ exports.TabularDetailPage = TabularDetailPage;
2103
+ exports.TabularMainPage = TabularMainPage;
2104
+ exports.TabularModalPage = TabularModalPage;
2105
+ exports.designTokens = designTokens;
2106
+ exports.themesOverrides = themesOverrides;
2107
+ exports.useModalState = useModalState;
2108
+ exports.version = version;