Add filter to apply Base64 encoding to order attribution cookies (#47597)
* Add filter to set Sourcebuster JS base64 configuration value * Use Sourcebuster v1.2.0 * Changelog * Reduce line length for linter
This commit is contained in:
parent
42cb91ae3c
commit
8541afa418
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: add
|
||||||
|
|
||||||
|
Filter to apply Base64 encoding to order attribution cookies
|
|
@ -82,6 +82,7 @@
|
||||||
sbjs.init( {
|
sbjs.init( {
|
||||||
lifetime: Number( params.lifetime ),
|
lifetime: Number( params.lifetime ),
|
||||||
session_length: Number( params.session ),
|
session_length: Number( params.session ),
|
||||||
|
base64: Boolean( params.base64 ),
|
||||||
timezone_offset: '0', // utc
|
timezone_offset: '0', // utc
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -184,7 +185,10 @@
|
||||||
if( input ) {
|
if( input ) {
|
||||||
input.value = stringifyFalsyInputValue( this.values[ fieldName ] );
|
input.value = stringifyFalsyInputValue( this.values[ fieldName ] );
|
||||||
} else {
|
} else {
|
||||||
console.warn( `Field "${fieldName}" not found. Most likely, the '<wc-order-attribution-inputs>' element was manipulated.`);
|
console.warn(
|
||||||
|
`Field "${fieldName}" not found. ` +
|
||||||
|
`Most likely, the '<wc-order-attribution-inputs>' element was manipulated.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
"wireit": "0.14.3"
|
"wireit": "0.14.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sourcebuster": "github:woocommerce/sourcebuster-js#v1.1.2"
|
"sourcebuster": "github:woocommerce/sourcebuster-js#v1.2.0"
|
||||||
},
|
},
|
||||||
"wireit": {
|
"wireit": {
|
||||||
"build:project:assets": {
|
"build:project:assets": {
|
||||||
|
|
|
@ -288,6 +288,15 @@ class OrderAttributionController implements RegisterHooksInterface {
|
||||||
*/
|
*/
|
||||||
$session_length = (int) apply_filters( 'wc_order_attribution_session_length_minutes', 30 );
|
$session_length = (int) apply_filters( 'wc_order_attribution_session_length_minutes', 30 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter to enable base64 encoding for cookie values.
|
||||||
|
*
|
||||||
|
* @since 9.0.0
|
||||||
|
*
|
||||||
|
* @param bool $use_base64_cookies True to enable base64 encoding, default is false.
|
||||||
|
*/
|
||||||
|
$use_base64_cookies = apply_filters( 'wc_order_attribution_use_base64_cookies', false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter to allow tracking.
|
* Filter to allow tracking.
|
||||||
*
|
*
|
||||||
|
@ -302,6 +311,7 @@ class OrderAttributionController implements RegisterHooksInterface {
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'lifetime' => $lifetime,
|
'lifetime' => $lifetime,
|
||||||
'session' => $session_length,
|
'session' => $session_length,
|
||||||
|
'base64' => $use_base64_cookies,
|
||||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||||
'prefix' => $this->field_prefix,
|
'prefix' => $this->field_prefix,
|
||||||
'allowTracking' => 'yes' === $allow_tracking,
|
'allowTracking' => 'yes' === $allow_tracking,
|
||||||
|
|
|
@ -4495,8 +4495,8 @@ importers:
|
||||||
plugins/woocommerce/client/legacy:
|
plugins/woocommerce/client/legacy:
|
||||||
dependencies:
|
dependencies:
|
||||||
sourcebuster:
|
sourcebuster:
|
||||||
specifier: github:woocommerce/sourcebuster-js#v1.1.2
|
specifier: github:woocommerce/sourcebuster-js#v1.2.0
|
||||||
version: https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/411d8dffaa37d7602d678c2ec02baacee93c12d5
|
version: https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/d7f4616d5a17e17db925ca1842457f309379d861
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^16.18.68
|
specifier: ^16.18.68
|
||||||
|
@ -22426,8 +22426,8 @@ packages:
|
||||||
resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
|
resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|
||||||
sourcebuster@https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/411d8dffaa37d7602d678c2ec02baacee93c12d5:
|
sourcebuster@https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/d7f4616d5a17e17db925ca1842457f309379d861:
|
||||||
resolution: {tarball: https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/411d8dffaa37d7602d678c2ec02baacee93c12d5}
|
resolution: {tarball: https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/d7f4616d5a17e17db925ca1842457f309379d861}
|
||||||
version: 1.1.2
|
version: 1.1.2
|
||||||
|
|
||||||
space-separated-tokens@1.1.5:
|
space-separated-tokens@1.1.5:
|
||||||
|
@ -58636,7 +58636,7 @@ snapshots:
|
||||||
|
|
||||||
source-map@0.7.4: {}
|
source-map@0.7.4: {}
|
||||||
|
|
||||||
sourcebuster@https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/411d8dffaa37d7602d678c2ec02baacee93c12d5: {}
|
sourcebuster@https://codeload.github.com/woocommerce/sourcebuster-js/tar.gz/d7f4616d5a17e17db925ca1842457f309379d861: {}
|
||||||
|
|
||||||
space-separated-tokens@1.1.5: {}
|
space-separated-tokens@1.1.5: {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue