@automattic/newspack-blocks 4.11.0 → 4.12.0
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 +15 -0
- package/dist/block_styles-rtl.css +1 -1
- package/dist/block_styles.asset.php +1 -1
- package/dist/block_styles.css +1 -1
- package/dist/editor-rtl.css +3 -3
- package/dist/editor.asset.php +1 -1
- package/dist/editor.css +3 -3
- package/dist/editor.js +3 -3
- package/dist/modal.asset.php +1 -1
- package/dist/modal.js +1 -1
- package/dist/modalCheckout.asset.php +1 -1
- package/dist/modalCheckout.js +1 -1
- package/includes/class-modal-checkout.php +61 -25
- package/includes/class-newspack-blocks-api.php +3 -48
- package/includes/class-newspack-blocks-caching.php +3 -0
- package/includes/class-newspack-blocks.php +47 -15
- package/includes/tracking/class-data-events.php +34 -7
- package/newspack-blocks.php +2 -2
- package/package.json +3 -3
- package/src/block-styles/core/columns/editor.scss +1 -1
- package/src/block-styles/core/columns/view.scss +1 -1
- package/src/blocks/carousel/edit.js +5 -10
- package/src/blocks/carousel/editor.scss +8 -0
- package/src/blocks/homepage-articles/edit.tsx +3 -9
- package/src/blocks/homepage-articles/editor.scss +8 -4
- package/src/blocks/homepage-articles/utils.ts +7 -8
- package/src/blocks/homepage-articles/view.php +10 -2
- package/src/modal-checkout/analytics/ga4/checkout-attempt.js +1 -17
- package/src/modal-checkout/analytics/ga4/checkout-success.js +17 -0
- package/src/modal-checkout/analytics/ga4/dismissed.js +1 -22
- package/src/modal-checkout/analytics/ga4/loaded.js +1 -27
- package/src/modal-checkout/analytics/ga4/opened.js +1 -26
- package/src/modal-checkout/analytics/ga4/pagination.js +16 -1
- package/src/modal-checkout/analytics/index.js +2 -1
- package/src/modal-checkout/index.js +3 -1
- package/src/modal-checkout/modal.js +19 -0
- package/src/modal-checkout/templates/thankyou.php +7 -1
- package/src/shared/js/utils.js +8 -29
- package/src/types/index.d.ts +2 -5
- package/vendor/autoload.php +1 -1
- package/vendor/composer/autoload_real.php +4 -4
- package/vendor/composer/autoload_static.php +2 -2
- package/vendor/composer/installed.php +2 -2
|
@@ -35,8 +35,7 @@ import QueryControls from '../../components/query-controls';
|
|
|
35
35
|
import { PostTypesPanel, PostStatusesPanel } from '../../components/editor-panels';
|
|
36
36
|
import createSwiper from './create-swiper';
|
|
37
37
|
import {
|
|
38
|
-
|
|
39
|
-
formatByline,
|
|
38
|
+
getBylineHTML,
|
|
40
39
|
formatSponsorLogos,
|
|
41
40
|
formatSponsorByline,
|
|
42
41
|
getPostStatusLabel,
|
|
@@ -320,14 +319,10 @@ class Edit extends Component {
|
|
|
320
319
|
</span>
|
|
321
320
|
) }
|
|
322
321
|
{ showAuthor &&
|
|
323
|
-
|
|
324
|
-
( ! post.newspack_post_sponsors ||
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
{ showAuthor &&
|
|
328
|
-
( ! post.newspack_post_sponsors ||
|
|
329
|
-
post.newspack_sponsors_show_author ) &&
|
|
330
|
-
formatByline( post.newspack_author_info ) }
|
|
322
|
+
! post.newspack_listings_hide_author &&
|
|
323
|
+
( ! post.newspack_post_sponsors || post.newspack_sponsors_show_author ) &&
|
|
324
|
+
<RawHTML className="byline-container">{ getBylineHTML( post, showAvatar ) }</RawHTML>
|
|
325
|
+
}
|
|
331
326
|
{ showDate && (
|
|
332
327
|
<time className="entry-date published" key="pub-date">
|
|
333
328
|
{ dateI18n( dateFormat, post.date ) }
|
|
@@ -33,6 +33,14 @@
|
|
|
33
33
|
visibility: hidden;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
// Work around RawHTML `<div />` encapsulation.
|
|
38
|
+
.entry-meta div.byline-container {
|
|
39
|
+
display: inline;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
margin-right: 1.5em;
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
.editor-block-list__layout .editor-block-list__block .wpnbpc .entry-title a,
|
|
38
46
|
.editor-block-list__layout .editor-block-list__block .wpnbpc .entry-meta .byline a {
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
import QueryControls from '../../components/query-controls';
|
|
7
7
|
import { postsBlockSelector, postsBlockDispatch, isBlogPrivate, shouldReflow } from './utils';
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
formatByline,
|
|
9
|
+
getBylineHTML,
|
|
11
10
|
formatSponsorLogos,
|
|
12
11
|
formatSponsorByline,
|
|
13
12
|
getPostStatusLabel,
|
|
@@ -236,14 +235,9 @@ class Edit extends Component< HomepageArticlesProps > {
|
|
|
236
235
|
|
|
237
236
|
{ showAuthor &&
|
|
238
237
|
! post.newspack_listings_hide_author &&
|
|
239
|
-
showAvatar &&
|
|
240
238
|
( ! post.newspack_post_sponsors || post.newspack_sponsors_show_author ) &&
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
{ showAuthor &&
|
|
244
|
-
! post.newspack_listings_hide_author &&
|
|
245
|
-
( ! post.newspack_post_sponsors || post.newspack_sponsors_show_author ) &&
|
|
246
|
-
formatByline( post.newspack_author_info ) }
|
|
239
|
+
<RawHTML className="byline-container">{ getBylineHTML( post, showAvatar ) }</RawHTML>
|
|
240
|
+
}
|
|
247
241
|
|
|
248
242
|
{ showDate && ! post.newspack_listings_hide_publish_date && (
|
|
249
243
|
<time className="entry-date published" key="pub-date">
|
|
@@ -30,18 +30,22 @@
|
|
|
30
30
|
flex-wrap: wrap;
|
|
31
31
|
align-items: center;
|
|
32
32
|
margin-top: 0.5em;
|
|
33
|
+
// Work around RawHTML `<div />` encapsulation.
|
|
34
|
+
div.byline-container {
|
|
35
|
+
display: inline;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
margin-right: 1.5em;
|
|
39
|
+
}
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
.cat-links {
|
|
36
43
|
font-size: variables.$font__size-xs;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
.entry-meta .avatar {
|
|
40
47
|
display: inline-block;
|
|
41
48
|
margin-right: 0.5em;
|
|
42
|
-
div {
|
|
43
|
-
display: inline;
|
|
44
|
-
}
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
/* Article excerpt */
|
|
@@ -176,14 +176,13 @@ const generatePreviewPost = ( id: PostId ) => {
|
|
|
176
176
|
rendered: __( 'Post Title', 'newspack-blocks' ),
|
|
177
177
|
},
|
|
178
178
|
newspack_article_classes: 'type-post',
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
],
|
|
179
|
+
newspack_post_avatars: `<div style="background: #e8e8e8;width: 40px;height: 40px;display: block;overflow: hidden;border-radius: 50%; max-width: 100%; max-height: 100%;" class="avatar"></div>`,
|
|
180
|
+
newspack_post_byline: `<span class="byline">
|
|
181
|
+
<span class="author-prefix">${ __( 'by', 'newspack-blocks' ) }</span>
|
|
182
|
+
<span class="author vcard">
|
|
183
|
+
<a class="url fn n" href="/">Author Name</a>
|
|
184
|
+
</span>
|
|
185
|
+
</span>`,
|
|
187
186
|
newspack_category_info: __( 'Category', 'newspack-blocks' ),
|
|
188
187
|
newspack_featured_image_caption: __( 'Featured image caption', 'newspack-blocks' ),
|
|
189
188
|
newspack_featured_image_src: {
|
|
@@ -467,7 +467,7 @@ function newspack_blocks_format_avatars( $author_info ) {
|
|
|
467
467
|
/**
|
|
468
468
|
* Renders byline markup.
|
|
469
469
|
*
|
|
470
|
-
* @param
|
|
470
|
+
* @param object[] $author_info Author info array.
|
|
471
471
|
*
|
|
472
472
|
* @return string Returns byline markup.
|
|
473
473
|
*/
|
|
@@ -500,7 +500,15 @@ function newspack_blocks_format_byline( $author_info ) {
|
|
|
500
500
|
)
|
|
501
501
|
);
|
|
502
502
|
|
|
503
|
-
|
|
503
|
+
$byline = implode( '', $elements );
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Filters the byline markup.
|
|
507
|
+
*
|
|
508
|
+
* @param string $byline Byline markup.
|
|
509
|
+
* @param objcet[] $author_info Author info array.
|
|
510
|
+
*/
|
|
511
|
+
return apply_filters( 'newspack_blocks_post_byline', $byline, $author_info );
|
|
504
512
|
}
|
|
505
513
|
|
|
506
514
|
/**
|
|
@@ -11,23 +11,7 @@ export const manageCheckoutAttempt = () => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const params = {
|
|
17
|
-
action_type,
|
|
18
|
-
amount,
|
|
19
|
-
currency,
|
|
20
|
-
product_id,
|
|
21
|
-
product_type,
|
|
22
|
-
recurrence,
|
|
23
|
-
referrer,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// There's only a variation ID for variable products, after you've selected one.
|
|
27
|
-
if ( variation_id ) {
|
|
28
|
-
params.variation_id = variation_id;
|
|
29
|
-
}
|
|
30
|
-
|
|
14
|
+
const params = getProductDetails( 'modal-checkout-product-details' );
|
|
31
15
|
const payload = getEventPayload( 'form_submission', params );
|
|
32
16
|
sendEvent( payload );
|
|
33
17
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getEventPayload, getProductDetails, sendEvent } from './utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Event fired when switching between steps of the multi-step checkout flow.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} action Action name for the event: 'continue' or 'back'.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const manageCheckoutSuccess = () => {
|
|
10
|
+
if ( 'function' !== typeof window.gtag ) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const params = getProductDetails( 'modal-checkout-product-details' );
|
|
15
|
+
const payload = getEventPayload( 'form_submission_success', params );
|
|
16
|
+
sendEvent( payload );
|
|
17
|
+
};
|
|
@@ -12,27 +12,6 @@ export const manageDismissed = ( data ) => {
|
|
|
12
12
|
|
|
13
13
|
data = data || getProductDetails( 'newspack_modal_checkout' );
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const params = {
|
|
18
|
-
action_type,
|
|
19
|
-
currency,
|
|
20
|
-
product_id,
|
|
21
|
-
product_type,
|
|
22
|
-
recurrence,
|
|
23
|
-
referrer,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// On the first variable screen, there may not be a price so we want to check for it.
|
|
27
|
-
if ( amount || price ) {
|
|
28
|
-
params.amount = amount ? amount : price;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// There's only a variation ID for variable products, after you've selected one.
|
|
32
|
-
if ( variation_id ) {
|
|
33
|
-
params.variation_id = variation_id;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const payload = getEventPayload( 'dismissed', params );
|
|
15
|
+
const payload = getEventPayload( 'dismissed', data );
|
|
37
16
|
sendEvent( payload );
|
|
38
17
|
};
|
|
@@ -9,33 +9,7 @@ export const manageLoaded = () => {
|
|
|
9
9
|
if ( 'function' !== typeof window.gtag ) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
action_type,
|
|
15
|
-
amount,
|
|
16
|
-
currency,
|
|
17
|
-
product_id,
|
|
18
|
-
product_type,
|
|
19
|
-
recurrence,
|
|
20
|
-
referrer,
|
|
21
|
-
variation_id = ''
|
|
22
|
-
} = getProductDetails( 'modal-checkout-product-details' );
|
|
23
|
-
|
|
24
|
-
const params = {
|
|
25
|
-
action_type,
|
|
26
|
-
amount,
|
|
27
|
-
currency,
|
|
28
|
-
product_id,
|
|
29
|
-
product_type,
|
|
30
|
-
recurrence,
|
|
31
|
-
referrer,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// There's only a variation ID for variable products, after you've selected one.
|
|
35
|
-
if ( variation_id ) {
|
|
36
|
-
params.variation_id = variation_id;
|
|
37
|
-
}
|
|
38
|
-
|
|
12
|
+
const params = getProductDetails( 'modal-checkout-product-details' );
|
|
39
13
|
const payload = getEventPayload( 'loaded', params );
|
|
40
14
|
|
|
41
15
|
sendEvent( payload );
|
|
@@ -13,24 +13,14 @@ export const manageOpened = ( data ) => {
|
|
|
13
13
|
let action = 'opened';
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
|
-
action_type,
|
|
17
16
|
amount = '',
|
|
18
|
-
currency,
|
|
19
17
|
is_variable = '',
|
|
20
18
|
price = '',
|
|
21
|
-
product_id,
|
|
22
|
-
product_type,
|
|
23
|
-
recurrence,
|
|
24
|
-
referrer,
|
|
25
19
|
variation_id = '',
|
|
26
20
|
} = data;
|
|
27
21
|
|
|
28
22
|
const params = {
|
|
29
|
-
|
|
30
|
-
currency,
|
|
31
|
-
product_id,
|
|
32
|
-
product_type,
|
|
33
|
-
referrer,
|
|
23
|
+
...data,
|
|
34
24
|
};
|
|
35
25
|
|
|
36
26
|
// On the first variable screen, there may not be a price so we want to check for it.
|
|
@@ -38,21 +28,6 @@ export const manageOpened = ( data ) => {
|
|
|
38
28
|
params.amount = amount ? amount : price;
|
|
39
29
|
}
|
|
40
30
|
|
|
41
|
-
// Only pass is_variable if available -- it only is for variable products.
|
|
42
|
-
if ( is_variable ) {
|
|
43
|
-
params.is_variable = is_variable;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Only pass the variation_id if available -- it only is when a variation is picked.
|
|
47
|
-
if ( variation_id ) {
|
|
48
|
-
params.variation_id = variation_id;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Only pass the recurrence if available -- for variable products, it won't be until a variation is picked.
|
|
52
|
-
if ( recurrence ) {
|
|
53
|
-
params.recurrence = recurrence;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
31
|
// Change the action when opening the initial variation modal.
|
|
57
32
|
if ( is_variable && ! variation_id ) {
|
|
58
33
|
action = 'opened_variations';
|
|
@@ -11,7 +11,17 @@ export const managePagination = ( action = 'continue' ) => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
action_type,
|
|
16
|
+
amount,
|
|
17
|
+
currency,
|
|
18
|
+
product_id,
|
|
19
|
+
product_type,
|
|
20
|
+
recurrence,
|
|
21
|
+
referrer,
|
|
22
|
+
variation_id = '',
|
|
23
|
+
gate_post_id = '',
|
|
24
|
+
} = getProductDetails( 'modal-checkout-product-details' );
|
|
15
25
|
|
|
16
26
|
const params = {
|
|
17
27
|
action_type,
|
|
@@ -28,6 +38,11 @@ export const managePagination = ( action = 'continue' ) => {
|
|
|
28
38
|
params.variation_id = variation_id;
|
|
29
39
|
}
|
|
30
40
|
|
|
41
|
+
// If this checkout started from a content gate, add the gate ID to the payload.
|
|
42
|
+
if ( gate_post_id ) {
|
|
43
|
+
params.gate_post_id = gate_post_id;
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
const payload = getEventPayload( action, params );
|
|
32
47
|
sendEvent( payload );
|
|
33
48
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { manageCheckoutAttempt } from './ga4/checkout-attempt';
|
|
2
|
+
export { manageCheckoutSuccess } from './ga4/checkout-success';
|
|
2
3
|
export { manageDismissed } from './ga4/dismissed';
|
|
3
4
|
export { manageLoaded } from './ga4/loaded';
|
|
4
5
|
export { manageOpened } from './ga4/opened';
|
|
5
|
-
export { managePagination } from './ga4/pagination';
|
|
6
|
+
export { managePagination } from './ga4/pagination';
|
|
@@ -7,7 +7,7 @@ import './checkout.scss';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { manageCheckoutAttempt, manageLoaded, managePagination } from './analytics';
|
|
10
|
+
import { manageCheckoutAttempt, manageCheckoutSuccess, manageLoaded, managePagination } from './analytics';
|
|
11
11
|
import { domReady } from './utils';
|
|
12
12
|
|
|
13
13
|
( $ => {
|
|
@@ -51,6 +51,8 @@ import { domReady } from './utils';
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if ( newspackBlocksModalCheckout.is_checkout_complete ) {
|
|
54
|
+
manageCheckoutSuccess();
|
|
55
|
+
|
|
54
56
|
/**
|
|
55
57
|
* Set the checkout as complete so the modal can resolve post checkout flows.
|
|
56
58
|
*/
|
|
@@ -10,6 +10,7 @@ import * as a11y from './accessibility.js';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { manageDismissed, manageOpened } from './analytics';
|
|
13
|
+
import { getProductDetails } from './analytics/ga4/utils';
|
|
13
14
|
import { createHiddenInput, domReady } from './utils';
|
|
14
15
|
|
|
15
16
|
const CLASS_PREFIX = newspackBlocksModal.newspack_class_prefix;
|
|
@@ -127,10 +128,18 @@ domReady( () => {
|
|
|
127
128
|
}
|
|
128
129
|
if ( container ) {
|
|
129
130
|
if ( container.checkoutComplete ) {
|
|
131
|
+
// Dispatch a checkout_completed event to RAS.
|
|
132
|
+
const params = getProductDetails( MODAL_CHECKOUT_ID );
|
|
133
|
+
window.newspackRAS = window.newspackRAS || [];
|
|
134
|
+
window.newspackRAS.push( function( ras ) {
|
|
135
|
+
ras.dispatchActivity( 'checkout_completed', params );
|
|
136
|
+
} );
|
|
137
|
+
|
|
130
138
|
// Update the newsletters signup modal if it exists.
|
|
131
139
|
if ( window?.newspackReaderActivation?.refreshNewslettersSignupModal && window?.newspackReaderActivation?.getReader()?.email ) {
|
|
132
140
|
window.newspackReaderActivation.refreshNewslettersSignupModal( window.newspackReaderActivation.getReader().email );
|
|
133
141
|
}
|
|
142
|
+
|
|
134
143
|
// Update the modal title and width to reflect successful transaction.
|
|
135
144
|
setModalSize( 'small' );
|
|
136
145
|
setModalTitle( newspackBlocksModal.labels.thankyou_modal_title );
|
|
@@ -372,6 +381,16 @@ domReady( () => {
|
|
|
372
381
|
};
|
|
373
382
|
}
|
|
374
383
|
|
|
384
|
+
// If the checkout started from a content gate, add the gate ID to the payload.
|
|
385
|
+
const gateId = formData.get( 'memberships_content_gate' );
|
|
386
|
+
if ( gateId ) {
|
|
387
|
+
analyticsData.gate_post_id = gateId;
|
|
388
|
+
}
|
|
389
|
+
const popupId = formData.get( 'newspack_popup_id' );
|
|
390
|
+
if ( popupId ) {
|
|
391
|
+
analyticsData.newspack_popup_id = popupId;
|
|
392
|
+
}
|
|
393
|
+
|
|
375
394
|
// Analytics.
|
|
376
395
|
if ( ! inCheckoutIntent ) {
|
|
377
396
|
manageOpened( analyticsData );
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
namespace Newspack_Blocks;
|
|
13
13
|
|
|
14
|
+
use Newspack_Blocks\Tracking\Data_Events;
|
|
15
|
+
|
|
14
16
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
15
17
|
exit;
|
|
16
18
|
}
|
|
@@ -41,6 +43,10 @@ function newspack_blocks_replace_login_with_order_summary() {
|
|
|
41
43
|
$after_success_behavior = isset( $_GET['after_success_behavior'] ) ? \sanitize_text_field( \wp_unslash( $_GET['after_success_behavior'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
|
42
44
|
$after_success_url = isset( $_GET['after_success_url'] ) ? esc_url( \sanitize_url( \wp_unslash( $_GET['after_success_url'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
|
43
45
|
$after_success_label = isset( $_GET['after_success_button_label'] ) ? \sanitize_text_field( \wp_unslash( $_GET['after_success_button_label'] ) ) : \Newspack_Blocks\Modal_Checkout::get_modal_checkout_labels( 'after_success' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
|
46
|
+
$order_items = $order->get_items();
|
|
47
|
+
$item = reset( $order_items );
|
|
48
|
+
$product_id = $item ? $item->get_product_id() : null;
|
|
49
|
+
$data_order_details = Data_Events::build_js_data_events( $product_id, null, $order );
|
|
44
50
|
?>
|
|
45
51
|
<div class="woocommerce-order">
|
|
46
52
|
<?php if ( $is_success ) : ?>
|
|
@@ -51,7 +57,7 @@ function newspack_blocks_replace_login_with_order_summary() {
|
|
|
51
57
|
<path d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"></path>
|
|
52
58
|
</svg>
|
|
53
59
|
</span>
|
|
54
|
-
<p>
|
|
60
|
+
<p id="modal-checkout-product-details" data-order-details='<?php echo wp_json_encode( $data_order_details ); ?>'>
|
|
55
61
|
<strong>
|
|
56
62
|
<?php
|
|
57
63
|
echo esc_html( Modal_Checkout::get_post_checkout_success_text() );
|
package/src/shared/js/utils.js
CHANGED
|
@@ -2,36 +2,15 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { _x, __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { Fragment } from '@wordpress/element';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
) );
|
|
15
|
-
|
|
16
|
-
export const formatByline = authorInfo => (
|
|
17
|
-
<span className="byline">
|
|
18
|
-
<span className="author-prefix">{ _x( 'by', 'post author', 'newspack-blocks' ) }</span>{ ' ' }
|
|
19
|
-
{ authorInfo.reduce( ( accumulator, author, index ) => {
|
|
20
|
-
return [
|
|
21
|
-
...accumulator,
|
|
22
|
-
<span className="author vcard" key={ author.id }>
|
|
23
|
-
<a className="url fn n" href={ author.author_link }>
|
|
24
|
-
{ author.display_name }
|
|
25
|
-
</a>
|
|
26
|
-
</span>,
|
|
27
|
-
index < authorInfo.length - 2 && ', ',
|
|
28
|
-
authorInfo.length > 1 &&
|
|
29
|
-
index === authorInfo.length - 2 &&
|
|
30
|
-
_x( ' and ', 'post author', 'newspack-blocks' ),
|
|
31
|
-
];
|
|
32
|
-
}, [] ) }
|
|
33
|
-
</span>
|
|
34
|
-
);
|
|
7
|
+
export const getBylineHTML = ( post, showAvatar = false ) => {
|
|
8
|
+
const byline = '<span class="byline">' + post.newspack_post_byline + '</span>';
|
|
9
|
+
if ( showAvatar && post.newspack_post_avatars ) {
|
|
10
|
+
return post.newspack_post_avatars + byline;
|
|
11
|
+
}
|
|
12
|
+
return byline;
|
|
13
|
+
};
|
|
35
14
|
|
|
36
15
|
export const formatSponsorLogos = sponsorInfo => (
|
|
37
16
|
<span className="sponsor-logos">
|
package/src/types/index.d.ts
CHANGED
|
@@ -71,11 +71,6 @@ declare global {
|
|
|
71
71
|
newspack_post_subtitle: string;
|
|
72
72
|
};
|
|
73
73
|
post_link: string;
|
|
74
|
-
newspack_author_info: {
|
|
75
|
-
id: number;
|
|
76
|
-
author_link: string;
|
|
77
|
-
avatar: string;
|
|
78
|
-
}[];
|
|
79
74
|
newspack_article_classes: string;
|
|
80
75
|
newspack_featured_image_caption: string;
|
|
81
76
|
newspack_featured_image_src: {
|
|
@@ -86,6 +81,8 @@ declare global {
|
|
|
86
81
|
uncropped: string;
|
|
87
82
|
};
|
|
88
83
|
newspack_category_info: string;
|
|
84
|
+
newspack_post_avatars: string;
|
|
85
|
+
newspack_post_byline: string;
|
|
89
86
|
newspack_sponsors_show_categories: boolean;
|
|
90
87
|
newspack_sponsors_show_author: boolean;
|
|
91
88
|
newspack_post_sponsors?:
|
package/vendor/autoload.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// autoload_real.php @generated by Composer
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ComposerAutoloaderInit7ab5ea472192e8edb0c273e1092ec41f
|
|
6
6
|
{
|
|
7
7
|
private static $loader;
|
|
8
8
|
|
|
@@ -22,12 +22,12 @@ class ComposerAutoloaderInitf2366ed8ad38ed7f55353e226beedbcf
|
|
|
22
22
|
return self::$loader;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
spl_autoload_register(array('
|
|
25
|
+
spl_autoload_register(array('ComposerAutoloaderInit7ab5ea472192e8edb0c273e1092ec41f', 'loadClassLoader'), true, true);
|
|
26
26
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
|
27
|
-
spl_autoload_unregister(array('
|
|
27
|
+
spl_autoload_unregister(array('ComposerAutoloaderInit7ab5ea472192e8edb0c273e1092ec41f', 'loadClassLoader'));
|
|
28
28
|
|
|
29
29
|
require __DIR__ . '/autoload_static.php';
|
|
30
|
-
call_user_func(\Composer\Autoload\
|
|
30
|
+
call_user_func(\Composer\Autoload\ComposerStaticInit7ab5ea472192e8edb0c273e1092ec41f::getInitializer($loader));
|
|
31
31
|
|
|
32
32
|
$loader->register(true);
|
|
33
33
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
namespace Composer\Autoload;
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class ComposerStaticInit7ab5ea472192e8edb0c273e1092ec41f
|
|
8
8
|
{
|
|
9
9
|
public static $classMap = array (
|
|
10
10
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
@@ -13,7 +13,7 @@ class ComposerStaticInitf2366ed8ad38ed7f55353e226beedbcf
|
|
|
13
13
|
public static function getInitializer(ClassLoader $loader)
|
|
14
14
|
{
|
|
15
15
|
return \Closure::bind(function () use ($loader) {
|
|
16
|
-
$loader->classMap =
|
|
16
|
+
$loader->classMap = ComposerStaticInit7ab5ea472192e8edb0c273e1092ec41f::$classMap;
|
|
17
17
|
|
|
18
18
|
}, null, ClassLoader::class);
|
|
19
19
|
}
|
|
@@ -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' => 'e46a434ddd06672bd650b94a2dbe060ab83ee58a',
|
|
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' => 'e46a434ddd06672bd650b94a2dbe060ab83ee58a',
|
|
17
17
|
'type' => 'wordpress-plugin',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|