diff --git a/blocks/contact-form/contact-form.js b/blocks/contact-form/contact-form.js index 527b3765..48c9bdd8 100644 --- a/blocks/contact-form/contact-form.js +++ b/blocks/contact-form/contact-form.js @@ -1,7 +1,7 @@ -import { createOptimizedPicture, loadScript } from '../../scripts/aem.js'; +import { loadScript } from '../../scripts/aem.js'; // import { getEnvelope } from '../../scripts/apis/creg/creg.js'; import { removeSideModal, i18nLookup, getCookieValue } from '../../scripts/util.js'; -import { a, div } from '../../scripts/dom-helpers.js'; +import { a, div, img } from '../../scripts/dom-helpers.js'; const LOGIN_ERROR = 'There was a problem processing your request.'; const i18n = await i18nLookup(); @@ -15,8 +15,11 @@ function getImageURL(jsonString) { try { const data = JSON.parse(jsonString); if (Array.isArray(data) && data.length > 0) { - const imageUrl = data[0].url; - return imageUrl; + const imageUrl = new URL(data[0].url); + // Replace the hostname and pathname with the new ones + imageUrl.hostname = 'hsfazpw2storagesf1.blob.core.windows.net'; + imageUrl.pathname = `/hsflibrary${imageUrl.pathname}`; + return imageUrl.toString(); } } catch (error) { return '/media/images/no-profile-image.png'; @@ -24,6 +27,7 @@ function getImageURL(jsonString) { return null; // Add a return statement at the end of the function } + /** * Adds form and cookie values to payload. * @@ -337,7 +341,7 @@ const addForm = async (block) => { if (prop.propertyDetails.listAgentCd) { const info = block.querySelector('.contact-info'); const pic = getImageURL(prop.listAgent.reAgentDetail.image); - const profile = div({ class: 'profile' }, createOptimizedPicture(pic, prop.listAgent.recipientName, 'lazy', [{ width: '82' }])); + const profile = div({ class: 'profile' }, img({ src: pic, alt: prop.listAgent.recipientName, width: '82px' })); info.insertAdjacentElement('beforebegin', profile); const name = block.querySelector('.company-name'); const link = a({ href: '#' }, prop.listAgent.recipientName); // TODO: add link to agent profile diff --git a/blocks/property-listing/property-listing.js b/blocks/property-listing/property-listing.js index 014f6bcc..11549b93 100644 --- a/blocks/property-listing/property-listing.js +++ b/blocks/property-listing/property-listing.js @@ -38,7 +38,6 @@ export default async function decorate(block) { const list = div({ class: `property-list-cards rows-${Math.floor(search.pageSize / 8)}` }); block.append(list); propertySearch(search).then((results) => { - window.propertyListings = results; renderCards(list, results.properties); }); } diff --git a/blocks/property-search-results/property-search-results.js b/blocks/property-search-results/property-search-results.js index 69f5d520..7a12daad 100644 --- a/blocks/property-search-results/property-search-results.js +++ b/blocks/property-search-results/property-search-results.js @@ -103,7 +103,6 @@ async function doSearch(search, redraw = true) { const controller = searchController; propertySearch(search).then((results) => { if (!controller.signal.aborted) { - window.propertyListings = results; displayList(parent, results); contentWrapper.querySelector('.search-results-disclaimer-wrapper').replaceChildren( domEl('hr', { role: 'presentation', 'aria-hidden': true, tabindex: -1 }),