if (typeof sswPageInterval == 'undefined') { var sswPageInterval = setInterval(function () { if (typeof sswJqLoaded != 'undefined' && sswJqLoaded) { clearInterval(sswPageInterval); var path_name = window.location.pathname; var ssw_substr = '/pages/'; var ssw_index = path_name.indexOf(ssw_substr) + ssw_substr.length; var ssw_request_url = sswProxyUrl + '/lite2/' + path_name.substr(ssw_index); if (path_name.indexOf('pages/profile-edit') > -1) { ssw_request_url = sswProxyUrl + '/lite2/profile-edit'; } else if (path_name.substr(ssw_index) == 'feed' || path_name.indexOf('pages/profile') > -1) ssw_request_url = sswProxyUrl + '/lite2/' + path_name.substr(ssw_index) + '/'; else if (path_name.substr(ssw_index) == 'collections' || path_name.substr(ssw_index) == 'people' || path_name.substr(ssw_index) == 'invite' || path_name.substr(ssw_index) == 'faves' || path_name.substr(ssw_index) == 'edit-notifications' || path_name.substr(ssw_index) == 'reviews') ssw_request_url = sswProxyUrl + '/lite2/' + path_name.substr(ssw_index); var params = location.search.substring(1).replace(/_sid\=[0-9a-f-]+\&*|\bhash_key\b\=[0-9a-f-]+\&*/ig, ''); if (path_name.indexOf('pages/collections') && window.location.hash.substring(1)) { if (params) { params += '&' + window.location.hash.substring(1); } else { params = window.location.hash.substring(1); } } var data = '_sid=' + sswCookie('hesid'); if (typeof sswApp !== 'undefined' && typeof sswApp.accounts_enabled !== 'undefined') { data += '&accounts_enabled=' + sswApp.accounts_enabled; } if (params) { data += '&' + params; } if (sswCookie('mail_id')) { data += '&resource_id=' + sswCookie('mail_id') + '&resource_type=mail'; } sswUserChecked(function () { if (path_name.substr(ssw_index) == 'reviews') { /* Define TimeZone offset */ const customer_timezone_offset = -1 * new Date().getTimezoneOffset() * 60; data += '&customer_timezone_offset=' + customer_timezone_offset; } data += '&hash_key=' + sswCookie('hash_key'); ssw.post(ssw_request_url, data, 'html').done(function (response) { ssw('#ssw-page').css('opacity', 0); ssw('#ssw-page').html(response).animate({ opacity: "1" }, 50, function () { if (typeof window.afterSswPageLoadedCallback === 'function') { window.afterSswPageLoadedCallback(response); } sswDispatchEvent('sswPageLoaded', { detail: {}, bubbles: true, cancelable: false }); }); }).fail(function(jqXHR) { if (jqXHR?.responseJSON?.message === 'Storefront account is disabled') { ssw('#ssw-page').slideUp( "slow"); } }); }); } }, 300); }