newspack-components 4.3.0 → 4.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/DEVELOPMENT.md +868 -0
- package/colors/colors.module.scss +52 -2
- package/copy-styles.js +3 -2
- package/dist/cjs/accordion/index.js +17 -12
- package/dist/cjs/action-card/index.js +176 -139
- package/dist/cjs/autocomplete-tokenfield/index.js +254 -234
- package/dist/cjs/autocomplete-with-latest-posts/index.js +172 -110
- package/dist/cjs/autocomplete-with-suggestions/index.js +229 -126
- package/dist/cjs/badge/index.js +7 -7
- package/dist/cjs/box-contrast/index.js +19 -15
- package/dist/cjs/button/index.js +41 -26
- package/dist/cjs/button-props/button-props.js +5 -5
- package/dist/cjs/button-props/index.js +2 -2
- package/dist/cjs/card/core-card.js +110 -52
- package/dist/cjs/card/index.js +74 -67
- package/dist/cjs/card/style-core.scss +93 -25
- package/dist/cjs/card/style.scss +2 -2
- package/dist/cjs/card-feature/index.js +141 -0
- package/dist/cjs/card-feature/style.scss +75 -0
- package/dist/cjs/card-form/index.js +144 -0
- package/dist/cjs/card-form/style.scss +20 -0
- package/dist/cjs/card-settings-group/index.js +36 -16
- package/dist/cjs/card-sortable-list/index.js +176 -140
- package/dist/cjs/category-autocomplete/index.js +175 -155
- package/dist/cjs/color-picker/index.js +41 -23
- package/dist/cjs/color-picker/index.test.js +82 -0
- package/dist/cjs/color-picker/style.scss +11 -13
- package/dist/cjs/confirm-dialog/index.js +86 -22
- package/dist/cjs/consts.js +1 -1
- package/dist/cjs/custom-select-control/index.js +39 -28
- package/dist/cjs/dataviews/index.js +38 -0
- package/dist/cjs/dataviews/style.scss +9 -0
- package/dist/cjs/divider/index.js +26 -21
- package/dist/cjs/footer/index.js +36 -30
- package/dist/cjs/form-token-field/index.js +51 -40
- package/dist/cjs/global-notices/index.js +5 -5
- package/dist/cjs/grid/index.js +25 -19
- package/dist/cjs/grid/style.scss +6 -1
- package/dist/cjs/handoff/index.js +204 -156
- package/dist/cjs/handoff-message/index.js +12 -7
- package/dist/cjs/hooks/index.js +10 -8
- package/dist/cjs/hooks/use-confirm-dialog.js +79 -0
- package/dist/cjs/hooks/use-unsaved-changes-dialog.js +144 -0
- package/dist/cjs/hooks/useObjectState.js +21 -12
- package/dist/cjs/hooks/useObjectState.test.js +55 -33
- package/dist/cjs/hooks/useOnClickOutside.js +6 -6
- package/dist/cjs/hooks/usePrompt.js +10 -13
- package/dist/cjs/image-upload/index.js +114 -123
- package/dist/cjs/image-upload/index.test.js +11 -13
- package/dist/cjs/image-upload/style.scss +12 -40
- package/dist/cjs/index.js +136 -104
- package/dist/cjs/info-button/index.js +43 -32
- package/dist/cjs/integration-icons/active-campaign.js +22 -0
- package/dist/cjs/integration-icons/constant-contact.js +28 -0
- package/dist/cjs/integration-icons/fundraise-up.js +25 -0
- package/dist/cjs/integration-icons/index.js +48 -0
- package/dist/cjs/integration-icons/mailchimp.js +19 -0
- package/dist/cjs/integration-icons/salesforce.js +17 -0
- package/dist/cjs/integration-icons/wisepops.js +20 -0
- package/dist/cjs/modal/index.js +22 -19
- package/dist/cjs/modal/style.scss +4 -0
- package/dist/cjs/newspack-icon/index.js +45 -38
- package/dist/cjs/notice/index.js +64 -55
- package/dist/cjs/plugin-installer/index.js +259 -253
- package/dist/cjs/plugin-settings/SettingsSection.js +66 -60
- package/dist/cjs/plugin-settings/index.js +217 -200
- package/dist/cjs/plugin-toggle/index.js +192 -199
- package/dist/cjs/popover/index.js +41 -28
- package/dist/cjs/position-control/index.js +24 -23
- package/dist/cjs/progress-bar/index.js +71 -59
- package/dist/cjs/progress-bar/index.test.js +62 -68
- package/dist/cjs/proxied-imports/router.js +3 -3
- package/dist/cjs/radio-control/index.js +40 -27
- package/dist/cjs/section-header/index.js +103 -58
- package/dist/cjs/section-header/style.scss +31 -11
- package/dist/cjs/select-control/ButtonGroupControl.js +26 -21
- package/dist/cjs/select-control/GroupedSelectControl.js +41 -35
- package/dist/cjs/select-control/index.js +52 -40
- package/dist/cjs/settings/MinMaxSetting.js +30 -20
- package/dist/cjs/settings/SettingsCard.js +20 -17
- package/dist/cjs/settings/SettingsSection.js +22 -21
- package/dist/cjs/settings/index.js +5 -5
- package/dist/cjs/sortable-newsletter-list-control/index.js +78 -57
- package/dist/cjs/steps-list/index.js +44 -34
- package/dist/cjs/steps-list-item/index.js +47 -39
- package/dist/cjs/style-card/index.js +70 -63
- package/dist/cjs/tabbed-navigation/index.js +38 -36
- package/dist/cjs/text-control/index.js +27 -25
- package/dist/cjs/utils/color.js +4 -4
- package/dist/cjs/utils/editor-toolbar-back-button.js +61 -0
- package/dist/cjs/utils/index.js +31 -19
- package/dist/cjs/utils/style.scss +8 -0
- package/dist/cjs/waiting/index.js +48 -37
- package/dist/cjs/web-preview/index.js +217 -211
- package/dist/cjs/with-wizard/index.js +362 -364
- package/dist/cjs/with-wizard/style.scss +4 -54
- package/dist/cjs/with-wizard-screen/index.js +54 -58
- package/dist/cjs/with-wizard-screen/style.scss +41 -3
- package/dist/cjs/wizard/components/WizardError.js +20 -18
- package/dist/cjs/wizard/components/WizardSnackbar.js +26 -23
- package/dist/cjs/wizard/index.js +176 -114
- package/dist/cjs/wizard/store/index.js +171 -123
- package/dist/cjs/wizard/store/utils.js +13 -8
- package/dist/esm/accordion/index.js +14 -9
- package/dist/esm/action-card/index.js +168 -123
- package/dist/esm/autocomplete-tokenfield/index.js +248 -222
- package/dist/esm/autocomplete-with-latest-posts/index.js +169 -103
- package/dist/esm/autocomplete-with-suggestions/index.js +226 -119
- package/dist/esm/badge/index.js +5 -5
- package/dist/esm/box-contrast/index.js +15 -11
- package/dist/esm/button/index.js +39 -21
- package/dist/esm/button-props/button-props.js +1 -1
- package/dist/esm/card/core-card.js +109 -47
- package/dist/esm/card/index.js +69 -54
- package/dist/esm/card/style-core.scss +93 -25
- package/dist/esm/card/style.scss +2 -2
- package/dist/esm/card-feature/index.js +131 -0
- package/dist/esm/card-feature/style.scss +75 -0
- package/dist/esm/card-form/index.js +134 -0
- package/dist/esm/card-form/style.scss +20 -0
- package/dist/esm/card-settings-group/index.js +33 -14
- package/dist/esm/card-sortable-list/index.js +170 -126
- package/dist/esm/category-autocomplete/index.js +168 -140
- package/dist/esm/color-picker/index.js +39 -21
- package/dist/esm/color-picker/index.test.js +78 -0
- package/dist/esm/color-picker/style.scss +11 -13
- package/dist/esm/confirm-dialog/index.js +85 -18
- package/dist/esm/consts.js +1 -1
- package/dist/esm/custom-select-control/index.js +34 -15
- package/dist/esm/dataviews/index.js +34 -0
- package/dist/esm/dataviews/style.scss +9 -0
- package/dist/esm/divider/index.js +24 -16
- package/dist/esm/footer/index.js +34 -28
- package/dist/esm/form-token-field/index.js +46 -27
- package/dist/esm/global-notices/index.js +3 -3
- package/dist/esm/grid/index.js +23 -14
- package/dist/esm/grid/style.scss +6 -1
- package/dist/esm/handoff/index.js +199 -143
- package/dist/esm/handoff-message/index.js +10 -6
- package/dist/esm/hooks/index.js +8 -6
- package/dist/esm/hooks/use-confirm-dialog.js +73 -0
- package/dist/esm/hooks/use-unsaved-changes-dialog.js +136 -0
- package/dist/esm/hooks/useObjectState.js +19 -9
- package/dist/esm/hooks/useObjectState.test.js +54 -32
- package/dist/esm/hooks/useOnClickOutside.js +4 -4
- package/dist/esm/hooks/usePrompt.js +9 -11
- package/dist/esm/image-upload/index.js +110 -111
- package/dist/esm/image-upload/index.test.js +11 -13
- package/dist/esm/image-upload/style.scss +12 -40
- package/dist/esm/index.js +7 -1
- package/dist/esm/info-button/index.js +38 -19
- package/dist/esm/integration-icons/active-campaign.js +16 -0
- package/dist/esm/integration-icons/constant-contact.js +22 -0
- package/dist/esm/integration-icons/fundraise-up.js +19 -0
- package/dist/esm/integration-icons/index.js +6 -0
- package/dist/esm/integration-icons/mailchimp.js +13 -0
- package/dist/esm/integration-icons/salesforce.js +11 -0
- package/dist/esm/integration-icons/wisepops.js +14 -0
- package/dist/esm/modal/index.js +20 -13
- package/dist/esm/modal/style.scss +4 -0
- package/dist/esm/newspack-icon/index.js +40 -25
- package/dist/esm/notice/index.js +59 -42
- package/dist/esm/plugin-installer/index.js +255 -243
- package/dist/esm/plugin-settings/SettingsSection.js +61 -50
- package/dist/esm/plugin-settings/index.js +212 -189
- package/dist/esm/plugin-toggle/index.js +187 -190
- package/dist/esm/popover/index.js +35 -16
- package/dist/esm/position-control/index.js +22 -18
- package/dist/esm/progress-bar/index.js +66 -49
- package/dist/esm/progress-bar/index.test.js +61 -67
- package/dist/esm/radio-control/index.js +34 -15
- package/dist/esm/section-header/index.js +102 -57
- package/dist/esm/section-header/style.scss +31 -11
- package/dist/esm/select-control/ButtonGroupControl.js +23 -18
- package/dist/esm/select-control/GroupedSelectControl.js +38 -30
- package/dist/esm/select-control/index.js +47 -27
- package/dist/esm/settings/MinMaxSetting.js +27 -16
- package/dist/esm/settings/SettingsCard.js +18 -13
- package/dist/esm/settings/SettingsSection.js +20 -19
- package/dist/esm/settings/index.js +3 -3
- package/dist/esm/sortable-newsletter-list-control/index.js +74 -53
- package/dist/esm/steps-list/index.js +39 -21
- package/dist/esm/steps-list-item/index.js +42 -26
- package/dist/esm/style-card/index.js +65 -50
- package/dist/esm/tabbed-navigation/index.js +35 -33
- package/dist/esm/text-control/index.js +25 -19
- package/dist/esm/utils/color.js +4 -4
- package/dist/esm/utils/editor-toolbar-back-button.js +53 -0
- package/dist/esm/utils/index.js +29 -16
- package/dist/esm/utils/style.scss +8 -0
- package/dist/esm/waiting/index.js +43 -24
- package/dist/esm/web-preview/index.js +213 -201
- package/dist/esm/with-wizard/index.js +360 -358
- package/dist/esm/with-wizard/style.scss +4 -54
- package/dist/esm/with-wizard-screen/index.js +48 -46
- package/dist/esm/with-wizard-screen/style.scss +41 -3
- package/dist/esm/wizard/components/WizardError.js +18 -16
- package/dist/esm/wizard/components/WizardSnackbar.js +23 -17
- package/dist/esm/wizard/index.js +171 -103
- package/dist/esm/wizard/store/index.js +169 -116
- package/dist/esm/wizard/store/utils.js +13 -6
- package/package.json +30 -16
- package/release.config.js +1 -0
- package/shared/hooks/use-coauthors.js +195 -27
- package/shared/hooks/use-coauthors.test.js +232 -6
- package/shared/scss/_mixins.scss +13 -5
- package/src/accordion/index.js +8 -7
- package/src/action-card/index.js +15 -1
- package/src/badge/index.tsx +3 -1
- package/src/card/core-card.js +95 -18
- package/src/card/index.js +1 -0
- package/src/card/style-core.scss +93 -25
- package/src/card/style.scss +2 -2
- package/src/card-feature/README.md +188 -0
- package/src/card-feature/index.tsx +186 -0
- package/src/card-feature/style.scss +75 -0
- package/src/card-form/README.md +113 -0
- package/src/card-form/index.tsx +128 -0
- package/src/card-form/style.scss +20 -0
- package/src/card-settings-group/index.tsx +28 -3
- package/src/card-sortable-list/index.tsx +27 -4
- package/src/color-picker/index.js +15 -8
- package/src/color-picker/index.test.js +52 -0
- package/src/color-picker/style.scss +11 -13
- package/src/confirm-dialog/README.md +128 -0
- package/src/confirm-dialog/index.tsx +74 -6
- package/src/dataviews/index.tsx +34 -0
- package/src/dataviews/style.scss +9 -0
- package/src/grid/style.scss +6 -1
- package/src/handoff/README.md +93 -0
- package/src/handoff/index.js +46 -8
- package/src/hooks/index.ts +2 -1
- package/src/hooks/use-confirm-dialog.tsx +80 -0
- package/src/hooks/use-unsaved-changes-dialog.tsx +140 -0
- package/src/image-upload/index.js +10 -15
- package/src/image-upload/style.scss +12 -40
- package/src/index.js +7 -1
- package/src/integration-icons/active-campaign.js +14 -0
- package/src/integration-icons/constant-contact.js +22 -0
- package/src/integration-icons/fundraise-up.js +18 -0
- package/src/integration-icons/index.js +6 -0
- package/src/integration-icons/mailchimp.js +10 -0
- package/src/integration-icons/salesforce.js +10 -0
- package/src/integration-icons/wisepops.js +14 -0
- package/src/modal/style.scss +4 -0
- package/src/plugin-installer/index.js +30 -19
- package/src/section-header/index.js +56 -24
- package/src/section-header/style.scss +31 -11
- package/src/select-control/index.js +4 -0
- package/src/utils/editor-toolbar-back-button.tsx +48 -0
- package/src/utils/index.js +6 -0
- package/src/utils/style.scss +8 -0
- package/src/with-wizard/style.scss +4 -54
- package/src/with-wizard-screen/style.scss +41 -3
- package/src/wizard/index.js +90 -53
- package/src/wizard/store/index.js +2 -2
- package/dist/cjs/button-card/index.js +0 -72
- package/dist/cjs/button-card/style.scss +0 -180
- package/dist/esm/button-card/index.js +0 -64
- package/dist/esm/button-card/style.scss +0 -180
- package/src/button-card/index.js +0 -52
- package/src/button-card/style.scss +0 -180
|
@@ -4,7 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports["default"] = withWizard;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
14
|
var _element = require("@wordpress/element");
|
|
9
15
|
var _i18n = require("@wordpress/i18n");
|
|
10
16
|
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
@@ -14,392 +20,384 @@ var _router = _interopRequireDefault(require("../proxied-imports/router"));
|
|
|
14
20
|
var _footer = _interopRequireDefault(require("../footer"));
|
|
15
21
|
require("./style.scss");
|
|
16
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
23
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
26
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
18
27
|
* WordPress dependencies.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
28
|
+
*/ /**
|
|
22
29
|
* Internal dependencies.
|
|
23
30
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Redirect,
|
|
27
|
-
Route
|
|
28
|
-
} = _router.default;
|
|
31
|
+
var Redirect = _router["default"].Redirect,
|
|
32
|
+
Route = _router["default"].Route;
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
35
|
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
32
36
|
*/
|
|
33
37
|
function withWizard(WrappedComponent, requiredPlugins) {
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
componentDidMount = () => {
|
|
47
|
-
// If there are no requiredPlugins, fire onWizardReady as soon as component mounts.
|
|
48
|
-
if (!requiredPlugins) {
|
|
49
|
-
const instance = this.wrappedComponentRef.current;
|
|
50
|
-
// eslint-disable-next-line no-unused-expressions
|
|
51
|
-
instance && instance.onWizardReady && instance.onWizardReady();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Set the error. Called by Wizards when an error occurs.
|
|
57
|
-
*
|
|
58
|
-
* @return {Promise} Resolved after state update
|
|
59
|
-
*/
|
|
60
|
-
setError = error => {
|
|
61
|
-
return new Promise(resolve => {
|
|
62
|
-
this.setState({
|
|
63
|
-
error: error || null
|
|
64
|
-
}, () => resolve());
|
|
38
|
+
return /*#__PURE__*/function (_Component) {
|
|
39
|
+
function WrappedWithWizard(props) {
|
|
40
|
+
var _this;
|
|
41
|
+
(0, _classCallCheck2["default"])(this, WrappedWithWizard);
|
|
42
|
+
_this = _callSuper(this, WrappedWithWizard, [props]);
|
|
43
|
+
(0, _defineProperty2["default"])(_this, "componentDidMount", function () {
|
|
44
|
+
// If there are no requiredPlugins, fire onWizardReady as soon as component mounts.
|
|
45
|
+
if (!requiredPlugins) {
|
|
46
|
+
var instance = _this.wrappedComponentRef.current;
|
|
47
|
+
// eslint-disable-next-line no-unused-expressions
|
|
48
|
+
instance && instance.onWizardReady && instance.onWizardReady();
|
|
49
|
+
}
|
|
65
50
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
const parsedError = this.parseError(error);
|
|
81
|
-
const {
|
|
82
|
-
level
|
|
83
|
-
} = parsedError;
|
|
84
|
-
if ('fatal' === level) {
|
|
85
|
-
return this.getFatalError(parsedError);
|
|
86
|
-
}
|
|
87
|
-
return this.getErrorNotice(parsedError);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Get a notice-level error.
|
|
92
|
-
*
|
|
93
|
-
* @param {Error} error object already parsed by parseError
|
|
94
|
-
* @return {Component} Error notice
|
|
95
|
-
*/
|
|
96
|
-
getErrorNotice = error => {
|
|
97
|
-
const {
|
|
98
|
-
message
|
|
99
|
-
} = error;
|
|
100
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
|
|
101
|
-
isError: true,
|
|
102
|
-
className: "newspack-wizard__above-header",
|
|
103
|
-
noticeText: message,
|
|
104
|
-
rawHTML: true
|
|
51
|
+
/**
|
|
52
|
+
* Set the error. Called by Wizards when an error occurs.
|
|
53
|
+
*
|
|
54
|
+
* @return {Promise} Resolved after state update
|
|
55
|
+
*/
|
|
56
|
+
(0, _defineProperty2["default"])(_this, "setError", function (error) {
|
|
57
|
+
return new Promise(function (resolve) {
|
|
58
|
+
_this.setState({
|
|
59
|
+
error: error || null
|
|
60
|
+
}, function () {
|
|
61
|
+
return resolve();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
105
64
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Render any errors that need rendering.
|
|
67
|
+
*
|
|
68
|
+
* @return {Component} Error UI
|
|
69
|
+
*/
|
|
70
|
+
(0, _defineProperty2["default"])(_this, "getError", function () {
|
|
71
|
+
var error = _this.state.error;
|
|
72
|
+
if (!error) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
var parsedError = _this.parseError(error);
|
|
76
|
+
var level = parsedError.level;
|
|
77
|
+
if ('fatal' === level) {
|
|
78
|
+
return _this.getFatalError(parsedError);
|
|
79
|
+
}
|
|
80
|
+
return _this.getErrorNotice(parsedError);
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Get a notice-level error.
|
|
84
|
+
*
|
|
85
|
+
* @param {Error} error object already parsed by parseError
|
|
86
|
+
* @return {Component} Error notice
|
|
87
|
+
*/
|
|
88
|
+
(0, _defineProperty2["default"])(_this, "getErrorNotice", function (error) {
|
|
89
|
+
var message = error.message;
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
|
|
127
91
|
isError: true,
|
|
92
|
+
className: "newspack-wizard__above-header",
|
|
93
|
+
noticeText: message,
|
|
128
94
|
rawHTML: true
|
|
129
|
-
})
|
|
130
|
-
buttonsCard: true,
|
|
131
|
-
noBorder: true,
|
|
132
|
-
className: "justify-end",
|
|
133
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
134
|
-
isPrimary: true,
|
|
135
|
-
href: fallbackURL,
|
|
136
|
-
children: (0, _i18n.__)('Return to Dashboard', 'newspack-plugin')
|
|
137
|
-
})
|
|
138
|
-
})]
|
|
95
|
+
});
|
|
139
96
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
message
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (this.state.loading) {
|
|
173
|
-
this.doneLoading();
|
|
174
|
-
}
|
|
175
|
-
const instance = this.wrappedComponentRef.current;
|
|
176
|
-
this.setState({
|
|
177
|
-
complete
|
|
178
|
-
}, () => {
|
|
179
|
-
// eslint-disable-next-line no-unused-expressions
|
|
180
|
-
complete && instance && instance.onWizardReady && instance.onWizardReady();
|
|
97
|
+
/**
|
|
98
|
+
* Get a fatal-level error.
|
|
99
|
+
*
|
|
100
|
+
* @param {Error} error object already parsed by parseError
|
|
101
|
+
* @return {Component} React object
|
|
102
|
+
*/
|
|
103
|
+
(0, _defineProperty2["default"])(_this, "getFatalError", function (error) {
|
|
104
|
+
var fallbackURL = _this.getFallbackURL();
|
|
105
|
+
if (!fallbackURL) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
var message = error.message;
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Modal, {
|
|
110
|
+
title: (0, _i18n.__)('Unrecoverable error'),
|
|
111
|
+
onRequestClose: function onRequestClose() {
|
|
112
|
+
return window.location = fallbackURL;
|
|
113
|
+
},
|
|
114
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Notice, {
|
|
115
|
+
noticeText: message,
|
|
116
|
+
isError: true,
|
|
117
|
+
rawHTML: true
|
|
118
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Card, {
|
|
119
|
+
buttonsCard: true,
|
|
120
|
+
noBorder: true,
|
|
121
|
+
className: "justify-end",
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
123
|
+
isPrimary: true,
|
|
124
|
+
href: fallbackURL,
|
|
125
|
+
children: (0, _i18n.__)('Return to Dashboard', 'newspack-plugin')
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
181
129
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
wizardApiFetch = args => {
|
|
218
|
-
const {
|
|
219
|
-
quiet
|
|
220
|
-
} = args;
|
|
221
|
-
this.startLoading(quiet);
|
|
222
|
-
return new Promise((resolve, reject) => {
|
|
223
|
-
(0, _apiFetch.default)(args).then(response => {
|
|
224
|
-
this.doneLoading(quiet);
|
|
225
|
-
resolve(response);
|
|
226
|
-
}).catch(error => {
|
|
227
|
-
this.doneLoading(quiet);
|
|
228
|
-
reject(error);
|
|
130
|
+
/**
|
|
131
|
+
* Get all the relevant info out of a raw API error response.
|
|
132
|
+
*
|
|
133
|
+
* @param {Object} error error object
|
|
134
|
+
* @return {Object} Error object with relevant fields and defaults
|
|
135
|
+
*/
|
|
136
|
+
(0, _defineProperty2["default"])(_this, "parseError", function (error) {
|
|
137
|
+
var data = error.data,
|
|
138
|
+
message = error.message,
|
|
139
|
+
code = error.code;
|
|
140
|
+
var level = 'fatal';
|
|
141
|
+
if (!!data && 'level' in data) {
|
|
142
|
+
level = data.level;
|
|
143
|
+
} else if ('rest_invalid_param' === code) {
|
|
144
|
+
level = 'notice';
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
message: message,
|
|
148
|
+
level: level
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Called when plugin installation is complete. Updates state and calls onWizardReady on the wrapped component.
|
|
153
|
+
*/
|
|
154
|
+
(0, _defineProperty2["default"])(_this, "pluginInstallationStatus", function (_ref) {
|
|
155
|
+
var complete = _ref.complete;
|
|
156
|
+
if (_this.state.loading) {
|
|
157
|
+
_this.doneLoading();
|
|
158
|
+
}
|
|
159
|
+
var instance = _this.wrappedComponentRef.current;
|
|
160
|
+
_this.setState({
|
|
161
|
+
complete: complete
|
|
162
|
+
}, function () {
|
|
163
|
+
// eslint-disable-next-line no-unused-expressions
|
|
164
|
+
complete && instance && instance.onWizardReady && instance.onWizardReady();
|
|
229
165
|
});
|
|
230
166
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Begin loading.
|
|
169
|
+
*/
|
|
170
|
+
(0, _defineProperty2["default"])(_this, "startLoading", function (quiet) {
|
|
171
|
+
if (quiet) {
|
|
172
|
+
_this.setState(function (state) {
|
|
173
|
+
return {
|
|
174
|
+
quietLoading: state.quietLoading + 1
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
_this.setState(function (state) {
|
|
179
|
+
return {
|
|
180
|
+
loading: state.loading + 1
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* End loading.
|
|
187
|
+
*/
|
|
188
|
+
(0, _defineProperty2["default"])(_this, "doneLoading", function (quiet) {
|
|
189
|
+
if (quiet) {
|
|
190
|
+
_this.setState(function (state) {
|
|
191
|
+
return {
|
|
192
|
+
quietLoading: state.quietLoading - 1
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
} else {
|
|
196
|
+
_this.setState(function (state) {
|
|
197
|
+
return {
|
|
198
|
+
loading: state.loading - 1
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
/**
|
|
204
|
+
* Replacement for core apiFetch that automatically manages wizard loading UI.
|
|
205
|
+
*/
|
|
206
|
+
(0, _defineProperty2["default"])(_this, "wizardApiFetch", function (args) {
|
|
207
|
+
var quiet = args.quiet;
|
|
208
|
+
_this.startLoading(quiet);
|
|
209
|
+
return new Promise(function (resolve, reject) {
|
|
210
|
+
(0, _apiFetch["default"])(args).then(function (response) {
|
|
211
|
+
_this.doneLoading(quiet);
|
|
212
|
+
resolve(response);
|
|
213
|
+
})["catch"](function (error) {
|
|
214
|
+
_this.doneLoading(quiet);
|
|
215
|
+
reject(error);
|
|
216
|
+
});
|
|
247
217
|
});
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* Render a Route that checks for plugin installation requirements, and redirects to '/' when all are done.
|
|
221
|
+
*
|
|
222
|
+
* @return {void}
|
|
223
|
+
*/
|
|
224
|
+
(0, _defineProperty2["default"])(_this, "pluginRequirements", function () {
|
|
225
|
+
var complete = _this.state.complete;
|
|
226
|
+
/* After all plugins are loaded, redirect to / (this could be configurable) */
|
|
227
|
+
if (complete) {
|
|
228
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Redirect, {
|
|
229
|
+
from: "/plugin-requirements",
|
|
230
|
+
to: "/"
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Route, {
|
|
234
|
+
path: "/",
|
|
235
|
+
render: function render() {
|
|
236
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
237
|
+
children: [complete !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
238
|
+
className: "newspack-wizard__header",
|
|
239
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
240
|
+
className: "newspack-wizard__header__inner",
|
|
241
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
242
|
+
className: "newspack-wizard__title",
|
|
243
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
244
|
+
isLink: true,
|
|
245
|
+
href: newspack_urls.dashboard,
|
|
246
|
+
label: (0, _i18n.__)('Return to Dashboard', 'newspack-plugin'),
|
|
247
|
+
showTooltip: true,
|
|
248
|
+
icon: _icons.category,
|
|
249
|
+
iconSize: 36,
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.NewspackIcon, {
|
|
251
|
+
size: 36
|
|
252
|
+
})
|
|
253
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
254
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
255
|
+
children: requiredPlugins.length > 1 ? (0, _i18n.__)('Required plugins', 'newspack-plugin') : (0, _i18n.__)('Required plugin', 'newspack-plugin')
|
|
256
|
+
})
|
|
257
|
+
})]
|
|
271
258
|
})
|
|
272
|
-
})
|
|
273
|
-
})
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
259
|
+
})
|
|
260
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
261
|
+
className: "newspack-wizard newspack-wizard__content",
|
|
262
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.PluginInstaller, {
|
|
263
|
+
plugins: requiredPlugins,
|
|
264
|
+
onStatus: function onStatus(status) {
|
|
265
|
+
return _this.pluginInstallationStatus(status);
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
})]
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
});
|
|
283
272
|
});
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
this.setState({
|
|
307
|
-
confirmation: modalOptions
|
|
273
|
+
/**
|
|
274
|
+
* Build a confirmation modal with the given title & message.
|
|
275
|
+
* Execute {callback} if confirmed.
|
|
276
|
+
*
|
|
277
|
+
* @property {Object} options Options for the confirmation modal.
|
|
278
|
+
* @property {string} options.title The title for the modal component.
|
|
279
|
+
* @property {string} options.message The message for the modal component body.
|
|
280
|
+
* @property {string} options.confirmText The text for the confirmation button.
|
|
281
|
+
* @property {string} options.cancelText The text for the cancel button.
|
|
282
|
+
* @property {Function} options.callback A function to call if the user confirms the action.
|
|
283
|
+
*/
|
|
284
|
+
(0, _defineProperty2["default"])(_this, "confirmAction", function (options) {
|
|
285
|
+
var modalOptions = _objectSpread({
|
|
286
|
+
title: null,
|
|
287
|
+
message: (0, _i18n.__)('Are you sure?', 'newpack-plugin'),
|
|
288
|
+
confirmText: (0, _i18n.__)('OK', 'newspack-plugin'),
|
|
289
|
+
cancelText: (0, _i18n.__)('Cancel', 'newspack-plugin'),
|
|
290
|
+
callback: null
|
|
291
|
+
}, options);
|
|
292
|
+
_this.setState({
|
|
293
|
+
confirmation: modalOptions
|
|
294
|
+
});
|
|
308
295
|
});
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
title: title,
|
|
332
|
-
onRequestClose: () => this.setState({
|
|
333
|
-
confirmation: null
|
|
334
|
-
}),
|
|
335
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
336
|
-
children: message
|
|
337
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Card, {
|
|
338
|
-
buttonsCard: true,
|
|
339
|
-
noBorder: true,
|
|
340
|
-
className: "justify-end",
|
|
341
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
342
|
-
variant: "secondary",
|
|
343
|
-
onClick: () => this.setState({
|
|
296
|
+
/**
|
|
297
|
+
* Show a confirmation modal with the given title & message.
|
|
298
|
+
* Execute {callback} if confirmed.
|
|
299
|
+
*
|
|
300
|
+
* @return {Component} <Modal>
|
|
301
|
+
*/
|
|
302
|
+
(0, _defineProperty2["default"])(_this, "getModal", function () {
|
|
303
|
+
if (!_this.state.confirmation) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
var _this$state$confirmat = _this.state.confirmation,
|
|
307
|
+
title = _this$state$confirmat.title,
|
|
308
|
+
message = _this$state$confirmat.message,
|
|
309
|
+
confirmText = _this$state$confirmat.confirmText,
|
|
310
|
+
cancelText = _this$state$confirmat.cancelText,
|
|
311
|
+
callback = _this$state$confirmat.callback;
|
|
312
|
+
return message && callback && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Modal, {
|
|
313
|
+
size: "small",
|
|
314
|
+
hideTitle: !title,
|
|
315
|
+
title: title,
|
|
316
|
+
onRequestClose: function onRequestClose() {
|
|
317
|
+
return _this.setState({
|
|
344
318
|
confirmation: null
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
322
|
+
children: message
|
|
323
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_.Card, {
|
|
324
|
+
buttonsCard: true,
|
|
325
|
+
noBorder: true,
|
|
326
|
+
className: "justify-end",
|
|
327
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
328
|
+
variant: "secondary",
|
|
329
|
+
onClick: function onClick() {
|
|
330
|
+
return _this.setState({
|
|
331
|
+
confirmation: null
|
|
332
|
+
});
|
|
333
|
+
},
|
|
334
|
+
children: cancelText
|
|
335
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Button, {
|
|
336
|
+
variant: "primary",
|
|
337
|
+
onClick: function onClick() {
|
|
338
|
+
_this.setState({
|
|
339
|
+
confirmation: null
|
|
340
|
+
});
|
|
341
|
+
callback();
|
|
342
|
+
},
|
|
343
|
+
children: confirmText
|
|
344
|
+
})]
|
|
356
345
|
})]
|
|
357
|
-
})
|
|
346
|
+
});
|
|
358
347
|
});
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Render.
|
|
368
|
-
*/
|
|
369
|
-
render() {
|
|
370
|
-
const {
|
|
371
|
-
simpleFooter
|
|
372
|
-
} = this.props;
|
|
373
|
-
const {
|
|
374
|
-
loading,
|
|
375
|
-
quietLoading,
|
|
376
|
-
error
|
|
377
|
-
} = this.state;
|
|
378
|
-
const loadingClasses = [loading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded'];
|
|
379
|
-
if (quietLoading) {
|
|
380
|
-
loadingClasses.push('newspack-wizard__is-loading-quiet');
|
|
381
|
-
}
|
|
382
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
383
|
-
children: [this.getError(), this.getModal(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
384
|
-
className: loadingClasses.join(' '),
|
|
385
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
386
|
-
confirmAction: this.confirmAction,
|
|
387
|
-
pluginRequirements: requiredPlugins && this.pluginRequirements(),
|
|
388
|
-
clearError: this.clearError,
|
|
389
|
-
getError: this.getError,
|
|
390
|
-
errorData: error,
|
|
391
|
-
setError: this.setError,
|
|
392
|
-
isLoading: loading,
|
|
393
|
-
startLoading: this.startLoading,
|
|
394
|
-
doneLoading: this.doneLoading,
|
|
395
|
-
wizardApiFetch: this.wizardApiFetch,
|
|
396
|
-
ref: this.wrappedComponentRef,
|
|
397
|
-
...this.props
|
|
398
|
-
})
|
|
399
|
-
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_footer.default, {
|
|
400
|
-
simple: simpleFooter
|
|
401
|
-
})]
|
|
348
|
+
(0, _defineProperty2["default"])(_this, "getFallbackURL", function () {
|
|
349
|
+
if (typeof newspack_urls !== 'undefined') {
|
|
350
|
+
return newspack_urls.dashboard;
|
|
351
|
+
}
|
|
402
352
|
});
|
|
353
|
+
_this.state = {
|
|
354
|
+
complete: null,
|
|
355
|
+
error: null,
|
|
356
|
+
loading: requiredPlugins && requiredPlugins.length > 0 ? 1 : 0,
|
|
357
|
+
quietLoading: false,
|
|
358
|
+
confirmation: null
|
|
359
|
+
};
|
|
360
|
+
_this.wrappedComponentRef = (0, _element.createRef)();
|
|
361
|
+
return _this;
|
|
403
362
|
}
|
|
404
|
-
|
|
363
|
+
(0, _inherits2["default"])(WrappedWithWizard, _Component);
|
|
364
|
+
return (0, _createClass2["default"])(WrappedWithWizard, [{
|
|
365
|
+
key: "render",
|
|
366
|
+
value:
|
|
367
|
+
/**
|
|
368
|
+
* Render.
|
|
369
|
+
*/
|
|
370
|
+
function render() {
|
|
371
|
+
var simpleFooter = this.props.simpleFooter;
|
|
372
|
+
var _this$state = this.state,
|
|
373
|
+
loading = _this$state.loading,
|
|
374
|
+
quietLoading = _this$state.quietLoading,
|
|
375
|
+
error = _this$state.error;
|
|
376
|
+
var loadingClasses = [loading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded'];
|
|
377
|
+
if (quietLoading) {
|
|
378
|
+
loadingClasses.push('newspack-wizard__is-loading-quiet');
|
|
379
|
+
}
|
|
380
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
381
|
+
children: [this.getError(), this.getModal(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
382
|
+
className: loadingClasses.join(' '),
|
|
383
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, _objectSpread({
|
|
384
|
+
confirmAction: this.confirmAction,
|
|
385
|
+
pluginRequirements: requiredPlugins && this.pluginRequirements(),
|
|
386
|
+
clearError: this.clearError,
|
|
387
|
+
getError: this.getError,
|
|
388
|
+
errorData: error,
|
|
389
|
+
setError: this.setError,
|
|
390
|
+
isLoading: loading,
|
|
391
|
+
startLoading: this.startLoading,
|
|
392
|
+
doneLoading: this.doneLoading,
|
|
393
|
+
wizardApiFetch: this.wizardApiFetch,
|
|
394
|
+
ref: this.wrappedComponentRef
|
|
395
|
+
}, this.props))
|
|
396
|
+
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_footer["default"], {
|
|
397
|
+
simple: simpleFooter
|
|
398
|
+
})]
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}]);
|
|
402
|
+
}(_element.Component);
|
|
405
403
|
}
|