function id_password_wali_div_daalo( email, password ) { //progress bar remove document.getElementById("boss-apps-progress-bar").remove(); // create the first div element inside the outer div const firstDiv = document.createElement("div"); firstDiv.setAttribute("id", "boss-apps-id-password-div"); const spanElement = document.createElement("span"); spanElement.textContent = "Congratulations, your course login credentials are here."; spanElement.style.fontSize = "15px"; spanElement.style.fontWeight = "bold"; // create the first p element with email and password credentials const emailPasswordElement = document.createElement("p"); emailPasswordElement.innerHTML = `Email : ${email}
Password : ${password}`; emailPasswordElement.style.marginTop = "10px"; emailPasswordElement.style.fontWeight = "bold"; // create the second p element with "Please click here to log in to your course." text const loginLinkElement = document.createElement("p"); const loginUrl = "https://"+Shopify.shop+"/apps/student"; loginLinkElement.innerHTML = `Please click here to log in to your course.`; loginLinkElement.style.marginTop = "10px"; // create the third p element with the additional message const additionalMessageElement = document.createElement("p"); additionalMessageElement.textContent = "You will receive an email from us at your registered email address containing the login credentials for this course."; additionalMessageElement.style.marginTop = "10px"; // append the span, first p, second p, and third p elements to the first div firstDiv.appendChild(spanElement); firstDiv.appendChild(emailPasswordElement); firstDiv.appendChild(loginLinkElement); firstDiv.appendChild(additionalMessageElement); // append the outer div to the body of the document document.getElementById("boss-apps-course-ape").appendChild(firstDiv); } function processing_div_daalo() { // create the style element const styleElement = document.createElement("style"); styleElement.textContent = ` .loader { border: 8px solid black; border-radius: 50%; border-top: 8px solid rgb(241, 195, 15); width: 40px; height: 40px; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } `; // add the style element to the head of the document document.head.appendChild(styleElement); // create the outer div element with id "boss-apps-course-ape" const outerDiv = document.createElement("div"); outerDiv.setAttribute("id", "boss-apps-course-ape"); // create the progress bar div element with id "boss-apps-progress-bar" const progressBarDiv = document.createElement("div"); progressBarDiv.setAttribute("id", "boss-apps-progress-bar"); progressBarDiv.style.display = "flex"; progressBarDiv.style.justifyContent = "center"; // create the loader div element with class "loader" const loaderDiv = document.createElement("div"); loaderDiv.setAttribute("class", "loader"); // create the text element with "Please wait..." message const textSpan = document.createElement("span"); textSpan.textContent = "Please wait..."; textSpan.style.display = "flex"; textSpan.style.alignItems = "center"; textSpan.style.fontSize = "20px"; textSpan.style.marginLeft = "10px"; // append the loader and text elements to the progress bar div element progressBarDiv.appendChild(loaderDiv); progressBarDiv.appendChild(textSpan); // append the progress bar div element to the outer div element outerDiv.appendChild(progressBarDiv); // append the outer div element to the body of the document document.body.appendChild(outerDiv); // add the container element to the checkout page window.Shopify.Checkout.OrderStatus.addContentBox(outerDiv); } function kya_hum_thank_you_page_par_hain() { if(window.Shopify.Checkout){ return "yes"; }else{ return "no"; } } function makeAPICall(url, data) { return fetch(url, { method: 'POST', body: JSON.stringify(data) }) .then(response => response.json()); } async function kya_order_course_wala_hain() { let url = "https://course.bossapps.co/api/is_order_course"; let data = {"msd":Shopify.shop, "order_json":Shopify.checkout}; const apiResponse = await makeAPICall(url, data); return apiResponse; } async function get_user_credentials() { let url = "https://course.bossapps.co/api/get_user_credentials"; let data = {"msd":Shopify.shop, "order_json":Shopify.checkout}; const apiResponse = await makeAPICall(url, data); return apiResponse; } function humri_div_ko_color_karo() { ele = document.getElementById("boss-apps-course-ape").closest(".content-box"); ele.style.backgroundColor = 'rgb(241, 195, 15)'; ele.style.color = 'black'; } function powered_by_add_karo() { const div = document.createElement('div'); div.style.textAlign = 'end'; div.style.paddingTop = '10px'; div.style.justifyContent = 'end'; div.style.display = 'flex'; const link = document.createElement('a'); link.href = 'https://apps.shopify.com/courses-coaching-ape'; link.target = '_blank'; link.style.textDecoration = 'none'; link.style.fontWeight = 'bold'; link.style.paddingRight = '3px'; link.style.textAlign = 'center'; link.style.color = 'black'; link.textContent = 'Powered by Online Courses Ape'; const img = document.createElement('img'); img.src = 'https://course.bossapps.co/transparent.jpg'; img.width = '22'; div.appendChild(link); div.appendChild(img); return div; } async function main_function() { let thank_you_page = kya_hum_thank_you_page_par_hain(); if( thank_you_page == "no" ){ return ; } response = await kya_order_course_wala_hain(); if( response.is_order_course == false){ return ; } processing_div_daalo(); humri_div_ko_color_karo(); response = await get_user_credentials(); if( response.email == "0" ){ location.reload(); return ; } id_password_wali_div_daalo( response.email, response.password ); } main_function();