Skip to content

Commit

Permalink
Merge pull request #2827 from Automattic/master
Browse files Browse the repository at this point in the history
Alpha release Dec 22
  • Loading branch information
dkoo authored Dec 22, 2023
2 parents d9cb621 + f8d35ec commit 65f243d
Show file tree
Hide file tree
Showing 13 changed files with 903 additions and 259 deletions.
29 changes: 29 additions & 0 deletions assets/other-scripts/wc-cover-fees/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* globals jQuery, newspack_wc_cover_fees */
( function ( $ ) {
if ( ! $ ) {
return;
}
const $body = $( document.body );
$body.on( 'init_checkout', function () {
const form = document.querySelector( 'form.checkout' );
if ( ! form ) {
return;
}
let checked = document.getElementById( newspack_wc_cover_fees.custom_field_name )?.checked;
form.addEventListener( 'change', function () {
// Get element on every change because the DOM is replaced by AJAX.
const input = document.getElementById( newspack_wc_cover_fees.custom_field_name );
if ( ! input ) {
return;
}
if ( checked !== input.checked ) {
checked = input.checked;
$body.trigger( 'update_checkout', { update_shipping_method: false } );
}
} );
// Trigger checkout update on payment method change so it updates the fee.
$( document ).on( 'payment_method_selected', function () {
$body.trigger( 'update_checkout', { update_shipping_method: false } );
} );
} );
} )( jQuery );
4 changes: 3 additions & 1 deletion assets/wizards/engagement/views/newsletters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ export const SubscriptionLists = ( { lockedLists, onUpdate, initialProvider } )
toggleOnChange={ handleChange( index, 'active' ) }
toggleChecked={ list.active }
className={
'mailchimp-group' === list?.type ? 'newspack-newsletters-group-list-item' : ''
list?.id && list.id.startsWith( 'group' )
? 'newspack-newsletters-group-list-item'
: ''
}
actionText={
list?.edit_link ? (
Expand Down
2 changes: 1 addition & 1 deletion includes/class-newspack.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private function includes() {
include_once NEWSPACK_ABSPATH . 'includes/authors/class-authors-custom-fields.php';

include_once NEWSPACK_ABSPATH . 'includes/optional-modules/class-rss.php';
include_once NEWSPACK_ABSPATH . 'includes/optional-modules/class-media-partners.php';

include_once NEWSPACK_ABSPATH . 'includes/starter_content/class-starter-content-provider.php';
include_once NEWSPACK_ABSPATH . 'includes/starter_content/class-starter-content-generated.php';
Expand Down Expand Up @@ -375,7 +376,6 @@ public static function load_common_assets() {
[],
NEWSPACK_PLUGIN_VERSION
);

}
}
Newspack::instance();
Loading

0 comments on commit 65f243d

Please sign in to comment.