newspack-components 3.0.0-alpha.1 → 3.0.0-alpha.2

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