newspack-components 2.2.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/{cjs/accordion → accordion}/index.js +17 -13
- package/dist/{cjs/accordion → accordion}/style.scss +7 -3
- package/dist/{cjs/action-card → action-card}/index.js +39 -43
- package/dist/{esm/action-card → action-card}/style.scss +9 -9
- package/dist/{cjs/autocomplete-tokenfield → autocomplete-tokenfield}/index.js +67 -29
- package/dist/{esm/autocomplete-tokenfield → autocomplete-tokenfield}/style.scss +14 -8
- package/dist/{cjs/autocomplete-with-suggestions → autocomplete-with-suggestions}/index.js +61 -73
- package/dist/{esm/autocomplete-with-suggestions → autocomplete-with-suggestions}/style.scss +9 -17
- package/dist/button/index.js +51 -0
- package/{src/button/index.js → dist/button/index.tsx} +12 -5
- package/dist/{cjs/button → button}/style.scss +1 -1
- package/dist/{cjs/button-card → button-card}/index.js +9 -10
- package/dist/{cjs/button-card → button-card}/style.scss +19 -13
- package/dist/{cjs/card → card}/index.js +4 -5
- package/dist/{esm/card → card}/style.scss +1 -1
- package/dist/{cjs/category-autocomplete → category-autocomplete}/index.js +51 -53
- package/dist/{esm/category-autocomplete → category-autocomplete}/style.scss +2 -2
- package/dist/{cjs/color-picker → color-picker}/index.js +14 -16
- package/dist/{cjs/color-picker → color-picker}/style.scss +3 -3
- package/dist/consts.js +7 -0
- package/dist/{cjs/custom-select-control → custom-select-control}/index.js +4 -5
- package/dist/{cjs/custom-select-control → custom-select-control}/style.scss +11 -10
- package/dist/{cjs/date-range-picker → date-range-picker}/index.js +9 -11
- package/dist/{cjs/date-range-picker → date-range-picker}/style.scss +6 -6
- package/dist/{cjs/footer → footer}/index.js +33 -36
- package/dist/{cjs/footer → footer}/style.scss +1 -1
- package/dist/{cjs/form-token-field → form-token-field}/index.js +6 -7
- package/dist/{esm/form-token-field → form-token-field}/style.scss +1 -1
- package/dist/{cjs/global-notices → global-notices}/index.js +4 -5
- package/dist/grid/index.js +44 -0
- package/dist/grid/index.tsx +34 -0
- package/dist/{cjs/grid → grid}/style.scss +9 -9
- package/dist/{cjs/handoff → handoff}/index.js +73 -71
- package/dist/{cjs/handoff-message → handoff-message}/index.js +5 -3
- package/dist/hooks/index.js +29 -0
- package/{src/hooks/index.js → dist/hooks/index.ts} +1 -1
- package/dist/{cjs/hooks → hooks}/useObjectState.js +2 -3
- package/dist/{cjs/hooks → hooks}/useObjectState.test.js +9 -9
- package/dist/{cjs/hooks → hooks}/useOnClickOutside.js +1 -2
- package/dist/hooks/usePrompt.js +47 -0
- package/{src/hooks/usePrompt.js → dist/hooks/usePrompt.ts} +4 -8
- package/dist/image-upload/index.js +148 -0
- package/dist/{cjs/image-upload → image-upload}/index.test.js +13 -6
- package/dist/{esm/image-upload → image-upload}/style.scss +5 -5
- package/dist/{cjs/index.js → index.js} +1 -1
- package/dist/{cjs/info-button → info-button}/index.js +6 -7
- package/dist/{cjs/modal → modal}/index.js +4 -5
- package/dist/{esm/modal → modal}/style.scss +5 -5
- package/dist/{cjs/newspack-icon → newspack-icon}/index.js +5 -6
- package/dist/{cjs/newspack-icon → newspack-icon}/style.scss +1 -1
- package/dist/{cjs/newspack-logo → newspack-logo}/index.js +5 -6
- package/dist/{cjs/newspack-logo → newspack-logo}/style.scss +1 -1
- package/dist/{cjs/notice → notice}/index.js +12 -10
- 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/{cjs/plugin-installer → plugin-installer}/style.scss +1 -1
- package/dist/{cjs/plugin-settings → plugin-settings}/SettingsSection.js +13 -13
- 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 +4 -5
- package/dist/{cjs/popover → popover}/style.scss +7 -7
- package/dist/{cjs/position-control → position-control}/index.js +33 -32
- package/dist/{cjs/position-control → position-control}/style.scss +8 -8
- package/dist/{cjs/progress-bar → progress-bar}/index.js +9 -10
- package/dist/{cjs/progress-bar → progress-bar}/index.test.js +16 -16
- package/dist/{cjs/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 +4 -5
- package/dist/{cjs/radio-control → radio-control}/style.scss +3 -3
- package/dist/{cjs/section-header → section-header}/index.js +20 -21
- package/dist/{esm/section-header → section-header}/style.scss +5 -1
- package/dist/{cjs/select-control → select-control}/ButtonGroupControl.js +17 -19
- package/dist/{cjs/select-control → select-control}/GroupedSelectControl.js +32 -35
- package/dist/{cjs/select-control → select-control}/index.js +7 -8
- package/dist/{cjs/select-control → select-control}/style.scss +4 -4
- package/dist/settings/MinMaxSetting.js +60 -0
- package/dist/{cjs/settings → settings}/SettingsCard.js +14 -16
- package/dist/settings/SettingsSection.js +33 -0
- package/dist/{cjs/settings → settings}/index.js +3 -4
- package/dist/{cjs/settings → settings}/style.scss +15 -2
- package/dist/sortable-newsletter-list-control/index.js +135 -0
- package/dist/sortable-newsletter-list-control/style.scss +45 -0
- package/dist/{cjs/steps-list → steps-list}/index.js +5 -6
- package/dist/{esm/steps-list → steps-list}/style.scss +2 -2
- package/dist/{cjs/steps-list-item → steps-list-item}/index.js +6 -7
- package/dist/{cjs/steps-list-item → steps-list-item}/style.scss +5 -5
- package/dist/{cjs/style-card → style-card}/index.js +21 -19
- package/dist/{esm/style-card → style-card}/style.scss +4 -4
- package/dist/{esm/style.scss → style.scss} +14 -2
- package/dist/{cjs/tabbed-navigation → tabbed-navigation}/index.js +16 -19
- 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/utils/index.js +36 -0
- package/dist/{cjs/waiting → waiting}/index.js +4 -5
- package/dist/web-preview/index.js +191 -0
- package/dist/{cjs/web-preview → web-preview}/style.scss +5 -5
- package/dist/with-wizard/index.js +328 -0
- package/dist/{esm/with-wizard → with-wizard}/style.scss +44 -22
- package/dist/{cjs/with-wizard-screen → with-wizard-screen}/index.js +40 -43
- package/dist/{esm/with-wizard-screen → with-wizard-screen}/style.scss +7 -7
- package/dist/{cjs/wizard → wizard}/components/WizardError.js +16 -17
- package/dist/{cjs/wizard → wizard}/index.js +44 -46
- package/dist/{cjs/wizard → wizard}/store/index.js +37 -38
- package/dist/{cjs/wizard → wizard}/store/utils.js +1 -4
- package/package.json +16 -14
- package/shared/scss/_mixins.scss +2 -2
- package/src/accordion/index.js +4 -1
- package/src/accordion/style.scss +7 -3
- package/src/action-card/style.scss +9 -9
- package/src/autocomplete-tokenfield/index.js +48 -15
- package/src/autocomplete-tokenfield/style.scss +14 -8
- package/src/autocomplete-with-suggestions/index.js +59 -62
- package/src/autocomplete-with-suggestions/style.scss +9 -17
- package/src/button/index.tsx +48 -0
- 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/consts.js +0 -2
- package/src/custom-select-control/style.scss +11 -10
- package/src/date-range-picker/style.scss +6 -6
- package/src/footer/index.js +7 -7
- package/src/footer/style.scss +1 -1
- package/src/form-token-field/style.scss +1 -1
- package/src/grid/index.tsx +34 -0
- package/src/grid/style.scss +9 -9
- package/src/handoff/index.js +7 -6
- package/src/handoff-message/index.js +3 -1
- package/src/hooks/index.ts +15 -0
- package/src/hooks/usePrompt.ts +46 -0
- package/src/image-upload/index.js +5 -5
- package/src/image-upload/index.test.js +6 -1
- package/src/image-upload/style.scss +5 -5
- 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/index.js +1 -1
- package/src/notice/style.scss +11 -11
- package/src/patrons-logo/index.js +4 -1
- package/src/plugin-installer/index.js +7 -7
- package/src/plugin-installer/style.scss +1 -1
- package/src/plugin-settings/index.js +1 -1
- package/src/plugin-settings/style.scss +1 -1
- package/src/plugin-toggle/index.js +13 -12
- package/src/plugin-toggle/style.scss +1 -1
- package/src/popover/style.scss +7 -7
- package/src/position-control/index.js +63 -64
- 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/index.js +3 -3
- package/src/section-header/style.scss +5 -1
- package/src/select-control/GroupedSelectControl.js +1 -1
- package/src/select-control/style.scss +4 -4
- package/src/settings/MinMaxSetting.js +8 -6
- package/src/settings/style.scss +15 -2
- package/src/sortable-newsletter-list-control/index.js +137 -0
- package/src/sortable-newsletter-list-control/style.scss +45 -0
- package/src/steps-list/style.scss +2 -2
- package/src/steps-list-item/style.scss +5 -5
- package/src/style-card/index.js +11 -5
- package/src/style-card/style.scss +4 -4
- package/src/style.scss +14 -2
- package/src/tabbed-navigation/style.scss +4 -4
- package/src/text-control/index.tsx +65 -0
- package/src/web-preview/index.js +6 -6
- package/src/web-preview/style.scss +5 -5
- package/src/with-wizard/index.js +4 -4
- package/src/with-wizard/style.scss +44 -22
- package/src/with-wizard-screen/index.js +1 -1
- package/src/with-wizard-screen/style.scss +7 -7
- package/src/wizard/components/WizardError.js +1 -1
- package/src/wizard/index.js +3 -3
- package/src/wizard/store/index.js +9 -2
- package/dist/cjs/action-card/style.scss +0 -483
- package/dist/cjs/autocomplete-tokenfield/style.scss +0 -43
- package/dist/cjs/autocomplete-with-suggestions/style.scss +0 -171
- package/dist/cjs/button/index.js +0 -57
- package/dist/cjs/card/style.scss +0 -168
- package/dist/cjs/category-autocomplete/style.scss +0 -34
- package/dist/cjs/consts.js +0 -12
- package/dist/cjs/form-token-field/style.scss +0 -37
- package/dist/cjs/grid/index.js +0 -54
- package/dist/cjs/hooks/index.js +0 -26
- package/dist/cjs/hooks/usePrompt.js +0 -52
- package/dist/cjs/image-upload/index.js +0 -144
- package/dist/cjs/image-upload/style.scss +0 -103
- package/dist/cjs/modal/style.scss +0 -56
- package/dist/cjs/patrons-logo/index.js +0 -82
- package/dist/cjs/plugin-installer/index.js +0 -299
- package/dist/cjs/plugin-settings/index.js +0 -222
- package/dist/cjs/plugin-toggle/index.js +0 -222
- package/dist/cjs/plugin-toggle/style.scss +0 -20
- package/dist/cjs/proxied-imports/router.js +0 -15
- package/dist/cjs/section-header/style.scss +0 -41
- package/dist/cjs/settings/MinMaxSetting.js +0 -57
- package/dist/cjs/settings/SettingsSection.js +0 -37
- package/dist/cjs/steps-list/style.scss +0 -11
- package/dist/cjs/style-card/style.scss +0 -94
- package/dist/cjs/style.scss +0 -43
- package/dist/cjs/text-control/index.js +0 -71
- package/dist/cjs/utils/index.js +0 -40
- package/dist/cjs/web-preview/index.js +0 -189
- package/dist/cjs/with-wizard/index.js +0 -318
- package/dist/cjs/with-wizard/style.scss +0 -260
- package/dist/cjs/with-wizard-screen/style.scss +0 -160
- package/dist/esm/accordion/index.js +0 -38
- package/dist/esm/accordion/style.scss +0 -27
- package/dist/esm/action-card/index.js +0 -222
- package/dist/esm/autocomplete-tokenfield/index.js +0 -223
- package/dist/esm/autocomplete-with-suggestions/index.js +0 -289
- package/dist/esm/button/index.js +0 -48
- package/dist/esm/button/style.scss +0 -11
- package/dist/esm/button-card/index.js +0 -65
- 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 -185
- package/dist/esm/color-picker/index.js +0 -61
- package/dist/esm/color-picker/style.scss +0 -37
- package/dist/esm/consts.js +0 -3
- package/dist/esm/custom-select-control/index.js +0 -37
- package/dist/esm/custom-select-control/style.scss +0 -92
- package/dist/esm/date-range-picker/index.js +0 -32
- package/dist/esm/date-range-picker/style.scss +0 -148
- package/dist/esm/footer/index.js +0 -105
- package/dist/esm/footer/style.scss +0 -82
- package/dist/esm/form-token-field/index.js +0 -50
- package/dist/esm/global-notices/index.js +0 -30
- package/dist/esm/grid/index.js +0 -45
- package/dist/esm/grid/style.scss +0 -166
- package/dist/esm/handoff/index.js +0 -177
- package/dist/esm/handoff-message/index.js +0 -45
- package/dist/esm/hooks/index.js +0 -17
- package/dist/esm/hooks/useObjectState.js +0 -31
- package/dist/esm/hooks/useObjectState.test.js +0 -83
- package/dist/esm/hooks/useOnClickOutside.js +0 -31
- package/dist/esm/hooks/usePrompt.js +0 -43
- package/dist/esm/image-upload/index.js +0 -141
- package/dist/esm/image-upload/index.test.js +0 -28
- package/dist/esm/index.js +0 -47
- 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/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 -67
- package/dist/esm/notice/style.scss +0 -111
- package/dist/esm/patrons-logo/index.js +0 -76
- package/dist/esm/plugin-installer/index.js +0 -295
- package/dist/esm/plugin-installer/style.scss +0 -72
- package/dist/esm/plugin-settings/SettingsSection.js +0 -136
- package/dist/esm/plugin-settings/index.js +0 -217
- package/dist/esm/plugin-settings/style.scss +0 -7
- package/dist/esm/plugin-toggle/index.js +0 -217
- package/dist/esm/popover/index.js +0 -41
- package/dist/esm/popover/style.scss +0 -161
- package/dist/esm/position-control/index.js +0 -109
- package/dist/esm/position-control/style.scss +0 -66
- package/dist/esm/progress-bar/index.js +0 -69
- package/dist/esm/progress-bar/index.test.js +0 -110
- package/dist/esm/progress-bar/style.scss +0 -42
- package/dist/esm/proxied-imports/router.js +0 -8
- package/dist/esm/radio-control/index.js +0 -37
- package/dist/esm/radio-control/style.scss +0 -92
- package/dist/esm/section-header/index.js +0 -68
- package/dist/esm/select-control/ButtonGroupControl.js +0 -54
- package/dist/esm/select-control/GroupedSelectControl.js +0 -84
- package/dist/esm/select-control/index.js +0 -51
- package/dist/esm/select-control/style.scss +0 -108
- package/dist/esm/settings/MinMaxSetting.js +0 -53
- package/dist/esm/settings/SettingsCard.js +0 -39
- package/dist/esm/settings/SettingsSection.js +0 -30
- package/dist/esm/settings/index.js +0 -9
- package/dist/esm/settings/style.scss +0 -106
- package/dist/esm/steps-list/index.js +0 -43
- package/dist/esm/steps-list-item/index.js +0 -48
- package/dist/esm/steps-list-item/style.scss +0 -47
- package/dist/esm/style-card/index.js +0 -76
- package/dist/esm/tabbed-navigation/index.js +0 -56
- package/dist/esm/tabbed-navigation/style.scss +0 -86
- package/dist/esm/text-control/index.js +0 -66
- package/dist/esm/text-control/style.scss +0 -32
- package/dist/esm/utils/index.js +0 -32
- package/dist/esm/waiting/index.js +0 -44
- package/dist/esm/waiting/style.scss +0 -27
- package/dist/esm/web-preview/index.js +0 -184
- package/dist/esm/web-preview/style.scss +0 -155
- package/dist/esm/with-wizard/index.js +0 -313
- package/dist/esm/with-wizard-screen/index.js +0 -116
- package/dist/esm/wizard/components/WizardError.js +0 -69
- package/dist/esm/wizard/index.js +0 -126
- package/dist/esm/wizard/store/index.js +0 -155
- package/dist/esm/wizard/store/utils.js +0 -17
- package/src/grid/index.js +0 -44
- package/src/text-control/index.js +0 -56
- /package/dist/{cjs/info-button → info-button}/style.scss +0 -0
- /package/dist/{cjs/text-control → text-control}/style.scss +0 -0
- /package/dist/{cjs/waiting → waiting}/style.scss +0 -0
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies.
|
|
4
|
-
*/
|
|
5
|
-
import { Component, createRef, Fragment } from '@wordpress/element';
|
|
6
|
-
import { __ as alias__ } from '@wordpress/i18n';
|
|
7
|
-
const __ = alias__;
|
|
8
|
-
import apiFetch from '@wordpress/api-fetch';
|
|
9
|
-
import { home } from '@wordpress/icons';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies.
|
|
13
|
-
*/
|
|
14
|
-
import { Button, Card, Modal, NewspackIcon, Notice, PluginInstaller } from '../';
|
|
15
|
-
import Router from '../proxied-imports/router';
|
|
16
|
-
import Footer from '../footer';
|
|
17
|
-
import './style.scss';
|
|
18
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
19
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
20
|
-
const {
|
|
21
|
-
Redirect,
|
|
22
|
-
Route
|
|
23
|
-
} = Router;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
27
|
-
*/
|
|
28
|
-
export default function withWizard(WrappedComponent, requiredPlugins) {
|
|
29
|
-
return class WrappedWithWizard extends Component {
|
|
30
|
-
constructor(props) {
|
|
31
|
-
super(props);
|
|
32
|
-
_defineProperty(this, "componentDidMount", () => {
|
|
33
|
-
// If there are no requiredPlugins, fire onWizardReady as soon as component mounts.
|
|
34
|
-
if (!requiredPlugins) {
|
|
35
|
-
const instance = this.wrappedComponentRef.current;
|
|
36
|
-
// eslint-disable-next-line no-unused-expressions
|
|
37
|
-
instance && instance.onWizardReady && instance.onWizardReady();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
/**
|
|
41
|
-
* Set the error. Called by Wizards when an error occurs.
|
|
42
|
-
*
|
|
43
|
-
* @return {Promise} Resolved after state update
|
|
44
|
-
*/
|
|
45
|
-
_defineProperty(this, "setError", error => {
|
|
46
|
-
return new Promise(resolve => {
|
|
47
|
-
this.setState({
|
|
48
|
-
error: error || null
|
|
49
|
-
}, () => resolve());
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Render any errors that need rendering.
|
|
54
|
-
*
|
|
55
|
-
* @return {Component} Error UI
|
|
56
|
-
*/
|
|
57
|
-
_defineProperty(this, "getError", () => {
|
|
58
|
-
const {
|
|
59
|
-
error
|
|
60
|
-
} = this.state;
|
|
61
|
-
if (!error) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const parsedError = this.parseError(error);
|
|
65
|
-
const {
|
|
66
|
-
level
|
|
67
|
-
} = parsedError;
|
|
68
|
-
if ('fatal' === level) {
|
|
69
|
-
return this.getFatalError(parsedError);
|
|
70
|
-
}
|
|
71
|
-
return this.getErrorNotice(parsedError);
|
|
72
|
-
});
|
|
73
|
-
/**
|
|
74
|
-
* Get a notice-level error.
|
|
75
|
-
*
|
|
76
|
-
* @param {Error} error object already parsed by parseError
|
|
77
|
-
* @return {Component} Error notice
|
|
78
|
-
*/
|
|
79
|
-
_defineProperty(this, "getErrorNotice", error => {
|
|
80
|
-
const {
|
|
81
|
-
message
|
|
82
|
-
} = error;
|
|
83
|
-
return _jsx(Notice, {
|
|
84
|
-
isError: true,
|
|
85
|
-
className: "newspack-wizard__above-header",
|
|
86
|
-
noticeText: message,
|
|
87
|
-
rawHTML: true
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
/**
|
|
91
|
-
* Get a fatal-level error.
|
|
92
|
-
*
|
|
93
|
-
* @param {Error} error object already parsed by parseError
|
|
94
|
-
* @return {Component} React object
|
|
95
|
-
*/
|
|
96
|
-
_defineProperty(this, "getFatalError", error => {
|
|
97
|
-
const fallbackURL = this.getFallbackURL();
|
|
98
|
-
if (!fallbackURL) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
const {
|
|
102
|
-
message
|
|
103
|
-
} = error;
|
|
104
|
-
return _jsxs(Modal, {
|
|
105
|
-
title: __('Unrecoverable error'),
|
|
106
|
-
onRequestClose: () => window.location = fallbackURL,
|
|
107
|
-
children: [_jsx(Notice, {
|
|
108
|
-
noticeText: message,
|
|
109
|
-
isError: true,
|
|
110
|
-
rawHTML: true
|
|
111
|
-
}), _jsx(Card, {
|
|
112
|
-
buttonsCard: true,
|
|
113
|
-
noBorder: true,
|
|
114
|
-
className: "justify-end",
|
|
115
|
-
children: _jsx(Button, {
|
|
116
|
-
isPrimary: true,
|
|
117
|
-
href: fallbackURL,
|
|
118
|
-
children: __('Return to Dashboard', 'newspack')
|
|
119
|
-
})
|
|
120
|
-
})]
|
|
121
|
-
});
|
|
122
|
-
});
|
|
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
|
-
*/
|
|
129
|
-
_defineProperty(this, "parseError", error => {
|
|
130
|
-
const {
|
|
131
|
-
data,
|
|
132
|
-
message,
|
|
133
|
-
code
|
|
134
|
-
} = error;
|
|
135
|
-
let level = 'fatal';
|
|
136
|
-
if (!!data && 'level' in data) {
|
|
137
|
-
level = data.level;
|
|
138
|
-
} else if ('rest_invalid_param' === code) {
|
|
139
|
-
level = 'notice';
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
message,
|
|
143
|
-
level
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
/**
|
|
147
|
-
* Called when plugin installation is complete. Updates state and calls onWizardReady on the wrapped component.
|
|
148
|
-
*/
|
|
149
|
-
_defineProperty(this, "pluginInstallationStatus", _ref => {
|
|
150
|
-
let {
|
|
151
|
-
complete
|
|
152
|
-
} = _ref;
|
|
153
|
-
if (this.state.loading) {
|
|
154
|
-
this.doneLoading();
|
|
155
|
-
}
|
|
156
|
-
const instance = this.wrappedComponentRef.current;
|
|
157
|
-
this.setState({
|
|
158
|
-
complete
|
|
159
|
-
}, () => {
|
|
160
|
-
// eslint-disable-next-line no-unused-expressions
|
|
161
|
-
complete && instance && instance.onWizardReady && instance.onWizardReady();
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
/**
|
|
165
|
-
* Begin loading.
|
|
166
|
-
*/
|
|
167
|
-
_defineProperty(this, "startLoading", quiet => {
|
|
168
|
-
if (quiet) {
|
|
169
|
-
this.setState(state => ({
|
|
170
|
-
quietLoading: state.quietLoading + 1
|
|
171
|
-
}));
|
|
172
|
-
} else {
|
|
173
|
-
this.setState(state => ({
|
|
174
|
-
loading: state.loading + 1
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
/**
|
|
179
|
-
* End loading.
|
|
180
|
-
*/
|
|
181
|
-
_defineProperty(this, "doneLoading", quiet => {
|
|
182
|
-
if (quiet) {
|
|
183
|
-
this.setState(state => ({
|
|
184
|
-
quietLoading: state.quietLoading - 1
|
|
185
|
-
}));
|
|
186
|
-
} else {
|
|
187
|
-
this.setState(state => ({
|
|
188
|
-
loading: state.loading - 1
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
/**
|
|
193
|
-
* Replacement for core apiFetch that automatically manages wizard loading UI.
|
|
194
|
-
*/
|
|
195
|
-
_defineProperty(this, "wizardApiFetch", args => {
|
|
196
|
-
const {
|
|
197
|
-
quiet
|
|
198
|
-
} = args;
|
|
199
|
-
this.startLoading(quiet);
|
|
200
|
-
return new Promise((resolve, reject) => {
|
|
201
|
-
apiFetch(args).then(response => {
|
|
202
|
-
this.doneLoading(quiet);
|
|
203
|
-
resolve(response);
|
|
204
|
-
}).catch(error => {
|
|
205
|
-
this.doneLoading(quiet);
|
|
206
|
-
reject(error);
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
/**
|
|
211
|
-
* Render a Route that checks for plugin installation requirements, and redirects to '/' when all are done.
|
|
212
|
-
*
|
|
213
|
-
* @return {void}
|
|
214
|
-
*/
|
|
215
|
-
_defineProperty(this, "pluginRequirements", () => {
|
|
216
|
-
const {
|
|
217
|
-
complete
|
|
218
|
-
} = this.state;
|
|
219
|
-
/* After all plugins are loaded, redirect to / (this could be configurable) */
|
|
220
|
-
if (complete) {
|
|
221
|
-
return _jsx(Redirect, {
|
|
222
|
-
from: "/plugin-requirements",
|
|
223
|
-
to: "/"
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
return _jsx(Route, {
|
|
227
|
-
path: "/",
|
|
228
|
-
render: () => _jsxs(Fragment, {
|
|
229
|
-
children: [complete !== null && _jsx("div", {
|
|
230
|
-
className: "newspack-wizard__header",
|
|
231
|
-
children: _jsx("div", {
|
|
232
|
-
className: "newspack-wizard__header__inner",
|
|
233
|
-
children: _jsxs("div", {
|
|
234
|
-
className: "newspack-wizard__title",
|
|
235
|
-
children: [_jsx(Button, {
|
|
236
|
-
isLink: true,
|
|
237
|
-
href: newspack_urls.dashboard,
|
|
238
|
-
label: __('Return to Dashboard', 'newspack'),
|
|
239
|
-
showTooltip: true,
|
|
240
|
-
icon: home,
|
|
241
|
-
iconSize: 36,
|
|
242
|
-
children: _jsx(NewspackIcon, {
|
|
243
|
-
size: 36
|
|
244
|
-
})
|
|
245
|
-
}), _jsx("div", {
|
|
246
|
-
children: _jsx("h2", {
|
|
247
|
-
children: requiredPlugins.length > 1 ? __('Required plugins', 'newspack') : __('Required plugin', 'newspack')
|
|
248
|
-
})
|
|
249
|
-
})]
|
|
250
|
-
})
|
|
251
|
-
})
|
|
252
|
-
}), _jsx("div", {
|
|
253
|
-
className: "newspack-wizard newspack-wizard__content",
|
|
254
|
-
children: _jsx(PluginInstaller, {
|
|
255
|
-
plugins: requiredPlugins,
|
|
256
|
-
onStatus: status => this.pluginInstallationStatus(status)
|
|
257
|
-
})
|
|
258
|
-
})]
|
|
259
|
-
})
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
_defineProperty(this, "getFallbackURL", () => {
|
|
263
|
-
if (typeof newspack_urls !== 'undefined') {
|
|
264
|
-
return newspack_urls.dashboard;
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
this.state = {
|
|
268
|
-
complete: null,
|
|
269
|
-
error: null,
|
|
270
|
-
loading: requiredPlugins && requiredPlugins.length > 0 ? 1 : 0,
|
|
271
|
-
quietLoading: false
|
|
272
|
-
};
|
|
273
|
-
this.wrappedComponentRef = createRef();
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Render.
|
|
277
|
-
*/
|
|
278
|
-
render() {
|
|
279
|
-
const {
|
|
280
|
-
simpleFooter
|
|
281
|
-
} = this.props;
|
|
282
|
-
const {
|
|
283
|
-
loading,
|
|
284
|
-
quietLoading,
|
|
285
|
-
error
|
|
286
|
-
} = this.state;
|
|
287
|
-
const loadingClasses = [loading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded'];
|
|
288
|
-
if (quietLoading) {
|
|
289
|
-
loadingClasses.push('newspack-wizard__is-loading-quiet');
|
|
290
|
-
}
|
|
291
|
-
return _jsxs(Fragment, {
|
|
292
|
-
children: [this.getError(), _jsx("div", {
|
|
293
|
-
className: loadingClasses.join(' '),
|
|
294
|
-
children: _jsx(WrappedComponent, {
|
|
295
|
-
pluginRequirements: requiredPlugins && this.pluginRequirements(),
|
|
296
|
-
clearError: this.clearError,
|
|
297
|
-
getError: this.getError,
|
|
298
|
-
errorData: error,
|
|
299
|
-
setError: this.setError,
|
|
300
|
-
isLoading: loading,
|
|
301
|
-
startLoading: this.startLoading,
|
|
302
|
-
doneLoading: this.doneLoading,
|
|
303
|
-
wizardApiFetch: this.wizardApiFetch,
|
|
304
|
-
ref: this.wrappedComponentRef,
|
|
305
|
-
...this.props
|
|
306
|
-
})
|
|
307
|
-
}), !loading && _jsx(Footer, {
|
|
308
|
-
simple: simpleFooter
|
|
309
|
-
})]
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies.
|
|
3
|
-
*/
|
|
4
|
-
import { __ as alias__ } from '@wordpress/i18n';
|
|
5
|
-
const __ = alias__;
|
|
6
|
-
import { category } from '@wordpress/icons';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { Button, Handoff, NewspackIcon, Notice, HandoffMessage, TabbedNavigation } from '../';
|
|
12
|
-
import { buttonProps } from '../../../shared/js/';
|
|
13
|
-
import './style.scss';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* External dependencies
|
|
17
|
-
*/
|
|
18
|
-
import classnames from 'classnames';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Higher-Order Component to provide plugin management and error handling to Newspack Wizards.
|
|
22
|
-
*/
|
|
23
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
|
-
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
26
|
-
export default function withWizardScreen(WrappedComponent) {
|
|
27
|
-
let {
|
|
28
|
-
hidePrimaryButton
|
|
29
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
30
|
-
const WrappedWithWizardScreen = props => {
|
|
31
|
-
const {
|
|
32
|
-
className,
|
|
33
|
-
buttonText,
|
|
34
|
-
buttonAction,
|
|
35
|
-
buttonDisabled,
|
|
36
|
-
headerText,
|
|
37
|
-
subHeaderText,
|
|
38
|
-
tabbedNavigation,
|
|
39
|
-
secondaryButtonText,
|
|
40
|
-
secondaryButtonAction,
|
|
41
|
-
renderAboveContent,
|
|
42
|
-
disableUpcomingInTabbedNavigation
|
|
43
|
-
} = props;
|
|
44
|
-
const retrievedButtonProps = buttonProps(buttonAction);
|
|
45
|
-
const retrievedSecondaryButtonProps = buttonProps(secondaryButtonAction);
|
|
46
|
-
const SecondaryCTAComponent = retrievedSecondaryButtonProps.plugin ? Handoff : Button;
|
|
47
|
-
const shouldRenderPrimaryButton = buttonText && buttonAction;
|
|
48
|
-
const shouldRenderSecondaryButton = secondaryButtonText && secondaryButtonAction;
|
|
49
|
-
const renderPrimaryButton = function () {
|
|
50
|
-
let overridingProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
|
-
return retrievedButtonProps.plugin ? _jsx(Handoff, {
|
|
52
|
-
isPrimary: true,
|
|
53
|
-
...retrievedButtonProps,
|
|
54
|
-
...overridingProps,
|
|
55
|
-
children: buttonText
|
|
56
|
-
}) : _jsx(Button, {
|
|
57
|
-
isPrimary: !buttonDisabled,
|
|
58
|
-
isSecondary: !!buttonDisabled,
|
|
59
|
-
disabled: buttonDisabled
|
|
60
|
-
// Allow overridingProps to set children.
|
|
61
|
-
// eslint-disable-next-line react/no-children-prop
|
|
62
|
-
,
|
|
63
|
-
children: buttonText,
|
|
64
|
-
...retrievedButtonProps,
|
|
65
|
-
...overridingProps
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
return _jsxs(_Fragment, {
|
|
69
|
-
children: [newspack_aux_data.is_debug_mode && _jsx(Notice, {
|
|
70
|
-
debugMode: true
|
|
71
|
-
}), _jsx("div", {
|
|
72
|
-
className: "newspack-wizard__header",
|
|
73
|
-
children: _jsx("div", {
|
|
74
|
-
className: "newspack-wizard__header__inner",
|
|
75
|
-
children: _jsxs("div", {
|
|
76
|
-
className: "newspack-wizard__title",
|
|
77
|
-
children: [_jsx(Button, {
|
|
78
|
-
isLink: true,
|
|
79
|
-
href: newspack_urls.dashboard,
|
|
80
|
-
label: __('Return to Dashboard', 'newspack'),
|
|
81
|
-
showTooltip: true,
|
|
82
|
-
icon: category,
|
|
83
|
-
iconSize: 36,
|
|
84
|
-
children: _jsx(NewspackIcon, {
|
|
85
|
-
size: 36
|
|
86
|
-
})
|
|
87
|
-
}), _jsxs("div", {
|
|
88
|
-
children: [headerText && _jsx("h2", {
|
|
89
|
-
children: headerText
|
|
90
|
-
}), subHeaderText && _jsx("span", {
|
|
91
|
-
children: subHeaderText
|
|
92
|
-
})]
|
|
93
|
-
})]
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
}), tabbedNavigation && _jsx(TabbedNavigation, {
|
|
97
|
-
disableUpcoming: disableUpcomingInTabbedNavigation,
|
|
98
|
-
items: tabbedNavigation.filter(item => !item.isHiddenInNav)
|
|
99
|
-
}), _jsx(HandoffMessage, {}), _jsxs("div", {
|
|
100
|
-
className: classnames('newspack-wizard newspack-wizard__content', className),
|
|
101
|
-
children: [typeof renderAboveContent === 'function' ? renderAboveContent() : null, _jsx(WrappedComponent, {
|
|
102
|
-
...props,
|
|
103
|
-
renderPrimaryButton: renderPrimaryButton
|
|
104
|
-
}), (shouldRenderPrimaryButton || shouldRenderSecondaryButton) && _jsxs("div", {
|
|
105
|
-
className: "newspack-buttons-card",
|
|
106
|
-
children: [shouldRenderPrimaryButton && !hidePrimaryButton && renderPrimaryButton(), shouldRenderSecondaryButton && _jsx(SecondaryCTAComponent, {
|
|
107
|
-
isSecondary: true,
|
|
108
|
-
...retrievedSecondaryButtonProps,
|
|
109
|
-
children: secondaryButtonText
|
|
110
|
-
})]
|
|
111
|
-
})]
|
|
112
|
-
})]
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
return WrappedWithWizardScreen;
|
|
116
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies.
|
|
3
|
-
*/
|
|
4
|
-
import { __ as alias__ } from '@wordpress/i18n';
|
|
5
|
-
const __ = alias__;
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies.
|
|
10
|
-
*/
|
|
11
|
-
import { Button, Card, Modal, Notice } from '../..';
|
|
12
|
-
import { WIZARD_STORE_NAMESPACE } from '../store';
|
|
13
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
14
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
15
|
-
const parseError = _ref => {
|
|
16
|
-
let {
|
|
17
|
-
data,
|
|
18
|
-
message,
|
|
19
|
-
code
|
|
20
|
-
} = _ref;
|
|
21
|
-
let level = 'fatal';
|
|
22
|
-
if (!!data && 'level' in data) {
|
|
23
|
-
level = data.level;
|
|
24
|
-
} else if ('rest_invalid_param' === code) {
|
|
25
|
-
level = 'notice';
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
message,
|
|
29
|
-
level
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
const WizardError = () => {
|
|
33
|
-
const error = useSelect(select => select(WIZARD_STORE_NAMESPACE).getError());
|
|
34
|
-
if (!error) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const {
|
|
38
|
-
level,
|
|
39
|
-
message
|
|
40
|
-
} = parseError(error);
|
|
41
|
-
if ('fatal' === level) {
|
|
42
|
-
const fallbackURL = typeof newspack_urls !== 'undefined' && newspack_urls.dashboard;
|
|
43
|
-
return _jsxs(Modal, {
|
|
44
|
-
title: __('Unrecoverable error'),
|
|
45
|
-
onRequestClose: fallbackURL ? () => window.location = fallbackURL : undefined,
|
|
46
|
-
children: [_jsx(Notice, {
|
|
47
|
-
noticeText: message,
|
|
48
|
-
isError: true,
|
|
49
|
-
rawHTML: true
|
|
50
|
-
}), fallbackURL && _jsx(Card, {
|
|
51
|
-
buttonsCard: true,
|
|
52
|
-
noBorder: true,
|
|
53
|
-
className: "justify-end",
|
|
54
|
-
children: _jsx(Button, {
|
|
55
|
-
isPrimary: true,
|
|
56
|
-
href: fallbackURL,
|
|
57
|
-
children: __('Return to Dashboard', 'newspack')
|
|
58
|
-
})
|
|
59
|
-
})]
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return _jsx(Notice, {
|
|
63
|
-
isError: true,
|
|
64
|
-
className: "newspack-wizard__above-header",
|
|
65
|
-
noticeText: message,
|
|
66
|
-
rawHTML: true
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
export default WizardError;
|
package/dist/esm/wizard/index.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies.
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies.
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { useState } from '@wordpress/element';
|
|
11
|
-
import { __ as alias__ } from '@wordpress/i18n';
|
|
12
|
-
const __ = alias__;
|
|
13
|
-
import { category } from '@wordpress/icons';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { Footer, Notice, Button, NewspackIcon, TabbedNavigation, PluginInstaller, HandoffMessage } from '../';
|
|
19
|
-
import Router from '../proxied-imports/router';
|
|
20
|
-
import registerStore, { WIZARD_STORE_NAMESPACE } from './store';
|
|
21
|
-
import { useWizardData } from './store/utils';
|
|
22
|
-
import WizardError from './components/WizardError';
|
|
23
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
|
-
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
26
|
-
registerStore();
|
|
27
|
-
const {
|
|
28
|
-
HashRouter,
|
|
29
|
-
Redirect,
|
|
30
|
-
Route,
|
|
31
|
-
Switch
|
|
32
|
-
} = Router;
|
|
33
|
-
const Wizard = _ref => {
|
|
34
|
-
let {
|
|
35
|
-
sections = [],
|
|
36
|
-
apiSlug,
|
|
37
|
-
headerText,
|
|
38
|
-
subHeaderText,
|
|
39
|
-
hasSimpleFooter,
|
|
40
|
-
className,
|
|
41
|
-
renderAboveSections,
|
|
42
|
-
requiredPlugins = []
|
|
43
|
-
} = _ref;
|
|
44
|
-
const isLoading = useSelect(select => select(WIZARD_STORE_NAMESPACE).isLoading());
|
|
45
|
-
const isQuietLoading = useSelect(select => select(WIZARD_STORE_NAMESPACE).isQuietLoading());
|
|
46
|
-
|
|
47
|
-
// Trigger initial data fetch. Some sections might not use the wizard data,
|
|
48
|
-
// but for consistency, fetching is triggered regardless of the section.
|
|
49
|
-
useSelect(select => select(WIZARD_STORE_NAMESPACE).getWizardAPIData(apiSlug));
|
|
50
|
-
let displayedSections = sections.filter(section => !section.isHidden);
|
|
51
|
-
const [pluginRequirementsSatisfied, setPluginRequirementsSatisfied] = useState(requiredPlugins.length === 0);
|
|
52
|
-
if (!pluginRequirementsSatisfied) {
|
|
53
|
-
headerText = requiredPlugins.length > 1 ? __('Required plugins', 'newspack') : __('Required plugin', 'newspack');
|
|
54
|
-
displayedSections = [{
|
|
55
|
-
path: '/',
|
|
56
|
-
render: () => _jsx(PluginInstaller, {
|
|
57
|
-
plugins: requiredPlugins,
|
|
58
|
-
onStatus: _ref2 => {
|
|
59
|
-
let {
|
|
60
|
-
complete
|
|
61
|
-
} = _ref2;
|
|
62
|
-
return setPluginRequirementsSatisfied(complete);
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
}];
|
|
66
|
-
}
|
|
67
|
-
return _jsxs(_Fragment, {
|
|
68
|
-
children: [_jsx("div", {
|
|
69
|
-
className: classnames(isLoading ? 'newspack-wizard__is-loading' : 'newspack-wizard__is-loaded', {
|
|
70
|
-
'newspack-wizard__is-loading-quiet': isQuietLoading
|
|
71
|
-
}),
|
|
72
|
-
children: _jsxs(HashRouter, {
|
|
73
|
-
hashType: "slash",
|
|
74
|
-
children: [newspack_aux_data.is_debug_mode && _jsx(Notice, {
|
|
75
|
-
debugMode: true
|
|
76
|
-
}), _jsx("div", {
|
|
77
|
-
className: "bg-white",
|
|
78
|
-
children: _jsx("div", {
|
|
79
|
-
className: "newspack-wizard__header__inner",
|
|
80
|
-
children: _jsxs("div", {
|
|
81
|
-
className: "newspack-wizard__title",
|
|
82
|
-
children: [_jsx(Button, {
|
|
83
|
-
isLink: true,
|
|
84
|
-
href: newspack_urls.dashboard,
|
|
85
|
-
label: __('Return to Dashboard', 'newspack'),
|
|
86
|
-
showTooltip: true,
|
|
87
|
-
icon: category,
|
|
88
|
-
iconSize: 36,
|
|
89
|
-
children: _jsx(NewspackIcon, {
|
|
90
|
-
size: 36
|
|
91
|
-
})
|
|
92
|
-
}), _jsxs("div", {
|
|
93
|
-
children: [headerText && _jsx("h2", {
|
|
94
|
-
children: headerText
|
|
95
|
-
}), subHeaderText && _jsx("span", {
|
|
96
|
-
children: subHeaderText
|
|
97
|
-
})]
|
|
98
|
-
})]
|
|
99
|
-
})
|
|
100
|
-
})
|
|
101
|
-
}), displayedSections.length > 1 && _jsx(TabbedNavigation, {
|
|
102
|
-
items: displayedSections,
|
|
103
|
-
children: _jsx(WizardError, {})
|
|
104
|
-
}), _jsx(HandoffMessage, {}), _jsxs(Switch, {
|
|
105
|
-
children: [displayedSections.map((section, index) => {
|
|
106
|
-
const SectionComponent = section.render;
|
|
107
|
-
return _jsx(Route, {
|
|
108
|
-
path: section.path,
|
|
109
|
-
children: _jsxs("div", {
|
|
110
|
-
className: classnames('newspack-wizard newspack-wizard__content', className),
|
|
111
|
-
children: ['function' === typeof renderAboveSections ? renderAboveSections() : null, _jsx(SectionComponent, {})]
|
|
112
|
-
})
|
|
113
|
-
}, index);
|
|
114
|
-
}), _jsx(Redirect, {
|
|
115
|
-
to: displayedSections[0].path
|
|
116
|
-
})]
|
|
117
|
-
})]
|
|
118
|
-
})
|
|
119
|
-
}), !isLoading && _jsx(Footer, {
|
|
120
|
-
simple: hasSimpleFooter
|
|
121
|
-
})]
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
Wizard.useWizardData = useWizardData;
|
|
125
|
-
Wizard.STORE_NAMESPACE = WIZARD_STORE_NAMESPACE;
|
|
126
|
-
export default Wizard;
|