Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -60,23 +60,22 @@ jQuery( function( $ ) {
/**
* Removes duplicate notices.
*
* @param {JQuery Object} notices
* @param {JQuery Object} $notices
*/
var remove_duplicate_notices = function( notices ) {
var seen = [];
var new_notices = notices;
var remove_duplicate_notices = function( $notices ) {
var seen = new Set();
var deduplicated_notices = [];
notices.each( function( index ) {
var text = $( this ).text();
$notices.each( function() {
const text = $( this ).text();
if ( 'undefined' === typeof seen[ text ] ) {
seen[ text ] = true;
} else {
new_notices.splice( index, 1 );
if ( ! seen.has( text ) ) {
seen.add( text );
deduplicated_notices.push( this );
}
} );
return new_notices;
return $( deduplicated_notices );
};
/**

File diff suppressed because one or more lines are too long

View File

@@ -83,17 +83,14 @@ jQuery( function( $ ) {
// Updates our (cookie-based) cache of the hash value. Expires in 1 hour.
Cookies.set( 'woocommerce_geo_hash', hash, { expires: 1 / 24 } );
var this_page = window.location.toString();
const urlQuery = new URL( window.location ).searchParams;
const existingHash = urlQuery.get( 'v' );
if ( this_page.indexOf( '?v=' ) > 0 || this_page.indexOf( '&v=' ) > 0 ) {
this_page = this_page.replace( /v=[^&]+/, 'v=' + hash );
} else if ( this_page.indexOf( '?' ) > 0 ) {
this_page = this_page + '&v=' + hash;
} else {
this_page = this_page + '?v=' + hash;
// If the current URL does not contain the expected hash, redirect.
if ( existingHash !== hash ) {
urlQuery.set( 'v', hash );
window.location.search = '?' + urlQuery.toString();
}
window.location = this_page;
};
/**

View File

@@ -1 +1 @@
jQuery(function(e){var o=!1;var t,a=function(){o&&e('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var t=e(this),a=t.attr("href"),n=a.split("#");a=(a=n[0]).indexOf("?")>0?a+"&v="+o:a+"?v="+o,"undefined"!=typeof n[1]&&null!==n[1]&&(a=a+"#"+n[1]),t.attr("href",a)})},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(e){e.success&&e.data.hash&&e.data.hash!==o&&i(e.data.hash)}},i=function(e){Cookies.set("woocommerce_geo_hash",e,{expires:1/24});var o=window.location.toString();o=o.indexOf("?v=")>0||o.indexOf("&v=")>0?o.replace(/v=[^&]+/,"v="+e):o.indexOf("?")>0?o+"&v="+e:o+"?v="+e,window.location=o};("string"!=typeof(t=Cookies.get("woocommerce_geo_hash"))||!t.length||(o=t,0)||o&&new URLSearchParams(window.location.search).get("v")!==o)&&e.ajax(n),o&&e("form").each(function(){var t=e(this),a=t.attr("method"),n=t.find('input[name="v"]').length>0;if(a&&"get"===a.toLowerCase()&&!n)t.append('<input type="hidden" name="v" value="'+o+'" />');else{var i=t.attr("action");i&&(i.indexOf("?")>0?t.attr("action",i+"&v="+o):t.attr("action",i+"?v="+o))}}),a(),e(document.body).on("added_to_cart",function(){a()}),e(document.body).on("woocommerce_append_geo_hashes",function(){a()})});
jQuery(function(e){var t=!1;var o,a=function(){t&&e('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=e(this),a=o.attr("href"),n=a.split("#");a=(a=n[0]).indexOf("?")>0?a+"&v="+t:a+"?v="+t,"undefined"!=typeof n[1]&&null!==n[1]&&(a=a+"#"+n[1]),o.attr("href",a)})},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(e){e.success&&e.data.hash&&e.data.hash!==t&&c(e.data.hash)}},c=function(e){Cookies.set("woocommerce_geo_hash",e,{expires:1/24});const t=new URL(window.location).searchParams;t.get("v")!==e&&(t.set("v",e),window.location.search="?"+t.toString())};("string"!=typeof(o=Cookies.get("woocommerce_geo_hash"))||!o.length||(t=o,0)||t&&new URLSearchParams(window.location.search).get("v")!==t)&&e.ajax(n),t&&e("form").each(function(){var o=e(this),a=o.attr("method"),n=o.find('input[name="v"]').length>0;if(a&&"get"===a.toLowerCase()&&!n)o.append('<input type="hidden" name="v" value="'+t+'" />');else{var c=o.attr("action");c&&(c.indexOf("?")>0?o.attr("action",c+"&v="+t):o.attr("action",c+"?v="+t))}}),a(),e(document.body).on("added_to_cart",function(){a()}),e(document.body).on("woocommerce_append_geo_hashes",function(){a()})});