Skip to content

Commit

Permalink
Merge pull request #1269 from hlxsites/bundle-thumb
Browse files Browse the repository at this point in the history
added bundle and thumbnail in RFQ
  • Loading branch information
dev-rajneeshkumar authored Nov 10, 2023
2 parents 2078923 + 052b00a commit cdf81ce
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions blocks/quote-request/quote-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ function iframeResizehandler(formUrl, id, root) {
});
}

function prepImageUrl(thumbImage) {
let thumbImg = thumbImage;
if (!thumbImg.startsWith('https')) {
if (thumbImg.startsWith('.')) {
thumbImg = thumbImage.substring(1);
}
thumbImg = `https://www.moleculardevices.com${thumbImage}`;
}
return thumbImg;
}

async function loadIframeForm(data, type) {
loadScript('../../scripts/iframeResizer.min.js');
const formUrl = 'https://info.moleculardevices.com/rfq';
Expand All @@ -144,7 +155,8 @@ async function loadIframeForm(data, type) {
let productFamily = '';
let primaryProductFamily = '';
let productImage = '';

let bundleThumbnail = '';
let productBundle = '';
const queryParams = new URLSearchParams(window.location.search);
if (type === 'Product') {
const typeParam = queryParams && queryParams.get('type');
Expand All @@ -157,13 +169,7 @@ async function loadIframeForm(data, type) {

// prepare the product image url
if (data.thumbnail) {
if (!data.thumbnail.startsWith('https')) {
if (data.thumbnail.startsWith('.')) {
data.thumbnail = data.thumbnail.substring(1);
}
data.thumbnail = `https://www.moleculardevices.com${data.thumbnail}`;
}
productImage = data.thumbnail;
productImage = prepImageUrl(data.thumbnail);
}

// special handling for bundles and customer breakthrough
Expand All @@ -173,6 +179,11 @@ async function loadIframeForm(data, type) {
&& data.productBundle !== '0'
) {
tab = `${data.productBundle} Bundle`;
productBundle = data.productBundle;
// prepare the product bundle thumbnail url
if (data.bundleThumbnail) {
bundleThumbnail = prepImageUrl(data.bundleThumbnail);
}
} else if (data.type === 'Customer Breakthrough') {
const fragmentHtml = await fetchFragment(data.path, false);
if (fragmentHtml) {
Expand Down Expand Up @@ -223,14 +234,16 @@ async function loadIframeForm(data, type) {
google_analytics_source__c: getCookie('utm_source') ? getCookie('utm_source') : '',
keyword_ppc__c: getCookie('utm_keyword') ? getCookie('utm_keyword') : '',
gclid__c: getCookie('gclid') ? getCookie('gclid') : '',
product_image: productImage,
product_image: productImage || 'NA',
product_bundle_image: bundleThumbnail || 'NA',
product_bundle: productBundle,
requested_qdc_discussion__c: requestTypeParam || 'Quote',
return_url: data.familyID
? `https://www.moleculardevices.com/quote-request-success?cat=${data.familyID}`
: 'https://www.moleculardevices.com/quote-request-success',
};

if (data) {
if (data.path) {
hubSpotQuery.website = `https://www.moleculardevices.com${data.path}`;
}

Expand Down

0 comments on commit cdf81ce

Please sign in to comment.