newspack-components 4.8.1-alpha.1 → 4.9.0-alpha.1
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/CHANGELOG.md +6 -5
- package/dist/cjs/card-feature/index.js +28 -3
- package/dist/cjs/card-feature/index.test.js +100 -45
- package/dist/cjs/card-feature/style.scss +1 -5
- package/dist/cjs/integration-icon/index.js +4 -4
- package/dist/cjs/integration-icon/style.scss +18 -2
- package/dist/cjs/integration-icons/active-campaign.js +4 -7
- package/dist/cjs/integration-icons/beehiiv.js +19 -0
- package/dist/cjs/integration-icons/gravity-forms.js +19 -0
- package/dist/cjs/integration-icons/index.js +26 -6
- package/dist/cjs/integration-icons/salesforce.js +5 -3
- package/dist/cjs/wizard/breadcrumbs-select.js +17 -4
- package/dist/cjs/wizard/breadcrumbs-select.test.js +17 -0
- package/dist/cjs/wizard/index.js +42 -6
- package/dist/cjs/wizard/index.test.js +146 -0
- package/dist/esm/card-feature/index.js +29 -4
- package/dist/esm/card-feature/index.test.js +100 -45
- package/dist/esm/card-feature/style.scss +1 -5
- package/dist/esm/integration-icon/index.js +5 -5
- package/dist/esm/integration-icon/style.scss +18 -2
- package/dist/esm/integration-icons/active-campaign.js +5 -8
- package/dist/esm/integration-icons/beehiiv.js +13 -0
- package/dist/esm/integration-icons/gravity-forms.js +13 -0
- package/dist/esm/integration-icons/index.js +15 -4
- package/dist/esm/integration-icons/salesforce.js +5 -3
- package/dist/esm/wizard/breadcrumbs-select.js +16 -3
- package/dist/esm/wizard/breadcrumbs-select.test.js +18 -1
- package/dist/esm/wizard/index.js +42 -6
- package/dist/esm/wizard/index.test.js +146 -0
- package/package.json +1 -1
- package/src/card-feature/README.md +10 -11
- package/src/card-feature/index.test.js +45 -15
- package/src/card-feature/index.tsx +43 -24
- package/src/card-feature/style.scss +1 -5
- package/src/integration-icon/index.tsx +5 -5
- package/src/integration-icon/style.scss +18 -2
- package/src/integration-icons/active-campaign.js +1 -5
- package/src/integration-icons/beehiiv.js +10 -0
- package/src/integration-icons/gravity-forms.js +10 -0
- package/src/integration-icons/index.js +14 -3
- package/src/integration-icons/salesforce.js +3 -3
- package/src/wizard/breadcrumbs-select.js +12 -4
- package/src/wizard/breadcrumbs-select.test.js +15 -1
- package/src/wizard/index.js +34 -5
- package/src/wizard/index.test.js +73 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
# newspack-components [4.9.0-alpha.1](https://github.com/Automattic/newspack-workspace/compare/newspack-components@4.8.1-alpha.1...newspack-components@4.9.0-alpha.1) (2026-09-28)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Features
|
|
5
5
|
|
|
6
|
-
* **
|
|
7
|
-
* **
|
|
8
|
-
* **
|
|
6
|
+
* **audience:** refresh the Integrations brand marks ([#1155](https://github.com/Automattic/newspack-workspace/issues/1155)) ([af2729c](https://github.com/Automattic/newspack-workspace/commit/af2729cc6a5dd69cebe18456762eb21c55ae16a3))
|
|
7
|
+
* **audience:** refresh the Integrations screen icons, order and copy ([#1151](https://github.com/Automattic/newspack-workspace/issues/1151)) ([1d3f5a6](https://github.com/Automattic/newspack-workspace/commit/1d3f5a6c074f18491b3047c0e679e6c4f7b1f3cd))
|
|
8
|
+
* **reader-activation:** split Gravity Forms into its own integration ([#1170](https://github.com/Automattic/newspack-workspace/issues/1170)) ([7bd756b](https://github.com/Automattic/newspack-workspace/commit/7bd756bc30b12856091c126c6d054d45e6b78244))
|
|
9
|
+
* **sync:** read the push log in a sync activity tab ([#1114](https://github.com/Automattic/newspack-workspace/issues/1114)) ([c1a2d2d](https://github.com/Automattic/newspack-workspace/commit/c1a2d2d299b8a0150ce1c4de37e14edf437176b3))
|
|
9
10
|
|
|
10
11
|
# newspack-components [4.8.0](https://github.com/Automattic/newspack-workspace/compare/newspack-components@4.7.0...newspack-components@4.8.0) (2026-09-14)
|
|
11
12
|
|
|
@@ -80,6 +80,30 @@ var _CardFeature = function CardFeature(_ref) {
|
|
|
80
80
|
// translators: %1$s: the button's visible action label, e.g. "Enable". %2$s: the feature's name. The visible label must stay first (WCAG 2.5.3).
|
|
81
81
|
(0, _i18n._x)('%1$s %2$s', 'accessible button name: visible action label, then feature name', 'newspack-plugin'), buttonLabel, title);
|
|
82
82
|
var showMoreControls = enabled && !!(moreControls !== null && moreControls !== void 0 && moreControls.length) && (!requirements || requirementsActionable);
|
|
83
|
+
// A Configure button with nothing behind it would click to nowhere.
|
|
84
|
+
var showPrimaryButton = !isConfigureState || !!onConfigure;
|
|
85
|
+
|
|
86
|
+
// Enabling a feature with nothing to configure removes the button that was
|
|
87
|
+
// just used, so its focus goes to the More menu instead of the page. React
|
|
88
|
+
// detaches a ref before removing the node, which is the last point the
|
|
89
|
+
// button can still be read as focused.
|
|
90
|
+
var actionsRef = (0, _element.useRef)(null);
|
|
91
|
+
var primaryButtonNode = (0, _element.useRef)(null);
|
|
92
|
+
var primaryButtonLeftWithFocus = (0, _element.useRef)(false);
|
|
93
|
+
var primaryButtonRef = (0, _element.useCallback)(function (node) {
|
|
94
|
+
if (!node && primaryButtonNode.current) {
|
|
95
|
+
primaryButtonLeftWithFocus.current = primaryButtonNode.current === primaryButtonNode.current.ownerDocument.activeElement;
|
|
96
|
+
}
|
|
97
|
+
primaryButtonNode.current = node;
|
|
98
|
+
}, []);
|
|
99
|
+
(0, _element.useEffect)(function () {
|
|
100
|
+
var _actionsRef$current;
|
|
101
|
+
if (showPrimaryButton || !primaryButtonLeftWithFocus.current) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
primaryButtonLeftWithFocus.current = false;
|
|
105
|
+
(_actionsRef$current = actionsRef.current) === null || _actionsRef$current === void 0 || (_actionsRef$current = _actionsRef$current.querySelector('.components-dropdown-menu__toggle')) === null || _actionsRef$current === void 0 || _actionsRef$current.focus();
|
|
106
|
+
}, [showPrimaryButton]);
|
|
83
107
|
var handleButtonClick = function handleButtonClick() {
|
|
84
108
|
if (isConfigureState) {
|
|
85
109
|
onConfigure === null || onConfigure === void 0 || onConfigure();
|
|
@@ -89,8 +113,7 @@ var _CardFeature = function CardFeature(_ref) {
|
|
|
89
113
|
};
|
|
90
114
|
var iconDescriptor = icon && !(0, _element.isValidElement)(icon) ? icon : null;
|
|
91
115
|
var iconClasses = iconDescriptor ? (0, _classnames["default"])('newspack-card-feature__icon', {
|
|
92
|
-
'newspack-card-feature__icon--
|
|
93
|
-
'newspack-card-feature__icon--radius-full': iconDescriptor.radius === 'full'
|
|
116
|
+
'newspack-card-feature__icon--has-background': !!iconDescriptor.backgroundColor
|
|
94
117
|
}) : undefined;
|
|
95
118
|
var renderedIcon = null;
|
|
96
119
|
if ((0, _element.isValidElement)(icon)) {
|
|
@@ -137,10 +160,12 @@ var _CardFeature = function CardFeature(_ref) {
|
|
|
137
160
|
gap: "sm",
|
|
138
161
|
wrap: "wrap",
|
|
139
162
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Stack, {
|
|
163
|
+
ref: actionsRef,
|
|
140
164
|
direction: "row",
|
|
141
165
|
align: "center",
|
|
142
166
|
gap: "sm",
|
|
143
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_button["default"], {
|
|
167
|
+
children: [showPrimaryButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button["default"], {
|
|
168
|
+
ref: primaryButtonRef,
|
|
144
169
|
variant: isConfigureState ? 'tertiary' : 'secondary',
|
|
145
170
|
accessibleWhenDisabled: true,
|
|
146
171
|
"aria-describedby": describedById,
|
|
@@ -91,7 +91,8 @@ describe('CardFeature', function () {
|
|
|
91
91
|
it('names the feature in the configure state too', function () {
|
|
92
92
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
93
93
|
title: "Content Gifting",
|
|
94
|
-
enabled: true
|
|
94
|
+
enabled: true,
|
|
95
|
+
onConfigure: function onConfigure() {}
|
|
95
96
|
}));
|
|
96
97
|
expect(_react.screen.getByRole('button', {
|
|
97
98
|
name: 'Configure Content Gifting'
|
|
@@ -160,6 +161,72 @@ describe('CardFeature', function () {
|
|
|
160
161
|
expect(onConfigure).toHaveBeenCalledTimes(1);
|
|
161
162
|
expect(onEnable).not.toHaveBeenCalled();
|
|
162
163
|
});
|
|
164
|
+
|
|
165
|
+
// A button reading Configure with nothing behind it would click to nowhere.
|
|
166
|
+
it('drops the primary button once enabled when there is nothing to configure', function () {
|
|
167
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
168
|
+
title: "Content gifting",
|
|
169
|
+
enabled: true,
|
|
170
|
+
onEnable: jest.fn(),
|
|
171
|
+
moreControls: [{
|
|
172
|
+
title: 'Disable',
|
|
173
|
+
onClick: jest.fn()
|
|
174
|
+
}]
|
|
175
|
+
}));
|
|
176
|
+
expect(_react.screen.queryByRole('button', {
|
|
177
|
+
name: /Configure/
|
|
178
|
+
})).toBeNull();
|
|
179
|
+
expect(moreMenu()).toBeInTheDocument();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Enabling removes the button that was just used; without a hand-off,
|
|
183
|
+
// keyboard focus falls to the page.
|
|
184
|
+
it('hands focus to the More menu when enabling removes the focused button', function () {
|
|
185
|
+
var props = {
|
|
186
|
+
title: 'Content gifting',
|
|
187
|
+
onEnable: jest.fn(),
|
|
188
|
+
moreControls: [{
|
|
189
|
+
title: 'Disable',
|
|
190
|
+
onClick: jest.fn()
|
|
191
|
+
}]
|
|
192
|
+
};
|
|
193
|
+
var _render2 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], _objectSpread({}, props))),
|
|
194
|
+
rerender = _render2.rerender;
|
|
195
|
+
primaryButton().focus();
|
|
196
|
+
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
197
|
+
enabled: true
|
|
198
|
+
})));
|
|
199
|
+
expect(moreMenu()).toHaveFocus();
|
|
200
|
+
});
|
|
201
|
+
it('leaves focus alone when the removed button did not have it', function () {
|
|
202
|
+
var props = {
|
|
203
|
+
title: 'Content gifting',
|
|
204
|
+
onEnable: jest.fn(),
|
|
205
|
+
moreControls: [{
|
|
206
|
+
title: 'Disable',
|
|
207
|
+
onClick: jest.fn()
|
|
208
|
+
}]
|
|
209
|
+
};
|
|
210
|
+
var _render3 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
211
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], _objectSpread({}, props)), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
212
|
+
children: "Elsewhere"
|
|
213
|
+
})]
|
|
214
|
+
})),
|
|
215
|
+
rerender = _render3.rerender;
|
|
216
|
+
_react.screen.getByRole('button', {
|
|
217
|
+
name: 'Elsewhere'
|
|
218
|
+
}).focus();
|
|
219
|
+
rerender(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
220
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
221
|
+
enabled: true
|
|
222
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
223
|
+
children: "Elsewhere"
|
|
224
|
+
})]
|
|
225
|
+
}));
|
|
226
|
+
expect(_react.screen.getByRole('button', {
|
|
227
|
+
name: 'Elsewhere'
|
|
228
|
+
})).toHaveFocus();
|
|
229
|
+
});
|
|
163
230
|
it('still routes to onEnable when enabled with an unmet requirement, since the button reads Enable', function () {
|
|
164
231
|
var onEnable = jest.fn();
|
|
165
232
|
var onConfigure = jest.fn();
|
|
@@ -217,18 +284,19 @@ describe('CardFeature', function () {
|
|
|
217
284
|
it('leaves the enabled badge unlinked, since it explains nothing about the button', function () {
|
|
218
285
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
219
286
|
title: "Content gifting",
|
|
220
|
-
enabled: true
|
|
287
|
+
enabled: true,
|
|
288
|
+
onConfigure: function onConfigure() {}
|
|
221
289
|
}));
|
|
222
290
|
expect(primaryButton()).not.toHaveAttribute('aria-describedby');
|
|
223
291
|
});
|
|
224
292
|
it('disables the button while an action is in flight, even with an actionable requirement', function () {
|
|
225
293
|
var onEnable = jest.fn();
|
|
226
|
-
var
|
|
294
|
+
var _render4 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
227
295
|
title: "Content gifting",
|
|
228
296
|
busy: true,
|
|
229
297
|
onEnable: onEnable
|
|
230
298
|
})),
|
|
231
|
-
rerender =
|
|
299
|
+
rerender = _render4.rerender;
|
|
232
300
|
expect(primaryButton()).toHaveAttribute('aria-disabled', 'true');
|
|
233
301
|
_react.fireEvent.click(primaryButton());
|
|
234
302
|
expect(onEnable).not.toHaveBeenCalled();
|
|
@@ -242,12 +310,12 @@ describe('CardFeature', function () {
|
|
|
242
310
|
expect(primaryButton()).toHaveAttribute('aria-disabled', 'true');
|
|
243
311
|
});
|
|
244
312
|
it('accepts custom labels for both states', function () {
|
|
245
|
-
var
|
|
313
|
+
var _render5 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
246
314
|
title: "Apple News",
|
|
247
315
|
enableLabel: "Connect",
|
|
248
316
|
configureLabel: "Manage connection"
|
|
249
317
|
})),
|
|
250
|
-
rerender =
|
|
318
|
+
rerender = _render5.rerender;
|
|
251
319
|
expect(_react.screen.getByRole('button', {
|
|
252
320
|
name: 'Connect Apple News'
|
|
253
321
|
})).toBeInTheDocument();
|
|
@@ -255,7 +323,8 @@ describe('CardFeature', function () {
|
|
|
255
323
|
title: "Apple News",
|
|
256
324
|
enabled: true,
|
|
257
325
|
enableLabel: "Connect",
|
|
258
|
-
configureLabel: "Manage connection"
|
|
326
|
+
configureLabel: "Manage connection",
|
|
327
|
+
onConfigure: function onConfigure() {}
|
|
259
328
|
}));
|
|
260
329
|
expect(_react.screen.getByRole('button', {
|
|
261
330
|
name: 'Manage connection Apple News'
|
|
@@ -264,10 +333,10 @@ describe('CardFeature', function () {
|
|
|
264
333
|
});
|
|
265
334
|
describe('badge', function () {
|
|
266
335
|
it('shows nothing when off, and the enabled badge when on', function () {
|
|
267
|
-
var
|
|
336
|
+
var _render6 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
268
337
|
title: "Content gifting"
|
|
269
338
|
})),
|
|
270
|
-
rerender =
|
|
339
|
+
rerender = _render6.rerender;
|
|
271
340
|
expect(_react.screen.queryByText('Enabled')).not.toBeInTheDocument();
|
|
272
341
|
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
273
342
|
title: "Content gifting",
|
|
@@ -302,11 +371,11 @@ describe('CardFeature', function () {
|
|
|
302
371
|
onClick: jest.fn()
|
|
303
372
|
}];
|
|
304
373
|
it('appears only when enabled and controls are supplied', function () {
|
|
305
|
-
var
|
|
374
|
+
var _render7 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
306
375
|
title: "Content gifting",
|
|
307
376
|
moreControls: controls
|
|
308
377
|
})),
|
|
309
|
-
rerender =
|
|
378
|
+
rerender = _render7.rerender;
|
|
310
379
|
expect(moreMenu()).not.toBeInTheDocument();
|
|
311
380
|
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
312
381
|
title: "Content gifting",
|
|
@@ -321,14 +390,14 @@ describe('CardFeature', function () {
|
|
|
321
390
|
expect(moreMenu()).toBeInTheDocument();
|
|
322
391
|
});
|
|
323
392
|
it('stays available on an actionable requirement and hides on a locked one', function () {
|
|
324
|
-
var
|
|
393
|
+
var _render8 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
325
394
|
title: "Content gifting",
|
|
326
395
|
enabled: true,
|
|
327
396
|
requirements: "Requires metering",
|
|
328
397
|
requirementsActionable: true,
|
|
329
398
|
moreControls: controls
|
|
330
399
|
})),
|
|
331
|
-
rerender =
|
|
400
|
+
rerender = _render8.rerender;
|
|
332
401
|
expect(moreMenu()).toBeInTheDocument();
|
|
333
402
|
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
334
403
|
title: "Content gifting",
|
|
@@ -341,88 +410,74 @@ describe('CardFeature', function () {
|
|
|
341
410
|
});
|
|
342
411
|
describe('icon', function () {
|
|
343
412
|
it('renders a ready element as-is, without the descriptor container', function () {
|
|
344
|
-
var
|
|
413
|
+
var _render9 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
345
414
|
title: "Content gifting",
|
|
346
415
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
347
416
|
"data-testid": "ready-icon"
|
|
348
417
|
})
|
|
349
418
|
})),
|
|
350
|
-
container =
|
|
419
|
+
container = _render9.container;
|
|
351
420
|
expect(_react.screen.getByTestId('ready-icon')).toBeInTheDocument();
|
|
352
421
|
expect(container.querySelector('.newspack-card-feature__icon')).toBeNull();
|
|
353
422
|
});
|
|
354
|
-
it('applies the descriptor colours inline and rounds
|
|
355
|
-
var
|
|
423
|
+
it('applies the descriptor colours inline and rounds a backed icon', function () {
|
|
424
|
+
var _render0 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
356
425
|
title: "Content gifting",
|
|
357
426
|
icon: {
|
|
358
427
|
node: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
359
428
|
"data-testid": "descriptor-icon"
|
|
360
429
|
}),
|
|
361
430
|
fill: '#003da5',
|
|
362
|
-
backgroundColor: '#dfe7f4'
|
|
363
|
-
radius: 'full'
|
|
431
|
+
backgroundColor: '#dfe7f4'
|
|
364
432
|
}
|
|
365
433
|
})),
|
|
366
|
-
container =
|
|
434
|
+
container = _render0.container;
|
|
367
435
|
var iconContainer = container.querySelector('.newspack-card-feature__icon');
|
|
368
436
|
expect(_react.screen.getByTestId('descriptor-icon')).toBeInTheDocument();
|
|
369
|
-
expect(iconContainer).toHaveClass('newspack-card-feature__icon--
|
|
437
|
+
expect(iconContainer).toHaveClass('newspack-card-feature__icon--has-background');
|
|
370
438
|
expect(iconContainer).toHaveStyle({
|
|
371
439
|
backgroundColor: '#dfe7f4',
|
|
372
440
|
color: '#003da5'
|
|
373
441
|
});
|
|
374
442
|
});
|
|
375
443
|
it('hides the descriptor container from assistive tech, since the title already names the feature', function () {
|
|
376
|
-
var
|
|
444
|
+
var _render1 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
377
445
|
title: "Content gifting",
|
|
378
446
|
icon: {
|
|
379
447
|
node: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {})
|
|
380
448
|
}
|
|
381
449
|
})),
|
|
382
|
-
container =
|
|
450
|
+
container = _render1.container;
|
|
383
451
|
expect(container.querySelector('.newspack-card-feature__icon')).toHaveAttribute('aria-hidden', 'true');
|
|
384
452
|
});
|
|
385
|
-
it('
|
|
386
|
-
var
|
|
387
|
-
title: "Content gifting",
|
|
388
|
-
icon: {
|
|
389
|
-
node: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
390
|
-
backgroundColor: '#dfe7f4'
|
|
391
|
-
}
|
|
392
|
-
})),
|
|
393
|
-
container = _render0.container;
|
|
394
|
-
var iconContainer = container.querySelector('.newspack-card-feature__icon');
|
|
395
|
-
expect(iconContainer).toHaveClass('newspack-card-feature__icon--radius-small');
|
|
396
|
-
expect(iconContainer).not.toHaveClass('newspack-card-feature__icon--radius-full');
|
|
397
|
-
});
|
|
398
|
-
it('leaves an unbacked descriptor icon without a radius class', function () {
|
|
399
|
-
var _render1 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
453
|
+
it('leaves an unbacked descriptor icon without the background class', function () {
|
|
454
|
+
var _render10 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
400
455
|
title: "Content gifting",
|
|
401
456
|
icon: {
|
|
402
457
|
node: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
403
458
|
fill: '#003da5'
|
|
404
459
|
}
|
|
405
460
|
})),
|
|
406
|
-
container =
|
|
461
|
+
container = _render10.container;
|
|
407
462
|
var iconContainer = container.querySelector('.newspack-card-feature__icon');
|
|
408
|
-
expect(iconContainer).not.toHaveClass('newspack-card-feature__icon--
|
|
463
|
+
expect(iconContainer).not.toHaveClass('newspack-card-feature__icon--has-background');
|
|
409
464
|
});
|
|
410
465
|
});
|
|
411
466
|
it('passes className through to the card element', function () {
|
|
412
|
-
var
|
|
467
|
+
var _render11 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
413
468
|
title: "Content gifting",
|
|
414
469
|
className: "newspack-subscribers__card"
|
|
415
470
|
})),
|
|
416
|
-
container =
|
|
471
|
+
container = _render11.container;
|
|
417
472
|
expect(container.querySelector('.newspack-card-feature')).toHaveClass('newspack-subscribers__card');
|
|
418
473
|
});
|
|
419
474
|
it('marks the card as muted only when requirements are set', function () {
|
|
420
|
-
var
|
|
475
|
+
var _render12 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
421
476
|
title: "Content gifting",
|
|
422
477
|
enabled: true
|
|
423
478
|
})),
|
|
424
|
-
container =
|
|
425
|
-
rerender =
|
|
479
|
+
container = _render12.container,
|
|
480
|
+
rerender = _render12.rerender;
|
|
426
481
|
expect(container.querySelector('.newspack-card-feature--muted')).toBeNull();
|
|
427
482
|
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index["default"], {
|
|
428
483
|
title: "Content gifting",
|
|
@@ -18,14 +18,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* The single source for how
|
|
22
|
-
* background. A new provider needs an icon file,
|
|
21
|
+
* The single source for how a provider is shown: brand mark plus badge
|
|
22
|
+
* background. A new provider needs an icon file, a `providerIcons` entry,
|
|
23
23
|
* and a background rule in this component's stylesheet.
|
|
24
24
|
*/var IntegrationIcon = function IntegrationIcon(_ref) {
|
|
25
25
|
var provider = _ref.provider,
|
|
26
26
|
className = _ref.className;
|
|
27
|
-
var icons = _integrationIcons.
|
|
28
|
-
var node = Object.prototype.hasOwnProperty.call(_integrationIcons.
|
|
27
|
+
var icons = _integrationIcons.providerIcons;
|
|
28
|
+
var node = Object.prototype.hasOwnProperty.call(_integrationIcons.providerIcons, provider) ? icons[provider] : null;
|
|
29
29
|
if (!node) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
@@ -21,14 +21,26 @@
|
|
|
21
21
|
background: #004cff;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
&--
|
|
25
|
-
background: #
|
|
24
|
+
&--beehiiv {
|
|
25
|
+
background: #060419;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
&--constant-contact {
|
|
29
29
|
background: wp-colors.$gray-100;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
&--fundraiseup {
|
|
33
|
+
background: #2bb77b;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--gravity-forms {
|
|
37
|
+
background: #ff4f00;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--mailchimp {
|
|
41
|
+
background: #ffe01b;
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
&--manual {
|
|
33
45
|
background: wp-colors.$gray-800;
|
|
34
46
|
color: wp-colors.$white;
|
|
@@ -39,4 +51,8 @@
|
|
|
39
51
|
fill: currentcolor;
|
|
40
52
|
}
|
|
41
53
|
}
|
|
54
|
+
|
|
55
|
+
&--salesforce {
|
|
56
|
+
background: #0d9dda;
|
|
57
|
+
}
|
|
42
58
|
}
|
|
@@ -5,18 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var activeCampaign = /*#__PURE__*/(0, _jsxRuntime.
|
|
8
|
+
var activeCampaign = /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
9
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10
10
|
width: "24",
|
|
11
11
|
height: "24",
|
|
12
12
|
viewBox: "0 0 24 24",
|
|
13
13
|
fill: "none",
|
|
14
|
-
children:
|
|
15
|
-
d: "
|
|
14
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
15
|
+
d: "M17.28 10.4037C17.8244 10.7666 18.115 11.3468 18.115 11.9637C18.115 12.5805 17.788 13.1609 17.28 13.5238L5.88501 21V19.4399C5.88501 18.9681 6.10324 18.4965 6.5387 18.2062L15.9375 11.9637L6.5387 5.68506C6.13946 5.43097 5.88501 4.95947 5.88501 4.45129V3L17.28 10.4037ZM5.88501 8.37122C5.88501 7.89959 6.4296 7.64482 6.79248 7.8988L12.7438 11.9275L11.9451 12.4713C11.4371 12.7977 10.7842 12.7978 10.2762 12.4713L8.96997 11.6375L5.88501 9.56873V8.37122Z",
|
|
16
16
|
fill: "white"
|
|
17
|
-
})
|
|
18
|
-
d: "M6.56445 8.77441C6.56445 8.35519 7.04853 8.12873 7.37109 8.35449L12.6611 11.9355L11.9512 12.4189C11.4996 12.7091 10.9193 12.7092 10.4678 12.4189L9.30664 11.6777L6.56445 9.83887V8.77441Z",
|
|
19
|
-
fill: "white"
|
|
20
|
-
})]
|
|
17
|
+
})
|
|
21
18
|
});
|
|
22
19
|
var _default = exports["default"] = activeCampaign;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var beehiiv = /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
15
|
+
d: "M18.6602 11.4894H5.35668C5.19293 11.4883 5.03627 11.4225 4.92088 11.3063C4.80549 11.1901 4.74073 11.033 4.74073 10.8692V9.92487C4.7398 9.67122 4.78886 9.41988 4.88509 9.1852C4.98132 8.95052 5.12284 8.73709 5.30157 8.55712C5.4803 8.37714 5.69274 8.23414 5.92675 8.13629C6.16076 8.03843 6.41176 7.98764 6.6654 7.9868H17.3353C17.5889 7.98754 17.8398 8.03822 18.0738 8.13595C18.3078 8.23368 18.5203 8.37654 18.6991 8.55637C18.8779 8.7362 19.0195 8.94949 19.1158 9.18406C19.2122 9.41862 19.2614 9.66987 19.2607 9.92346V10.8685C19.2638 10.9491 19.2506 11.0296 19.2218 11.1049C19.193 11.1803 19.1492 11.249 19.0931 11.307C19.0369 11.365 18.9697 11.411 18.8953 11.4422C18.8209 11.4734 18.7409 11.4899 18.6602 11.4894ZM15.8574 6.96492H8.15947C7.99191 6.96343 7.8317 6.89593 7.71361 6.77704C7.59552 6.65816 7.52908 6.4975 7.52872 6.32994C7.52872 4.74919 8.80643 3.46302 10.3773 3.46302H13.641C15.2119 3.46302 16.4896 4.74919 16.4896 6.32994C16.4907 6.41334 16.4752 6.49613 16.4439 6.57345C16.4126 6.65077 16.3662 6.72106 16.3074 6.7802C16.2486 6.83934 16.1785 6.88615 16.1014 6.91787C16.0243 6.94959 15.9416 6.96558 15.8582 6.96492H15.8574ZM19.2755 12.5113H4.74073C3.7858 12.5113 3 13.3013 3 14.2619C3 15.2225 3.7858 16.0132 4.74073 16.0132H9.89879C10.0834 15.0216 10.9453 14.2619 11.9919 14.2619C12.4923 14.2631 12.9767 14.4386 13.3618 14.7582C13.7468 15.0778 14.0085 15.5216 14.1019 16.0132H19.2607C20.2149 16.0132 21 15.2225 21 14.2619C21 13.3013 20.2304 12.5113 19.2755 12.5113ZM18.6454 17.0358H14.1336V20.537H17.5214C18.4756 20.537 19.2607 19.7477 19.2607 18.7864V17.6708C19.2636 17.5882 19.2499 17.506 19.2202 17.4289C19.1906 17.3518 19.1457 17.2816 19.0883 17.2223C19.0308 17.163 18.962 17.1159 18.8859 17.0838C18.8098 17.0518 18.728 17.0354 18.6454 17.0358ZM5.35668 17.0358C5.189 17.0371 5.02861 17.1045 4.91037 17.2234C4.79213 17.3423 4.72559 17.5031 4.72523 17.6708V18.7864C4.72523 19.747 5.51102 20.537 6.46596 20.537H9.85298V17.0358H5.35668Z",
|
|
16
|
+
fill: "white"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
var _default = exports["default"] = beehiiv;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var gravityForms = /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
15
|
+
d: "M8.74072 8.98989H24V4.73383H8.77618C6.75022 4.67092 4.79489 5.46964 3.41 6.92583C0.0886559 10.4377 0 19.2696 0 19.2696H23.8818V11.2749H19.5912V15.0019H4.58018C4.67474 13.6123 5.31889 11.1296 6.53633 9.84462C7.10785 9.25496 7.91399 8.9424 8.74072 8.98989Z",
|
|
16
|
+
fill: "white"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
var _default = exports["default"] = gravityForms;
|
|
@@ -10,25 +10,38 @@ Object.defineProperty(exports, "activeCampaign", {
|
|
|
10
10
|
return _activeCampaign["default"];
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "beehiiv", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _beehiiv["default"];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "constantContact", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function get() {
|
|
16
22
|
return _constantContact["default"];
|
|
17
23
|
}
|
|
18
24
|
});
|
|
19
|
-
exports.espProviderOrder =
|
|
25
|
+
exports.espProviderOrder = void 0;
|
|
20
26
|
Object.defineProperty(exports, "fundraiseUp", {
|
|
21
27
|
enumerable: true,
|
|
22
28
|
get: function get() {
|
|
23
29
|
return _fundraiseUp["default"];
|
|
24
30
|
}
|
|
25
31
|
});
|
|
32
|
+
Object.defineProperty(exports, "gravityForms", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _gravityForms["default"];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
26
38
|
Object.defineProperty(exports, "mailchimp", {
|
|
27
39
|
enumerable: true,
|
|
28
40
|
get: function get() {
|
|
29
41
|
return _mailchimp["default"];
|
|
30
42
|
}
|
|
31
43
|
});
|
|
44
|
+
exports.providerIcons = void 0;
|
|
32
45
|
Object.defineProperty(exports, "salesforce", {
|
|
33
46
|
enumerable: true,
|
|
34
47
|
get: function get() {
|
|
@@ -43,9 +56,11 @@ Object.defineProperty(exports, "wisepops", {
|
|
|
43
56
|
});
|
|
44
57
|
var _icons = require("@wordpress/icons");
|
|
45
58
|
var _activeCampaign = _interopRequireDefault(require("./active-campaign"));
|
|
59
|
+
var _beehiiv = _interopRequireDefault(require("./beehiiv"));
|
|
46
60
|
var _constantContact = _interopRequireDefault(require("./constant-contact"));
|
|
47
|
-
var _mailchimp = _interopRequireDefault(require("./mailchimp"));
|
|
48
61
|
var _fundraiseUp = _interopRequireDefault(require("./fundraise-up"));
|
|
62
|
+
var _gravityForms = _interopRequireDefault(require("./gravity-forms"));
|
|
63
|
+
var _mailchimp = _interopRequireDefault(require("./mailchimp"));
|
|
49
64
|
var _salesforce = _interopRequireDefault(require("./salesforce"));
|
|
50
65
|
var _wisepops = _interopRequireDefault(require("./wisepops"));
|
|
51
66
|
/**
|
|
@@ -56,12 +71,17 @@ var _wisepops = _interopRequireDefault(require("./wisepops"));
|
|
|
56
71
|
* Internal dependencies
|
|
57
72
|
*/
|
|
58
73
|
|
|
59
|
-
//
|
|
60
|
-
// (`Newspack_Newsletters::service_provider()`)
|
|
61
|
-
|
|
74
|
+
// Brand marks keyed by the ESP slug the backend reports
|
|
75
|
+
// (`Newspack_Newsletters::service_provider()`), by integration ID, or by the
|
|
76
|
+
// brand slug an integration maps to. Rendered via IntegrationIcon.
|
|
77
|
+
var providerIcons = exports.providerIcons = {
|
|
62
78
|
active_campaign: _activeCampaign["default"],
|
|
63
79
|
mailchimp: _mailchimp["default"],
|
|
64
80
|
constant_contact: _constantContact["default"],
|
|
65
|
-
manual: _icons.atSymbol
|
|
81
|
+
manual: _icons.atSymbol,
|
|
82
|
+
salesforce: _salesforce["default"],
|
|
83
|
+
beehiiv: _beehiiv["default"],
|
|
84
|
+
fundraiseup: _fundraiseUp["default"],
|
|
85
|
+
gravity_forms: _gravityForms["default"]
|
|
66
86
|
};
|
|
67
87
|
var espProviderOrder = exports.espProviderOrder = ['active_campaign', 'mailchimp', 'constant_contact', 'manual'];
|
|
@@ -7,11 +7,13 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var salesforce = /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
9
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
-
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
11
13
|
fill: "none",
|
|
12
14
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
13
|
-
d: "
|
|
14
|
-
fill: "
|
|
15
|
+
d: "M10.0838 5.745C10.8213 4.9775 11.8463 4.5 12.9813 4.5C14.4913 4.5 15.8063 5.3425 16.5088 6.59C17.1188 6.3175 17.7938 6.165 18.5013 6.165C21.2238 6.165 23.4288 8.39 23.4288 11.1375C23.4288 13.885 21.2213 16.11 18.5013 16.11C18.1688 16.11 17.8438 16.0775 17.5313 16.0125C16.9138 17.1125 15.7363 17.8575 14.3863 17.8575C13.8213 17.8575 13.2863 17.7275 12.8113 17.495C12.1863 18.9675 10.7263 20 9.02876 20C7.33126 20 5.75126 18.88 5.17126 17.31C4.91876 17.3625 4.65626 17.3925 4.38626 17.3925C2.27876 17.3925 0.571259 15.6675 0.571259 13.5375C0.571259 12.11 1.33876 10.865 2.47876 10.1975C2.24376 9.6575 2.11376 9.06 2.11376 8.435C2.11376 5.985 4.10126 4 6.55376 4C7.99376 4 9.27376 4.685 10.0838 5.745Z",
|
|
16
|
+
fill: "white"
|
|
15
17
|
})
|
|
16
18
|
});
|
|
17
19
|
var _default = exports["default"] = salesforce;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.appendSectionName = exports.activeBreadcrumbs = void 0;
|
|
7
|
+
exports.appendSectionName = exports.activeSection = exports.activeBreadcrumbs = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _routeMatch = require("../route-match");
|
|
10
10
|
/**
|
|
@@ -20,15 +20,28 @@ var _routeMatch = require("../route-match");
|
|
|
20
20
|
* @return {Array} Breadcrumb items `{ label, url? }`.
|
|
21
21
|
*/
|
|
22
22
|
var activeBreadcrumbs = exports.activeBreadcrumbs = function activeBreadcrumbs() {
|
|
23
|
+
var _activeSection;
|
|
24
|
+
var sections = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
25
|
+
var pathname = arguments.length > 1 ? arguments[1] : undefined;
|
|
26
|
+
return ((_activeSection = activeSection(sections, pathname)) === null || _activeSection === void 0 ? void 0 : _activeSection.breadcrumbs) || [];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Select the section matching the current route, falling back to the first.
|
|
31
|
+
*
|
|
32
|
+
* @param {Array} sections Wizard sections.
|
|
33
|
+
* @param {string} pathname Current router pathname.
|
|
34
|
+
* @return {Object|undefined} The active section, if any.
|
|
35
|
+
*/
|
|
36
|
+
var activeSection = exports.activeSection = function activeSection() {
|
|
23
37
|
var sections = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24
38
|
var pathname = arguments.length > 1 ? arguments[1] : undefined;
|
|
25
39
|
if (!(sections !== null && sections !== void 0 && sections.length)) {
|
|
26
|
-
return
|
|
40
|
+
return undefined;
|
|
27
41
|
}
|
|
28
|
-
|
|
42
|
+
return sections.find(function (section) {
|
|
29
43
|
return (0, _routeMatch.matchesRoute)(section, pathname);
|
|
30
44
|
}) || sections[0];
|
|
31
|
-
return match.breadcrumbs || [];
|
|
32
45
|
};
|
|
33
46
|
|
|
34
47
|
/**
|