newspack-components 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/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/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/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/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/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/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/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/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/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/package.json +4 -4
- package/shared/js/button-props.js +3 -1
- package/shared/scss/_mixins.scss +12 -0
- 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,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies.
|
|
5
4
|
*/
|
|
@@ -8,10 +7,10 @@ import { __ as alias__ } from '@wordpress/i18n';
|
|
|
8
7
|
const __ = alias__;
|
|
9
8
|
import apiFetch from '@wordpress/api-fetch';
|
|
10
9
|
import { home } from '@wordpress/icons';
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
14
|
import { Button, Card, Modal, NewspackIcon, Notice, PluginInstaller } from '../';
|
|
16
15
|
import Router from '../proxied-imports/router';
|
|
17
16
|
import Footer from '../footer';
|
|
@@ -22,24 +21,27 @@ const {
|
|
|
22
21
|
Redirect,
|
|
23
22
|
Route
|
|
24
23
|
} = Router;
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
28
|
export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
30
29
|
return class WrappedWithWizard extends Component {
|
|
31
30
|
constructor(props) {
|
|
32
31
|
super(props);
|
|
33
|
-
|
|
34
32
|
_defineProperty(this, "componentDidMount", () => {
|
|
35
33
|
// If there are no requiredPlugins, fire onWizardReady as soon as component mounts.
|
|
36
34
|
if (!requiredPlugins) {
|
|
37
|
-
const instance = this.wrappedComponentRef.current;
|
|
38
|
-
|
|
35
|
+
const instance = this.wrappedComponentRef.current;
|
|
36
|
+
// eslint-disable-next-line no-unused-expressions
|
|
39
37
|
instance && instance.onWizardReady && instance.onWizardReady();
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Set the error. Called by Wizards when an error occurs.
|
|
42
|
+
*
|
|
43
|
+
* @return {Promise} Resolved after state update
|
|
44
|
+
*/
|
|
43
45
|
_defineProperty(this, "setError", error => {
|
|
44
46
|
return new Promise(resolve => {
|
|
45
47
|
this.setState({
|
|
@@ -47,28 +49,33 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
47
49
|
}, () => resolve());
|
|
48
50
|
});
|
|
49
51
|
});
|
|
50
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Render any errors that need rendering.
|
|
54
|
+
*
|
|
55
|
+
* @return {Component} Error UI
|
|
56
|
+
*/
|
|
51
57
|
_defineProperty(this, "getError", () => {
|
|
52
58
|
const {
|
|
53
59
|
error
|
|
54
60
|
} = this.state;
|
|
55
|
-
|
|
56
61
|
if (!error) {
|
|
57
62
|
return null;
|
|
58
63
|
}
|
|
59
|
-
|
|
60
64
|
const parsedError = this.parseError(error);
|
|
61
65
|
const {
|
|
62
66
|
level
|
|
63
67
|
} = parsedError;
|
|
64
|
-
|
|
65
68
|
if ('fatal' === level) {
|
|
66
69
|
return this.getFatalError(parsedError);
|
|
67
70
|
}
|
|
68
|
-
|
|
69
71
|
return this.getErrorNotice(parsedError);
|
|
70
72
|
});
|
|
71
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Get a notice-level error.
|
|
75
|
+
*
|
|
76
|
+
* @param {Error} error object already parsed by parseError
|
|
77
|
+
* @return {Component} Error notice
|
|
78
|
+
*/
|
|
72
79
|
_defineProperty(this, "getErrorNotice", error => {
|
|
73
80
|
const {
|
|
74
81
|
message
|
|
@@ -80,14 +87,17 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
80
87
|
rawHTML: true
|
|
81
88
|
});
|
|
82
89
|
});
|
|
83
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Get a fatal-level error.
|
|
92
|
+
*
|
|
93
|
+
* @param {Error} error object already parsed by parseError
|
|
94
|
+
* @return {Component} React object
|
|
95
|
+
*/
|
|
84
96
|
_defineProperty(this, "getFatalError", error => {
|
|
85
97
|
const fallbackURL = this.getFallbackURL();
|
|
86
|
-
|
|
87
98
|
if (!fallbackURL) {
|
|
88
99
|
return null;
|
|
89
100
|
}
|
|
90
|
-
|
|
91
101
|
const {
|
|
92
102
|
message
|
|
93
103
|
} = error;
|
|
@@ -110,7 +120,12 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
110
120
|
})]
|
|
111
121
|
});
|
|
112
122
|
});
|
|
113
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Get all the relevant info out of a raw API error response.
|
|
125
|
+
*
|
|
126
|
+
* @param {Object} error error object
|
|
127
|
+
* @return {Object} Error object with relevant fields and defaults
|
|
128
|
+
*/
|
|
114
129
|
_defineProperty(this, "parseError", error => {
|
|
115
130
|
const {
|
|
116
131
|
data,
|
|
@@ -118,28 +133,26 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
118
133
|
code
|
|
119
134
|
} = error;
|
|
120
135
|
let level = 'fatal';
|
|
121
|
-
|
|
122
136
|
if (!!data && 'level' in data) {
|
|
123
137
|
level = data.level;
|
|
124
138
|
} else if ('rest_invalid_param' === code) {
|
|
125
139
|
level = 'notice';
|
|
126
140
|
}
|
|
127
|
-
|
|
128
141
|
return {
|
|
129
142
|
message,
|
|
130
143
|
level
|
|
131
144
|
};
|
|
132
145
|
});
|
|
133
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Called when plugin installation is complete. Updates state and calls onWizardReady on the wrapped component.
|
|
148
|
+
*/
|
|
134
149
|
_defineProperty(this, "pluginInstallationStatus", _ref => {
|
|
135
150
|
let {
|
|
136
151
|
complete
|
|
137
152
|
} = _ref;
|
|
138
|
-
|
|
139
153
|
if (this.state.loading) {
|
|
140
154
|
this.doneLoading();
|
|
141
155
|
}
|
|
142
|
-
|
|
143
156
|
const instance = this.wrappedComponentRef.current;
|
|
144
157
|
this.setState({
|
|
145
158
|
complete
|
|
@@ -148,7 +161,9 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
148
161
|
complete && instance && instance.onWizardReady && instance.onWizardReady();
|
|
149
162
|
});
|
|
150
163
|
});
|
|
151
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Begin loading.
|
|
166
|
+
*/
|
|
152
167
|
_defineProperty(this, "startLoading", quiet => {
|
|
153
168
|
if (quiet) {
|
|
154
169
|
this.setState(state => ({
|
|
@@ -160,7 +175,9 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
160
175
|
}));
|
|
161
176
|
}
|
|
162
177
|
});
|
|
163
|
-
|
|
178
|
+
/**
|
|
179
|
+
* End loading.
|
|
180
|
+
*/
|
|
164
181
|
_defineProperty(this, "doneLoading", quiet => {
|
|
165
182
|
if (quiet) {
|
|
166
183
|
this.setState(state => ({
|
|
@@ -172,7 +189,9 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
172
189
|
}));
|
|
173
190
|
}
|
|
174
191
|
});
|
|
175
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Replacement for core apiFetch that automatically manages wizard loading UI.
|
|
194
|
+
*/
|
|
176
195
|
_defineProperty(this, "wizardApiFetch", args => {
|
|
177
196
|
const {
|
|
178
197
|
quiet
|
|
@@ -188,20 +207,22 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
188
207
|
});
|
|
189
208
|
});
|
|
190
209
|
});
|
|
191
|
-
|
|
210
|
+
/**
|
|
211
|
+
* Render a Route that checks for plugin installation requirements, and redirects to '/' when all are done.
|
|
212
|
+
*
|
|
213
|
+
* @return {void}
|
|
214
|
+
*/
|
|
192
215
|
_defineProperty(this, "pluginRequirements", () => {
|
|
193
216
|
const {
|
|
194
217
|
complete
|
|
195
218
|
} = this.state;
|
|
196
219
|
/* After all plugins are loaded, redirect to / (this could be configurable) */
|
|
197
|
-
|
|
198
220
|
if (complete) {
|
|
199
221
|
return _jsx(Redirect, {
|
|
200
222
|
from: "/plugin-requirements",
|
|
201
223
|
to: "/"
|
|
202
224
|
});
|
|
203
225
|
}
|
|
204
|
-
|
|
205
226
|
return _jsx(Route, {
|
|
206
227
|
path: "/",
|
|
207
228
|
render: () => _jsxs(Fragment, {
|
|
@@ -238,13 +259,11 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
238
259
|
})
|
|
239
260
|
});
|
|
240
261
|
});
|
|
241
|
-
|
|
242
262
|
_defineProperty(this, "getFallbackURL", () => {
|
|
243
263
|
if (typeof newspack_urls !== 'undefined') {
|
|
244
264
|
return newspack_urls.dashboard;
|
|
245
265
|
}
|
|
246
266
|
});
|
|
247
|
-
|
|
248
267
|
this.state = {
|
|
249
268
|
complete: null,
|
|
250
269
|
error: null,
|
|
@@ -253,7 +272,6 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
253
272
|
};
|
|
254
273
|
this.wrappedComponentRef = createRef();
|
|
255
274
|
}
|
|
256
|
-
|
|
257
275
|
/**
|
|
258
276
|
* Render.
|
|
259
277
|
*/
|
|
@@ -267,11 +285,9 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
267
285
|
error
|
|
268
286
|
} = this.state;
|
|
269
287
|
const loadingClasses = [loading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded'];
|
|
270
|
-
|
|
271
288
|
if (quietLoading) {
|
|
272
289
|
loadingClasses.push('newspack-wizard__is-loading-quiet');
|
|
273
290
|
}
|
|
274
|
-
|
|
275
291
|
return _jsxs(Fragment, {
|
|
276
292
|
children: [this.getError(), _jsx("div", {
|
|
277
293
|
className: loadingClasses.join(' '),
|
|
@@ -293,6 +309,5 @@ export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
|
293
309
|
})]
|
|
294
310
|
});
|
|
295
311
|
}
|
|
296
|
-
|
|
297
312
|
};
|
|
298
313
|
}
|
|
@@ -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
|
}
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
5
5
|
const __ = alias__;
|
|
6
6
|
import { category } from '@wordpress/icons';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
import { Button, Handoff, NewspackIcon, Notice, TabbedNavigation } from '../';
|
|
11
|
+
import { Button, Handoff, NewspackIcon, Notice, HandoffMessage, TabbedNavigation } from '../';
|
|
12
12
|
import { buttonProps } from '../../../shared/js/';
|
|
13
13
|
import './style.scss';
|
|
14
|
+
|
|
14
15
|
/**
|
|
15
16
|
* External dependencies
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
18
|
import classnames from 'classnames';
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
23
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
24
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
25
|
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
@@ -27,7 +27,6 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
27
27
|
let {
|
|
28
28
|
hidePrimaryButton
|
|
29
29
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
30
|
-
|
|
31
30
|
const WrappedWithWizardScreen = props => {
|
|
32
31
|
const {
|
|
33
32
|
className,
|
|
@@ -47,7 +46,6 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
47
46
|
const SecondaryCTAComponent = retrievedSecondaryButtonProps.plugin ? Handoff : Button;
|
|
48
47
|
const shouldRenderPrimaryButton = buttonText && buttonAction;
|
|
49
48
|
const shouldRenderSecondaryButton = secondaryButtonText && secondaryButtonAction;
|
|
50
|
-
|
|
51
49
|
const renderPrimaryButton = function () {
|
|
52
50
|
let overridingProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
53
51
|
return retrievedButtonProps.plugin ? _jsx(Handoff, {
|
|
@@ -58,7 +56,8 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
58
56
|
}) : _jsx(Button, {
|
|
59
57
|
isPrimary: !buttonDisabled,
|
|
60
58
|
isSecondary: !!buttonDisabled,
|
|
61
|
-
disabled: buttonDisabled
|
|
59
|
+
disabled: buttonDisabled
|
|
60
|
+
// Allow overridingProps to set children.
|
|
62
61
|
// eslint-disable-next-line react/no-children-prop
|
|
63
62
|
,
|
|
64
63
|
children: buttonText,
|
|
@@ -66,7 +65,6 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
66
65
|
...overridingProps
|
|
67
66
|
});
|
|
68
67
|
};
|
|
69
|
-
|
|
70
68
|
return _jsxs(_Fragment, {
|
|
71
69
|
children: [newspack_aux_data.is_debug_mode && _jsx(Notice, {
|
|
72
70
|
debugMode: true
|
|
@@ -98,9 +96,10 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
98
96
|
}), tabbedNavigation && _jsx(TabbedNavigation, {
|
|
99
97
|
disableUpcoming: disableUpcomingInTabbedNavigation,
|
|
100
98
|
items: tabbedNavigation.filter(item => !item.isHiddenInNav)
|
|
101
|
-
}), _jsxs("div", {
|
|
99
|
+
}), _jsx(HandoffMessage, {}), _jsxs("div", {
|
|
102
100
|
className: classnames('newspack-wizard newspack-wizard__content', className),
|
|
103
|
-
children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, _jsx(WrappedComponent, {
|
|
101
|
+
children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, _jsx(WrappedComponent, {
|
|
102
|
+
...props,
|
|
104
103
|
renderPrimaryButton: renderPrimaryButton
|
|
105
104
|
}), (shouldRenderPrimaryButton || shouldRenderSecondaryButton) && _jsxs("div", {
|
|
106
105
|
className: "newspack-buttons-card",
|
|
@@ -113,6 +112,5 @@ export default function withWizardScreen(WrappedComponent) {
|
|
|
113
112
|
})]
|
|
114
113
|
});
|
|
115
114
|
};
|
|
116
|
-
|
|
117
115
|
return WrappedWithWizardScreen;
|
|
118
116
|
}
|
|
@@ -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,15 +4,14 @@
|
|
|
4
4
|
import { __ as alias__ } from '@wordpress/i18n';
|
|
5
5
|
const __ = alias__;
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies.
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
11
|
import { Button, Card, Modal, Notice } from '../..';
|
|
12
12
|
import { WIZARD_STORE_NAMESPACE } from '../store';
|
|
13
13
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
15
|
-
|
|
16
15
|
const parseError = _ref => {
|
|
17
16
|
let {
|
|
18
17
|
data,
|
|
@@ -20,31 +19,25 @@ const parseError = _ref => {
|
|
|
20
19
|
code
|
|
21
20
|
} = _ref;
|
|
22
21
|
let level = 'fatal';
|
|
23
|
-
|
|
24
22
|
if (!!data && 'level' in data) {
|
|
25
23
|
level = data.level;
|
|
26
24
|
} else if ('rest_invalid_param' === code) {
|
|
27
25
|
level = 'notice';
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
return {
|
|
31
28
|
message,
|
|
32
29
|
level
|
|
33
30
|
};
|
|
34
31
|
};
|
|
35
|
-
|
|
36
32
|
const WizardError = () => {
|
|
37
33
|
const error = useSelect(select => select(WIZARD_STORE_NAMESPACE).getError());
|
|
38
|
-
|
|
39
34
|
if (!error) {
|
|
40
35
|
return null;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
const {
|
|
44
38
|
level,
|
|
45
39
|
message
|
|
46
40
|
} = parseError(error);
|
|
47
|
-
|
|
48
41
|
if ('fatal' === level) {
|
|
49
42
|
const fallbackURL = typeof newspack_urls !== 'undefined' && newspack_urls.dashboard;
|
|
50
43
|
return _jsxs(Modal, {
|
|
@@ -66,7 +59,6 @@ const WizardError = () => {
|
|
|
66
59
|
})]
|
|
67
60
|
});
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
return _jsx(Notice, {
|
|
71
63
|
isError: true,
|
|
72
64
|
className: "newspack-wizard__above-header",
|
|
@@ -74,5 +66,4 @@ const WizardError = () => {
|
|
|
74
66
|
rawHTML: true
|
|
75
67
|
});
|
|
76
68
|
};
|
|
77
|
-
|
|
78
69
|
export default WizardError;
|