@automattic/newspack-blocks 4.25.3 → 4.26.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/blocks/author-profile/block.json +4 -0
- package/dist/blocks/carousel/block.json +4 -0
- package/dist/editor-rtl.css +1 -1
- package/dist/editor.asset.php +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.js +17 -17
- package/dist/modalCheckout-rtl.css +1 -1
- package/dist/modalCheckout.asset.php +1 -1
- package/dist/modalCheckout.css +1 -1
- package/dist/modalCheckout.js +1 -1
- package/includes/class-modal-checkout.php +42 -0
- package/languages/newspack-blocks-de_DE-37552bb09e2a9fceec1970e3c6d46557.json +1 -1
- package/languages/newspack-blocks-de_DE-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -1
- package/languages/newspack-blocks-de_DE-eccbc51a43c04f59165364eda71e0be7.json +1 -1
- package/languages/newspack-blocks-de_DE-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-de_DE-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-de_DE.po +289 -260
- package/languages/newspack-blocks-es_ES-37552bb09e2a9fceec1970e3c6d46557.json +1 -1
- package/languages/newspack-blocks-es_ES-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -1
- package/languages/newspack-blocks-es_ES-eccbc51a43c04f59165364eda71e0be7.json +1 -1
- package/languages/newspack-blocks-es_ES-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-es_ES-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-es_ES.po +289 -260
- package/languages/newspack-blocks-fr_BE-37552bb09e2a9fceec1970e3c6d46557.json +1 -1
- package/languages/newspack-blocks-fr_BE-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -1
- package/languages/newspack-blocks-fr_BE-eccbc51a43c04f59165364eda71e0be7.json +1 -1
- package/languages/newspack-blocks-fr_BE-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-fr_BE-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-fr_BE.po +289 -260
- package/languages/newspack-blocks-nb_NO-37552bb09e2a9fceec1970e3c6d46557.json +1 -1
- package/languages/newspack-blocks-nb_NO-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -1
- package/languages/newspack-blocks-nb_NO-eccbc51a43c04f59165364eda71e0be7.json +1 -1
- package/languages/newspack-blocks-nb_NO-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-nb_NO-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-nb_NO.po +289 -260
- package/languages/newspack-blocks-pt_PT-37552bb09e2a9fceec1970e3c6d46557.json +1 -1
- package/languages/newspack-blocks-pt_PT-53e2a1d5945b8d2b1c35e81ae1e532f3.json +1 -1
- package/languages/newspack-blocks-pt_PT-eccbc51a43c04f59165364eda71e0be7.json +1 -1
- package/languages/newspack-blocks-pt_PT-f5f8db76788e4079ddfa743333708b88.json +1 -0
- package/languages/newspack-blocks-pt_PT-fcc93143c1f2b74671f595454b971f44.json +1 -0
- package/languages/newspack-blocks-pt_PT.po +289 -260
- package/languages/newspack-blocks.pot +349 -311
- package/newspack-blocks.php +2 -2
- package/package.json +1 -1
- package/src/blocks/author-profile/README.md +105 -0
- package/src/blocks/author-profile/block.json +4 -0
- package/src/blocks/author-profile/edit.js +76 -165
- package/src/blocks/author-profile/editor.scss +1 -1
- package/src/blocks/author-profile/index.js +2 -0
- package/src/blocks/author-profile/templates.js +263 -0
- package/src/blocks/author-profile/variations.js +86 -0
- package/src/blocks/carousel/block.json +4 -0
- package/src/blocks/carousel/edit.js +2 -0
- package/src/blocks/carousel/view.php +3 -1
- package/src/blocks/donate/styles/editor.scss +1 -1
- package/src/blocks/homepage-articles/edit.tsx +2 -6
- package/src/components/query-controls.js +12 -0
- package/src/modal-checkout/checkout.scss +28 -0
- package/src/modal-checkout/index.js +1 -1
- package/src/modal-checkout/templates/form-checkout.php +13 -1
- package/vendor/composer/installed.php +2 -2
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Helper to create a bound paragraph block with custom list view name.
|
|
8
|
+
* If wrapInLink is true, the content will be wrapped in an anchor tag for editor preview.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} key Author data key for binding.
|
|
11
|
+
* @param {string} className CSS class for the paragraph.
|
|
12
|
+
* @param {string} name Display name shown in list view.
|
|
13
|
+
* @param {string} placeholder Placeholder text (defaults to name).
|
|
14
|
+
* @param {boolean} wrapInLink Whether to wrap content in a link.
|
|
15
|
+
* @return {Array} InnerBlocks template entry for a bound paragraph.
|
|
16
|
+
*/
|
|
17
|
+
const createBoundParagraph = ( key, className, name, placeholder, wrapInLink = false ) => {
|
|
18
|
+
const attributes = {
|
|
19
|
+
metadata: {
|
|
20
|
+
name, // Custom name shown in list view.
|
|
21
|
+
bindings: {
|
|
22
|
+
content: {
|
|
23
|
+
source: 'newspack-blocks/author',
|
|
24
|
+
args: { key },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
className,
|
|
29
|
+
placeholder: placeholder || name,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// If wrapInLink is true, set initial content with link wrapper for editor preview.
|
|
33
|
+
if ( wrapInLink ) {
|
|
34
|
+
const linkText = placeholder || name;
|
|
35
|
+
attributes.content = `<a href="#" class="no-op">${ linkText }</a>`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return [ 'core/paragraph', attributes ];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Shared block definition constants.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
// Styles applied to the content column in column-based layouts.
|
|
46
|
+
const CONTENT_COLUMN_ATTRS = Object.freeze( {
|
|
47
|
+
className: 'author-profile-content-column',
|
|
48
|
+
templateLock: false,
|
|
49
|
+
allowedBlocks: [ 'core/heading', 'core/paragraph', 'core/separator', 'core/spacer', 'newspack/author-profile-social' ],
|
|
50
|
+
style: {
|
|
51
|
+
spacing: {
|
|
52
|
+
blockGap: 'var:preset|spacing|20',
|
|
53
|
+
},
|
|
54
|
+
elements: {
|
|
55
|
+
link: {
|
|
56
|
+
color: {
|
|
57
|
+
text: 'var:preset|color|contrast-3',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
textColor: 'contrast-3',
|
|
63
|
+
fontSize: 'small',
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
// Author name heading block.
|
|
67
|
+
const HEADING_BLOCK = [
|
|
68
|
+
'core/heading',
|
|
69
|
+
{
|
|
70
|
+
level: 3,
|
|
71
|
+
metadata: {
|
|
72
|
+
name: __( 'Author Name', 'newspack-blocks' ),
|
|
73
|
+
bindings: {
|
|
74
|
+
content: {
|
|
75
|
+
source: 'newspack-blocks/author',
|
|
76
|
+
args: { key: 'name' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
className: 'author-name',
|
|
81
|
+
placeholder: __( 'Author Name', 'newspack-blocks' ),
|
|
82
|
+
textColor: 'contrast',
|
|
83
|
+
fontSize: 'large',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
// Job title paragraph block with bold styling.
|
|
88
|
+
const JOB_TITLE_BLOCK = [
|
|
89
|
+
'core/paragraph',
|
|
90
|
+
{
|
|
91
|
+
metadata: {
|
|
92
|
+
name: __( 'Job Title', 'newspack-blocks' ),
|
|
93
|
+
bindings: {
|
|
94
|
+
content: {
|
|
95
|
+
source: 'newspack-blocks/author',
|
|
96
|
+
args: { key: 'newspack_job_title' },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
className: 'author-job-title',
|
|
101
|
+
placeholder: __( 'Job Title', 'newspack-blocks' ),
|
|
102
|
+
style: {
|
|
103
|
+
typography: {
|
|
104
|
+
fontStyle: 'normal',
|
|
105
|
+
fontWeight: '600',
|
|
106
|
+
},
|
|
107
|
+
elements: {
|
|
108
|
+
link: {
|
|
109
|
+
color: {
|
|
110
|
+
text: 'var:preset|color|contrast',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
textColor: 'contrast',
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
// Bound paragraph blocks for author fields.
|
|
120
|
+
const ROLE_BLOCK = createBoundParagraph( 'newspack_role', 'author-role', __( 'Role', 'newspack-blocks' ) );
|
|
121
|
+
const EMPLOYER_BLOCK = createBoundParagraph( 'newspack_employer', 'author-employer', __( 'Employer', 'newspack-blocks' ) );
|
|
122
|
+
const BIO_BLOCK = createBoundParagraph( 'bio', 'author-bio', __( 'Biography', 'newspack-blocks' ) );
|
|
123
|
+
|
|
124
|
+
const archiveLinkLabel = sprintf(
|
|
125
|
+
/* translators: %s: author name. */
|
|
126
|
+
__( 'More by %s', 'newspack-blocks' ),
|
|
127
|
+
__( 'Author Name', 'newspack-blocks' )
|
|
128
|
+
);
|
|
129
|
+
const ARCHIVE_LINK_BLOCK = createBoundParagraph( 'archive_link_text', 'author-archive-link', archiveLinkLabel, undefined, true );
|
|
130
|
+
|
|
131
|
+
// Social icons block with top padding.
|
|
132
|
+
const SOCIAL_BLOCK = [
|
|
133
|
+
'newspack/author-profile-social',
|
|
134
|
+
{
|
|
135
|
+
style: {
|
|
136
|
+
spacing: {
|
|
137
|
+
padding: {
|
|
138
|
+
top: 'var:preset|spacing|20',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Returns a copy of a block template entry with center alignment added.
|
|
147
|
+
* Uses `textAlign` for headings, `align` for paragraphs.
|
|
148
|
+
*
|
|
149
|
+
* @param {Array} block InnerBlocks template entry [blockName, attributes].
|
|
150
|
+
* @param {string} block.0 Block name.
|
|
151
|
+
* @param {Object} block.1 Block attributes.
|
|
152
|
+
* @return {Array} New template entry with center alignment.
|
|
153
|
+
*/
|
|
154
|
+
const centered = ( [ blockName, attrs ] ) => [
|
|
155
|
+
blockName,
|
|
156
|
+
{ ...attrs, ...( blockName === 'core/heading' ? { textAlign: 'center' } : { align: 'center' } ) },
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
// Shared group styles for centered and compact layouts.
|
|
160
|
+
const GROUP_STYLES = Object.freeze( {
|
|
161
|
+
spacing: {
|
|
162
|
+
blockGap: 'var:preset|spacing|20',
|
|
163
|
+
},
|
|
164
|
+
elements: {
|
|
165
|
+
link: {
|
|
166
|
+
color: {
|
|
167
|
+
text: 'var:preset|color|contrast-3',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
} );
|
|
172
|
+
|
|
173
|
+
// Content blocks shared across all layouts.
|
|
174
|
+
// Shallow-frozen to prevent push/splice; nested block definitions are safe because templates compose via spread.
|
|
175
|
+
const CONTENT_BLOCKS = Object.freeze( [ HEADING_BLOCK, JOB_TITLE_BLOCK, ROLE_BLOCK, EMPLOYER_BLOCK, BIO_BLOCK, ARCHIVE_LINK_BLOCK, SOCIAL_BLOCK ] );
|
|
176
|
+
|
|
177
|
+
// -- Layout Templates --------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Avatar left layout: avatar on the left, content on the right.
|
|
181
|
+
*/
|
|
182
|
+
export const AVATAR_LEFT_TEMPLATE = [
|
|
183
|
+
[
|
|
184
|
+
'core/columns',
|
|
185
|
+
{ isStackedOnMobile: true, className: 'author-profile-columns', templateLock: 'insert' },
|
|
186
|
+
[
|
|
187
|
+
[
|
|
188
|
+
'core/column',
|
|
189
|
+
{
|
|
190
|
+
className: 'author-profile-avatar-column',
|
|
191
|
+
templateLock: 'insert',
|
|
192
|
+
allowedBlocks: [ 'newspack/avatar' ],
|
|
193
|
+
},
|
|
194
|
+
[ [ 'newspack/avatar', { size: 128 } ] ],
|
|
195
|
+
],
|
|
196
|
+
[ 'core/column', CONTENT_COLUMN_ATTRS, CONTENT_BLOCKS ],
|
|
197
|
+
],
|
|
198
|
+
],
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Avatar right layout: avatar first in DOM for correct mobile stacking,
|
|
203
|
+
* CSS reorders content to the left on desktop.
|
|
204
|
+
*/
|
|
205
|
+
export const AVATAR_RIGHT_TEMPLATE = [
|
|
206
|
+
[
|
|
207
|
+
'core/columns',
|
|
208
|
+
{ isStackedOnMobile: true, className: 'author-profile-columns is-style-first-col-to-second', templateLock: 'insert' },
|
|
209
|
+
[
|
|
210
|
+
[
|
|
211
|
+
'core/column',
|
|
212
|
+
{
|
|
213
|
+
className: 'author-profile-avatar-column',
|
|
214
|
+
templateLock: 'insert',
|
|
215
|
+
allowedBlocks: [ 'newspack/avatar' ],
|
|
216
|
+
},
|
|
217
|
+
[ [ 'newspack/avatar', { size: 128 } ] ],
|
|
218
|
+
],
|
|
219
|
+
[ 'core/column', CONTENT_COLUMN_ATTRS, CONTENT_BLOCKS ],
|
|
220
|
+
],
|
|
221
|
+
],
|
|
222
|
+
];
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Centered layout: large centered avatar with center-aligned text.
|
|
226
|
+
*/
|
|
227
|
+
export const CENTERED_TEMPLATE = [
|
|
228
|
+
[
|
|
229
|
+
'core/group',
|
|
230
|
+
{
|
|
231
|
+
layout: { type: 'flex', orientation: 'vertical', justifyContent: 'center' },
|
|
232
|
+
style: GROUP_STYLES,
|
|
233
|
+
textColor: 'contrast-3',
|
|
234
|
+
fontSize: 'small',
|
|
235
|
+
},
|
|
236
|
+
[
|
|
237
|
+
[ 'newspack/avatar', { size: 200 } ],
|
|
238
|
+
centered( HEADING_BLOCK ),
|
|
239
|
+
centered( JOB_TITLE_BLOCK ),
|
|
240
|
+
centered( ROLE_BLOCK ),
|
|
241
|
+
centered( EMPLOYER_BLOCK ),
|
|
242
|
+
centered( BIO_BLOCK ),
|
|
243
|
+
centered( ARCHIVE_LINK_BLOCK ),
|
|
244
|
+
SOCIAL_BLOCK,
|
|
245
|
+
],
|
|
246
|
+
],
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Compact layout: no avatar.
|
|
251
|
+
*/
|
|
252
|
+
export const COMPACT_TEMPLATE = [
|
|
253
|
+
[
|
|
254
|
+
'core/group',
|
|
255
|
+
{
|
|
256
|
+
layout: { type: 'flex', orientation: 'vertical' },
|
|
257
|
+
style: GROUP_STYLES,
|
|
258
|
+
textColor: 'contrast-3',
|
|
259
|
+
fontSize: 'small',
|
|
260
|
+
},
|
|
261
|
+
CONTENT_BLOCKS,
|
|
262
|
+
],
|
|
263
|
+
];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Newspack dependencies
|
|
3
|
+
*/
|
|
4
|
+
import colors from 'newspack-colors';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { SVG, Path } from '@wordpress/primitives';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { AVATAR_LEFT_TEMPLATE, AVATAR_RIGHT_TEMPLATE, CENTERED_TEMPLATE, COMPACT_TEMPLATE } from './templates';
|
|
16
|
+
|
|
17
|
+
const ICON_COLOR = colors[ 'primary-400' ];
|
|
18
|
+
|
|
19
|
+
// Variation icons: abstract layout representations.
|
|
20
|
+
// Circle represents the avatar, rectangles represent text lines.
|
|
21
|
+
|
|
22
|
+
const iconAvatarLeft = (
|
|
23
|
+
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
|
|
24
|
+
<Path d="M31 33H17V32H31V33ZM39 30H17V29H39V30ZM37 27H17V26H37V27ZM41 24H17V23H41V24ZM11 15C13.2091 15 15 16.7909 15 19C15 21.2091 13.2091 23 11 23C8.79086 23 7 21.2091 7 19C7 16.7909 8.79086 15 11 15ZM37 21H17V20H37V21ZM41 18H17V15H41V18Z" />
|
|
25
|
+
</SVG>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const iconAvatarRight = (
|
|
29
|
+
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
|
|
30
|
+
<Path d="M21 33H7V32H21V33ZM29 30H7V29H29V30ZM27 27H7V26H27V27ZM31 24H7V23H31V24ZM37 15C39.2091 15 41 16.7909 41 19C41 21.2091 39.2091 23 37 23C34.7909 23 33 21.2091 33 19C33 16.7909 34.7909 15 37 15ZM27 21H7V20H27V21ZM31 18H7V15H31V18Z" />
|
|
31
|
+
</SVG>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const iconCentered = (
|
|
35
|
+
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
|
|
36
|
+
<Path d="M36 38H12V37H36V38ZM40 35H8V34H40V35ZM39 32H9V31H39V32ZM41 29H7V28H41V29ZM39 26H9V25H39V26ZM41 23H7V20H41V23ZM24 10C26.2091 10 27.9999 11.791 28 14C28 16.2091 26.2091 18 24 18C21.7909 18 20 16.2091 20 14C20.0001 11.791 21.7909 10 24 10Z" />
|
|
37
|
+
</SVG>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const iconCompact = (
|
|
41
|
+
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
|
|
42
|
+
<Path d="M31 33H7V32H31V33ZM39 30H7V29H39V30ZM37 27H7V26H37V27ZM41 24H7V23H41V24ZM37 21H7V20H37V21ZM41 18H7V15H41V18Z" />
|
|
43
|
+
</SVG>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const variations = [
|
|
47
|
+
{
|
|
48
|
+
name: 'avatar-left',
|
|
49
|
+
title: __( 'Avatar left', 'newspack-blocks' ),
|
|
50
|
+
description: __( 'Avatar on the left, content on the right.', 'newspack-blocks' ),
|
|
51
|
+
icon: { src: iconAvatarLeft, foreground: ICON_COLOR },
|
|
52
|
+
attributes: { variation: 'avatar-left' },
|
|
53
|
+
innerBlocks: AVATAR_LEFT_TEMPLATE,
|
|
54
|
+
scope: [ 'block' ],
|
|
55
|
+
isDefault: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'avatar-right',
|
|
59
|
+
title: __( 'Avatar right', 'newspack-blocks' ),
|
|
60
|
+
description: __( 'Content on the left, avatar on the right.', 'newspack-blocks' ),
|
|
61
|
+
icon: { src: iconAvatarRight, foreground: ICON_COLOR },
|
|
62
|
+
attributes: { variation: 'avatar-right' },
|
|
63
|
+
innerBlocks: AVATAR_RIGHT_TEMPLATE,
|
|
64
|
+
scope: [ 'block' ],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'centered',
|
|
68
|
+
title: __( 'Centered', 'newspack-blocks' ),
|
|
69
|
+
description: __( 'Large centered avatar with center-aligned text.', 'newspack-blocks' ),
|
|
70
|
+
icon: { src: iconCentered, foreground: ICON_COLOR },
|
|
71
|
+
attributes: { variation: 'centered' },
|
|
72
|
+
innerBlocks: CENTERED_TEMPLATE,
|
|
73
|
+
scope: [ 'block' ],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'compact',
|
|
77
|
+
title: __( 'Compact', 'newspack-blocks' ),
|
|
78
|
+
description: __( 'No avatar, vertical stack.', 'newspack-blocks' ),
|
|
79
|
+
icon: { src: iconCompact, foreground: ICON_COLOR },
|
|
80
|
+
attributes: { variation: 'compact' },
|
|
81
|
+
innerBlocks: COMPACT_TEMPLATE,
|
|
82
|
+
scope: [ 'block' ],
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
export default variations;
|
|
@@ -228,6 +228,8 @@ class Edit extends Component {
|
|
|
228
228
|
specificPosts={ specificPosts }
|
|
229
229
|
onSpecificPostsChange={ _specificPosts => setAttributes( { specificPosts: _specificPosts } ) }
|
|
230
230
|
postType={ postType }
|
|
231
|
+
allowDedupeCurrentValue={ ! attributes.deduplicate }
|
|
232
|
+
onAllowDedupeChange={ value => setAttributes( { deduplicate: ! value } ) }
|
|
231
233
|
/>
|
|
232
234
|
) }
|
|
233
235
|
</PanelBody>
|
|
@@ -51,7 +51,9 @@ function newspack_blocks_render_block_carousel( $attributes ) {
|
|
|
51
51
|
$article_query->the_post();
|
|
52
52
|
$post_id = get_the_ID();
|
|
53
53
|
$authors = Newspack_Blocks::prepare_authors();
|
|
54
|
-
|
|
54
|
+
if ( Newspack_Blocks::should_deduplicate_block( $attributes ) ) {
|
|
55
|
+
$newspack_blocks_post_id[ $post_id ] = true;
|
|
56
|
+
}
|
|
55
57
|
|
|
56
58
|
$article_classes = [
|
|
57
59
|
'post-has-image',
|
|
@@ -285,12 +285,8 @@ class Edit extends Component< HomepageArticlesProps > {
|
|
|
285
285
|
customTaxonomyExclusions={ customTaxonomyExclusions }
|
|
286
286
|
onCustomTaxonomyExclusionsChange={ handleAttributeChange( 'customTaxonomyExclusions' ) }
|
|
287
287
|
postType={ postType }
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
label={ __( 'Allow duplicate content', 'newspack-blocks' ) }
|
|
291
|
-
help={ __( "Exclude this block from the page's deduplication logic.", 'newspack-blocks' ) }
|
|
292
|
-
checked={ ! attributes.deduplicate }
|
|
293
|
-
onChange={ ( value: boolean ) => setAttributes( { deduplicate: ! value } ) }
|
|
288
|
+
allowDedupeCurrentValue={ ! attributes.deduplicate }
|
|
289
|
+
onAllowDedupeChange={ ( value: boolean ) => setAttributes( { deduplicate: ! value } ) }
|
|
294
290
|
/>
|
|
295
291
|
{ ! specificMode && isBlogPrivate() ? (
|
|
296
292
|
/*
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CheckboxControl,
|
|
9
9
|
SelectControl,
|
|
10
10
|
QueryControls as BasicQueryControls,
|
|
11
|
+
ToggleControl,
|
|
11
12
|
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
|
|
12
13
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
13
14
|
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
|
|
@@ -263,6 +264,8 @@ class QueryControls extends Component {
|
|
|
263
264
|
customTaxonomyExclusions,
|
|
264
265
|
onCustomTaxonomyExclusionsChange,
|
|
265
266
|
enableSpecific,
|
|
267
|
+
onAllowDedupeChange,
|
|
268
|
+
allowDedupeCurrentValue,
|
|
266
269
|
} = this.props;
|
|
267
270
|
|
|
268
271
|
const registeredCustomTaxonomies = window.newspack_blocks_data?.custom_taxonomies;
|
|
@@ -417,6 +420,15 @@ class QueryControls extends Component {
|
|
|
417
420
|
tokens={ getTermsOfCustomTaxonomy( customTaxonomyExclusions, slug ) }
|
|
418
421
|
/>
|
|
419
422
|
) ) }
|
|
423
|
+
|
|
424
|
+
{ onAllowDedupeChange && (
|
|
425
|
+
<ToggleControl
|
|
426
|
+
label={ __( 'Allow duplicate content', 'newspack-blocks' ) }
|
|
427
|
+
help={ __( "Exclude this block from the page's deduplication logic.", 'newspack-blocks' ) }
|
|
428
|
+
checked={ allowDedupeCurrentValue }
|
|
429
|
+
onChange={ value => onAllowDedupeChange( value ) }
|
|
430
|
+
/>
|
|
431
|
+
) }
|
|
420
432
|
</>
|
|
421
433
|
) }
|
|
422
434
|
</>
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
background: var(--newspack-ui-color-neutral-0, np-colors.$neutral-000);
|
|
7
7
|
padding: var(--newspack-ui-spacer-5, 24px);
|
|
8
8
|
|
|
9
|
+
a,
|
|
10
|
+
a:hover {
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
form p {
|
|
10
15
|
margin: 0 0 var(--newspack-ui-spacer-5, 24px);
|
|
11
16
|
|
|
@@ -16,6 +21,11 @@
|
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
table.woocommerce-checkout-review-order-table {
|
|
24
|
+
tr,
|
|
25
|
+
th {
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
thead > tr > th {
|
|
20
30
|
font-weight: var(--newspack-ui-font-weight-strong, 600);
|
|
21
31
|
}
|
|
@@ -821,6 +831,8 @@
|
|
|
821
831
|
|
|
822
832
|
// Order review table.
|
|
823
833
|
.woocommerce-checkout-review-order-table {
|
|
834
|
+
width: 100%;
|
|
835
|
+
|
|
824
836
|
th,
|
|
825
837
|
td,
|
|
826
838
|
label,
|
|
@@ -841,6 +853,22 @@
|
|
|
841
853
|
margin: 0;
|
|
842
854
|
}
|
|
843
855
|
}
|
|
856
|
+
|
|
857
|
+
td,
|
|
858
|
+
th {
|
|
859
|
+
border: 1px solid var(--newspack-ui-color-border, #ddd);
|
|
860
|
+
border-width: 0 0 1px;
|
|
861
|
+
word-break: break-all;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
tfoot {
|
|
865
|
+
tr:last-child {
|
|
866
|
+
td,
|
|
867
|
+
th {
|
|
868
|
+
border-bottom: 0;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
844
872
|
}
|
|
845
873
|
|
|
846
874
|
.woocommerce .first-payment-date {
|
|
@@ -685,7 +685,7 @@ import { domReady, onCheckoutPlaceOrderProcessing } from './utils';
|
|
|
685
685
|
// Serialize form and remove fields that shouldn't be included for validation.
|
|
686
686
|
const serializedForm = $form.serializeArray().filter( item => ! removeFromValidation.includes( item.name ) );
|
|
687
687
|
// Add 'update totals' parameter so it just performs validation.
|
|
688
|
-
serializedForm.push( { name: '
|
|
688
|
+
serializedForm.push( { name: 'newspack_blocks_checkout_action', value: '1' } );
|
|
689
689
|
// Ajax request.
|
|
690
690
|
$.ajax( {
|
|
691
691
|
type: 'POST',
|
|
@@ -25,6 +25,7 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
|
|
|
25
25
|
?>
|
|
26
26
|
|
|
27
27
|
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
|
|
28
|
+
<?php wp_nonce_field( 'newspack_modal_checkout_nonce', 'newspack_checkout_nonce' ); ?>
|
|
28
29
|
<?php if ( $checkout->get_checkout_fields() ) : ?>
|
|
29
30
|
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
|
|
30
31
|
<div id="customer_details">
|
|
@@ -34,6 +35,11 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
|
|
|
34
35
|
<button class="newspack-ui__button newspack-ui__button--primary newspack-ui__button--wide" id="checkout_continue" type="submit"><?php esc_html_e( 'Continue', 'newspack-blocks' ); ?></button>
|
|
35
36
|
</div>
|
|
36
37
|
<div id="after_customer_details">
|
|
38
|
+
<?php
|
|
39
|
+
if ( wp_is_block_theme() && function_exists( 'woocommerce_checkout_payment' ) ) {
|
|
40
|
+
woocommerce_checkout_payment();
|
|
41
|
+
}
|
|
42
|
+
?>
|
|
37
43
|
<div class="order-review-wrapper hidden">
|
|
38
44
|
<?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
|
|
39
45
|
<button id="order_review_heading" aria-expanded="false" aria-controls="order_review_content" class="newspack-ui__button newspack-ui__button--ghost" type="button">
|
|
@@ -46,7 +52,13 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
|
|
|
46
52
|
<div class="transaction-details-content-inner" id="order_review_content">
|
|
47
53
|
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
|
|
48
54
|
<div id="order_review" class="woocommerce-checkout-review-order newspack-ui__box">
|
|
49
|
-
<?php
|
|
55
|
+
<?php
|
|
56
|
+
if ( wp_is_block_theme() && function_exists( 'woocommerce_order_review' ) ) {
|
|
57
|
+
woocommerce_order_review();
|
|
58
|
+
} else {
|
|
59
|
+
do_action( 'woocommerce_checkout_order_review' );
|
|
60
|
+
}
|
|
61
|
+
?>
|
|
50
62
|
</div>
|
|
51
63
|
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
|
|
52
64
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'name' => 'automattic/newspack-blocks',
|
|
4
4
|
'pretty_version' => 'dev-trunk',
|
|
5
5
|
'version' => 'dev-trunk',
|
|
6
|
-
'reference' => '
|
|
6
|
+
'reference' => 'c033b36b1e6451553b1b7c2c048b0bae5f331695',
|
|
7
7
|
'type' => 'wordpress-plugin',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
'automattic/newspack-blocks' => array(
|
|
14
14
|
'pretty_version' => 'dev-trunk',
|
|
15
15
|
'version' => 'dev-trunk',
|
|
16
|
-
'reference' => '
|
|
16
|
+
'reference' => 'c033b36b1e6451553b1b7c2c048b0bae5f331695',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|