'
);
clearInterval(pageInterval);
}
}, 500);
break;
case "TimeSlotScreen":
pageInterval = setInterval(() => {
const loadingSpinner = jQuery("#scheduler-container .loadingSpinner");
if (loadingSpinner.hasClass("slds-hide")) {
jQuery(".cTimeSlotScreen .slds-button_brand.flow-button__NEXT").text("Confirm");
clearInterval(pageInterval);
}
}, 500);
default:
break;
}
};
function hasUTMTags() {
const urlParams = new URLSearchParams(window.location.search);
const utmTags = [
"utm_source",
"utm_medium",
"utm_campaign",
"utm_term",
"utm_content",
];
for (let tag of utmTags) {
if (urlParams.has(tag)) {
return true;
}
}
return false;
}
//Function to get querystring parameters
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
//Get pub querystring parameter
if (params.pub) var pubcode = params.pub;
if (params.gclid) var gclid = params.gclid;
var url = window.location.href.split("?")[0];
var urlwithutm = "";
if (hasUTMTags()) urlwithutm = window.location.href;
$Lightning.use(
"runtime_appointmentbooking:lightningOutGuest",
function () {
// Callback once framework and app load
$Lightning.createComponent(
"lightning:flow",
{ onstatuschange: statusChange },
"scheduler-container", // The DOM location to insert the component
function (component) {
var inputVariables = [];
if (pubcode && pubcode.length > 0) {
inputVariables.push({
name: "pubcode",
type: "String",
value: pubcode,
});
}
if (gclid && gclid.length > 0) {
inputVariables.push({
name: "gclid",
type: "String",
value: gclid,
});
}
//This will put the scheduler in to full width mode, thus removing the image on the right side of the first screen.
inputVariables.push({
name: "viewconfig",
type: "String",
value: "normal",
});
inputVariables.push({
name: "legal",
type: "Boolean",
value: true,
});
inputVariables.push({
name: "source",
type: "String",
value: url,
});
inputVariables.push({
name: "UTM",
type: "String",
value: urlwithutm,
});
//Add inputVariables if they exist
if (inputVariables.length > 0) {
component.startFlow(
"HC_Website_Inbound_New_Guest_Appointment_V3",
inputVariables
);
} else {
component.startFlow(
"HC_Website_Inbound_New_Guest_Appointment_V3"
);
}
}
);
},
"https://hairclub1.my.site.com/scheduler/" // Site endpoint
//"https://hairclub1--preprod.sandbox.my.site.com/scheduler/" // Site endpoint
);
})();
