newspack-components 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/accordion/index.js +46 -0
- package/dist/cjs/accordion/style.scss +27 -0
- package/dist/cjs/action-card/index.js +48 -25
- package/dist/cjs/action-card/style.scss +100 -23
- package/dist/cjs/autocomplete-tokenfield/index.js +13 -41
- package/dist/cjs/autocomplete-tokenfield/style.scss +2 -2
- package/dist/cjs/autocomplete-with-suggestions/index.js +30 -51
- package/dist/cjs/autocomplete-with-suggestions/style.scss +16 -15
- package/dist/cjs/button/index.js +5 -13
- package/dist/cjs/button-card/index.js +1 -10
- package/dist/cjs/button-card/style.scss +13 -13
- package/dist/cjs/button-group/index.js +57 -0
- package/dist/cjs/button-group/style.scss +73 -0
- package/dist/cjs/card/index.js +1 -8
- package/dist/cjs/card/style.scss +25 -8
- package/dist/cjs/category-autocomplete/index.js +18 -38
- package/dist/cjs/category-autocomplete/style.scss +0 -2
- package/dist/cjs/checkbox-control/index.js +63 -0
- package/dist/cjs/checkbox-control/style.scss +78 -0
- package/dist/cjs/color-picker/index.js +1 -15
- package/dist/cjs/color-picker/style.scss +0 -3
- package/dist/cjs/consts.js +5 -3
- package/dist/cjs/custom-select-control/index.js +1 -9
- package/dist/cjs/custom-select-control/style.scss +6 -7
- package/dist/cjs/date-range-picker/index.js +1 -10
- package/dist/cjs/date-range-picker/style.scss +12 -12
- package/dist/cjs/footer/index.js +5 -17
- package/dist/cjs/footer/style.scss +5 -5
- package/dist/cjs/form-token-field/index.js +1 -9
- package/dist/cjs/form-token-field/style.scss +2 -3
- package/dist/cjs/global-notices/index.js +1 -8
- package/dist/cjs/grid/index.js +1 -8
- package/dist/cjs/grid/style.scss +5 -5
- package/dist/cjs/handoff/index.js +8 -17
- package/dist/cjs/handoff-message/index.js +50 -0
- package/dist/cjs/hooks/index.js +1 -7
- package/dist/cjs/hooks/useObjectState.js +7 -13
- package/dist/cjs/hooks/useObjectState.test.js +0 -14
- package/dist/cjs/hooks/useOnClickOutside.js +3 -6
- package/dist/cjs/hooks/usePrompt.js +1 -13
- package/dist/cjs/image-upload/index.js +21 -19
- package/dist/cjs/image-upload/index.test.js +0 -5
- package/dist/cjs/image-upload/style.scss +5 -9
- package/dist/cjs/index.js +28 -44
- package/dist/cjs/info-button/index.js +3 -11
- package/dist/cjs/info-button/style.scss +1 -3
- package/dist/cjs/modal/index.js +1 -9
- package/dist/cjs/modal/style.scss +8 -8
- package/dist/cjs/newspack-icon/index.js +1 -9
- package/dist/cjs/newspack-icon/style.scss +4 -4
- package/dist/cjs/newspack-logo/index.js +1 -9
- package/dist/cjs/newspack-logo/style.scss +3 -3
- package/dist/cjs/notice/index.js +8 -15
- package/dist/cjs/notice/style.scss +28 -15
- package/dist/cjs/patrons-logo/index.js +3 -11
- package/dist/cjs/plugin-installer/index.js +36 -36
- package/dist/cjs/plugin-installer/style.scss +5 -5
- package/dist/cjs/plugin-settings/SettingsSection.js +9 -28
- package/dist/cjs/plugin-settings/index.js +39 -22
- package/dist/cjs/plugin-toggle/index.js +40 -33
- package/dist/cjs/plugin-toggle/style.scss +2 -2
- package/dist/cjs/popover/index.js +1 -11
- package/dist/cjs/popover/style.scss +19 -16
- package/dist/cjs/position-control/index.js +113 -0
- package/dist/cjs/position-control/style.scss +66 -0
- package/dist/cjs/preview-box/index.js +36 -0
- package/dist/cjs/preview-box/style.scss +18 -0
- package/dist/cjs/progress-bar/index.js +2 -9
- package/dist/cjs/progress-bar/index.test.js +2 -7
- package/dist/cjs/progress-bar/style.scss +4 -4
- package/dist/cjs/proxied-imports/router.js +0 -3
- package/dist/cjs/radio-control/index.js +1 -11
- package/dist/cjs/radio-control/style.scss +9 -9
- package/dist/cjs/section-header/index.js +44 -29
- package/dist/cjs/section-header/style.scss +2 -2
- package/dist/cjs/select-control/ButtonGroupControl.js +4 -13
- package/dist/cjs/select-control/GroupedSelectControl.js +9 -15
- package/dist/cjs/select-control/index.js +5 -12
- package/dist/cjs/select-control/style.scss +2 -2
- package/dist/cjs/settings/MinMaxSetting.js +3 -7
- package/dist/cjs/settings/SettingsCard.js +3 -7
- package/dist/cjs/settings/SettingsSection.js +1 -4
- package/dist/cjs/settings/index.js +0 -6
- package/dist/cjs/settings/style.scss +1 -1
- package/dist/cjs/steps-list/index.js +52 -0
- package/dist/cjs/steps-list/style.scss +11 -0
- package/dist/cjs/steps-list-item/index.js +56 -0
- package/dist/cjs/steps-list-item/style.scss +47 -0
- package/dist/cjs/style-card/index.js +6 -13
- package/dist/cjs/style-card/style.scss +9 -12
- package/dist/cjs/style.scss +5 -6
- package/dist/cjs/tabbed-navigation/index.js +19 -16
- package/dist/cjs/tabbed-navigation/style.scss +3 -4
- package/dist/cjs/text-control/index.js +6 -16
- package/dist/cjs/textarea-control/index.js +54 -0
- package/dist/cjs/textarea-control/style.scss +76 -0
- package/dist/cjs/toggle-control/index.js +58 -0
- package/dist/cjs/toggle-control/style.scss +74 -0
- package/dist/cjs/toggle-group/index.js +71 -0
- package/dist/cjs/toggle-group/style.scss +28 -0
- package/dist/cjs/utils/index.js +10 -5
- package/dist/cjs/waiting/index.js +1 -9
- package/dist/cjs/web-preview/index.js +13 -28
- package/dist/cjs/web-preview/style.scss +14 -14
- package/dist/cjs/with-wizard/index.js +51 -31
- package/dist/cjs/with-wizard/style.scss +35 -37
- package/dist/cjs/with-wizard-screen/index.js +11 -17
- package/dist/cjs/with-wizard-screen/style.scss +14 -17
- package/dist/cjs/wizard/components/WizardError.js +3 -15
- package/dist/cjs/wizard/index.js +10 -24
- package/dist/cjs/wizard/store/index.js +42 -55
- package/dist/cjs/wizard/store/utils.js +1 -6
- package/dist/cjs/wizard/style.scss +148 -0
- package/dist/esm/accordion/index.js +38 -0
- package/dist/esm/accordion/style.scss +27 -0
- package/dist/esm/action-card/index.js +50 -21
- package/dist/esm/action-card/style.scss +100 -23
- package/dist/esm/autocomplete-tokenfield/index.js +14 -37
- package/dist/esm/autocomplete-tokenfield/style.scss +2 -2
- package/dist/esm/autocomplete-with-suggestions/index.js +28 -41
- package/dist/esm/autocomplete-with-suggestions/style.scss +16 -15
- package/dist/esm/button/index.js +5 -7
- package/dist/esm/button-card/index.js +2 -5
- package/dist/esm/button-card/style.scss +13 -13
- package/dist/esm/button-group/index.js +43 -0
- package/dist/esm/button-group/style.scss +73 -0
- package/dist/esm/card/index.js +2 -5
- package/dist/esm/card/style.scss +25 -8
- package/dist/esm/category-autocomplete/index.js +17 -30
- package/dist/esm/category-autocomplete/style.scss +0 -2
- package/dist/esm/checkbox-control/index.js +49 -0
- package/dist/esm/checkbox-control/style.scss +78 -0
- package/dist/esm/color-picker/index.js +2 -4
- package/dist/esm/color-picker/style.scss +0 -3
- package/dist/esm/consts.js +3 -2
- package/dist/esm/custom-select-control/index.js +2 -5
- package/dist/esm/custom-select-control/style.scss +6 -7
- package/dist/esm/date-range-picker/index.js +1 -3
- package/dist/esm/date-range-picker/style.scss +12 -12
- package/dist/esm/footer/index.js +3 -11
- package/dist/esm/footer/style.scss +5 -5
- package/dist/esm/form-token-field/index.js +2 -5
- package/dist/esm/form-token-field/style.scss +2 -3
- package/dist/esm/global-notices/index.js +1 -6
- package/dist/esm/grid/index.js +2 -5
- package/dist/esm/grid/style.scss +5 -5
- package/dist/esm/handoff/index.js +3 -14
- package/dist/esm/handoff-message/index.js +45 -0
- package/dist/esm/hooks/index.js +0 -2
- package/dist/esm/hooks/useObjectState.js +3 -8
- package/dist/esm/hooks/useObjectState.test.js +0 -3
- package/dist/esm/hooks/useOnClickOutside.js +2 -5
- package/dist/esm/hooks/usePrompt.js +1 -8
- package/dist/esm/image-upload/index.js +17 -16
- package/dist/esm/image-upload/style.scss +5 -9
- package/dist/esm/index.js +4 -0
- package/dist/esm/info-button/index.js +4 -6
- package/dist/esm/info-button/style.scss +1 -3
- package/dist/esm/modal/index.js +2 -5
- package/dist/esm/modal/style.scss +8 -8
- package/dist/esm/newspack-icon/index.js +2 -5
- package/dist/esm/newspack-icon/style.scss +4 -4
- package/dist/esm/newspack-logo/index.js +2 -5
- package/dist/esm/newspack-logo/style.scss +3 -3
- package/dist/esm/notice/index.js +4 -8
- package/dist/esm/notice/style.scss +28 -15
- package/dist/esm/patrons-logo/index.js +3 -5
- package/dist/esm/plugin-installer/index.js +35 -39
- package/dist/esm/plugin-installer/style.scss +5 -5
- package/dist/esm/plugin-settings/SettingsSection.js +8 -21
- package/dist/esm/plugin-settings/index.js +38 -24
- package/dist/esm/plugin-toggle/index.js +39 -36
- package/dist/esm/plugin-toggle/style.scss +2 -2
- package/dist/esm/popover/index.js +3 -6
- package/dist/esm/popover/style.scss +19 -16
- package/dist/esm/position-control/index.js +109 -0
- package/dist/esm/position-control/style.scss +66 -0
- package/dist/esm/preview-box/index.js +30 -0
- package/dist/esm/preview-box/style.scss +18 -0
- package/dist/esm/progress-bar/index.js +2 -7
- package/dist/esm/progress-bar/index.test.js +2 -1
- package/dist/esm/progress-bar/style.scss +4 -4
- package/dist/esm/proxied-imports/router.js +1 -0
- package/dist/esm/radio-control/index.js +3 -6
- package/dist/esm/radio-control/style.scss +9 -9
- package/dist/esm/section-header/index.js +44 -25
- package/dist/esm/section-header/style.scss +2 -2
- package/dist/esm/select-control/ButtonGroupControl.js +5 -7
- package/dist/esm/select-control/GroupedSelectControl.js +5 -6
- package/dist/esm/select-control/index.js +6 -6
- package/dist/esm/select-control/style.scss +2 -2
- package/dist/esm/settings/MinMaxSetting.js +1 -3
- package/dist/esm/settings/SettingsCard.js +3 -4
- package/dist/esm/settings/SettingsSection.js +0 -2
- package/dist/esm/settings/style.scss +1 -1
- package/dist/esm/steps-list/index.js +43 -0
- package/dist/esm/steps-list/style.scss +11 -0
- package/dist/esm/steps-list-item/index.js +48 -0
- package/dist/esm/steps-list-item/style.scss +47 -0
- package/dist/esm/style-card/index.js +2 -5
- package/dist/esm/style-card/style.scss +9 -12
- package/dist/esm/style.scss +5 -6
- package/dist/esm/tabbed-navigation/index.js +20 -10
- package/dist/esm/tabbed-navigation/style.scss +3 -4
- package/dist/esm/text-control/index.js +2 -9
- package/dist/esm/textarea-control/index.js +40 -0
- package/dist/esm/textarea-control/style.scss +76 -0
- package/dist/esm/toggle-control/index.js +44 -0
- package/dist/esm/toggle-control/style.scss +74 -0
- package/dist/esm/toggle-group/index.js +58 -0
- package/dist/esm/toggle-group/style.scss +28 -0
- package/dist/esm/utils/index.js +9 -3
- package/dist/esm/waiting/index.js +2 -5
- package/dist/esm/web-preview/index.js +9 -24
- package/dist/esm/web-preview/style.scss +14 -14
- package/dist/esm/with-wizard/index.js +49 -34
- package/dist/esm/with-wizard/style.scss +35 -37
- package/dist/esm/with-wizard-screen/index.js +9 -11
- package/dist/esm/with-wizard-screen/style.scss +14 -17
- package/dist/esm/wizard/components/WizardError.js +1 -10
- package/dist/esm/wizard/index.js +10 -12
- package/dist/esm/wizard/store/index.js +40 -46
- package/dist/esm/wizard/store/utils.js +1 -1
- package/dist/esm/wizard/style.scss +148 -0
- package/package.json +4 -4
- package/shared/scss/_colors.scss +0 -15
- package/src/accordion/index.js +32 -0
- package/src/accordion/style.scss +27 -0
- package/src/action-card/index.js +43 -8
- package/src/action-card/style.scss +100 -23
- package/src/autocomplete-tokenfield/index.js +1 -1
- package/src/autocomplete-tokenfield/style.scss +2 -2
- package/src/autocomplete-with-suggestions/style.scss +16 -15
- package/src/button-card/style.scss +13 -13
- package/src/card/style.scss +25 -8
- package/src/category-autocomplete/index.js +3 -1
- package/src/category-autocomplete/style.scss +0 -2
- package/src/color-picker/style.scss +0 -3
- package/src/consts.js +2 -1
- package/src/custom-select-control/style.scss +6 -7
- package/src/date-range-picker/style.scss +12 -12
- package/src/footer/index.js +2 -2
- package/src/footer/style.scss +5 -5
- package/src/form-token-field/index.js +2 -7
- package/src/form-token-field/style.scss +2 -3
- package/src/grid/style.scss +5 -5
- package/src/handoff/index.js +3 -8
- package/src/handoff-message/index.js +39 -0
- package/src/hooks/useObjectState.js +2 -1
- package/src/image-upload/index.js +9 -3
- package/src/image-upload/style.scss +5 -9
- package/src/index.js +4 -0
- package/src/info-button/style.scss +1 -3
- package/src/modal/style.scss +8 -8
- package/src/newspack-icon/style.scss +4 -4
- package/src/newspack-logo/style.scss +3 -3
- package/src/notice/index.js +2 -0
- package/src/notice/style.scss +28 -15
- package/src/plugin-installer/index.js +15 -2
- package/src/plugin-installer/style.scss +5 -5
- package/src/plugin-settings/SettingsSection.js +7 -13
- package/src/plugin-settings/index.js +7 -2
- package/src/plugin-toggle/index.js +2 -3
- package/src/plugin-toggle/style.scss +2 -2
- package/src/popover/style.scss +19 -16
- package/src/position-control/index.js +122 -0
- package/src/position-control/style.scss +66 -0
- package/src/progress-bar/style.scss +4 -4
- package/src/radio-control/style.scss +9 -9
- package/src/section-header/index.js +32 -15
- package/src/section-header/style.scss +2 -2
- package/src/select-control/ButtonGroupControl.js +3 -0
- package/src/select-control/GroupedSelectControl.js +2 -1
- package/src/select-control/index.js +6 -2
- package/src/select-control/style.scss +2 -2
- package/src/settings/style.scss +1 -1
- package/src/steps-list/index.js +39 -0
- package/src/steps-list/style.scss +11 -0
- package/src/steps-list-item/index.js +40 -0
- package/src/steps-list-item/style.scss +47 -0
- package/src/style-card/index.js +2 -11
- package/src/style-card/style.scss +9 -12
- package/src/style.scss +5 -6
- package/src/tabbed-navigation/index.js +12 -4
- package/src/tabbed-navigation/style.scss +3 -4
- package/src/utils/index.js +9 -0
- package/src/web-preview/index.js +1 -1
- package/src/web-preview/style.scss +14 -14
- package/src/with-wizard/style.scss +35 -37
- package/src/with-wizard-screen/index.js +4 -1
- package/src/with-wizard-screen/style.scss +14 -17
- package/src/wizard/index.js +15 -3
- package/src/wizard/store/index.js +8 -2
|
@@ -1,44 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = withWizard;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _element = require("@wordpress/element");
|
|
13
|
-
|
|
14
10
|
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
11
|
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
17
|
-
|
|
18
12
|
var _icons = require("@wordpress/icons");
|
|
19
|
-
|
|
20
13
|
var _ = require("../");
|
|
21
|
-
|
|
22
14
|
var _router = _interopRequireDefault(require("../proxied-imports/router"));
|
|
23
|
-
|
|
24
15
|
var _footer = _interopRequireDefault(require("../footer"));
|
|
25
|
-
|
|
26
16
|
require("./style.scss");
|
|
27
|
-
|
|
28
17
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
29
|
-
|
|
30
18
|
/**
|
|
31
19
|
* WordPress dependencies.
|
|
32
20
|
*/
|
|
33
21
|
const __ = _i18n.__;
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies.
|
|
24
|
+
*/
|
|
34
25
|
const {
|
|
35
26
|
Redirect,
|
|
36
27
|
Route
|
|
37
28
|
} = _router.default;
|
|
29
|
+
|
|
38
30
|
/**
|
|
39
31
|
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
40
32
|
*/
|
|
41
|
-
|
|
42
33
|
function withWizard(WrappedComponent, requiredPlugins) {
|
|
43
34
|
return class WrappedWithWizard extends _element.Component {
|
|
44
35
|
constructor(props) {
|
|
@@ -46,11 +37,16 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
46
37
|
(0, _defineProperty2.default)(this, "componentDidMount", () => {
|
|
47
38
|
// If there are no requiredPlugins, fire onWizardReady as soon as component mounts.
|
|
48
39
|
if (!requiredPlugins) {
|
|
49
|
-
const instance = this.wrappedComponentRef.current;
|
|
50
|
-
|
|
40
|
+
const instance = this.wrappedComponentRef.current;
|
|
41
|
+
// eslint-disable-next-line no-unused-expressions
|
|
51
42
|
instance && instance.onWizardReady && instance.onWizardReady();
|
|
52
43
|
}
|
|
53
44
|
});
|
|
45
|
+
/**
|
|
46
|
+
* Set the error. Called by Wizards when an error occurs.
|
|
47
|
+
*
|
|
48
|
+
* @return {Promise} Resolved after state update
|
|
49
|
+
*/
|
|
54
50
|
(0, _defineProperty2.default)(this, "setError", error => {
|
|
55
51
|
return new Promise(resolve => {
|
|
56
52
|
this.setState({
|
|
@@ -58,26 +54,33 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
58
54
|
}, () => resolve());
|
|
59
55
|
});
|
|
60
56
|
});
|
|
57
|
+
/**
|
|
58
|
+
* Render any errors that need rendering.
|
|
59
|
+
*
|
|
60
|
+
* @return {Component} Error UI
|
|
61
|
+
*/
|
|
61
62
|
(0, _defineProperty2.default)(this, "getError", () => {
|
|
62
63
|
const {
|
|
63
64
|
error
|
|
64
65
|
} = this.state;
|
|
65
|
-
|
|
66
66
|
if (!error) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
69
|
const parsedError = this.parseError(error);
|
|
71
70
|
const {
|
|
72
71
|
level
|
|
73
72
|
} = parsedError;
|
|
74
|
-
|
|
75
73
|
if ('fatal' === level) {
|
|
76
74
|
return this.getFatalError(parsedError);
|
|
77
75
|
}
|
|
78
|
-
|
|
79
76
|
return this.getErrorNotice(parsedError);
|
|
80
77
|
});
|
|
78
|
+
/**
|
|
79
|
+
* Get a notice-level error.
|
|
80
|
+
*
|
|
81
|
+
* @param {Error} error object already parsed by parseError
|
|
82
|
+
* @return {Component} Error notice
|
|
83
|
+
*/
|
|
81
84
|
(0, _defineProperty2.default)(this, "getErrorNotice", error => {
|
|
82
85
|
const {
|
|
83
86
|
message
|
|
@@ -89,13 +92,17 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
89
92
|
rawHTML: true
|
|
90
93
|
});
|
|
91
94
|
});
|
|
95
|
+
/**
|
|
96
|
+
* Get a fatal-level error.
|
|
97
|
+
*
|
|
98
|
+
* @param {Error} error object already parsed by parseError
|
|
99
|
+
* @return {Component} React object
|
|
100
|
+
*/
|
|
92
101
|
(0, _defineProperty2.default)(this, "getFatalError", error => {
|
|
93
102
|
const fallbackURL = this.getFallbackURL();
|
|
94
|
-
|
|
95
103
|
if (!fallbackURL) {
|
|
96
104
|
return null;
|
|
97
105
|
}
|
|
98
|
-
|
|
99
106
|
const {
|
|
100
107
|
message
|
|
101
108
|
} = error;
|
|
@@ -118,6 +125,12 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
118
125
|
})]
|
|
119
126
|
});
|
|
120
127
|
});
|
|
128
|
+
/**
|
|
129
|
+
* Get all the relevant info out of a raw API error response.
|
|
130
|
+
*
|
|
131
|
+
* @param {Object} error error object
|
|
132
|
+
* @return {Object} Error object with relevant fields and defaults
|
|
133
|
+
*/
|
|
121
134
|
(0, _defineProperty2.default)(this, "parseError", error => {
|
|
122
135
|
const {
|
|
123
136
|
data,
|
|
@@ -125,27 +138,26 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
125
138
|
code
|
|
126
139
|
} = error;
|
|
127
140
|
let level = 'fatal';
|
|
128
|
-
|
|
129
141
|
if (!!data && 'level' in data) {
|
|
130
142
|
level = data.level;
|
|
131
143
|
} else if ('rest_invalid_param' === code) {
|
|
132
144
|
level = 'notice';
|
|
133
145
|
}
|
|
134
|
-
|
|
135
146
|
return {
|
|
136
147
|
message,
|
|
137
148
|
level
|
|
138
149
|
};
|
|
139
150
|
});
|
|
151
|
+
/**
|
|
152
|
+
* Called when plugin installation is complete. Updates state and calls onWizardReady on the wrapped component.
|
|
153
|
+
*/
|
|
140
154
|
(0, _defineProperty2.default)(this, "pluginInstallationStatus", _ref => {
|
|
141
155
|
let {
|
|
142
156
|
complete
|
|
143
157
|
} = _ref;
|
|
144
|
-
|
|
145
158
|
if (this.state.loading) {
|
|
146
159
|
this.doneLoading();
|
|
147
160
|
}
|
|
148
|
-
|
|
149
161
|
const instance = this.wrappedComponentRef.current;
|
|
150
162
|
this.setState({
|
|
151
163
|
complete
|
|
@@ -154,6 +166,9 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
154
166
|
complete && instance && instance.onWizardReady && instance.onWizardReady();
|
|
155
167
|
});
|
|
156
168
|
});
|
|
169
|
+
/**
|
|
170
|
+
* Begin loading.
|
|
171
|
+
*/
|
|
157
172
|
(0, _defineProperty2.default)(this, "startLoading", quiet => {
|
|
158
173
|
if (quiet) {
|
|
159
174
|
this.setState(state => ({
|
|
@@ -165,6 +180,9 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
165
180
|
}));
|
|
166
181
|
}
|
|
167
182
|
});
|
|
183
|
+
/**
|
|
184
|
+
* End loading.
|
|
185
|
+
*/
|
|
168
186
|
(0, _defineProperty2.default)(this, "doneLoading", quiet => {
|
|
169
187
|
if (quiet) {
|
|
170
188
|
this.setState(state => ({
|
|
@@ -176,6 +194,9 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
176
194
|
}));
|
|
177
195
|
}
|
|
178
196
|
});
|
|
197
|
+
/**
|
|
198
|
+
* Replacement for core apiFetch that automatically manages wizard loading UI.
|
|
199
|
+
*/
|
|
179
200
|
(0, _defineProperty2.default)(this, "wizardApiFetch", args => {
|
|
180
201
|
const {
|
|
181
202
|
quiet
|
|
@@ -191,19 +212,22 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
191
212
|
});
|
|
192
213
|
});
|
|
193
214
|
});
|
|
215
|
+
/**
|
|
216
|
+
* Render a Route that checks for plugin installation requirements, and redirects to '/' when all are done.
|
|
217
|
+
*
|
|
218
|
+
* @return {void}
|
|
219
|
+
*/
|
|
194
220
|
(0, _defineProperty2.default)(this, "pluginRequirements", () => {
|
|
195
221
|
const {
|
|
196
222
|
complete
|
|
197
223
|
} = this.state;
|
|
198
224
|
/* After all plugins are loaded, redirect to / (this could be configurable) */
|
|
199
|
-
|
|
200
225
|
if (complete) {
|
|
201
226
|
return (0, _jsxRuntime.jsx)(Redirect, {
|
|
202
227
|
from: "/plugin-requirements",
|
|
203
228
|
to: "/"
|
|
204
229
|
});
|
|
205
230
|
}
|
|
206
|
-
|
|
207
231
|
return (0, _jsxRuntime.jsx)(Route, {
|
|
208
232
|
path: "/",
|
|
209
233
|
render: () => (0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
@@ -253,7 +277,6 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
253
277
|
};
|
|
254
278
|
this.wrappedComponentRef = (0, _element.createRef)();
|
|
255
279
|
}
|
|
256
|
-
|
|
257
280
|
/**
|
|
258
281
|
* Render.
|
|
259
282
|
*/
|
|
@@ -267,11 +290,9 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
267
290
|
error
|
|
268
291
|
} = this.state;
|
|
269
292
|
const loadingClasses = [loading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded'];
|
|
270
|
-
|
|
271
293
|
if (quietLoading) {
|
|
272
294
|
loadingClasses.push('newspack-wizard__is-loading-quiet');
|
|
273
295
|
}
|
|
274
|
-
|
|
275
296
|
return (0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
276
297
|
children: [this.getError(), (0, _jsxRuntime.jsx)("div", {
|
|
277
298
|
className: loadingClasses.join(' '),
|
|
@@ -293,6 +314,5 @@ function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
293
314
|
})]
|
|
294
315
|
});
|
|
295
316
|
}
|
|
296
|
-
|
|
297
317
|
};
|
|
298
318
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* With Wizard
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
6
|
-
@
|
|
5
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
6
|
+
@use '../../../shared/scss/colors';
|
|
7
7
|
|
|
8
8
|
// Reset Padding of the Admin Page
|
|
9
9
|
|
|
@@ -32,11 +32,11 @@ body[class*='admin_page_newspack-'] {
|
|
|
32
32
|
|
|
33
33
|
svg {
|
|
34
34
|
&.newspack--error {
|
|
35
|
-
fill:
|
|
35
|
+
fill: wp-colors.$alert-red;
|
|
36
36
|
transform: rotate( 180deg );
|
|
37
37
|
}
|
|
38
38
|
&.newspack--success {
|
|
39
|
-
fill:
|
|
39
|
+
fill: wp-colors.$alert-green;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -44,12 +44,12 @@ svg {
|
|
|
44
44
|
|
|
45
45
|
.newspack-wizard__blue {
|
|
46
46
|
#wpwrap {
|
|
47
|
-
background:
|
|
47
|
+
background: colors.$primary-500;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.newspack-footer {
|
|
51
|
-
background:
|
|
52
|
-
border-color:
|
|
51
|
+
background: colors.$primary-500;
|
|
52
|
+
border-color: colors.$primary-500;
|
|
53
53
|
justify-content: center;
|
|
54
54
|
|
|
55
55
|
&__logo {
|
|
@@ -76,12 +76,9 @@ svg {
|
|
|
76
76
|
|
|
77
77
|
.newspack-wizard__is-loading {
|
|
78
78
|
background: white;
|
|
79
|
-
bottom: 0;
|
|
80
79
|
cursor: wait;
|
|
81
|
-
|
|
80
|
+
inset: 0;
|
|
82
81
|
position: absolute;
|
|
83
|
-
right: 0;
|
|
84
|
-
top: 0;
|
|
85
82
|
|
|
86
83
|
> * {
|
|
87
84
|
display: none !important;
|
|
@@ -95,38 +92,39 @@ svg {
|
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
&::before {
|
|
98
|
-
background:
|
|
99
|
-
box-shadow: 24px 0 0 white, 69px 0 0 -15px
|
|
100
|
-
|
|
95
|
+
background: colors.$primary-500;
|
|
96
|
+
box-shadow: 24px 0 0 white, 69px 0 0 -15px wp-colors.$gray-900,
|
|
97
|
+
99px 0 0 -15px wp-colors.$gray-900, 129px 0 0 -15px wp-colors.$gray-900,
|
|
98
|
+
159px 0 0 -15px wp-colors.$gray-900, 189px 0 0 -15px wp-colors.$gray-900;
|
|
101
99
|
height: 60px;
|
|
102
100
|
width: 60px;
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
&::after {
|
|
106
|
-
background:
|
|
107
|
-
box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0
|
|
108
|
-
0 96px 0 0
|
|
104
|
+
background: wp-colors.$gray-900;
|
|
105
|
+
box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 40vw 96px 0 0 white,
|
|
106
|
+
0 96px 0 0 wp-colors.$gray-700;
|
|
109
107
|
height: 24px;
|
|
110
108
|
margin: 68px auto 0;
|
|
111
109
|
max-width: 1040px;
|
|
112
110
|
width: calc( 100% - ( 32px * 2 ) );
|
|
113
111
|
|
|
114
112
|
@media screen and ( min-width: 744px ) {
|
|
115
|
-
box-shadow: inset -400px 0 0 0 white, 0 64px 0 0
|
|
116
|
-
0 96px 0 0
|
|
113
|
+
box-shadow: inset -400px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 200px 96px 0 0 white,
|
|
114
|
+
0 96px 0 0 wp-colors.$gray-700;
|
|
117
115
|
width: calc( 100% - ( 64px * 2 ) );
|
|
118
116
|
}
|
|
119
117
|
|
|
120
118
|
@media screen and ( min-width: 1224px ) {
|
|
121
|
-
box-shadow: inset -600px 0 0 0 white, 0 64px 0 0
|
|
122
|
-
0 96px 0 0
|
|
119
|
+
box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 512px 96px 0 0 white,
|
|
120
|
+
0 96px 0 0 wp-colors.$gray-700;
|
|
123
121
|
width: calc( 100% - ( 64px * 2 ) );
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
// Blue Screen
|
|
128
126
|
.newspack-wizard__blue & {
|
|
129
|
-
background:
|
|
127
|
+
background: colors.$primary-500;
|
|
130
128
|
|
|
131
129
|
&::before {
|
|
132
130
|
animation: loading-quiet 1.25s ease-in-out infinite;
|
|
@@ -182,7 +180,7 @@ svg {
|
|
|
182
180
|
|
|
183
181
|
&::before {
|
|
184
182
|
animation: loading-quiet 1.25s ease-in-out infinite;
|
|
185
|
-
background:
|
|
183
|
+
background: colors.$primary-500;
|
|
186
184
|
height: 8px;
|
|
187
185
|
right: 100%;
|
|
188
186
|
z-index: 9999;
|
|
@@ -210,42 +208,42 @@ svg {
|
|
|
210
208
|
animation: loading 2s ease-in-out infinite;
|
|
211
209
|
content: '';
|
|
212
210
|
display: block;
|
|
213
|
-
background:
|
|
214
|
-
box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0
|
|
215
|
-
0 96px 0 0
|
|
211
|
+
background: wp-colors.$gray-900;
|
|
212
|
+
box-shadow: inset -40vw 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 40vw 96px 0 0 white,
|
|
213
|
+
0 96px 0 0 wp-colors.$gray-700;
|
|
216
214
|
height: 24px;
|
|
217
215
|
margin: 0 auto;
|
|
218
216
|
max-width: 1040px;
|
|
219
217
|
width: 100%;
|
|
220
218
|
|
|
221
219
|
@media screen and ( min-width: 744px ) {
|
|
222
|
-
box-shadow: inset -400px 0 0 0 white, 0 64px 0 0
|
|
223
|
-
0 96px 0 0
|
|
220
|
+
box-shadow: inset -400px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 200px 96px 0 0 white,
|
|
221
|
+
0 96px 0 0 wp-colors.$gray-700;
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
@media screen and ( min-width: 1224px ) {
|
|
227
|
-
box-shadow: inset -600px 0 0 0 white, 0 64px 0 0
|
|
228
|
-
0 96px 0 0
|
|
225
|
+
box-shadow: inset -600px 0 0 0 white, 0 64px 0 0 wp-colors.$gray-700, 520px 96px 0 0 white,
|
|
226
|
+
0 96px 0 0 wp-colors.$gray-700;
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
229
|
}
|
|
232
230
|
|
|
233
231
|
@keyframes loading {
|
|
234
|
-
|
|
235
|
-
opacity:
|
|
232
|
+
0% {
|
|
233
|
+
opacity: 1;
|
|
236
234
|
}
|
|
237
235
|
|
|
238
236
|
50% {
|
|
239
|
-
opacity:
|
|
237
|
+
opacity: 0.1;
|
|
240
238
|
}
|
|
241
239
|
|
|
242
|
-
|
|
243
|
-
opacity:
|
|
240
|
+
100% {
|
|
241
|
+
opacity: 1;
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
244
|
|
|
247
245
|
@keyframes loading-quiet {
|
|
248
|
-
|
|
246
|
+
0% {
|
|
249
247
|
left: 0;
|
|
250
248
|
right: 100%;
|
|
251
249
|
}
|
|
@@ -255,7 +253,7 @@ svg {
|
|
|
255
253
|
right: 0;
|
|
256
254
|
}
|
|
257
255
|
|
|
258
|
-
|
|
256
|
+
100% {
|
|
259
257
|
left: 100%;
|
|
260
258
|
right: 0;
|
|
261
259
|
}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = withWizardScreen;
|
|
9
|
-
|
|
10
8
|
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
9
|
var _icons = require("@wordpress/icons");
|
|
13
|
-
|
|
14
10
|
var _ = require("../");
|
|
15
|
-
|
|
16
11
|
var _js = require("../../../shared/js/");
|
|
17
|
-
|
|
18
12
|
require("./style.scss");
|
|
19
|
-
|
|
20
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
-
|
|
22
14
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* WordPress dependencies.
|
|
26
17
|
*/
|
|
27
18
|
const __ = _i18n.__;
|
|
28
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* External dependencies
|
|
24
|
+
*/
|
|
29
25
|
/**
|
|
30
26
|
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
31
27
|
*/
|
|
@@ -33,7 +29,6 @@ function withWizardScreen(WrappedComponent) {
|
|
|
33
29
|
let {
|
|
34
30
|
hidePrimaryButton
|
|
35
31
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
36
|
-
|
|
37
32
|
const WrappedWithWizardScreen = props => {
|
|
38
33
|
const {
|
|
39
34
|
className,
|
|
@@ -53,7 +48,6 @@ function withWizardScreen(WrappedComponent) {
|
|
|
53
48
|
const SecondaryCTAComponent = retrievedSecondaryButtonProps.plugin ? _.Handoff : _.Button;
|
|
54
49
|
const shouldRenderPrimaryButton = buttonText && buttonAction;
|
|
55
50
|
const shouldRenderSecondaryButton = secondaryButtonText && secondaryButtonAction;
|
|
56
|
-
|
|
57
51
|
const renderPrimaryButton = function () {
|
|
58
52
|
let overridingProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
59
53
|
return retrievedButtonProps.plugin ? (0, _jsxRuntime.jsx)(_.Handoff, {
|
|
@@ -64,7 +58,8 @@ function withWizardScreen(WrappedComponent) {
|
|
|
64
58
|
}) : (0, _jsxRuntime.jsx)(_.Button, {
|
|
65
59
|
isPrimary: !buttonDisabled,
|
|
66
60
|
isSecondary: !!buttonDisabled,
|
|
67
|
-
disabled: buttonDisabled
|
|
61
|
+
disabled: buttonDisabled
|
|
62
|
+
// Allow overridingProps to set children.
|
|
68
63
|
// eslint-disable-next-line react/no-children-prop
|
|
69
64
|
,
|
|
70
65
|
children: buttonText,
|
|
@@ -72,7 +67,6 @@ function withWizardScreen(WrappedComponent) {
|
|
|
72
67
|
...overridingProps
|
|
73
68
|
});
|
|
74
69
|
};
|
|
75
|
-
|
|
76
70
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
77
71
|
children: [newspack_aux_data.is_debug_mode && (0, _jsxRuntime.jsx)(_.Notice, {
|
|
78
72
|
debugMode: true
|
|
@@ -104,9 +98,10 @@ function withWizardScreen(WrappedComponent) {
|
|
|
104
98
|
}), tabbedNavigation && (0, _jsxRuntime.jsx)(_.TabbedNavigation, {
|
|
105
99
|
disableUpcoming: disableUpcomingInTabbedNavigation,
|
|
106
100
|
items: tabbedNavigation.filter(item => !item.isHiddenInNav)
|
|
107
|
-
}), (0, _jsxRuntime.jsxs)("div", {
|
|
101
|
+
}), (0, _jsxRuntime.jsx)(_.HandoffMessage, {}), (0, _jsxRuntime.jsxs)("div", {
|
|
108
102
|
className: (0, _classnames.default)('newspack-wizard newspack-wizard__content', className),
|
|
109
|
-
children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, (0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
103
|
+
children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, (0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
104
|
+
...props,
|
|
110
105
|
renderPrimaryButton: renderPrimaryButton
|
|
111
106
|
}), (shouldRenderPrimaryButton || shouldRenderSecondaryButton) && (0, _jsxRuntime.jsxs)("div", {
|
|
112
107
|
className: "newspack-buttons-card",
|
|
@@ -119,6 +114,5 @@ function withWizardScreen(WrappedComponent) {
|
|
|
119
114
|
})]
|
|
120
115
|
});
|
|
121
116
|
};
|
|
122
|
-
|
|
123
117
|
return WrappedWithWizardScreen;
|
|
124
118
|
}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* With Wizard Screen
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
@
|
|
6
|
-
@
|
|
5
|
+
@use '~@wordpress/base-styles/colors' as wp-colors;
|
|
6
|
+
@use '../../../shared/scss/colors';
|
|
7
7
|
|
|
8
8
|
.newspack-wizard {
|
|
9
9
|
// Color
|
|
10
|
-
--wp-admin-theme-color: #{
|
|
11
|
-
--wp-admin-theme-color--rgb: #{
|
|
12
|
-
--wp-admin-theme-color-darker-10: #{
|
|
13
|
-
--wp-admin-theme-color-darker-10--rgb: #{
|
|
14
|
-
--wp-admin-theme-color-darker-20: #{
|
|
15
|
-
--wp-admin-theme-color-darker-20--rgb: #{
|
|
10
|
+
--wp-admin-theme-color: #{colors.$primary-500};
|
|
11
|
+
--wp-admin-theme-color--rgb: #{colors.$primary-500--rgb};
|
|
12
|
+
--wp-admin-theme-color-darker-10: #{colors.$primary-600};
|
|
13
|
+
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-600--rgb};
|
|
14
|
+
--wp-admin-theme-color-darker-20: #{colors.$primary-700};
|
|
15
|
+
--wp-admin-theme-color-darker-20--rgb: #{colors.$primary-700--rgb};
|
|
16
16
|
|
|
17
|
-
color:
|
|
17
|
+
color: wp-colors.$gray-900;
|
|
18
18
|
|
|
19
19
|
// Headings
|
|
20
20
|
h1,
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
&__title {
|
|
51
51
|
align-items: center;
|
|
52
|
-
border-bottom: 1px solid
|
|
52
|
+
border-bottom: 1px solid wp-colors.$gray-300;
|
|
53
53
|
display: flex;
|
|
54
54
|
|
|
55
55
|
h2 {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
padding: 0 24px;
|
|
64
64
|
|
|
65
65
|
span {
|
|
66
|
-
color:
|
|
66
|
+
color: wp-colors.$gray-700;
|
|
67
67
|
display: none;
|
|
68
68
|
margin-left: 8px;
|
|
69
69
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
&:not( .newspack-icon ) {
|
|
86
|
-
background:
|
|
86
|
+
background: colors.$primary-500;
|
|
87
87
|
left: 50%;
|
|
88
88
|
margin: -28px 0 0 -28px !important;
|
|
89
89
|
opacity: 0;
|
|
@@ -110,13 +110,10 @@
|
|
|
110
110
|
&::before {
|
|
111
111
|
border: 2px solid white;
|
|
112
112
|
border-radius: 2px;
|
|
113
|
-
bottom: 5px;
|
|
114
113
|
content: '';
|
|
115
114
|
display: block;
|
|
116
|
-
|
|
115
|
+
inset: 6px 6px 5px;
|
|
117
116
|
position: absolute;
|
|
118
|
-
right: 6px;
|
|
119
|
-
top: 6px;
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
}
|
|
@@ -145,7 +142,7 @@
|
|
|
145
142
|
// Thematic Break
|
|
146
143
|
|
|
147
144
|
hr {
|
|
148
|
-
background:
|
|
145
|
+
background: wp-colors.$gray-300;
|
|
149
146
|
border: 0;
|
|
150
147
|
height: 1px;
|
|
151
148
|
margin: 48px 0;
|
|
@@ -4,22 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
|
|
10
8
|
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
9
|
var _ = require("../..");
|
|
13
|
-
|
|
14
10
|
var _store = require("../store");
|
|
15
|
-
|
|
16
11
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* WordPress dependencies.
|
|
20
14
|
*/
|
|
21
15
|
const __ = _i18n.__;
|
|
22
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies.
|
|
18
|
+
*/
|
|
23
19
|
const parseError = _ref => {
|
|
24
20
|
let {
|
|
25
21
|
data,
|
|
@@ -27,31 +23,25 @@ const parseError = _ref => {
|
|
|
27
23
|
code
|
|
28
24
|
} = _ref;
|
|
29
25
|
let level = 'fatal';
|
|
30
|
-
|
|
31
26
|
if (!!data && 'level' in data) {
|
|
32
27
|
level = data.level;
|
|
33
28
|
} else if ('rest_invalid_param' === code) {
|
|
34
29
|
level = 'notice';
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
return {
|
|
38
32
|
message,
|
|
39
33
|
level
|
|
40
34
|
};
|
|
41
35
|
};
|
|
42
|
-
|
|
43
36
|
const WizardError = () => {
|
|
44
37
|
const error = (0, _data.useSelect)(select => select(_store.WIZARD_STORE_NAMESPACE).getError());
|
|
45
|
-
|
|
46
38
|
if (!error) {
|
|
47
39
|
return null;
|
|
48
40
|
}
|
|
49
|
-
|
|
50
41
|
const {
|
|
51
42
|
level,
|
|
52
43
|
message
|
|
53
44
|
} = parseError(error);
|
|
54
|
-
|
|
55
45
|
if ('fatal' === level) {
|
|
56
46
|
const fallbackURL = typeof newspack_urls !== 'undefined' && newspack_urls.dashboard;
|
|
57
47
|
return (0, _jsxRuntime.jsxs)(_.Modal, {
|
|
@@ -73,7 +63,6 @@ const WizardError = () => {
|
|
|
73
63
|
})]
|
|
74
64
|
});
|
|
75
65
|
}
|
|
76
|
-
|
|
77
66
|
return (0, _jsxRuntime.jsx)(_.Notice, {
|
|
78
67
|
isError: true,
|
|
79
68
|
className: "newspack-wizard__above-header",
|
|
@@ -81,6 +70,5 @@ const WizardError = () => {
|
|
|
81
70
|
rawHTML: true
|
|
82
71
|
});
|
|
83
72
|
};
|
|
84
|
-
|
|
85
73
|
var _default = WizardError;
|
|
86
74
|
exports.default = _default;
|