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