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,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Modal
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
@use '../../../shared/scss/colors';
|
|
6
|
-
|
|
7
|
-
.newspack-modal {
|
|
8
|
-
// Color
|
|
9
|
-
--wp-admin-theme-color: #{colors.$primary-500};
|
|
10
|
-
--wp-admin-theme-color--rgb: #{colors.$primary-500--rgb};
|
|
11
|
-
--wp-admin-theme-color-darker-10: #{colors.$primary-600};
|
|
12
|
-
--wp-admin-theme-color-darker-10--rgb: #{colors.$primary-600--rgb};
|
|
13
|
-
--wp-admin-theme-color-darker-20: #{colors.$primary-700};
|
|
14
|
-
--wp-admin-theme-color-darker-20--rgb: #{colors.$primary-700--rgb};
|
|
15
|
-
|
|
16
|
-
@media screen and ( min-width: 744px ) {
|
|
17
|
-
max-width: 680px;
|
|
18
|
-
width: 680px;
|
|
19
|
-
|
|
20
|
-
&--wide {
|
|
21
|
-
max-width: 1168px;
|
|
22
|
-
width: 1168px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&--narrow {
|
|
27
|
-
max-width: 360px;
|
|
28
|
-
width: 360px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@media screen and ( min-width: 960px ) {
|
|
32
|
-
max-height: calc( 100% - 128px );
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Links
|
|
36
|
-
a {
|
|
37
|
-
color: var( --wp-admin-theme-color );
|
|
38
|
-
|
|
39
|
-
&:active,
|
|
40
|
-
&:focus,
|
|
41
|
-
&:hover {
|
|
42
|
-
color: var( --wp-admin-theme-color-darker-10 );
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:focus {
|
|
46
|
-
box-shadow: 0 0 0 var( --wp-admin-border-width-focus ) var( --wp-admin-theme-color );
|
|
47
|
-
outline: 3px solid transparent;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.components-modal__content {
|
|
52
|
-
> *:last-child {
|
|
53
|
-
margin-bottom: 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _element = require("@wordpress/element");
|
|
10
|
-
var _components = require("@wordpress/components");
|
|
11
|
-
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress.com and Google News Initiative Logos.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
const __ = _i18n.__;
|
|
20
|
-
class PatronsLogo extends _element.Component {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
/**
|
|
24
|
-
* Render.
|
|
25
|
-
*/
|
|
26
|
-
(0, _defineProperty2.default)(this, "render", () => {
|
|
27
|
-
return (0, _jsxRuntime.jsxs)(_components.SVG, {
|
|
28
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
-
width: "219",
|
|
30
|
-
height: "16",
|
|
31
|
-
viewBox: "0 0 438 32",
|
|
32
|
-
className: "patrons-logo",
|
|
33
|
-
"aria-label": __('A project of WordPress.com and the Google News Initiative', 'newspack'),
|
|
34
|
-
children: [(0, _jsxRuntime.jsx)(_components.Path, {
|
|
35
|
-
fillRule: "evenodd",
|
|
36
|
-
clipRule: "evenodd",
|
|
37
|
-
d: "M0 16C0 7.179 7.146 0 15.93 0c8.784 0 15.93 7.178 15.93 16 0 8.823-7.146 16-15.93 16C7.145 32 0 24.823 0 16zm27.506-.271L23.13 28.435a14.349 14.349 0 005.214-5.263 14.424 14.424 0 001.906-7.171 14.36 14.36 0 00-1.754-6.902c.062.458.097.95.097 1.477 0 1.461-.271 3.102-1.088 5.153zM18.96 9.177c-.291.027-.665.057-1.056.077l5.177 15.463 1.427-4.792c.728-1.87 1.09-3.42 1.09-4.653 0-1.775-.635-3.007-1.179-3.964l-.154-.25-.014-.022c-.66-1.071-1.239-2.008-1.239-3.105 0-1.32.997-2.55 2.404-2.55.052 0 .1.004.148.008l.037.003a14.226 14.226 0 00-9.672-3.777 14.26 14.26 0 00-6.797 1.723 14.334 14.334 0 00-5.167 4.76c.337.01.654.019.922.019 1.497 0 3.817-.185 3.817-.185.772-.046.863 1.095.093 1.186 0 0-.234.028-.589.06-.291.026-.663.056-1.053.076l5.214 15.582 3.135-9.44-2.23-6.14a26.784 26.784 0 01-1.502-.138c-.772-.047-.681-1.23.091-1.186 0 0 2.364.185 3.771.185 1.498 0 3.818-.185 3.818-.185.772-.046.863 1.095.09 1.186 0 0-.23.027-.582.06zm-7.076 20.624a14.282 14.282 0 008.803-.23 1.188 1.188 0 01-.103-.199l-4.402-12.115-4.298 12.544zM2.846 10.145a14.434 14.434 0 00.945 13.493 14.345 14.345 0 005.888 5.308l-6.833-18.8z"
|
|
38
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
39
|
-
d: "M56.125 8.758l-3.172 12.258-3.178-12.258h-3.209l.747 2.626-2.797 10.047L41.48 8.758h-3.087l4.334 16.01h3.362l2.596-8.56 2.431 8.56h3.361l4.549-16.01h-2.9zM151.302 24.767h-2.818v-2.915h2.818v2.915z"
|
|
40
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
41
|
-
fillRule: "evenodd",
|
|
42
|
-
clipRule: "evenodd",
|
|
43
|
-
d: "M64.38 13.13c-3.878 0-5.71 2.509-5.71 5.973 0 3.465 1.832 5.95 5.71 5.95 3.854 0 5.71-2.485 5.71-5.95 0-3.464-1.856-5.973-5.71-5.973zm0 9.654c-1.833 0-2.807-1.194-2.807-3.681 0-2.461.974-3.68 2.807-3.68 1.83 0 2.783 1.196 2.783 3.68 0 2.462-.953 3.68-2.783 3.68zM86.344 13.13c.69 0 1.285.096 2.117.262V8.756h2.807v16.01h-2.663v-1.052c-.906.767-2.404 1.34-3.64 1.34-2.5 0-4.616-1.745-4.616-5.52 0-3.798 2.117-6.404 5.995-6.404zm-.548 9.654c.904 0 1.76-.455 2.665-1.29v-5.758a5.2 5.2 0 00-1.83-.36c-2.144 0-3.38 1.362-3.38 3.968 0 2.411 1 3.44 2.545 3.44zM99.941 8.758h-5.199v16.01h2.998v-5.57h2.201c3.403 0 5.879-1.84 5.879-5.28 0-3.466-2.476-5.16-5.879-5.16zm.024 8.1H97.74v-5.734h2.225c1.809 0 2.713 1.003 2.713 2.795 0 1.768-.834 2.938-2.713 2.938zM115.57 19.032c0-3.083 1.879-5.902 5.496-5.902 3.593 0 4.854 2.509 4.854 4.9 0 .767-.046 1.195-.092 1.636l-.004.035h-7.232c.072 2.487 1.47 3.059 3.564 3.059 1.141 0 2.204-.262 3.383-.697v2.344c-1.463.453-2.718.646-4.169.646-3.588 0-5.8-1.79-5.8-6.02zm5.472-3.775c-1.403 0-2.26 1.002-2.426 2.581h4.377c0-1.387-.453-2.582-1.951-2.582z"
|
|
44
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
45
|
-
d: "M130.798 16.595c0-.861.926-1.196 1.925-1.196 1.613 0 3.14.504 3.14.504v-2.344c-1.047-.31-2.117-.43-3.353-.43-2.712 0-4.615 1.29-4.615 3.394 0 2.408 1.95 3.032 3.551 3.544 1.116.357 2.063.66 2.063 1.474 0 .98-.88 1.241-2.164 1.241-.906 0-2.357-.352-3.402-.717v2.316c.871.345 2.093.672 3.306.672 2.641 0 5.161-.787 5.161-3.63 0-2.325-1.95-2.922-3.552-3.412-1.114-.342-2.06-.631-2.06-1.416z"
|
|
46
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
47
|
-
fillRule: "evenodd",
|
|
48
|
-
clipRule: "evenodd",
|
|
49
|
-
d: "M164.046 19.103c0-3.464 1.833-5.971 5.711-5.971 3.853 0 5.71 2.507 5.71 5.97 0 3.466-1.857 5.951-5.71 5.951-3.878 0-5.711-2.485-5.711-5.95zm2.904 0c0 2.487.974 3.679 2.807 3.679 1.832 0 2.783-1.217 2.783-3.68 0-2.483-.951-3.678-2.783-3.678-1.833 0-2.807 1.218-2.807 3.679z"
|
|
50
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
51
|
-
d: "M191.528 13.132c-1.213 0-2.592.667-3.855 1.504l-.333.215c-.594-1.268-1.784-1.721-3.092-1.721-1.213 0-2.592.62-3.854 1.458v-1.172h-2.664v11.351h2.831V16.62c1.047-.692 2.165-1.123 2.973-1.123.927 0 1.498.5 1.498 2.102v7.17h2.807v-8.126c1.049-.693 2.167-1.146 2.975-1.146.927 0 1.498.5 1.498 2.102v7.17h2.809V16.93c0-2.2-1.309-3.798-3.593-3.798zM110.191 15.28h.095c.786-1.41 1.832-2.005 3.354-2.005.357 0 .762.046.762.046v2.461h-.285c-1.784 0-2.855.552-3.735 2.223v6.762h-2.807V13.416h2.616v1.865zM75.066 15.28h-.095v-1.864h-2.618v11.351h2.809v-6.762c.88-1.671 1.95-2.223 3.733-2.223h.287v-2.46s-.405-.047-.762-.047c-1.522 0-2.568.596-3.354 2.006zM158.983 15.424c-1.712 0-3.164.908-3.164 3.562 0 2.912 1.452 3.774 3.308 3.774.881 0 1.867-.192 3.151-.693v2.34c-1.14.383-2.176.648-3.507.648-4.213 0-5.877-2.416-5.877-5.928 0-3.703 2.306-5.997 6.043-5.997 1.403 0 2.248.24 3.2.55v2.388c-.81-.31-2.011-.644-3.154-.644zM141.016 16.595c0-.861.926-1.196 1.926-1.196 1.611 0 3.14.504 3.14.504v-2.344c-1.046-.31-2.117-.43-3.356-.43-2.711 0-4.615 1.29-4.615 3.394 0 2.408 1.95 3.032 3.552 3.544 1.116.357 2.063.66 2.063 1.474 0 .98-.88 1.241-2.165 1.241-.904 0-2.354-.352-3.401-.717v2.316c.87.345 2.094.672 3.307.672 2.642 0 5.161-.787 5.161-3.63 0-2.325-1.951-2.922-3.552-3.412-1.115-.342-2.06-.631-2.06-1.416zM300.756 24.617V8.443h2.523l7.837 12.582h.092l-.092-3.117V8.443h2.069v16.174h-2.162l-8.198-13.194h-.088l.088 3.118v10.076h-2.069z"
|
|
52
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
53
|
-
fillRule: "evenodd",
|
|
54
|
-
clipRule: "evenodd",
|
|
55
|
-
d: "M318.835 24.585c.704.288 1.461.42 2.22.39v-.016a5.175 5.175 0 003.041-.866 5 5 0 001.776-2.158l-1.845-.768c-.527 1.262-1.532 1.899-3.02 1.899a3.36 3.36 0 01-2.396-.98 3.775 3.775 0 01-1.118-2.642h8.73l.024-.381a6.096 6.096 0 00-1.463-4.292 5.095 5.095 0 00-3.953-1.586 4.923 4.923 0 00-3.904 1.742 6.116 6.116 0 00-1.517 4.155 5.926 5.926 0 001.566 4.223 5.302 5.302 0 001.859 1.28zm4.324-8.66c.49.485.797 1.125.868 1.811l-6.397.015a3.654 3.654 0 011.161-1.958 2.925 2.925 0 011.991-.724 3.098 3.098 0 012.377.857z"
|
|
56
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
57
|
-
d: "M339.793 24.617h-2.117l-2.748-8.496-2.722 8.496h-2.099l-3.557-11.07h2.162l2.454 8.359h.025l2.722-8.359h2.143l2.722 8.359h.025l2.43-8.359h2.118l-3.558 11.07zM345.498 24.069c.889.63 1.961.949 3.049.905v-.024a4.768 4.768 0 003.128-.979 3.073 3.073 0 001.22-2.481 2.987 2.987 0 00-.746-1.987 4.102 4.102 0 00-2.299-1.243l-2.181-.519c-.976-.23-1.464-.655-1.464-1.287a1.18 1.18 0 01.63-1.042 2.92 2.92 0 011.551-.382c1.276 0 2.117.49 2.523 1.468l1.806-.749a3.774 3.774 0 00-1.645-1.908 5.16 5.16 0 00-2.615-.666 5.214 5.214 0 00-3.074.916 2.787 2.787 0 00-1.294 2.383 2.49 2.49 0 00.947 2.045 5.298 5.298 0 002.006 1.028l2.225.543c1.008.261 1.512.75 1.512 1.468a1.312 1.312 0 01-.619 1.13 2.717 2.717 0 01-1.591.431 3.039 3.039 0 01-2.991-2.08l-1.85.769a5.333 5.333 0 001.772 2.26zM362.084 8.443h-2.074v16.17h2.074V8.442zM366.895 15.084v-1.537h-1.991v11.07h2.069v-6.122a3.726 3.726 0 01.815-2.383 2.55 2.55 0 012.093-1.028c1.815 0 2.723 1.024 2.723 3.073v6.46h2.084v-6.778a5.026 5.026 0 00-1.084-3.386 3.9 3.9 0 00-3.127-1.268 4.127 4.127 0 00-2.074.553 3.713 3.713 0 00-1.42 1.346h-.088zM379.094 10.768a1.414 1.414 0 01-1.039.43 1.396 1.396 0 01-1.035-.43 1.47 1.47 0 011.598-2.397 1.47 1.47 0 01.476 2.397zM379.094 24.617h-2.074v-11.07h2.074v11.07zM384.709 24.642c.457.157.942.209 1.421.151a4.17 4.17 0 001.664-.293l-.717-1.782c-.299.128-.622.19-.947.181-.992 0-1.488-.602-1.488-1.806v-5.647h2.703v-1.899h-2.703v-3.386h-2.074v3.386h-1.952v1.9h1.952v5.803a3.22 3.22 0 00.927 2.635c.343.34.758.6 1.214.757zM391.278 10.768a1.465 1.465 0 01-2.076.007 1.474 1.474 0 01.468-2.401 1.458 1.458 0 011.596.316 1.475 1.475 0 01.003 2.078h.009zM391.269 24.617h-2.074v-11.07h2.074v11.07z"
|
|
58
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
59
|
-
fillRule: "evenodd",
|
|
60
|
-
clipRule: "evenodd",
|
|
61
|
-
d: "M394.24 23.961a4.356 4.356 0 002.928 1.018l.025.01a4.055 4.055 0 003.625-1.899h.088v1.522h1.952v-6.68a4.459 4.459 0 00-1.362-3.509 5.1 5.1 0 00-3.513-1.243 4.837 4.837 0 00-2.976.847 4.306 4.306 0 00-1.508 1.84l1.893.817c.18-.5.536-.917 1-1.174a3.152 3.152 0 011.635-.43 2.993 2.993 0 012.05.733c.276.243.494.545.637.884.144.339.21.706.192 1.074v.318a5.84 5.84 0 00-3.006-.68 5.645 5.645 0 00-3.445 1.027 3.323 3.323 0 00-1.4 2.834 3.385 3.385 0 001.185 2.692zm5.583-1.85a3.383 3.383 0 01-2.333.98 2.776 2.776 0 01-1.586-.49 1.467 1.467 0 01-.673-1.282 1.966 1.966 0 01.771-1.537 3.409 3.409 0 012.274-.656 4.045 4.045 0 012.63.724 2.99 2.99 0 01-1.083 2.261z"
|
|
62
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
63
|
-
d: "M409.533 24.793a3.19 3.19 0 01-2.631-.91 3.207 3.207 0 01-.926-2.633v-5.804h-1.952v-1.899h1.952v-3.386h2.069v3.386h2.703v1.9h-2.703v5.646c0 1.204.496 1.806 1.488 1.806.325.008.648-.053.947-.18l.717 1.78a4.17 4.17 0 01-1.664.294zM414.072 11.135a1.47 1.47 0 00-.43-2.873 1.462 1.462 0 00-1.454 1.327 1.468 1.468 0 001.884 1.546zM412.617 24.617h2.064l.01-11.07h-2.074v11.07zM420.459 24.617l-4.455-11.07h2.249l3.245 8.584h.044l3.289-8.584h2.205l-4.503 11.07h-2.074z"
|
|
64
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
65
|
-
fillRule: "evenodd",
|
|
66
|
-
clipRule: "evenodd",
|
|
67
|
-
d: "M430.621 24.58a5.31 5.31 0 002.213.394v-.015a5.173 5.173 0 003.04-.866 4.972 4.972 0 001.781-2.158l-1.845-.768c-.527 1.262-1.532 1.899-3.02 1.899a3.353 3.353 0 01-2.396-.98 3.742 3.742 0 01-1.118-2.642h8.691l.024-.381a6.076 6.076 0 00-1.464-4.292 5.063 5.063 0 00-3.903-1.586 4.926 4.926 0 00-3.904 1.742 6.097 6.097 0 00-1.513 4.155 5.934 5.934 0 001.562 4.223c.52.553 1.151.987 1.852 1.275zm4.321-8.654c.49.484.797 1.124.868 1.81l-6.397.015a3.676 3.676 0 011.156-1.957 2.968 2.968 0 011.996-.725 3.12 3.12 0 012.377.857zM276.919 23.82V13.21l-2.454-.005v.979h-.088a4.086 4.086 0 00-3.104-1.317c-2.947 0-5.645 2.594-5.645 5.931a5.882 5.882 0 001.64 4.08 5.847 5.847 0 004.005 1.793 4 4 0 003.104-1.346h.088v.847c0 2.26-1.196 3.47-3.148 3.47a3.262 3.262 0 01-2.967-2.104l-2.254.944a5.634 5.634 0 002.079 2.546 5.61 5.61 0 003.142.948c3.035 0 5.602-1.791 5.602-6.157zm-5.421-8.643c1.761 0 3.147 1.522 3.147 3.607 0 2.055-1.361 3.557-3.147 3.557-1.786 0-3.279-1.473-3.279-3.557 0-2.085 1.517-3.607 3.279-3.607z"
|
|
68
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
69
|
-
d: "M226.063 24.034a9.134 9.134 0 003.568.637c2.737 0 4.747-.905 6.397-2.57 1.649-1.663 2.166-3.993 2.166-5.872a7.91 7.91 0 00-.136-1.566h-8.427v2.506h5.982a5.262 5.262 0 01-1.361 3.156 6.128 6.128 0 01-4.621 1.835 6.64 6.64 0 01-4.703-1.953 6.677 6.677 0 01-1.948-4.717c0-1.769.7-3.465 1.948-4.716a6.64 6.64 0 014.703-1.954 6.368 6.368 0 014.523 1.791l1.747-1.766a8.686 8.686 0 00-6.27-2.53 9.132 9.132 0 00-6.61 2.611 9.2 9.2 0 000 13.133 9.158 9.158 0 003.042 1.975z"
|
|
70
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
71
|
-
fillRule: "evenodd",
|
|
72
|
-
clipRule: "evenodd",
|
|
73
|
-
d: "M250.189 21.972a5.832 5.832 0 001.019-3.213 5.801 5.801 0 00-1.661-4.182 5.76 5.76 0 00-4.146-1.724c-1.145 0-2.264.34-3.217.976a5.833 5.833 0 00-.917 8.936 5.792 5.792 0 008.922-.793zm-4.788-6.795c1.752 0 3.265 1.458 3.265 3.582 0 2.114-1.508 3.582-3.265 3.582-1.756 0-3.264-1.468-3.264-3.582s1.513-3.582 3.264-3.582zM293.646 22.048l-2.01-1.341a3.374 3.374 0 01-2.899 1.634 2.995 2.995 0 01-2.859-1.79l7.881-3.27-.269-.67c-.493-1.312-2.01-3.759-5.045-3.759s-5.475 2.394-5.475 5.907c0 3.313 2.415 5.912 5.767 5.912a5.843 5.843 0 004.909-2.623zm-2.923-5.662l-5.27 2.197a3.258 3.258 0 01.817-2.374 3.228 3.228 0 012.263-1.076 2.285 2.285 0 012.19 1.253zM264.227 18.76a5.839 5.839 0 01-1.018 3.212 5.813 5.813 0 01-2.623 2.108 5.792 5.792 0 01-6.3-1.315 5.841 5.841 0 01-1.222-6.336 5.82 5.82 0 012.139-2.6 5.796 5.796 0 013.217-.976 5.75 5.75 0 014.148 1.723 5.791 5.791 0 011.659 4.183zm-2.542 0c0-2.125-1.513-3.583-3.265-3.583-1.751 0-3.264 1.468-3.264 3.582s1.508 3.582 3.264 3.582c1.757 0 3.265-1.468 3.265-3.582z"
|
|
74
|
-
}), (0, _jsxRuntime.jsx)(_components.Path, {
|
|
75
|
-
d: "M281.457 6.941h-2.591v17.373h2.591V6.94z"
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
var _default = PatronsLogo;
|
|
82
|
-
exports.default = _default;
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _icons = require("@wordpress/icons");
|
|
13
|
-
var _ = require("../");
|
|
14
|
-
require("./style.scss");
|
|
15
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
-
/**
|
|
18
|
-
* Plugin Installer
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* WordPress dependencies.
|
|
22
|
-
*/
|
|
23
|
-
const __ = _i18n.__;
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies.
|
|
26
|
-
*/
|
|
27
|
-
const PLUGIN_STATE_NONE = 0;
|
|
28
|
-
const PLUGIN_STATE_ACTIVE = 1;
|
|
29
|
-
const PLUGIN_STATE_INSTALLING = 2;
|
|
30
|
-
const PLUGIN_STATE_ERROR = 3;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* External dependencies.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Plugin installer.
|
|
38
|
-
*/
|
|
39
|
-
class PluginInstaller extends _element.Component {
|
|
40
|
-
constructor() {
|
|
41
|
-
var _this;
|
|
42
|
-
super(...arguments);
|
|
43
|
-
_this = this;
|
|
44
|
-
(0, _defineProperty2.default)(this, "componentDidMount", () => {
|
|
45
|
-
const {
|
|
46
|
-
plugins
|
|
47
|
-
} = this.props;
|
|
48
|
-
this.retrievePluginInfo(plugins).then(() => {
|
|
49
|
-
if (this.props.autoInstall) {
|
|
50
|
-
this.installAllPlugins();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
(0, _defineProperty2.default)(this, "componentDidUpdate", prevProps => {
|
|
55
|
-
const {
|
|
56
|
-
autoInstall,
|
|
57
|
-
plugins
|
|
58
|
-
} = this.props;
|
|
59
|
-
const {
|
|
60
|
-
installationInitialized
|
|
61
|
-
} = this.state;
|
|
62
|
-
if (plugins !== prevProps.plugins) {
|
|
63
|
-
this.retrievePluginInfo(plugins);
|
|
64
|
-
}
|
|
65
|
-
if (autoInstall && !installationInitialized) {
|
|
66
|
-
this.installAllPlugins();
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
(0, _defineProperty2.default)(this, "retrievePluginInfo", plugins => {
|
|
70
|
-
return new Promise(resolve => {
|
|
71
|
-
(0, _apiFetch.default)({
|
|
72
|
-
path: '/newspack/v1/plugins/'
|
|
73
|
-
}).then(response => {
|
|
74
|
-
const pluginInfo = Object.keys(response).reduce((result, slug) => {
|
|
75
|
-
if (plugins.indexOf(slug) === -1) {
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
result[slug] = {
|
|
79
|
-
...response[slug],
|
|
80
|
-
installationStatus: response[slug].Status === 'active' ? PLUGIN_STATE_ACTIVE : PLUGIN_STATE_NONE
|
|
81
|
-
};
|
|
82
|
-
return result;
|
|
83
|
-
}, {});
|
|
84
|
-
this.updatePluginInfo(pluginInfo).then(() => resolve());
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
(0, _defineProperty2.default)(this, "installAllPlugins", () => {
|
|
89
|
-
const {
|
|
90
|
-
pluginInfo
|
|
91
|
-
} = this.state;
|
|
92
|
-
this.setState({
|
|
93
|
-
installationInitialized: true
|
|
94
|
-
});
|
|
95
|
-
const promises = Object.keys(pluginInfo).filter(slug => 'active' !== pluginInfo[slug].Status).map(slug => () => this.installPlugin(slug));
|
|
96
|
-
promises.reduce((promise, action) => promise.then(result => action().then(Array.prototype.concat.bind(result))), Promise.resolve([]));
|
|
97
|
-
});
|
|
98
|
-
(0, _defineProperty2.default)(this, "installPlugin", slug => {
|
|
99
|
-
this.setInstallationStatus(slug, PLUGIN_STATE_INSTALLING);
|
|
100
|
-
const params = {
|
|
101
|
-
path: `/newspack/v1/plugins/${slug}/configure/`,
|
|
102
|
-
method: 'post'
|
|
103
|
-
};
|
|
104
|
-
return (0, _apiFetch.default)(params).then(response => {
|
|
105
|
-
const {
|
|
106
|
-
pluginInfo
|
|
107
|
-
} = this.state;
|
|
108
|
-
this.props.onInstalled(slug);
|
|
109
|
-
this.updatePluginInfo({
|
|
110
|
-
...pluginInfo,
|
|
111
|
-
[slug]: {
|
|
112
|
-
...response,
|
|
113
|
-
installationStatus: PLUGIN_STATE_ACTIVE
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}).catch(error => {
|
|
117
|
-
this.setInstallationStatus(slug, PLUGIN_STATE_ERROR, error.message);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
(0, _defineProperty2.default)(this, "setChecked", (slug, checked) => {
|
|
121
|
-
const {
|
|
122
|
-
pluginInfo
|
|
123
|
-
} = this.state;
|
|
124
|
-
this.updatePluginInfo({
|
|
125
|
-
...pluginInfo,
|
|
126
|
-
[slug]: {
|
|
127
|
-
...pluginInfo[slug],
|
|
128
|
-
checked
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
(0, _defineProperty2.default)(this, "setInstallationStatus", function (slug, installationStatus) {
|
|
133
|
-
let notification = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
134
|
-
const {
|
|
135
|
-
pluginInfo
|
|
136
|
-
} = _this.state;
|
|
137
|
-
_this.updatePluginInfo({
|
|
138
|
-
...pluginInfo,
|
|
139
|
-
[slug]: {
|
|
140
|
-
...pluginInfo[slug],
|
|
141
|
-
installationStatus,
|
|
142
|
-
notification
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
(0, _defineProperty2.default)(this, "updatePluginInfo", pluginInfo => {
|
|
147
|
-
return new Promise(resolve => {
|
|
148
|
-
const {
|
|
149
|
-
onStatus
|
|
150
|
-
} = this.props;
|
|
151
|
-
this.setState({
|
|
152
|
-
pluginInfo
|
|
153
|
-
}, () => {
|
|
154
|
-
const complete = Object.values(pluginInfo).every(plugin => {
|
|
155
|
-
return 'active' === plugin.Status;
|
|
156
|
-
});
|
|
157
|
-
onStatus({
|
|
158
|
-
complete,
|
|
159
|
-
pluginInfo
|
|
160
|
-
});
|
|
161
|
-
resolve();
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
(0, _defineProperty2.default)(this, "classForInstallationStatus", status => {
|
|
166
|
-
switch (status) {
|
|
167
|
-
case PLUGIN_STATE_ACTIVE:
|
|
168
|
-
return 'newspack-plugin-installer__status-active';
|
|
169
|
-
case PLUGIN_STATE_INSTALLING:
|
|
170
|
-
return 'newspack-plugin-installer__status-installing';
|
|
171
|
-
case PLUGIN_STATE_ERROR:
|
|
172
|
-
return 'newspack-plugin-installer__status-error';
|
|
173
|
-
default:
|
|
174
|
-
return 'newspack-plugin-installer__status-none';
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
this.state = {
|
|
178
|
-
pluginInfo: {},
|
|
179
|
-
installationInitialized: false
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Render.
|
|
184
|
-
*/
|
|
185
|
-
render() {
|
|
186
|
-
const {
|
|
187
|
-
autoInstall,
|
|
188
|
-
isSmall,
|
|
189
|
-
withoutFooterButton
|
|
190
|
-
} = this.props;
|
|
191
|
-
const {
|
|
192
|
-
pluginInfo
|
|
193
|
-
} = this.state;
|
|
194
|
-
const {
|
|
195
|
-
is_atomic: isAtomic
|
|
196
|
-
} = window;
|
|
197
|
-
const slugs = Object.keys(pluginInfo);
|
|
198
|
-
|
|
199
|
-
// Store all plugin status info for installer button text value based on current status.
|
|
200
|
-
const currentPluginStatuses = [];
|
|
201
|
-
slugs.forEach(slug => {
|
|
202
|
-
const plugin = pluginInfo[slug];
|
|
203
|
-
currentPluginStatuses.push(plugin.Status);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
// Make sure plugin status falls in either one of these, to handle button text.
|
|
207
|
-
const pluginInstalled = currentStatus => currentStatus === 'active' || currentStatus === 'inactive';
|
|
208
|
-
const buttonText = currentPluginStatuses.every(pluginInstalled) ? __('Activate', 'newspack') : __('Install', 'newspack');
|
|
209
|
-
const needsInstall = slugs.some(slug => {
|
|
210
|
-
const plugin = pluginInfo[slug];
|
|
211
|
-
return plugin.Status !== 'active' && plugin.installationStatus === PLUGIN_STATE_NONE;
|
|
212
|
-
});
|
|
213
|
-
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
214
|
-
children: [(!pluginInfo || !Object.keys(pluginInfo).length) && (0, _jsxRuntime.jsxs)("div", {
|
|
215
|
-
className: "newspack-plugin-installer_is-waiting",
|
|
216
|
-
children: [(0, _jsxRuntime.jsx)(_.Waiting, {
|
|
217
|
-
isLeft: true
|
|
218
|
-
}), __('Retrieving plugin information…')]
|
|
219
|
-
}), pluginInfo && slugs.length > 0 && slugs.map(slug => {
|
|
220
|
-
const plugin = pluginInfo[slug];
|
|
221
|
-
const {
|
|
222
|
-
Name,
|
|
223
|
-
Description,
|
|
224
|
-
Download,
|
|
225
|
-
Status,
|
|
226
|
-
installationStatus,
|
|
227
|
-
notification
|
|
228
|
-
} = plugin;
|
|
229
|
-
const isWaiting = installationStatus === PLUGIN_STATE_INSTALLING;
|
|
230
|
-
const isButton = !isWaiting && Status !== 'active';
|
|
231
|
-
const installable = Download || pluginInstalled(Status);
|
|
232
|
-
let actionText;
|
|
233
|
-
if (installationStatus === PLUGIN_STATE_INSTALLING) {
|
|
234
|
-
actionText = 'inactive' === Status ? __('Activating…') : __('Installing…');
|
|
235
|
-
} else if (!installable) {
|
|
236
|
-
actionText = (0, _jsxRuntime.jsxs)("span", {
|
|
237
|
-
className: "newspack-plugin-installer__status",
|
|
238
|
-
children: [isAtomic ? __('Contact Newspack support to install', 'newspack') : __('Plugin must be installed manually', 'newspack'), (0, _jsxRuntime.jsx)("span", {
|
|
239
|
-
className: "newspack-checkbox-icon"
|
|
240
|
-
})]
|
|
241
|
-
});
|
|
242
|
-
} else if (Status === 'uninstalled') {
|
|
243
|
-
actionText = (0, _jsxRuntime.jsxs)("span", {
|
|
244
|
-
className: "newspack-plugin-installer__status",
|
|
245
|
-
children: [__('Install', 'newspack'), (0, _jsxRuntime.jsx)("span", {
|
|
246
|
-
className: "newspack-checkbox-icon"
|
|
247
|
-
})]
|
|
248
|
-
});
|
|
249
|
-
} else if (Status === 'inactive') {
|
|
250
|
-
actionText = (0, _jsxRuntime.jsxs)("span", {
|
|
251
|
-
className: "newspack-plugin-installer__status",
|
|
252
|
-
children: [__('Activate', 'newspack'), (0, _jsxRuntime.jsx)("span", {
|
|
253
|
-
className: "newspack-checkbox-icon"
|
|
254
|
-
})]
|
|
255
|
-
});
|
|
256
|
-
} else if (Status === 'active') {
|
|
257
|
-
actionText = (0, _jsxRuntime.jsxs)("span", {
|
|
258
|
-
className: "newspack-plugin-installer__status",
|
|
259
|
-
children: [__('Installed', 'newspack'), (0, _jsxRuntime.jsx)("span", {
|
|
260
|
-
className: "newspack-checkbox-icon newspack-checkbox-icon--checked",
|
|
261
|
-
children: (0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
262
|
-
icon: _icons.check
|
|
263
|
-
})
|
|
264
|
-
})]
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
const classes = (0, _classnames.default)('newspack-action-card__plugin-installer', this.classForInstallationStatus(installationStatus));
|
|
268
|
-
const onClick = isButton ? () => this.installPlugin(slug) : null;
|
|
269
|
-
return (0, _jsxRuntime.jsx)(_.ActionCard, {
|
|
270
|
-
title: Name,
|
|
271
|
-
description: Description,
|
|
272
|
-
disabled: !installable,
|
|
273
|
-
actionText: actionText,
|
|
274
|
-
isSmall: isSmall,
|
|
275
|
-
isWaiting: isWaiting,
|
|
276
|
-
onClick: onClick,
|
|
277
|
-
notification: notification,
|
|
278
|
-
notificationLevel: "error",
|
|
279
|
-
notificationHTML: true,
|
|
280
|
-
className: classes
|
|
281
|
-
}, slug);
|
|
282
|
-
}), !withoutFooterButton && !autoInstall && pluginInfo && slugs.length > 0 && (0, _jsxRuntime.jsx)("div", {
|
|
283
|
-
className: "newspack-buttons-card",
|
|
284
|
-
children: (0, _jsxRuntime.jsx)(_.Button, {
|
|
285
|
-
disabled: !needsInstall,
|
|
286
|
-
isPrimary: true,
|
|
287
|
-
onClick: this.installAllPlugins,
|
|
288
|
-
children: buttonText
|
|
289
|
-
})
|
|
290
|
-
})]
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
PluginInstaller.defaultProps = {
|
|
295
|
-
onStatus: () => {},
|
|
296
|
-
onInstalled: () => {}
|
|
297
|
-
};
|
|
298
|
-
var _default = PluginInstaller;
|
|
299
|
-
exports.default = _default;
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
11
|
-
var _element = require("@wordpress/element");
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
var _ = require("../");
|
|
14
|
-
var _SettingsSection = _interopRequireDefault(require("./SettingsSection"));
|
|
15
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
|
-
/**
|
|
17
|
-
* External dependencies
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* WordPress dependencies.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies.
|
|
24
|
-
*/
|
|
25
|
-
const __ = _i18n.__;
|
|
26
|
-
class PluginSettings extends _element.Component {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
(0, _defineProperty2.default)(this, "fetchSettings", () => {
|
|
30
|
-
const {
|
|
31
|
-
afterFetch,
|
|
32
|
-
pluginSlug,
|
|
33
|
-
isWizard
|
|
34
|
-
} = this.props;
|
|
35
|
-
this.setState({
|
|
36
|
-
inFlight: true
|
|
37
|
-
});
|
|
38
|
-
(0, _apiFetch.default)({
|
|
39
|
-
path: isWizard ? `/newspack/v1/wizard/${pluginSlug}/settings` : `/${pluginSlug}/v1/settings`
|
|
40
|
-
}).then(settings => {
|
|
41
|
-
this.setState({
|
|
42
|
-
settings,
|
|
43
|
-
error: null
|
|
44
|
-
});
|
|
45
|
-
if ('function' === typeof afterFetch) {
|
|
46
|
-
afterFetch(settings);
|
|
47
|
-
}
|
|
48
|
-
}).catch(error => {
|
|
49
|
-
this.setState({
|
|
50
|
-
error
|
|
51
|
-
});
|
|
52
|
-
}).finally(() => {
|
|
53
|
-
this.setState({
|
|
54
|
-
inFlight: false
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
(0, _defineProperty2.default)(this, "getSettingsValues", sectionKey => {
|
|
59
|
-
return this.state.settings[sectionKey]?.reduce((map, setting) => {
|
|
60
|
-
map[setting.key] = setting.value;
|
|
61
|
-
return map;
|
|
62
|
-
}, {}) || {};
|
|
63
|
-
});
|
|
64
|
-
(0, _defineProperty2.default)(this, "handleSettingChange", sectionKey => (key, value) => {
|
|
65
|
-
const sectionSettings = [...this.state.settings[sectionKey]];
|
|
66
|
-
sectionSettings.forEach(setting => {
|
|
67
|
-
if (setting.key === key) {
|
|
68
|
-
setting.value = value;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
this.setState({
|
|
72
|
-
settings: {
|
|
73
|
-
...this.state.settings,
|
|
74
|
-
[sectionKey]: sectionSettings
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
(0, _defineProperty2.default)(this, "handleSectionUpdate", sectionKey => data => {
|
|
79
|
-
const {
|
|
80
|
-
afterUpdate,
|
|
81
|
-
pluginSlug,
|
|
82
|
-
isWizard
|
|
83
|
-
} = this.props;
|
|
84
|
-
this.setState({
|
|
85
|
-
inFlight: true
|
|
86
|
-
});
|
|
87
|
-
(0, _apiFetch.default)({
|
|
88
|
-
path: isWizard ? `/newspack/v1/wizard/${pluginSlug}/settings` : `/${pluginSlug}/v1/settings`,
|
|
89
|
-
method: 'POST',
|
|
90
|
-
data: {
|
|
91
|
-
section: sectionKey,
|
|
92
|
-
settings: data ? data : this.getSettingsValues(sectionKey)
|
|
93
|
-
}
|
|
94
|
-
}).then(settings => {
|
|
95
|
-
this.setState({
|
|
96
|
-
settings: {
|
|
97
|
-
...this.state.settings,
|
|
98
|
-
[sectionKey]: settings[sectionKey]
|
|
99
|
-
},
|
|
100
|
-
error: null
|
|
101
|
-
});
|
|
102
|
-
if ('function' === typeof afterUpdate) {
|
|
103
|
-
afterUpdate(settings);
|
|
104
|
-
}
|
|
105
|
-
}).catch(error => {
|
|
106
|
-
this.setState({
|
|
107
|
-
error
|
|
108
|
-
});
|
|
109
|
-
}).finally(() => {
|
|
110
|
-
this.setState({
|
|
111
|
-
inFlight: false
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
/**
|
|
116
|
-
* Get the section setting containing section information.
|
|
117
|
-
*
|
|
118
|
-
* @param {string} sectionKey The section name.
|
|
119
|
-
* @return {Object} The section setting.
|
|
120
|
-
*/
|
|
121
|
-
(0, _defineProperty2.default)(this, "getSectionInfo", sectionKey => {
|
|
122
|
-
return this.state.settings[sectionKey]?.find(setting => !setting.key || setting.key === 'active');
|
|
123
|
-
});
|
|
124
|
-
/**
|
|
125
|
-
* Get the section title.
|
|
126
|
-
*
|
|
127
|
-
* @param {string} sectionKey The section name.
|
|
128
|
-
* @return {string} The section title.
|
|
129
|
-
*/
|
|
130
|
-
(0, _defineProperty2.default)(this, "getSectionTitle", sectionKey => {
|
|
131
|
-
return this.getSectionInfo(sectionKey)?.description;
|
|
132
|
-
});
|
|
133
|
-
/**
|
|
134
|
-
* Get the section description.
|
|
135
|
-
*
|
|
136
|
-
* @param {string} sectionKey The section name.
|
|
137
|
-
* @return {string} The section description.
|
|
138
|
-
*/
|
|
139
|
-
(0, _defineProperty2.default)(this, "getSectionDescription", sectionKey => {
|
|
140
|
-
return this.getSectionInfo(sectionKey)?.help;
|
|
141
|
-
});
|
|
142
|
-
/**
|
|
143
|
-
* Get whether a section is active.
|
|
144
|
-
*
|
|
145
|
-
* @param {string} sectionKey The section name.
|
|
146
|
-
* @return {?boolean} Whether the section is active or not. Null if the section is not found or does not support activation.
|
|
147
|
-
*/
|
|
148
|
-
(0, _defineProperty2.default)(this, "isSectionActive", sectionKey => {
|
|
149
|
-
const {
|
|
150
|
-
settings
|
|
151
|
-
} = this.state;
|
|
152
|
-
const activation = settings[sectionKey]?.find(setting => setting.key === 'active');
|
|
153
|
-
if (!activation) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
return activation.value;
|
|
157
|
-
});
|
|
158
|
-
/**
|
|
159
|
-
* Get list of section field settings.
|
|
160
|
-
*
|
|
161
|
-
* @param {string} sectionKey The section name.
|
|
162
|
-
* @return {?Array} List of section fields.
|
|
163
|
-
*/
|
|
164
|
-
(0, _defineProperty2.default)(this, "getSectionFields", sectionKey => {
|
|
165
|
-
return this.state.settings[sectionKey]?.filter(setting => setting.key && setting.key !== 'active');
|
|
166
|
-
});
|
|
167
|
-
this.state = {
|
|
168
|
-
inFlight: false,
|
|
169
|
-
settings: {},
|
|
170
|
-
error: null
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
componentDidMount() {
|
|
174
|
-
this.fetchSettings();
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Render.
|
|
178
|
-
*/
|
|
179
|
-
render() {
|
|
180
|
-
const {
|
|
181
|
-
title,
|
|
182
|
-
description,
|
|
183
|
-
hasGreyHeader,
|
|
184
|
-
children
|
|
185
|
-
} = this.props;
|
|
186
|
-
const {
|
|
187
|
-
settings,
|
|
188
|
-
inFlight,
|
|
189
|
-
error
|
|
190
|
-
} = this.state;
|
|
191
|
-
return (0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
192
|
-
children: [title && (0, _jsxRuntime.jsx)(_.SectionHeader, {
|
|
193
|
-
title: title,
|
|
194
|
-
description: description
|
|
195
|
-
}), error && (0, _jsxRuntime.jsx)(_.Notice, {
|
|
196
|
-
isError: true,
|
|
197
|
-
noticeText: error.message
|
|
198
|
-
}), (0, _jsxRuntime.jsxs)("div", {
|
|
199
|
-
className: (0, _classnames.default)('newspack-plugin-settings', {
|
|
200
|
-
'newspack-wizard-section__is-loading': inFlight && !Object.keys(settings).length
|
|
201
|
-
}),
|
|
202
|
-
children: [Object.keys(settings).map(sectionKey => (0, _jsxRuntime.jsx)(_SettingsSection.default, {
|
|
203
|
-
disabled: inFlight,
|
|
204
|
-
sectionKey: sectionKey,
|
|
205
|
-
title: this.getSectionTitle(sectionKey),
|
|
206
|
-
description: this.getSectionDescription(sectionKey),
|
|
207
|
-
active: this.isSectionActive(sectionKey),
|
|
208
|
-
fields: this.getSectionFields(sectionKey),
|
|
209
|
-
onChange: this.handleSettingChange(sectionKey),
|
|
210
|
-
onUpdate: this.handleSectionUpdate(sectionKey),
|
|
211
|
-
hasGreyHeader: hasGreyHeader
|
|
212
|
-
}, sectionKey)), children]
|
|
213
|
-
})]
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
PluginSettings.defaultProps = {
|
|
218
|
-
title: __('General Settings', 'newspack')
|
|
219
|
-
};
|
|
220
|
-
PluginSettings.Section = _SettingsSection.default;
|
|
221
|
-
var _default = PluginSettings;
|
|
222
|
-
exports.default = _default;
|