newspack-components 3.0.0-alpha.2 → 3.0.0-alpha.3
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.cjs.js +26 -0
- package/babel.config.js +1 -0
- package/copy-styles.js +10 -2
- package/dist/esm/accordion/index.js +42 -0
- package/dist/esm/accordion/style.scss +31 -0
- package/dist/esm/action-card/index.js +218 -0
- package/dist/esm/action-card/style.scss +483 -0
- package/dist/esm/autocomplete-tokenfield/index.js +261 -0
- package/dist/esm/autocomplete-tokenfield/style.scss +49 -0
- package/dist/esm/autocomplete-with-suggestions/index.js +274 -0
- package/dist/esm/autocomplete-with-suggestions/style.scss +163 -0
- package/dist/esm/button/style.scss +11 -0
- package/dist/esm/button-card/index.js +64 -0
- package/dist/esm/button-card/style.scss +180 -0
- package/dist/esm/card/index.js +43 -0
- package/dist/esm/card/style.scss +168 -0
- package/dist/esm/category-autocomplete/index.js +183 -0
- package/dist/esm/category-autocomplete/style.scss +34 -0
- package/dist/esm/color-picker/index.js +59 -0
- package/dist/esm/color-picker/style.scss +37 -0
- package/dist/esm/consts.js +1 -0
- package/dist/esm/custom-select-control/index.js +37 -0
- package/dist/esm/custom-select-control/style.scss +93 -0
- package/dist/esm/date-range-picker/index.js +31 -0
- package/dist/esm/date-range-picker/style.scss +148 -0
- package/dist/esm/footer/index.js +99 -0
- package/dist/esm/footer/style.scss +82 -0
- package/dist/esm/form-token-field/index.js +49 -0
- package/dist/esm/form-token-field/style.scss +37 -0
- package/dist/esm/global-notices/index.js +30 -0
- package/dist/esm/grid/style.scss +166 -0
- package/dist/esm/handoff/index.js +175 -0
- package/dist/esm/handoff-message/index.js +47 -0
- package/dist/esm/hooks/useObjectState.js +30 -0
- package/dist/esm/hooks/useObjectState.test.js +82 -0
- package/dist/esm/hooks/useOnClickOutside.js +31 -0
- package/dist/esm/image-upload/index.js +140 -0
- package/dist/esm/image-upload/index.test.js +34 -0
- package/dist/esm/image-upload/style.scss +103 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/info-button/index.js +42 -0
- package/dist/esm/info-button/style.scss +18 -0
- package/dist/esm/modal/index.js +39 -0
- package/dist/esm/modal/style.scss +56 -0
- package/dist/esm/newspack-icon/index.js +50 -0
- package/dist/esm/newspack-icon/style.scss +26 -0
- package/dist/esm/newspack-logo/index.js +46 -0
- package/dist/esm/newspack-logo/style.scss +30 -0
- package/dist/esm/notice/index.js +65 -0
- package/dist/esm/notice/style.scss +111 -0
- package/dist/esm/patrons-logo/index.js +70 -0
- package/dist/esm/plugin-installer/index.js +289 -0
- package/dist/esm/plugin-installer/style.scss +72 -0
- package/dist/esm/plugin-settings/SettingsSection.js +133 -0
- package/dist/esm/plugin-settings/index.js +220 -0
- package/dist/esm/plugin-settings/style.scss +7 -0
- package/dist/esm/plugin-toggle/index.js +216 -0
- package/dist/esm/plugin-toggle/style.scss +20 -0
- package/dist/esm/popover/index.js +41 -0
- package/dist/esm/popover/style.scss +161 -0
- package/dist/esm/position-control/index.js +106 -0
- package/dist/esm/position-control/style.scss +66 -0
- package/dist/esm/progress-bar/index.js +68 -0
- package/dist/esm/progress-bar/index.test.js +108 -0
- package/dist/esm/progress-bar/style.scss +42 -0
- package/dist/esm/proxied-imports/router.js +8 -0
- package/dist/esm/radio-control/index.js +37 -0
- package/dist/esm/radio-control/style.scss +92 -0
- package/dist/esm/section-header/index.js +67 -0
- package/dist/esm/section-header/style.scss +45 -0
- package/dist/esm/select-control/ButtonGroupControl.js +53 -0
- package/dist/esm/select-control/GroupedSelectControl.js +78 -0
- package/dist/esm/select-control/index.js +51 -0
- package/dist/esm/select-control/style.scss +108 -0
- package/dist/esm/settings/MinMaxSetting.js +53 -0
- package/dist/esm/settings/SettingsCard.js +38 -0
- package/dist/esm/settings/SettingsSection.js +26 -0
- package/dist/esm/settings/index.js +9 -0
- package/dist/esm/settings/style.scss +119 -0
- package/dist/esm/sortable-newsletter-list-control/index.js +127 -0
- package/dist/esm/sortable-newsletter-list-control/style.scss +45 -0
- package/dist/esm/steps-list/index.js +43 -0
- package/dist/esm/steps-list/style.scss +11 -0
- package/dist/esm/steps-list-item/index.js +47 -0
- package/dist/esm/steps-list-item/style.scss +47 -0
- package/dist/esm/style-card/index.js +74 -0
- package/dist/esm/style-card/style.scss +94 -0
- package/dist/esm/style.scss +55 -0
- package/dist/esm/tabbed-navigation/index.js +53 -0
- package/dist/esm/tabbed-navigation/style.scss +86 -0
- package/dist/esm/text-control/style.scss +32 -0
- package/dist/esm/utils/index.js +29 -0
- package/dist/esm/waiting/index.js +44 -0
- package/dist/esm/waiting/style.scss +27 -0
- package/dist/esm/web-preview/index.js +183 -0
- package/dist/esm/web-preview/style.scss +155 -0
- package/dist/esm/with-wizard/index.js +320 -0
- package/dist/esm/with-wizard/style.scss +282 -0
- package/dist/esm/with-wizard-screen/index.js +109 -0
- package/dist/esm/with-wizard-screen/style.scss +160 -0
- package/dist/esm/wizard/components/WizardError.js +66 -0
- package/dist/esm/wizard/index.js +119 -0
- package/dist/esm/wizard/store/index.js +155 -0
- package/dist/esm/wizard/store/utils.js +14 -0
- package/package.json +7 -4
- package/dist/button/index.js +0 -51
- package/dist/button/index.tsx +0 -48
- package/dist/grid/index.js +0 -44
- package/dist/grid/index.tsx +0 -34
- package/dist/hooks/index.js +0 -29
- package/dist/hooks/index.ts +0 -15
- package/dist/hooks/usePrompt.js +0 -47
- package/dist/hooks/usePrompt.ts +0 -46
- package/dist/plugin-toggle/README.md +0 -53
- package/dist/text-control/index.js +0 -76
- package/dist/text-control/index.tsx +0 -71
- /package/dist/{accordion → cjs/accordion}/index.js +0 -0
- /package/dist/{accordion → cjs/accordion}/style.scss +0 -0
- /package/dist/{action-card → cjs/action-card}/index.js +0 -0
- /package/dist/{action-card → cjs/action-card}/style.scss +0 -0
- /package/dist/{autocomplete-tokenfield → cjs/autocomplete-tokenfield}/index.js +0 -0
- /package/dist/{autocomplete-tokenfield → cjs/autocomplete-tokenfield}/style.scss +0 -0
- /package/dist/{autocomplete-with-suggestions → cjs/autocomplete-with-suggestions}/index.js +0 -0
- /package/dist/{autocomplete-with-suggestions → cjs/autocomplete-with-suggestions}/style.scss +0 -0
- /package/dist/{button → cjs/button}/style.scss +0 -0
- /package/dist/{button-card → cjs/button-card}/index.js +0 -0
- /package/dist/{button-card → cjs/button-card}/style.scss +0 -0
- /package/dist/{card → cjs/card}/index.js +0 -0
- /package/dist/{card → cjs/card}/style.scss +0 -0
- /package/dist/{category-autocomplete → cjs/category-autocomplete}/index.js +0 -0
- /package/dist/{category-autocomplete → cjs/category-autocomplete}/style.scss +0 -0
- /package/dist/{color-picker → cjs/color-picker}/index.js +0 -0
- /package/dist/{color-picker → cjs/color-picker}/style.scss +0 -0
- /package/dist/{consts.js → cjs/consts.js} +0 -0
- /package/dist/{custom-select-control → cjs/custom-select-control}/index.js +0 -0
- /package/dist/{custom-select-control → cjs/custom-select-control}/style.scss +0 -0
- /package/dist/{date-range-picker → cjs/date-range-picker}/index.js +0 -0
- /package/dist/{date-range-picker → cjs/date-range-picker}/style.scss +0 -0
- /package/dist/{footer → cjs/footer}/index.js +0 -0
- /package/dist/{footer → cjs/footer}/style.scss +0 -0
- /package/dist/{form-token-field → cjs/form-token-field}/index.js +0 -0
- /package/dist/{form-token-field → cjs/form-token-field}/style.scss +0 -0
- /package/dist/{global-notices → cjs/global-notices}/index.js +0 -0
- /package/dist/{grid → cjs/grid}/style.scss +0 -0
- /package/dist/{handoff → cjs/handoff}/index.js +0 -0
- /package/dist/{handoff-message → cjs/handoff-message}/index.js +0 -0
- /package/dist/{hooks → cjs/hooks}/useObjectState.js +0 -0
- /package/dist/{hooks → cjs/hooks}/useObjectState.test.js +0 -0
- /package/dist/{hooks → cjs/hooks}/useOnClickOutside.js +0 -0
- /package/dist/{image-upload → cjs/image-upload}/index.js +0 -0
- /package/dist/{image-upload → cjs/image-upload}/index.test.js +0 -0
- /package/dist/{image-upload → cjs/image-upload}/style.scss +0 -0
- /package/dist/{index.js → cjs/index.js} +0 -0
- /package/dist/{info-button → cjs/info-button}/index.js +0 -0
- /package/dist/{info-button → cjs/info-button}/style.scss +0 -0
- /package/dist/{modal → cjs/modal}/index.js +0 -0
- /package/dist/{modal → cjs/modal}/style.scss +0 -0
- /package/dist/{newspack-icon → cjs/newspack-icon}/index.js +0 -0
- /package/dist/{newspack-icon → cjs/newspack-icon}/style.scss +0 -0
- /package/dist/{newspack-logo → cjs/newspack-logo}/index.js +0 -0
- /package/dist/{newspack-logo → cjs/newspack-logo}/style.scss +0 -0
- /package/dist/{notice → cjs/notice}/index.js +0 -0
- /package/dist/{notice → cjs/notice}/style.scss +0 -0
- /package/dist/{patrons-logo → cjs/patrons-logo}/index.js +0 -0
- /package/dist/{plugin-installer → cjs/plugin-installer}/index.js +0 -0
- /package/dist/{plugin-installer → cjs/plugin-installer}/style.scss +0 -0
- /package/dist/{plugin-settings → cjs/plugin-settings}/SettingsSection.js +0 -0
- /package/dist/{plugin-settings → cjs/plugin-settings}/index.js +0 -0
- /package/dist/{plugin-settings → cjs/plugin-settings}/style.scss +0 -0
- /package/dist/{plugin-toggle → cjs/plugin-toggle}/index.js +0 -0
- /package/dist/{plugin-toggle → cjs/plugin-toggle}/style.scss +0 -0
- /package/dist/{popover → cjs/popover}/index.js +0 -0
- /package/dist/{popover → cjs/popover}/style.scss +0 -0
- /package/dist/{position-control → cjs/position-control}/index.js +0 -0
- /package/dist/{position-control → cjs/position-control}/style.scss +0 -0
- /package/dist/{progress-bar → cjs/progress-bar}/index.js +0 -0
- /package/dist/{progress-bar → cjs/progress-bar}/index.test.js +0 -0
- /package/dist/{progress-bar → cjs/progress-bar}/style.scss +0 -0
- /package/dist/{proxied-imports → cjs/proxied-imports}/router.js +0 -0
- /package/dist/{radio-control → cjs/radio-control}/index.js +0 -0
- /package/dist/{radio-control → cjs/radio-control}/style.scss +0 -0
- /package/dist/{section-header → cjs/section-header}/index.js +0 -0
- /package/dist/{section-header → cjs/section-header}/style.scss +0 -0
- /package/dist/{select-control → cjs/select-control}/ButtonGroupControl.js +0 -0
- /package/dist/{select-control → cjs/select-control}/GroupedSelectControl.js +0 -0
- /package/dist/{select-control → cjs/select-control}/index.js +0 -0
- /package/dist/{select-control → cjs/select-control}/style.scss +0 -0
- /package/dist/{settings → cjs/settings}/MinMaxSetting.js +0 -0
- /package/dist/{settings → cjs/settings}/SettingsCard.js +0 -0
- /package/dist/{settings → cjs/settings}/SettingsSection.js +0 -0
- /package/dist/{settings → cjs/settings}/index.js +0 -0
- /package/dist/{settings → cjs/settings}/style.scss +0 -0
- /package/dist/{sortable-newsletter-list-control → cjs/sortable-newsletter-list-control}/index.js +0 -0
- /package/dist/{sortable-newsletter-list-control → cjs/sortable-newsletter-list-control}/style.scss +0 -0
- /package/dist/{steps-list → cjs/steps-list}/index.js +0 -0
- /package/dist/{steps-list → cjs/steps-list}/style.scss +0 -0
- /package/dist/{steps-list-item → cjs/steps-list-item}/index.js +0 -0
- /package/dist/{steps-list-item → cjs/steps-list-item}/style.scss +0 -0
- /package/dist/{style-card → cjs/style-card}/index.js +0 -0
- /package/dist/{style-card → cjs/style-card}/style.scss +0 -0
- /package/dist/{style.scss → cjs/style.scss} +0 -0
- /package/dist/{tabbed-navigation → cjs/tabbed-navigation}/index.js +0 -0
- /package/dist/{tabbed-navigation → cjs/tabbed-navigation}/style.scss +0 -0
- /package/dist/{text-control → cjs/text-control}/style.scss +0 -0
- /package/dist/{utils → cjs/utils}/index.js +0 -0
- /package/dist/{waiting → cjs/waiting}/index.js +0 -0
- /package/dist/{waiting → cjs/waiting}/style.scss +0 -0
- /package/dist/{web-preview → cjs/web-preview}/index.js +0 -0
- /package/dist/{web-preview → cjs/web-preview}/style.scss +0 -0
- /package/dist/{with-wizard → cjs/with-wizard}/index.js +0 -0
- /package/dist/{with-wizard → cjs/with-wizard}/style.scss +0 -0
- /package/dist/{with-wizard-screen → cjs/with-wizard-screen}/index.js +0 -0
- /package/dist/{with-wizard-screen → cjs/with-wizard-screen}/style.scss +0 -0
- /package/dist/{wizard → cjs/wizard}/components/WizardError.js +0 -0
- /package/dist/{wizard → cjs/wizard}/index.js +0 -0
- /package/dist/{wizard → cjs/wizard}/store/index.js +0 -0
- /package/dist/{wizard → cjs/wizard}/store/utils.js +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress.com and Google News Initiative Logos.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { Component } from '@wordpress/element';
|
|
9
|
+
import { Path, SVG } from '@wordpress/components';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
class PatronsLogo extends Component {
|
|
13
|
+
/**
|
|
14
|
+
* Render.
|
|
15
|
+
*/
|
|
16
|
+
render = () => {
|
|
17
|
+
return /*#__PURE__*/_jsxs(SVG, {
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
width: "219",
|
|
20
|
+
height: "16",
|
|
21
|
+
viewBox: "0 0 438 32",
|
|
22
|
+
className: "patrons-logo",
|
|
23
|
+
"aria-label": __('A project of WordPress.com and the Google News Initiative', 'newspack-plugin'),
|
|
24
|
+
children: [/*#__PURE__*/_jsx(Path, {
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
clipRule: "evenodd",
|
|
27
|
+
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"
|
|
28
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
29
|
+
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"
|
|
30
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
31
|
+
fillRule: "evenodd",
|
|
32
|
+
clipRule: "evenodd",
|
|
33
|
+
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"
|
|
34
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
35
|
+
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"
|
|
36
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
37
|
+
fillRule: "evenodd",
|
|
38
|
+
clipRule: "evenodd",
|
|
39
|
+
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"
|
|
40
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
41
|
+
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"
|
|
42
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
43
|
+
fillRule: "evenodd",
|
|
44
|
+
clipRule: "evenodd",
|
|
45
|
+
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"
|
|
46
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
47
|
+
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"
|
|
48
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
49
|
+
fillRule: "evenodd",
|
|
50
|
+
clipRule: "evenodd",
|
|
51
|
+
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"
|
|
52
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
53
|
+
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"
|
|
54
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
55
|
+
fillRule: "evenodd",
|
|
56
|
+
clipRule: "evenodd",
|
|
57
|
+
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"
|
|
58
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
59
|
+
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"
|
|
60
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
61
|
+
fillRule: "evenodd",
|
|
62
|
+
clipRule: "evenodd",
|
|
63
|
+
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"
|
|
64
|
+
}), /*#__PURE__*/_jsx(Path, {
|
|
65
|
+
d: "M281.457 6.941h-2.591v17.373h2.591V6.94z"
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export default PatronsLogo;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Installer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies.
|
|
7
|
+
*/
|
|
8
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
9
|
+
import { Component } from '@wordpress/element';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { Icon, check } from '@wordpress/icons';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies.
|
|
15
|
+
*/
|
|
16
|
+
import { ActionCard, Button, Waiting } from '../';
|
|
17
|
+
import './style.scss';
|
|
18
|
+
const PLUGIN_STATE_NONE = 0;
|
|
19
|
+
const PLUGIN_STATE_ACTIVE = 1;
|
|
20
|
+
const PLUGIN_STATE_INSTALLING = 2;
|
|
21
|
+
const PLUGIN_STATE_ERROR = 3;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* External dependencies.
|
|
25
|
+
*/
|
|
26
|
+
import classnames from 'classnames';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Plugin installer.
|
|
30
|
+
*/
|
|
31
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
32
|
+
class PluginInstaller extends Component {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.state = {
|
|
36
|
+
pluginInfo: {},
|
|
37
|
+
installationInitialized: false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
componentDidMount = () => {
|
|
41
|
+
const {
|
|
42
|
+
plugins
|
|
43
|
+
} = this.props;
|
|
44
|
+
this.retrievePluginInfo(plugins).then(() => {
|
|
45
|
+
if (this.props.autoInstall) {
|
|
46
|
+
this.installAllPlugins();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
componentDidUpdate = prevProps => {
|
|
51
|
+
const {
|
|
52
|
+
autoInstall,
|
|
53
|
+
plugins
|
|
54
|
+
} = this.props;
|
|
55
|
+
const {
|
|
56
|
+
installationInitialized
|
|
57
|
+
} = this.state;
|
|
58
|
+
if (plugins !== prevProps.plugins) {
|
|
59
|
+
this.retrievePluginInfo(plugins);
|
|
60
|
+
}
|
|
61
|
+
if (autoInstall && !installationInitialized) {
|
|
62
|
+
this.installAllPlugins();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
retrievePluginInfo = plugins => {
|
|
66
|
+
return new Promise(resolve => {
|
|
67
|
+
apiFetch({
|
|
68
|
+
path: '/newspack/v1/plugins/'
|
|
69
|
+
}).then(response => {
|
|
70
|
+
const pluginInfo = Object.keys(response).reduce((result, slug) => {
|
|
71
|
+
if (plugins.indexOf(slug) === -1) {
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
result[slug] = {
|
|
75
|
+
...response[slug],
|
|
76
|
+
installationStatus: response[slug].Status === 'active' ? PLUGIN_STATE_ACTIVE : PLUGIN_STATE_NONE
|
|
77
|
+
};
|
|
78
|
+
return result;
|
|
79
|
+
}, {});
|
|
80
|
+
this.updatePluginInfo(pluginInfo).then(() => resolve());
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
installAllPlugins = () => {
|
|
85
|
+
const {
|
|
86
|
+
pluginInfo
|
|
87
|
+
} = this.state;
|
|
88
|
+
this.setState({
|
|
89
|
+
installationInitialized: true
|
|
90
|
+
});
|
|
91
|
+
const promises = Object.keys(pluginInfo).filter(slug => 'active' !== pluginInfo[slug].Status).map(slug => () => this.installPlugin(slug));
|
|
92
|
+
promises.reduce((promise, action) => promise.then(result => action().then(Array.prototype.concat.bind(result))), Promise.resolve([]));
|
|
93
|
+
};
|
|
94
|
+
installPlugin = slug => {
|
|
95
|
+
this.setInstallationStatus(slug, PLUGIN_STATE_INSTALLING);
|
|
96
|
+
const params = {
|
|
97
|
+
path: `/newspack/v1/plugins/${slug}/configure/`,
|
|
98
|
+
method: 'post'
|
|
99
|
+
};
|
|
100
|
+
return apiFetch(params).then(response => {
|
|
101
|
+
const {
|
|
102
|
+
pluginInfo
|
|
103
|
+
} = this.state;
|
|
104
|
+
this.props.onInstalled(slug);
|
|
105
|
+
this.updatePluginInfo({
|
|
106
|
+
...pluginInfo,
|
|
107
|
+
[slug]: {
|
|
108
|
+
...response,
|
|
109
|
+
installationStatus: PLUGIN_STATE_ACTIVE
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}).catch(error => {
|
|
113
|
+
this.setInstallationStatus(slug, PLUGIN_STATE_ERROR, error.message);
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
setChecked = (slug, checked) => {
|
|
117
|
+
const {
|
|
118
|
+
pluginInfo
|
|
119
|
+
} = this.state;
|
|
120
|
+
this.updatePluginInfo({
|
|
121
|
+
...pluginInfo,
|
|
122
|
+
[slug]: {
|
|
123
|
+
...pluginInfo[slug],
|
|
124
|
+
checked
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
setInstallationStatus = (slug, installationStatus, notification = null) => {
|
|
129
|
+
const {
|
|
130
|
+
pluginInfo
|
|
131
|
+
} = this.state;
|
|
132
|
+
this.updatePluginInfo({
|
|
133
|
+
...pluginInfo,
|
|
134
|
+
[slug]: {
|
|
135
|
+
...pluginInfo[slug],
|
|
136
|
+
installationStatus,
|
|
137
|
+
notification
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
updatePluginInfo = pluginInfo => {
|
|
142
|
+
return new Promise(resolve => {
|
|
143
|
+
const {
|
|
144
|
+
onStatus
|
|
145
|
+
} = this.props;
|
|
146
|
+
this.setState({
|
|
147
|
+
pluginInfo
|
|
148
|
+
}, () => {
|
|
149
|
+
const complete = Object.values(pluginInfo).every(plugin => {
|
|
150
|
+
return 'active' === plugin.Status;
|
|
151
|
+
});
|
|
152
|
+
onStatus({
|
|
153
|
+
complete,
|
|
154
|
+
pluginInfo
|
|
155
|
+
});
|
|
156
|
+
resolve();
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
classForInstallationStatus = status => {
|
|
161
|
+
switch (status) {
|
|
162
|
+
case PLUGIN_STATE_ACTIVE:
|
|
163
|
+
return 'newspack-plugin-installer__status-active';
|
|
164
|
+
case PLUGIN_STATE_INSTALLING:
|
|
165
|
+
return 'newspack-plugin-installer__status-installing';
|
|
166
|
+
case PLUGIN_STATE_ERROR:
|
|
167
|
+
return 'newspack-plugin-installer__status-error';
|
|
168
|
+
default:
|
|
169
|
+
return 'newspack-plugin-installer__status-none';
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Render.
|
|
175
|
+
*/
|
|
176
|
+
render() {
|
|
177
|
+
const {
|
|
178
|
+
autoInstall,
|
|
179
|
+
isSmall,
|
|
180
|
+
withoutFooterButton
|
|
181
|
+
} = this.props;
|
|
182
|
+
const {
|
|
183
|
+
pluginInfo
|
|
184
|
+
} = this.state;
|
|
185
|
+
const {
|
|
186
|
+
is_atomic: isAtomic
|
|
187
|
+
} = window;
|
|
188
|
+
const slugs = Object.keys(pluginInfo);
|
|
189
|
+
|
|
190
|
+
// Store all plugin status info for installer button text value based on current status.
|
|
191
|
+
const currentPluginStatuses = [];
|
|
192
|
+
slugs.forEach(slug => {
|
|
193
|
+
const plugin = pluginInfo[slug];
|
|
194
|
+
currentPluginStatuses.push(plugin.Status);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// Make sure plugin status falls in either one of these, to handle button text.
|
|
198
|
+
const pluginInstalled = currentStatus => currentStatus === 'active' || currentStatus === 'inactive';
|
|
199
|
+
const buttonText = currentPluginStatuses.every(pluginInstalled) ? __('Activate', 'newspack-plugin') : __('Install', 'newspack-plugin');
|
|
200
|
+
const needsInstall = slugs.some(slug => {
|
|
201
|
+
const plugin = pluginInfo[slug];
|
|
202
|
+
return plugin.Status !== 'active' && plugin.installationStatus === PLUGIN_STATE_NONE;
|
|
203
|
+
});
|
|
204
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
|
+
children: [(!pluginInfo || !Object.keys(pluginInfo).length) && /*#__PURE__*/_jsxs("div", {
|
|
206
|
+
className: "newspack-plugin-installer_is-waiting",
|
|
207
|
+
children: [/*#__PURE__*/_jsx(Waiting, {
|
|
208
|
+
isLeft: true
|
|
209
|
+
}), __('Retrieving plugin information…', 'newspack-plugin')]
|
|
210
|
+
}), pluginInfo && slugs.length > 0 && slugs.map(slug => {
|
|
211
|
+
const plugin = pluginInfo[slug];
|
|
212
|
+
const {
|
|
213
|
+
Name,
|
|
214
|
+
Description,
|
|
215
|
+
Download,
|
|
216
|
+
Status,
|
|
217
|
+
installationStatus,
|
|
218
|
+
notification
|
|
219
|
+
} = plugin;
|
|
220
|
+
const isWaiting = installationStatus === PLUGIN_STATE_INSTALLING;
|
|
221
|
+
const isButton = !isWaiting && Status !== 'active';
|
|
222
|
+
const installable = Download || pluginInstalled(Status);
|
|
223
|
+
let actionText;
|
|
224
|
+
if (installationStatus === PLUGIN_STATE_INSTALLING) {
|
|
225
|
+
actionText = 'inactive' === Status ? __('Activating…') : __('Installing…');
|
|
226
|
+
} else if (!installable) {
|
|
227
|
+
actionText = /*#__PURE__*/_jsxs("span", {
|
|
228
|
+
className: "newspack-plugin-installer__status",
|
|
229
|
+
children: [isAtomic ? __('Contact Newspack support to install', 'newspack-plugin') : __('Plugin must be installed manually', 'newspack-plugin'), /*#__PURE__*/_jsx("span", {
|
|
230
|
+
className: "newspack-checkbox-icon"
|
|
231
|
+
})]
|
|
232
|
+
});
|
|
233
|
+
} else if (Status === 'uninstalled') {
|
|
234
|
+
actionText = /*#__PURE__*/_jsxs("span", {
|
|
235
|
+
className: "newspack-plugin-installer__status",
|
|
236
|
+
children: [__('Install', 'newspack'), /*#__PURE__*/_jsx("span", {
|
|
237
|
+
className: "newspack-checkbox-icon"
|
|
238
|
+
})]
|
|
239
|
+
});
|
|
240
|
+
} else if (Status === 'inactive') {
|
|
241
|
+
actionText = /*#__PURE__*/_jsxs("span", {
|
|
242
|
+
className: "newspack-plugin-installer__status",
|
|
243
|
+
children: [__('Activate', 'newspack-plugin'), /*#__PURE__*/_jsx("span", {
|
|
244
|
+
className: "newspack-checkbox-icon"
|
|
245
|
+
})]
|
|
246
|
+
});
|
|
247
|
+
} else if (Status === 'active') {
|
|
248
|
+
actionText = /*#__PURE__*/_jsxs("span", {
|
|
249
|
+
className: "newspack-plugin-installer__status",
|
|
250
|
+
children: [__('Installed', 'newspack-plugin'), /*#__PURE__*/_jsx("span", {
|
|
251
|
+
className: "newspack-checkbox-icon newspack-checkbox-icon--checked",
|
|
252
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
253
|
+
icon: check
|
|
254
|
+
})
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
const classes = classnames('newspack-action-card__plugin-installer', this.classForInstallationStatus(installationStatus));
|
|
259
|
+
const onClick = isButton ? () => this.installPlugin(slug) : null;
|
|
260
|
+
return /*#__PURE__*/_jsx(ActionCard, {
|
|
261
|
+
title: Name,
|
|
262
|
+
description: Description,
|
|
263
|
+
disabled: !installable,
|
|
264
|
+
actionText: actionText,
|
|
265
|
+
isSmall: isSmall,
|
|
266
|
+
isWaiting: isWaiting,
|
|
267
|
+
onClick: onClick,
|
|
268
|
+
notification: notification,
|
|
269
|
+
notificationLevel: "error",
|
|
270
|
+
notificationHTML: true,
|
|
271
|
+
className: classes
|
|
272
|
+
}, slug);
|
|
273
|
+
}), !withoutFooterButton && !autoInstall && pluginInfo && slugs.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
274
|
+
className: "newspack-buttons-card",
|
|
275
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
276
|
+
disabled: !needsInstall,
|
|
277
|
+
isPrimary: true,
|
|
278
|
+
onClick: this.installAllPlugins,
|
|
279
|
+
children: buttonText
|
|
280
|
+
})
|
|
281
|
+
})]
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
PluginInstaller.defaultProps = {
|
|
286
|
+
onStatus: () => {},
|
|
287
|
+
onInstalled: () => {}
|
|
288
|
+
};
|
|
289
|
+
export default PluginInstaller;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Installer
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
@use "~@wordpress/base-styles/colors" as wp-colors;
|
|
6
|
+
|
|
7
|
+
.newspack-card {
|
|
8
|
+
.newspack-plugin-installer__status {
|
|
9
|
+
align-items: center;
|
|
10
|
+
display: flex;
|
|
11
|
+
|
|
12
|
+
.newspack-checkbox-icon {
|
|
13
|
+
margin-left: 4px;
|
|
14
|
+
|
|
15
|
+
svg {
|
|
16
|
+
height: inherit;
|
|
17
|
+
width: inherit;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.newspack-plugin-installer__status-active,
|
|
23
|
+
&.newspack-plugin-installer__status-error,
|
|
24
|
+
&.newspack-plugin-installer__status-installing,
|
|
25
|
+
&.newspack-plugin-installer__status-none {
|
|
26
|
+
.newspack-action-card__region-top {
|
|
27
|
+
padding-left: 28px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.is-small {
|
|
31
|
+
.newspack-action-card__region-top {
|
|
32
|
+
padding-left: 20px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.newspack-plugin-installer__status-active {
|
|
38
|
+
box-shadow: inset 4px 0 0 wp-colors.$alert-green;
|
|
39
|
+
|
|
40
|
+
.newspack-plugin-installer__checkbox {
|
|
41
|
+
background: wp-colors.$alert-green;
|
|
42
|
+
box-shadow: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
svg {
|
|
46
|
+
fill: white;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.newspack-plugin-installer__status-error {
|
|
51
|
+
box-shadow: inset 4px 0 0 wp-colors.$alert-red;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.newspack-plugin-installer__status-installing,
|
|
55
|
+
&.newspack-plugin-installer__status-none {
|
|
56
|
+
box-shadow: inset 4px 0 0 wp-colors.$gray-100;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Is Small
|
|
60
|
+
&.is-small {
|
|
61
|
+
.newspack-plugin-installer__status {
|
|
62
|
+
.newspack-checkbox-icon {
|
|
63
|
+
height: 16px;
|
|
64
|
+
width: 16px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.newspack-plugin-installer_is-waiting {
|
|
71
|
+
display: flex;
|
|
72
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ads Settings Section.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { Fragment, useState } from '@wordpress/element';
|
|
9
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { CheckboxControl } from '@wordpress/components';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { ActionCard, Button, Grid, Notice, SelectControl, TextControl } from '../';
|
|
17
|
+
import './style.scss';
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
const isSelectControl = setting => {
|
|
20
|
+
return Array.isArray(setting.options) && setting.options.length;
|
|
21
|
+
};
|
|
22
|
+
const getControlComponent = setting => {
|
|
23
|
+
if (isSelectControl(setting)) {
|
|
24
|
+
return SelectControl;
|
|
25
|
+
}
|
|
26
|
+
switch (setting.type) {
|
|
27
|
+
case 'checkbox':
|
|
28
|
+
case 'boolean':
|
|
29
|
+
return CheckboxControl;
|
|
30
|
+
default:
|
|
31
|
+
return TextControl;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const getControlType = setting => {
|
|
35
|
+
switch (setting.type) {
|
|
36
|
+
case 'int':
|
|
37
|
+
case 'integer':
|
|
38
|
+
case 'float':
|
|
39
|
+
case 'number':
|
|
40
|
+
return 'number';
|
|
41
|
+
case 'string':
|
|
42
|
+
case 'text':
|
|
43
|
+
return 'text';
|
|
44
|
+
case 'password':
|
|
45
|
+
return 'password';
|
|
46
|
+
case 'boolean':
|
|
47
|
+
case 'checkbox':
|
|
48
|
+
return 'checkbox';
|
|
49
|
+
default:
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const SettingsSection = props => {
|
|
54
|
+
const [saveDisabled, setSaveDisabled] = useState(true);
|
|
55
|
+
const {
|
|
56
|
+
error,
|
|
57
|
+
sectionKey,
|
|
58
|
+
active,
|
|
59
|
+
title,
|
|
60
|
+
description,
|
|
61
|
+
fields,
|
|
62
|
+
disabled,
|
|
63
|
+
onChange,
|
|
64
|
+
onUpdate
|
|
65
|
+
} = props;
|
|
66
|
+
const getControlProps = setting => ({
|
|
67
|
+
disabled,
|
|
68
|
+
name: `${setting.section}_${setting.key}`,
|
|
69
|
+
type: getControlType(setting),
|
|
70
|
+
label: setting.description,
|
|
71
|
+
help: setting.help || null,
|
|
72
|
+
options: setting.options?.map(option => ({
|
|
73
|
+
value: option.value,
|
|
74
|
+
label: option.name || option.label
|
|
75
|
+
})) || null,
|
|
76
|
+
value: setting.value,
|
|
77
|
+
multiple: isSelectControl(setting) && setting.multiple ? true : null,
|
|
78
|
+
checked: setting.type === 'boolean' ? !!setting.value : null,
|
|
79
|
+
onChange: value => {
|
|
80
|
+
onChange(setting.key, value);
|
|
81
|
+
setSaveDisabled(false);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const createFilter = (name, defaultComponent = null) => {
|
|
85
|
+
return applyFilters(`newspack.settingSection.${sectionKey}.${name}`, defaultComponent, props);
|
|
86
|
+
};
|
|
87
|
+
let columns = 2;
|
|
88
|
+
if (fields.length % 3 === 0) {
|
|
89
|
+
columns = 3;
|
|
90
|
+
} else if (fields.length === 1) {
|
|
91
|
+
columns = 1;
|
|
92
|
+
}
|
|
93
|
+
return /*#__PURE__*/_jsx(ActionCard, {
|
|
94
|
+
isMedium: true,
|
|
95
|
+
disabled: disabled,
|
|
96
|
+
title: title,
|
|
97
|
+
description: description,
|
|
98
|
+
toggleChecked: active,
|
|
99
|
+
hasGreyHeader: active || null === active,
|
|
100
|
+
toggleOnChange: active !== null ? value => onUpdate({
|
|
101
|
+
active: value
|
|
102
|
+
}) : null,
|
|
103
|
+
actionContent: (active || null === active) && createFilter('buttons', /*#__PURE__*/_jsx(Button, {
|
|
104
|
+
variant: "primary",
|
|
105
|
+
disabled: disabled || saveDisabled,
|
|
106
|
+
onClick: () => {
|
|
107
|
+
onUpdate();
|
|
108
|
+
setSaveDisabled(true);
|
|
109
|
+
},
|
|
110
|
+
children: __('Save Settings', 'newspack')
|
|
111
|
+
})),
|
|
112
|
+
children: (active || active === null) && /*#__PURE__*/_jsxs(Fragment, {
|
|
113
|
+
children: [error?.message && /*#__PURE__*/_jsx(Notice, {
|
|
114
|
+
noticeText: error.message,
|
|
115
|
+
isError: true
|
|
116
|
+
}), createFilter('beforeControls'), /*#__PURE__*/_jsx(Grid, {
|
|
117
|
+
columns: columns,
|
|
118
|
+
gutter: 32,
|
|
119
|
+
children: fields.map(setting => {
|
|
120
|
+
const Control = getControlComponent(setting); // eslint-disable-line @wordpress/no-unused-vars-before-return, no-unused-vars
|
|
121
|
+
return applyFilters(`newspack.settingsSection.${sectionKey}.control`, /*#__PURE__*/_jsx(Control, {
|
|
122
|
+
...getControlProps(setting)
|
|
123
|
+
}, setting.key), {
|
|
124
|
+
sectionKey,
|
|
125
|
+
setting,
|
|
126
|
+
onChange
|
|
127
|
+
});
|
|
128
|
+
})
|
|
129
|
+
})]
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
export default SettingsSection;
|