plugin updates

This commit is contained in:
Tony Volpe
2024-02-21 16:19:46 +00:00
parent c72f206574
commit 21d4c85c00
1214 changed files with 102269 additions and 179257 deletions

View File

@@ -1,24 +1,19 @@
( function ( $ ) {
( function () {
'use strict';
// Check init order attribution on consent change.
const CONSENT_CATEGORY_MARKING = 'marketing';
// Set order attribution on consent change.
document.addEventListener( 'wp_listen_for_consent_change', ( e ) => {
const changedConsentCategory = e.detail;
for ( const key in changedConsentCategory ) {
if ( changedConsentCategory.hasOwnProperty( key ) ) {
if ( key === CONSENT_CATEGORY_MARKING && changedConsentCategory[ key ] === 'allow' ) {
window.wc_order_attribution.setAllowTrackingConsent( true );
}
}
if ( changedConsentCategory.hasOwnProperty( key ) && key === window.wc_order_attribution.params.consentCategory ) {
window.wc_order_attribution.setOrderTracking( changedConsentCategory[ key ] === 'allow' );
}
}
} );
// Init order attribution as soon as consent type is defined.
$( document ).on( 'wp_consent_type_defined', () => {
if ( wp_has_consent( CONSENT_CATEGORY_MARKING ) ) {
window.wc_order_attribution.setAllowTrackingConsent( true );
}
// Set order attribution as soon as consent type is defined.
document.addEventListener( 'wp_consent_type_defined', () => {
window.wc_order_attribution.setOrderTracking( wp_has_consent( window.wc_order_attribution.params.consentCategory ) );
} );
}( jQuery ) );
}() );